Merge
authoriveresov
Fri, 26 Aug 2016 14:47:52 -0700
changeset 40883 765d366c28e1
parent 40882 23f882a600ce (current diff)
parent 40861 1c22cfe35580 (diff)
child 40884 0e28c526f5d3
child 41050 1a952c00b8e4
Merge
hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.inline.hpp
hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp
hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp
hotspot/src/os_cpu/linux_aarch64/vm/atomic_linux_aarch64.inline.hpp
hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.inline.hpp
hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp
hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp
hotspot/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp
hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp
hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp
hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
hotspot/src/share/vm/runtime/atomic.inline.hpp
hotspot/src/share/vm/runtime/globals.hpp
hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java
jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogUriResolver.java
jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogUriResolverImpl.java
jdk/make/data/cryptopolicy/limited/default_local.policy
jdk/make/data/cryptopolicy/limited/exempt_local.policy
jdk/make/data/cryptopolicy/unlimited/default_US_export.policy
jdk/make/data/cryptopolicy/unlimited/default_local.policy
jdk/make/gendata/GendataPolicyJars.gmk
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocletAbortException.java
--- a/.hgtags	Thu Aug 25 02:10:03 2016 -0700
+++ b/.hgtags	Fri Aug 26 14:47:52 2016 -0700
@@ -375,3 +375,4 @@
 e613affb88d178dc7c589f1679db113d589bddb4 jdk-9+130
 4d2a15091124488080d65848b704e25599b2aaeb jdk-9+131
 2e83d21d78cd9c1d52e6cd2599e9c8aa36ea1f52 jdk-9+132
+e17429a7e843c4a4ed3651458d0f950970edcbcc jdk-9+133
--- a/.hgtags-top-repo	Thu Aug 25 02:10:03 2016 -0700
+++ b/.hgtags-top-repo	Fri Aug 26 14:47:52 2016 -0700
@@ -375,3 +375,4 @@
 d94d54a3192fea79234c3ac55cd0b4052d45e954 jdk-9+130
 8728756c2f70a79a90188f4019cfd6b9a275765c jdk-9+131
 a24702d4d5ab0015a5c553ed57f66fce7d85155e jdk-9+132
+be1218f792a450dfb5d4b1f82616b9d95a6a732e jdk-9+133
--- a/corba/.hgtags	Thu Aug 25 02:10:03 2016 -0700
+++ b/corba/.hgtags	Fri Aug 26 14:47:52 2016 -0700
@@ -375,3 +375,4 @@
 77f9692d5976ae155773dd3e07533616bb95bae1 jdk-9+130
 f7e1d5337c2e550fe553df7a3886bbed80292ecd jdk-9+131
 1ab4b9399c4cba584f66c1c088188f2f565fbf9c jdk-9+132
+2021bfedf1c478a4808a7711a6090682a12f4c0e jdk-9+133
--- a/hotspot/.hgtags	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/.hgtags	Fri Aug 26 14:47:52 2016 -0700
@@ -535,3 +535,4 @@
 7d54c7056328b6a2bf4877458b8f4d8cd870f93b jdk-9+130
 943bf73b49c33c2d7cbd796f6a4ae3c7a00ae932 jdk-9+131
 713951c08aa26813375175c2ab6cc99ff2a56903 jdk-9+132
+a25e0fb6033245ab075136e744d362ce765464cd jdk-9+133
--- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -28,6 +28,7 @@
 
 #include "runtime/globals_extension.hpp"
 #include "runtime/vm_version.hpp"
+#include "utilities/sizes.hpp"
 
 class VM_Version : public Abstract_VM_Version {
   friend class JVMCIVMStructs;
--- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -37,7 +37,7 @@
 #include "prims/jvmtiExport.hpp"
 #include "prims/jvmtiThreadState.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/G1CollectedHeap.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/G1CollectedHeap.java	Fri Aug 26 14:47:52 2016 -0700
@@ -24,6 +24,7 @@
 
 package sun.jvm.hotspot.gc.g1;
 
+import java.io.PrintStream;
 import java.util.Iterator;
 import java.util.Observable;
 import java.util.Observer;
@@ -125,6 +126,15 @@
         return CollectedHeapName.G1_COLLECTED_HEAP;
     }
 
+    @Override
+    public void printOn(PrintStream tty) {
+        MemRegion mr = reservedRegion();
+
+        tty.print("garbage-first heap");
+        tty.print(" [" + mr.start() + ", " + mr.end() + "]");
+        tty.println(" region size " + (HeapRegion.grainBytes() / 1024) + "K");
+    }
+
     public G1CollectedHeap(Address addr) {
         super(addr);
     }
--- a/hotspot/src/os/aix/vm/os_aix.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/os/aix/vm/os_aix.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -52,7 +52,7 @@
 #include "prims/jvm.h"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/extendedPC.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.hpp"
@@ -3800,10 +3800,6 @@
   return ::stat(pathbuf, sbuf);
 }
 
-bool os::check_heap(bool force) {
-  return true;
-}
-
 // Is a (classpath) directory empty?
 bool os::dir_is_empty(const char* path) {
   DIR *dir = NULL;
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -42,7 +42,7 @@
 #include "prims/jvm.h"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/extendedPC.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.hpp"
@@ -3780,11 +3780,6 @@
   return diff;
 }
 
-
-bool os::check_heap(bool force) {
-  return true;
-}
-
 // Is a (classpath) directory empty?
 bool os::dir_is_empty(const char* path) {
   DIR *dir = NULL;
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -42,7 +42,7 @@
 #include "prims/jvm.h"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/extendedPC.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.hpp"
@@ -5174,10 +5174,6 @@
   return ::stat(pathbuf, sbuf);
 }
 
-bool os::check_heap(bool force) {
-  return true;
-}
-
 // Is a (classpath) directory empty?
 bool os::dir_is_empty(const char* path) {
   DIR *dir = NULL;
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -42,7 +42,7 @@
 #include "prims/jvm.h"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/extendedPC.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.hpp"
@@ -4589,10 +4589,6 @@
   }
 }
 
-// OS interface.
-
-bool os::check_heap(bool force) { return true; }
-
 // Is a (classpath) directory empty?
 bool os::dir_is_empty(const char* path) {
   DIR *dir = NULL;
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -45,7 +45,7 @@
 #include "prims/jvm.h"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/extendedPC.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.hpp"
@@ -5258,75 +5258,6 @@
   }
 }
 
-//--------------------------------------------------------------------------------------------------
-// Non-product code
-
-static int mallocDebugIntervalCounter = 0;
-static int mallocDebugCounter = 0;
-
-// For debugging possible bugs inside HeapWalk (a ring buffer)
-#define SAVE_COUNT 8
-static PROCESS_HEAP_ENTRY saved_heap_entries[SAVE_COUNT];
-static int saved_heap_entry_index;
-
-bool os::check_heap(bool force) {
-  if (++mallocDebugCounter < MallocVerifyStart && !force) return true;
-  if (++mallocDebugIntervalCounter >= MallocVerifyInterval || force) {
-    // Note: HeapValidate executes two hardware breakpoints when it finds something
-    // wrong; at these points, eax contains the address of the offending block (I think).
-    // To get to the exlicit error message(s) below, just continue twice.
-    //
-    // Note:  we want to check the CRT heap, which is not necessarily located in the
-    // process default heap.
-    HANDLE heap = (HANDLE) _get_heap_handle();
-    if (!heap) {
-      return true;
-    }
-
-    // If we fail to lock the heap, then gflags.exe has been used
-    // or some other special heap flag has been set that prevents
-    // locking. We don't try to walk a heap we can't lock.
-    if (HeapLock(heap) != 0) {
-      PROCESS_HEAP_ENTRY phe;
-      phe.lpData = NULL;
-      memset(saved_heap_entries, 0, sizeof(saved_heap_entries));
-      saved_heap_entry_index = 0;
-      int count = 0;
-
-      while (HeapWalk(heap, &phe) != 0) {
-        count ++;
-        if ((phe.wFlags & PROCESS_HEAP_ENTRY_BUSY) &&
-            !HeapValidate(heap, 0, phe.lpData)) {
-          tty->print_cr("C heap has been corrupted (time: %d allocations)", mallocDebugCounter);
-          tty->print_cr("corrupted block near address %#x, length %d, count %d", phe.lpData, phe.cbData, count);
-          HeapUnlock(heap);
-          fatal("corrupted C heap");
-        } else {
-          // Save previous seen entries in a ring buffer. We have seen strange
-          // heap corruption fatal errors that produced mdmp files, but when we load
-          // these mdmp files in WinDBG, "!heap -triage" shows no error.
-          // We can examine the saved_heap_entries[] array in the mdmp file to
-          // diagnose such seemingly spurious errors reported by HeapWalk.
-          saved_heap_entries[saved_heap_entry_index++] = phe;
-          if (saved_heap_entry_index >= SAVE_COUNT) {
-            saved_heap_entry_index = 0;
-          }
-        }
-      }
-      DWORD err = GetLastError();
-      if (err != ERROR_NO_MORE_ITEMS && err != ERROR_CALL_NOT_IMPLEMENTED &&
-         (err == ERROR_INVALID_FUNCTION && phe.lpData != NULL)) {
-        HeapUnlock(heap);
-        fatal("heap walk aborted with error %d", err);
-      }
-      HeapUnlock(heap);
-    }
-    mallocDebugIntervalCounter = 0;
-  }
-  return true;
-}
-
-
 bool os::find(address addr, outputStream* st) {
   int offset = -1;
   bool result = false;
--- a/hotspot/src/os/windows/vm/threadCritical_windows.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/os/windows/vm/threadCritical_windows.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/thread.inline.hpp"
 #include "runtime/threadCritical.hpp"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,479 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014 SAP SE. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef OS_CPU_AIX_OJDKPPC_VM_ATOMIC_AIX_PPC_HPP
+#define OS_CPU_AIX_OJDKPPC_VM_ATOMIC_AIX_PPC_HPP
+
+#ifndef _LP64
+#error "Atomic currently only impleneted for PPC64"
+#endif
+
+// Implementation of class atomic
+
+inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
+inline void Atomic::store    (jshort   store_value, jshort*   dest) { *dest = store_value; }
+inline void Atomic::store    (jint     store_value, jint*     dest) { *dest = store_value; }
+inline void Atomic::store    (jlong    store_value, jlong*    dest) { *dest = store_value; }
+inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
+inline void Atomic::store_ptr(void*    store_value, void*     dest) { *(void**)dest = store_value; }
+
+inline void Atomic::store    (jbyte    store_value, volatile jbyte*    dest) { *dest = store_value; }
+inline void Atomic::store    (jshort   store_value, volatile jshort*   dest) { *dest = store_value; }
+inline void Atomic::store    (jint     store_value, volatile jint*     dest) { *dest = store_value; }
+inline void Atomic::store    (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
+inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
+inline void Atomic::store_ptr(void*    store_value, volatile void*     dest) { *(void* volatile *)dest = store_value; }
+
+inline jlong Atomic::load(volatile jlong* src) { return *src; }
+
+//
+//   machine barrier instructions:
+//
+//   - ppc_sync            two-way memory barrier, aka fence
+//   - ppc_lwsync          orders  Store|Store,
+//                                  Load|Store,
+//                                  Load|Load,
+//                         but not Store|Load
+//   - ppc_eieio           orders memory accesses for device memory (only)
+//   - ppc_isync           invalidates speculatively executed instructions
+//                         From the POWER ISA 2.06 documentation:
+//                          "[...] an isync instruction prevents the execution of
+//                         instructions following the isync until instructions
+//                         preceding the isync have completed, [...]"
+//                         From IBM's AIX assembler reference:
+//                          "The isync [...] instructions causes the processor to
+//                         refetch any instructions that might have been fetched
+//                         prior to the isync instruction. The instruction isync
+//                         causes the processor to wait for all previous instructions
+//                         to complete. Then any instructions already fetched are
+//                         discarded and instruction processing continues in the
+//                         environment established by the previous instructions."
+//
+//   semantic barrier instructions:
+//   (as defined in orderAccess.hpp)
+//
+//   - ppc_release         orders Store|Store,       (maps to ppc_lwsync)
+//                                 Load|Store
+//   - ppc_acquire         orders  Load|Store,       (maps to ppc_lwsync)
+//                                 Load|Load
+//   - ppc_fence           orders Store|Store,       (maps to ppc_sync)
+//                                 Load|Store,
+//                                 Load|Load,
+//                                Store|Load
+//
+
+#define strasm_sync                       "\n  sync    \n"
+#define strasm_lwsync                     "\n  lwsync  \n"
+#define strasm_isync                      "\n  isync   \n"
+#define strasm_release                    strasm_lwsync
+#define strasm_acquire                    strasm_lwsync
+#define strasm_fence                      strasm_sync
+#define strasm_nobarrier                  ""
+#define strasm_nobarrier_clobber_memory   ""
+
+inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
+
+  unsigned int result;
+
+  __asm__ __volatile__ (
+    strasm_lwsync
+    "1: lwarx   %0,  0, %2    \n"
+    "   add     %0, %0, %1    \n"
+    "   stwcx.  %0,  0, %2    \n"
+    "   bne-    1b            \n"
+    strasm_isync
+    : /*%0*/"=&r" (result)
+    : /*%1*/"r" (add_value), /*%2*/"r" (dest)
+    : "cc", "memory" );
+
+  return (jint) result;
+}
+
+
+inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
+
+  long result;
+
+  __asm__ __volatile__ (
+    strasm_lwsync
+    "1: ldarx   %0,  0, %2    \n"
+    "   add     %0, %0, %1    \n"
+    "   stdcx.  %0,  0, %2    \n"
+    "   bne-    1b            \n"
+    strasm_isync
+    : /*%0*/"=&r" (result)
+    : /*%1*/"r" (add_value), /*%2*/"r" (dest)
+    : "cc", "memory" );
+
+  return (intptr_t) result;
+}
+
+inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
+  return (void*)add_ptr(add_value, (volatile intptr_t*)dest);
+}
+
+
+inline void Atomic::inc    (volatile jint*     dest) {
+
+  unsigned int temp;
+
+  __asm__ __volatile__ (
+    strasm_nobarrier
+    "1: lwarx   %0,  0, %2    \n"
+    "   addic   %0, %0,  1    \n"
+    "   stwcx.  %0,  0, %2    \n"
+    "   bne-    1b            \n"
+    strasm_nobarrier
+    : /*%0*/"=&r" (temp), "=m" (*dest)
+    : /*%2*/"r" (dest), "m" (*dest)
+    : "cc" strasm_nobarrier_clobber_memory);
+
+}
+
+inline void Atomic::inc_ptr(volatile intptr_t* dest) {
+
+  long temp;
+
+  __asm__ __volatile__ (
+    strasm_nobarrier
+    "1: ldarx   %0,  0, %2    \n"
+    "   addic   %0, %0,  1    \n"
+    "   stdcx.  %0,  0, %2    \n"
+    "   bne-    1b            \n"
+    strasm_nobarrier
+    : /*%0*/"=&r" (temp), "=m" (*dest)
+    : /*%2*/"r" (dest), "m" (*dest)
+    : "cc" strasm_nobarrier_clobber_memory);
+
+}
+
+inline void Atomic::inc_ptr(volatile void*     dest) {
+  inc_ptr((volatile intptr_t*)dest);
+}
+
+
+inline void Atomic::dec    (volatile jint*     dest) {
+
+  unsigned int temp;
+
+  __asm__ __volatile__ (
+    strasm_nobarrier
+    "1: lwarx   %0,  0, %2    \n"
+    "   addic   %0, %0, -1    \n"
+    "   stwcx.  %0,  0, %2    \n"
+    "   bne-    1b            \n"
+    strasm_nobarrier
+    : /*%0*/"=&r" (temp), "=m" (*dest)
+    : /*%2*/"r" (dest), "m" (*dest)
+    : "cc" strasm_nobarrier_clobber_memory);
+
+}
+
+inline void Atomic::dec_ptr(volatile intptr_t* dest) {
+
+  long temp;
+
+  __asm__ __volatile__ (
+    strasm_nobarrier
+    "1: ldarx   %0,  0, %2    \n"
+    "   addic   %0, %0, -1    \n"
+    "   stdcx.  %0,  0, %2    \n"
+    "   bne-    1b            \n"
+    strasm_nobarrier
+    : /*%0*/"=&r" (temp), "=m" (*dest)
+    : /*%2*/"r" (dest), "m" (*dest)
+    : "cc" strasm_nobarrier_clobber_memory);
+
+}
+
+inline void Atomic::dec_ptr(volatile void*     dest) {
+  dec_ptr((volatile intptr_t*)dest);
+}
+
+inline jint Atomic::xchg(jint exchange_value, volatile jint* dest) {
+
+  // Note that xchg_ptr doesn't necessarily do an acquire
+  // (see synchronizer.cpp).
+
+  unsigned int old_value;
+  const uint64_t zero = 0;
+
+  __asm__ __volatile__ (
+    /* lwsync */
+    strasm_lwsync
+    /* atomic loop */
+    "1:                                                 \n"
+    "   lwarx   %[old_value], %[dest], %[zero]          \n"
+    "   stwcx.  %[exchange_value], %[dest], %[zero]     \n"
+    "   bne-    1b                                      \n"
+    /* isync */
+    strasm_sync
+    /* exit */
+    "2:                                                 \n"
+    /* out */
+    : [old_value]       "=&r"   (old_value),
+                        "=m"    (*dest)
+    /* in */
+    : [dest]            "b"     (dest),
+      [zero]            "r"     (zero),
+      [exchange_value]  "r"     (exchange_value),
+                        "m"     (*dest)
+    /* clobber */
+    : "cc",
+      "memory"
+    );
+
+  return (jint) old_value;
+}
+
+inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
+
+  // Note that xchg_ptr doesn't necessarily do an acquire
+  // (see synchronizer.cpp).
+
+  long old_value;
+  const uint64_t zero = 0;
+
+  __asm__ __volatile__ (
+    /* lwsync */
+    strasm_lwsync
+    /* atomic loop */
+    "1:                                                 \n"
+    "   ldarx   %[old_value], %[dest], %[zero]          \n"
+    "   stdcx.  %[exchange_value], %[dest], %[zero]     \n"
+    "   bne-    1b                                      \n"
+    /* isync */
+    strasm_sync
+    /* exit */
+    "2:                                                 \n"
+    /* out */
+    : [old_value]       "=&r"   (old_value),
+                        "=m"    (*dest)
+    /* in */
+    : [dest]            "b"     (dest),
+      [zero]            "r"     (zero),
+      [exchange_value]  "r"     (exchange_value),
+                        "m"     (*dest)
+    /* clobber */
+    : "cc",
+      "memory"
+    );
+
+  return (intptr_t) old_value;
+}
+
+inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) {
+  return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
+}
+
+inline void cmpxchg_pre_membar(cmpxchg_memory_order order) {
+  if (order != memory_order_relaxed) {
+    __asm__ __volatile__ (
+      /* fence */
+      strasm_sync
+      );
+  }
+}
+
+inline void cmpxchg_post_membar(cmpxchg_memory_order order) {
+  if (order != memory_order_relaxed) {
+    __asm__ __volatile__ (
+      /* fence */
+      strasm_sync
+      );
+  }
+}
+
+#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, cmpxchg_memory_order order) {
+
+  // Note that cmpxchg guarantees a two-way memory barrier across
+  // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not
+  // specified otherwise (see atomic.hpp).
+
+  // Using 32 bit internally.
+  volatile int *dest_base = (volatile int*)((uintptr_t)dest & ~3);
+
+#ifdef VM_LITTLE_ENDIAN
+  const unsigned int shift_amount        = ((uintptr_t)dest & 3) * 8;
+#else
+  const unsigned int shift_amount        = ((~(uintptr_t)dest) & 3) * 8;
+#endif
+  const unsigned int masked_compare_val  = ((unsigned int)(unsigned char)compare_value),
+                     masked_exchange_val = ((unsigned int)(unsigned char)exchange_value),
+                     xor_value           = (masked_compare_val ^ masked_exchange_val) << shift_amount;
+
+  unsigned int old_value, value32;
+
+  cmpxchg_pre_membar(order);
+
+  __asm__ __volatile__ (
+    /* simple guard */
+    "   lbz     %[old_value], 0(%[dest])                  \n"
+    "   cmpw    %[masked_compare_val], %[old_value]       \n"
+    "   bne-    2f                                        \n"
+    /* atomic loop */
+    "1:                                                   \n"
+    "   lwarx   %[value32], 0, %[dest_base]               \n"
+    /* extract byte and compare */
+    "   srd     %[old_value], %[value32], %[shift_amount] \n"
+    "   clrldi  %[old_value], %[old_value], 56            \n"
+    "   cmpw    %[masked_compare_val], %[old_value]       \n"
+    "   bne-    2f                                        \n"
+    /* replace byte and try to store */
+    "   xor     %[value32], %[xor_value], %[value32]      \n"
+    "   stwcx.  %[value32], 0, %[dest_base]               \n"
+    "   bne-    1b                                        \n"
+    /* exit */
+    "2:                                                   \n"
+    /* out */
+    : [old_value]           "=&r"   (old_value),
+      [value32]             "=&r"   (value32),
+                            "=m"    (*dest),
+                            "=m"    (*dest_base)
+    /* in */
+    : [dest]                "b"     (dest),
+      [dest_base]           "b"     (dest_base),
+      [shift_amount]        "r"     (shift_amount),
+      [masked_compare_val]  "r"     (masked_compare_val),
+      [xor_value]           "r"     (xor_value),
+                            "m"     (*dest),
+                            "m"     (*dest_base)
+    /* clobber */
+    : "cc",
+      "memory"
+    );
+
+  cmpxchg_post_membar(order);
+
+  return (jbyte)(unsigned char)old_value;
+}
+
+inline jint Atomic::cmpxchg(jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order) {
+
+  // Note that cmpxchg guarantees a two-way memory barrier across
+  // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not
+  // specified otherwise (see atomic.hpp).
+
+  unsigned int old_value;
+  const uint64_t zero = 0;
+
+  cmpxchg_pre_membar(order);
+
+  __asm__ __volatile__ (
+    /* simple guard */
+    "   lwz     %[old_value], 0(%[dest])                \n"
+    "   cmpw    %[compare_value], %[old_value]          \n"
+    "   bne-    2f                                      \n"
+    /* atomic loop */
+    "1:                                                 \n"
+    "   lwarx   %[old_value], %[dest], %[zero]          \n"
+    "   cmpw    %[compare_value], %[old_value]          \n"
+    "   bne-    2f                                      \n"
+    "   stwcx.  %[exchange_value], %[dest], %[zero]     \n"
+    "   bne-    1b                                      \n"
+    /* exit */
+    "2:                                                 \n"
+    /* out */
+    : [old_value]       "=&r"   (old_value),
+                        "=m"    (*dest)
+    /* in */
+    : [dest]            "b"     (dest),
+      [zero]            "r"     (zero),
+      [compare_value]   "r"     (compare_value),
+      [exchange_value]  "r"     (exchange_value),
+                        "m"     (*dest)
+    /* clobber */
+    : "cc",
+      "memory"
+    );
+
+  cmpxchg_post_membar(order);
+
+  return (jint) old_value;
+}
+
+inline jlong Atomic::cmpxchg(jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order) {
+
+  // Note that cmpxchg guarantees a two-way memory barrier across
+  // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not
+  // specified otherwise (see atomic.hpp).
+
+  long old_value;
+  const uint64_t zero = 0;
+
+  cmpxchg_pre_membar(order);
+
+  __asm__ __volatile__ (
+    /* simple guard */
+    "   ld      %[old_value], 0(%[dest])                \n"
+    "   cmpd    %[compare_value], %[old_value]          \n"
+    "   bne-    2f                                      \n"
+    /* atomic loop */
+    "1:                                                 \n"
+    "   ldarx   %[old_value], %[dest], %[zero]          \n"
+    "   cmpd    %[compare_value], %[old_value]          \n"
+    "   bne-    2f                                      \n"
+    "   stdcx.  %[exchange_value], %[dest], %[zero]     \n"
+    "   bne-    1b                                      \n"
+    /* exit */
+    "2:                                                 \n"
+    /* out */
+    : [old_value]       "=&r"   (old_value),
+                        "=m"    (*dest)
+    /* in */
+    : [dest]            "b"     (dest),
+      [zero]            "r"     (zero),
+      [compare_value]   "r"     (compare_value),
+      [exchange_value]  "r"     (exchange_value),
+                        "m"     (*dest)
+    /* clobber */
+    : "cc",
+      "memory"
+    );
+
+  cmpxchg_post_membar(order);
+
+  return (jlong) old_value;
+}
+
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+  return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
+}
+
+inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order) {
+  return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
+}
+
+#undef strasm_sync
+#undef strasm_lwsync
+#undef strasm_isync
+#undef strasm_release
+#undef strasm_acquire
+#undef strasm_fence
+#undef strasm_nobarrier
+#undef strasm_nobarrier_clobber_memory
+
+#endif // OS_CPU_AIX_OJDKPPC_VM_ATOMIC_AIX_PPC_HPP
--- a/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,482 +0,0 @@
-/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2014 SAP SE. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef OS_CPU_AIX_OJDKPPC_VM_ATOMIC_AIX_PPC_INLINE_HPP
-#define OS_CPU_AIX_OJDKPPC_VM_ATOMIC_AIX_PPC_INLINE_HPP
-
-#include "runtime/atomic.hpp"
-#include "runtime/os.hpp"
-
-#ifndef _LP64
-#error "Atomic currently only impleneted for PPC64"
-#endif
-
-// Implementation of class atomic
-
-inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
-inline void Atomic::store    (jshort   store_value, jshort*   dest) { *dest = store_value; }
-inline void Atomic::store    (jint     store_value, jint*     dest) { *dest = store_value; }
-inline void Atomic::store    (jlong    store_value, jlong*    dest) { *dest = store_value; }
-inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
-inline void Atomic::store_ptr(void*    store_value, void*     dest) { *(void**)dest = store_value; }
-
-inline void Atomic::store    (jbyte    store_value, volatile jbyte*    dest) { *dest = store_value; }
-inline void Atomic::store    (jshort   store_value, volatile jshort*   dest) { *dest = store_value; }
-inline void Atomic::store    (jint     store_value, volatile jint*     dest) { *dest = store_value; }
-inline void Atomic::store    (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
-inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
-inline void Atomic::store_ptr(void*    store_value, volatile void*     dest) { *(void* volatile *)dest = store_value; }
-
-inline jlong Atomic::load(volatile jlong* src) { return *src; }
-
-//
-//   machine barrier instructions:
-//
-//   - ppc_sync            two-way memory barrier, aka fence
-//   - ppc_lwsync          orders  Store|Store,
-//                                  Load|Store,
-//                                  Load|Load,
-//                         but not Store|Load
-//   - ppc_eieio           orders memory accesses for device memory (only)
-//   - ppc_isync           invalidates speculatively executed instructions
-//                         From the POWER ISA 2.06 documentation:
-//                          "[...] an isync instruction prevents the execution of
-//                         instructions following the isync until instructions
-//                         preceding the isync have completed, [...]"
-//                         From IBM's AIX assembler reference:
-//                          "The isync [...] instructions causes the processor to
-//                         refetch any instructions that might have been fetched
-//                         prior to the isync instruction. The instruction isync
-//                         causes the processor to wait for all previous instructions
-//                         to complete. Then any instructions already fetched are
-//                         discarded and instruction processing continues in the
-//                         environment established by the previous instructions."
-//
-//   semantic barrier instructions:
-//   (as defined in orderAccess.hpp)
-//
-//   - ppc_release         orders Store|Store,       (maps to ppc_lwsync)
-//                                 Load|Store
-//   - ppc_acquire         orders  Load|Store,       (maps to ppc_lwsync)
-//                                 Load|Load
-//   - ppc_fence           orders Store|Store,       (maps to ppc_sync)
-//                                 Load|Store,
-//                                 Load|Load,
-//                                Store|Load
-//
-
-#define strasm_sync                       "\n  sync    \n"
-#define strasm_lwsync                     "\n  lwsync  \n"
-#define strasm_isync                      "\n  isync   \n"
-#define strasm_release                    strasm_lwsync
-#define strasm_acquire                    strasm_lwsync
-#define strasm_fence                      strasm_sync
-#define strasm_nobarrier                  ""
-#define strasm_nobarrier_clobber_memory   ""
-
-inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
-
-  unsigned int result;
-
-  __asm__ __volatile__ (
-    strasm_lwsync
-    "1: lwarx   %0,  0, %2    \n"
-    "   add     %0, %0, %1    \n"
-    "   stwcx.  %0,  0, %2    \n"
-    "   bne-    1b            \n"
-    strasm_isync
-    : /*%0*/"=&r" (result)
-    : /*%1*/"r" (add_value), /*%2*/"r" (dest)
-    : "cc", "memory" );
-
-  return (jint) result;
-}
-
-
-inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
-
-  long result;
-
-  __asm__ __volatile__ (
-    strasm_lwsync
-    "1: ldarx   %0,  0, %2    \n"
-    "   add     %0, %0, %1    \n"
-    "   stdcx.  %0,  0, %2    \n"
-    "   bne-    1b            \n"
-    strasm_isync
-    : /*%0*/"=&r" (result)
-    : /*%1*/"r" (add_value), /*%2*/"r" (dest)
-    : "cc", "memory" );
-
-  return (intptr_t) result;
-}
-
-inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
-  return (void*)add_ptr(add_value, (volatile intptr_t*)dest);
-}
-
-
-inline void Atomic::inc    (volatile jint*     dest) {
-
-  unsigned int temp;
-
-  __asm__ __volatile__ (
-    strasm_nobarrier
-    "1: lwarx   %0,  0, %2    \n"
-    "   addic   %0, %0,  1    \n"
-    "   stwcx.  %0,  0, %2    \n"
-    "   bne-    1b            \n"
-    strasm_nobarrier
-    : /*%0*/"=&r" (temp), "=m" (*dest)
-    : /*%2*/"r" (dest), "m" (*dest)
-    : "cc" strasm_nobarrier_clobber_memory);
-
-}
-
-inline void Atomic::inc_ptr(volatile intptr_t* dest) {
-
-  long temp;
-
-  __asm__ __volatile__ (
-    strasm_nobarrier
-    "1: ldarx   %0,  0, %2    \n"
-    "   addic   %0, %0,  1    \n"
-    "   stdcx.  %0,  0, %2    \n"
-    "   bne-    1b            \n"
-    strasm_nobarrier
-    : /*%0*/"=&r" (temp), "=m" (*dest)
-    : /*%2*/"r" (dest), "m" (*dest)
-    : "cc" strasm_nobarrier_clobber_memory);
-
-}
-
-inline void Atomic::inc_ptr(volatile void*     dest) {
-  inc_ptr((volatile intptr_t*)dest);
-}
-
-
-inline void Atomic::dec    (volatile jint*     dest) {
-
-  unsigned int temp;
-
-  __asm__ __volatile__ (
-    strasm_nobarrier
-    "1: lwarx   %0,  0, %2    \n"
-    "   addic   %0, %0, -1    \n"
-    "   stwcx.  %0,  0, %2    \n"
-    "   bne-    1b            \n"
-    strasm_nobarrier
-    : /*%0*/"=&r" (temp), "=m" (*dest)
-    : /*%2*/"r" (dest), "m" (*dest)
-    : "cc" strasm_nobarrier_clobber_memory);
-
-}
-
-inline void Atomic::dec_ptr(volatile intptr_t* dest) {
-
-  long temp;
-
-  __asm__ __volatile__ (
-    strasm_nobarrier
-    "1: ldarx   %0,  0, %2    \n"
-    "   addic   %0, %0, -1    \n"
-    "   stdcx.  %0,  0, %2    \n"
-    "   bne-    1b            \n"
-    strasm_nobarrier
-    : /*%0*/"=&r" (temp), "=m" (*dest)
-    : /*%2*/"r" (dest), "m" (*dest)
-    : "cc" strasm_nobarrier_clobber_memory);
-
-}
-
-inline void Atomic::dec_ptr(volatile void*     dest) {
-  dec_ptr((volatile intptr_t*)dest);
-}
-
-inline jint Atomic::xchg(jint exchange_value, volatile jint* dest) {
-
-  // Note that xchg_ptr doesn't necessarily do an acquire
-  // (see synchronizer.cpp).
-
-  unsigned int old_value;
-  const uint64_t zero = 0;
-
-  __asm__ __volatile__ (
-    /* lwsync */
-    strasm_lwsync
-    /* atomic loop */
-    "1:                                                 \n"
-    "   lwarx   %[old_value], %[dest], %[zero]          \n"
-    "   stwcx.  %[exchange_value], %[dest], %[zero]     \n"
-    "   bne-    1b                                      \n"
-    /* isync */
-    strasm_sync
-    /* exit */
-    "2:                                                 \n"
-    /* out */
-    : [old_value]       "=&r"   (old_value),
-                        "=m"    (*dest)
-    /* in */
-    : [dest]            "b"     (dest),
-      [zero]            "r"     (zero),
-      [exchange_value]  "r"     (exchange_value),
-                        "m"     (*dest)
-    /* clobber */
-    : "cc",
-      "memory"
-    );
-
-  return (jint) old_value;
-}
-
-inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
-
-  // Note that xchg_ptr doesn't necessarily do an acquire
-  // (see synchronizer.cpp).
-
-  long old_value;
-  const uint64_t zero = 0;
-
-  __asm__ __volatile__ (
-    /* lwsync */
-    strasm_lwsync
-    /* atomic loop */
-    "1:                                                 \n"
-    "   ldarx   %[old_value], %[dest], %[zero]          \n"
-    "   stdcx.  %[exchange_value], %[dest], %[zero]     \n"
-    "   bne-    1b                                      \n"
-    /* isync */
-    strasm_sync
-    /* exit */
-    "2:                                                 \n"
-    /* out */
-    : [old_value]       "=&r"   (old_value),
-                        "=m"    (*dest)
-    /* in */
-    : [dest]            "b"     (dest),
-      [zero]            "r"     (zero),
-      [exchange_value]  "r"     (exchange_value),
-                        "m"     (*dest)
-    /* clobber */
-    : "cc",
-      "memory"
-    );
-
-  return (intptr_t) old_value;
-}
-
-inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) {
-  return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
-}
-
-inline void cmpxchg_pre_membar(cmpxchg_memory_order order) {
-  if (order != memory_order_relaxed) {
-    __asm__ __volatile__ (
-      /* fence */
-      strasm_sync
-      );
-  }
-}
-
-inline void cmpxchg_post_membar(cmpxchg_memory_order order) {
-  if (order != memory_order_relaxed) {
-    __asm__ __volatile__ (
-      /* fence */
-      strasm_sync
-      );
-  }
-}
-
-#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
-inline jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, cmpxchg_memory_order order) {
-
-  // Note that cmpxchg guarantees a two-way memory barrier across
-  // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not
-  // specified otherwise (see atomic.hpp).
-
-  // Using 32 bit internally.
-  volatile int *dest_base = (volatile int*)((uintptr_t)dest & ~3);
-
-#ifdef VM_LITTLE_ENDIAN
-  const unsigned int shift_amount        = ((uintptr_t)dest & 3) * 8;
-#else
-  const unsigned int shift_amount        = ((~(uintptr_t)dest) & 3) * 8;
-#endif
-  const unsigned int masked_compare_val  = ((unsigned int)(unsigned char)compare_value),
-                     masked_exchange_val = ((unsigned int)(unsigned char)exchange_value),
-                     xor_value           = (masked_compare_val ^ masked_exchange_val) << shift_amount;
-
-  unsigned int old_value, value32;
-
-  cmpxchg_pre_membar(order);
-
-  __asm__ __volatile__ (
-    /* simple guard */
-    "   lbz     %[old_value], 0(%[dest])                  \n"
-    "   cmpw    %[masked_compare_val], %[old_value]       \n"
-    "   bne-    2f                                        \n"
-    /* atomic loop */
-    "1:                                                   \n"
-    "   lwarx   %[value32], 0, %[dest_base]               \n"
-    /* extract byte and compare */
-    "   srd     %[old_value], %[value32], %[shift_amount] \n"
-    "   clrldi  %[old_value], %[old_value], 56            \n"
-    "   cmpw    %[masked_compare_val], %[old_value]       \n"
-    "   bne-    2f                                        \n"
-    /* replace byte and try to store */
-    "   xor     %[value32], %[xor_value], %[value32]      \n"
-    "   stwcx.  %[value32], 0, %[dest_base]               \n"
-    "   bne-    1b                                        \n"
-    /* exit */
-    "2:                                                   \n"
-    /* out */
-    : [old_value]           "=&r"   (old_value),
-      [value32]             "=&r"   (value32),
-                            "=m"    (*dest),
-                            "=m"    (*dest_base)
-    /* in */
-    : [dest]                "b"     (dest),
-      [dest_base]           "b"     (dest_base),
-      [shift_amount]        "r"     (shift_amount),
-      [masked_compare_val]  "r"     (masked_compare_val),
-      [xor_value]           "r"     (xor_value),
-                            "m"     (*dest),
-                            "m"     (*dest_base)
-    /* clobber */
-    : "cc",
-      "memory"
-    );
-
-  cmpxchg_post_membar(order);
-
-  return (jbyte)(unsigned char)old_value;
-}
-
-inline jint Atomic::cmpxchg(jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order) {
-
-  // Note that cmpxchg guarantees a two-way memory barrier across
-  // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not
-  // specified otherwise (see atomic.hpp).
-
-  unsigned int old_value;
-  const uint64_t zero = 0;
-
-  cmpxchg_pre_membar(order);
-
-  __asm__ __volatile__ (
-    /* simple guard */
-    "   lwz     %[old_value], 0(%[dest])                \n"
-    "   cmpw    %[compare_value], %[old_value]          \n"
-    "   bne-    2f                                      \n"
-    /* atomic loop */
-    "1:                                                 \n"
-    "   lwarx   %[old_value], %[dest], %[zero]          \n"
-    "   cmpw    %[compare_value], %[old_value]          \n"
-    "   bne-    2f                                      \n"
-    "   stwcx.  %[exchange_value], %[dest], %[zero]     \n"
-    "   bne-    1b                                      \n"
-    /* exit */
-    "2:                                                 \n"
-    /* out */
-    : [old_value]       "=&r"   (old_value),
-                        "=m"    (*dest)
-    /* in */
-    : [dest]            "b"     (dest),
-      [zero]            "r"     (zero),
-      [compare_value]   "r"     (compare_value),
-      [exchange_value]  "r"     (exchange_value),
-                        "m"     (*dest)
-    /* clobber */
-    : "cc",
-      "memory"
-    );
-
-  cmpxchg_post_membar(order);
-
-  return (jint) old_value;
-}
-
-inline jlong Atomic::cmpxchg(jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order) {
-
-  // Note that cmpxchg guarantees a two-way memory barrier across
-  // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not
-  // specified otherwise (see atomic.hpp).
-
-  long old_value;
-  const uint64_t zero = 0;
-
-  cmpxchg_pre_membar(order);
-
-  __asm__ __volatile__ (
-    /* simple guard */
-    "   ld      %[old_value], 0(%[dest])                \n"
-    "   cmpd    %[compare_value], %[old_value]          \n"
-    "   bne-    2f                                      \n"
-    /* atomic loop */
-    "1:                                                 \n"
-    "   ldarx   %[old_value], %[dest], %[zero]          \n"
-    "   cmpd    %[compare_value], %[old_value]          \n"
-    "   bne-    2f                                      \n"
-    "   stdcx.  %[exchange_value], %[dest], %[zero]     \n"
-    "   bne-    1b                                      \n"
-    /* exit */
-    "2:                                                 \n"
-    /* out */
-    : [old_value]       "=&r"   (old_value),
-                        "=m"    (*dest)
-    /* in */
-    : [dest]            "b"     (dest),
-      [zero]            "r"     (zero),
-      [compare_value]   "r"     (compare_value),
-      [exchange_value]  "r"     (exchange_value),
-                        "m"     (*dest)
-    /* clobber */
-    : "cc",
-      "memory"
-    );
-
-  cmpxchg_post_membar(order);
-
-  return (jlong) old_value;
-}
-
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
-  return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
-}
-
-inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order) {
-  return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
-}
-
-#undef strasm_sync
-#undef strasm_lwsync
-#undef strasm_isync
-#undef strasm_release
-#undef strasm_acquire
-#undef strasm_fence
-#undef strasm_nobarrier
-#undef strasm_nobarrier_clobber_memory
-
-#endif // OS_CPU_AIX_OJDKPPC_VM_ATOMIC_AIX_PPC_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,227 @@
+/*
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_HPP
+#define OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_HPP
+
+#include "runtime/os.hpp"
+
+// Implementation of class atomic
+
+inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
+inline void Atomic::store    (jshort   store_value, jshort*   dest) { *dest = store_value; }
+inline void Atomic::store    (jint     store_value, jint*     dest) { *dest = store_value; }
+inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
+inline void Atomic::store_ptr(void*    store_value, void*     dest) { *(void**)dest = store_value; }
+
+inline void Atomic::store    (jbyte    store_value, volatile jbyte*    dest) { *dest = store_value; }
+inline void Atomic::store    (jshort   store_value, volatile jshort*   dest) { *dest = store_value; }
+inline void Atomic::store    (jint     store_value, volatile jint*     dest) { *dest = store_value; }
+inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
+inline void Atomic::store_ptr(void*    store_value, volatile void*     dest) { *(void* volatile *)dest = store_value; }
+
+
+// Adding a lock prefix to an instruction on MP machine
+#define LOCK_IF_MP(mp) "cmp $0, " #mp "; je 1f; lock; 1: "
+
+inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
+  jint addend = add_value;
+  int mp = os::is_MP();
+  __asm__ volatile (  LOCK_IF_MP(%3) "xaddl %0,(%2)"
+                    : "=r" (addend)
+                    : "0" (addend), "r" (dest), "r" (mp)
+                    : "cc", "memory");
+  return addend + add_value;
+}
+
+inline void Atomic::inc    (volatile jint*     dest) {
+  int mp = os::is_MP();
+  __asm__ volatile (LOCK_IF_MP(%1) "addl $1,(%0)" :
+                    : "r" (dest), "r" (mp) : "cc", "memory");
+}
+
+inline void Atomic::inc_ptr(volatile void*     dest) {
+  inc_ptr((volatile intptr_t*)dest);
+}
+
+inline void Atomic::dec    (volatile jint*     dest) {
+  int mp = os::is_MP();
+  __asm__ volatile (LOCK_IF_MP(%1) "subl $1,(%0)" :
+                    : "r" (dest), "r" (mp) : "cc", "memory");
+}
+
+inline void Atomic::dec_ptr(volatile void*     dest) {
+  dec_ptr((volatile intptr_t*)dest);
+}
+
+inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
+  __asm__ volatile (  "xchgl (%2),%0"
+                    : "=r" (exchange_value)
+                    : "0" (exchange_value), "r" (dest)
+                    : "memory");
+  return exchange_value;
+}
+
+inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
+  return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
+}
+
+#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline jbyte    Atomic::cmpxchg    (jbyte    exchange_value, volatile jbyte*    dest, jbyte    compare_value, cmpxchg_memory_order order) {
+  int mp = os::is_MP();
+  __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)"
+                    : "=a" (exchange_value)
+                    : "q" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
+                    : "cc", "memory");
+  return exchange_value;
+}
+
+inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value, cmpxchg_memory_order order) {
+  int mp = os::is_MP();
+  __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgl %1,(%3)"
+                    : "=a" (exchange_value)
+                    : "r" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
+                    : "cc", "memory");
+  return exchange_value;
+}
+
+#ifdef AMD64
+inline void Atomic::store    (jlong    store_value, jlong*    dest) { *dest = store_value; }
+inline void Atomic::store    (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
+
+inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
+  intptr_t addend = add_value;
+  bool mp = os::is_MP();
+  __asm__ __volatile__ (LOCK_IF_MP(%3) "xaddq %0,(%2)"
+                        : "=r" (addend)
+                        : "0" (addend), "r" (dest), "r" (mp)
+                        : "cc", "memory");
+  return addend + add_value;
+}
+
+inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
+  return (void*)add_ptr(add_value, (volatile intptr_t*)dest);
+}
+
+inline void Atomic::inc_ptr(volatile intptr_t* dest) {
+  bool mp = os::is_MP();
+  __asm__ __volatile__ (LOCK_IF_MP(%1) "addq $1,(%0)"
+                        :
+                        : "r" (dest), "r" (mp)
+                        : "cc", "memory");
+}
+
+inline void Atomic::dec_ptr(volatile intptr_t* dest) {
+  bool mp = os::is_MP();
+  __asm__ __volatile__ (LOCK_IF_MP(%1) "subq $1,(%0)"
+                        :
+                        : "r" (dest), "r" (mp)
+                        : "cc", "memory");
+}
+
+inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
+  __asm__ __volatile__ ("xchgq (%2),%0"
+                        : "=r" (exchange_value)
+                        : "0" (exchange_value), "r" (dest)
+                        : "memory");
+  return exchange_value;
+}
+
+inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
+  bool mp = os::is_MP();
+  __asm__ __volatile__ (LOCK_IF_MP(%4) "cmpxchgq %1,(%3)"
+                        : "=a" (exchange_value)
+                        : "r" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
+                        : "cc", "memory");
+  return exchange_value;
+}
+
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+  return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
+}
+
+inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
+  return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
+}
+
+inline jlong Atomic::load(volatile jlong* src) { return *src; }
+
+#else // !AMD64
+
+inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
+  return (intptr_t)Atomic::add((jint)add_value, (volatile jint*)dest);
+}
+
+inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
+  return (void*)Atomic::add((jint)add_value, (volatile jint*)dest);
+}
+
+
+inline void Atomic::inc_ptr(volatile intptr_t* dest) {
+  inc((volatile jint*)dest);
+}
+
+inline void Atomic::dec_ptr(volatile intptr_t* dest) {
+  dec((volatile jint*)dest);
+}
+
+inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
+  return (intptr_t)xchg((jint)exchange_value, (volatile jint*)dest);
+}
+
+extern "C" {
+  // defined in bsd_x86.s
+  jlong _Atomic_cmpxchg_long(jlong, volatile jlong*, jlong, bool);
+  void _Atomic_move_long(volatile jlong* src, volatile jlong* dst);
+}
+
+inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
+  return _Atomic_cmpxchg_long(exchange_value, dest, compare_value, os::is_MP());
+}
+
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+  return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
+}
+
+inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
+  return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
+}
+
+inline jlong Atomic::load(volatile jlong* src) {
+  volatile jlong dest;
+  _Atomic_move_long(src, &dest);
+  return dest;
+}
+
+inline void Atomic::store(jlong store_value, jlong* dest) {
+  _Atomic_move_long((volatile jlong*)&store_value, (volatile jlong*)dest);
+}
+
+inline void Atomic::store(jlong store_value, volatile jlong* dest) {
+  _Atomic_move_long((volatile jlong*)&store_value, dest);
+}
+
+#endif // AMD64
+
+#endif // OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_HPP
--- a/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,228 +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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_INLINE_HPP
-#define OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_INLINE_HPP
-
-#include "runtime/atomic.hpp"
-#include "runtime/os.hpp"
-
-// Implementation of class atomic
-
-inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
-inline void Atomic::store    (jshort   store_value, jshort*   dest) { *dest = store_value; }
-inline void Atomic::store    (jint     store_value, jint*     dest) { *dest = store_value; }
-inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
-inline void Atomic::store_ptr(void*    store_value, void*     dest) { *(void**)dest = store_value; }
-
-inline void Atomic::store    (jbyte    store_value, volatile jbyte*    dest) { *dest = store_value; }
-inline void Atomic::store    (jshort   store_value, volatile jshort*   dest) { *dest = store_value; }
-inline void Atomic::store    (jint     store_value, volatile jint*     dest) { *dest = store_value; }
-inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
-inline void Atomic::store_ptr(void*    store_value, volatile void*     dest) { *(void* volatile *)dest = store_value; }
-
-
-// Adding a lock prefix to an instruction on MP machine
-#define LOCK_IF_MP(mp) "cmp $0, " #mp "; je 1f; lock; 1: "
-
-inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
-  jint addend = add_value;
-  int mp = os::is_MP();
-  __asm__ volatile (  LOCK_IF_MP(%3) "xaddl %0,(%2)"
-                    : "=r" (addend)
-                    : "0" (addend), "r" (dest), "r" (mp)
-                    : "cc", "memory");
-  return addend + add_value;
-}
-
-inline void Atomic::inc    (volatile jint*     dest) {
-  int mp = os::is_MP();
-  __asm__ volatile (LOCK_IF_MP(%1) "addl $1,(%0)" :
-                    : "r" (dest), "r" (mp) : "cc", "memory");
-}
-
-inline void Atomic::inc_ptr(volatile void*     dest) {
-  inc_ptr((volatile intptr_t*)dest);
-}
-
-inline void Atomic::dec    (volatile jint*     dest) {
-  int mp = os::is_MP();
-  __asm__ volatile (LOCK_IF_MP(%1) "subl $1,(%0)" :
-                    : "r" (dest), "r" (mp) : "cc", "memory");
-}
-
-inline void Atomic::dec_ptr(volatile void*     dest) {
-  dec_ptr((volatile intptr_t*)dest);
-}
-
-inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
-  __asm__ volatile (  "xchgl (%2),%0"
-                    : "=r" (exchange_value)
-                    : "0" (exchange_value), "r" (dest)
-                    : "memory");
-  return exchange_value;
-}
-
-inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
-  return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
-}
-
-#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
-inline jbyte    Atomic::cmpxchg    (jbyte    exchange_value, volatile jbyte*    dest, jbyte    compare_value, cmpxchg_memory_order order) {
-  int mp = os::is_MP();
-  __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)"
-                    : "=a" (exchange_value)
-                    : "q" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
-                    : "cc", "memory");
-  return exchange_value;
-}
-
-inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value, cmpxchg_memory_order order) {
-  int mp = os::is_MP();
-  __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgl %1,(%3)"
-                    : "=a" (exchange_value)
-                    : "r" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
-                    : "cc", "memory");
-  return exchange_value;
-}
-
-#ifdef AMD64
-inline void Atomic::store    (jlong    store_value, jlong*    dest) { *dest = store_value; }
-inline void Atomic::store    (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
-
-inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
-  intptr_t addend = add_value;
-  bool mp = os::is_MP();
-  __asm__ __volatile__ (LOCK_IF_MP(%3) "xaddq %0,(%2)"
-                        : "=r" (addend)
-                        : "0" (addend), "r" (dest), "r" (mp)
-                        : "cc", "memory");
-  return addend + add_value;
-}
-
-inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
-  return (void*)add_ptr(add_value, (volatile intptr_t*)dest);
-}
-
-inline void Atomic::inc_ptr(volatile intptr_t* dest) {
-  bool mp = os::is_MP();
-  __asm__ __volatile__ (LOCK_IF_MP(%1) "addq $1,(%0)"
-                        :
-                        : "r" (dest), "r" (mp)
-                        : "cc", "memory");
-}
-
-inline void Atomic::dec_ptr(volatile intptr_t* dest) {
-  bool mp = os::is_MP();
-  __asm__ __volatile__ (LOCK_IF_MP(%1) "subq $1,(%0)"
-                        :
-                        : "r" (dest), "r" (mp)
-                        : "cc", "memory");
-}
-
-inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
-  __asm__ __volatile__ ("xchgq (%2),%0"
-                        : "=r" (exchange_value)
-                        : "0" (exchange_value), "r" (dest)
-                        : "memory");
-  return exchange_value;
-}
-
-inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
-  bool mp = os::is_MP();
-  __asm__ __volatile__ (LOCK_IF_MP(%4) "cmpxchgq %1,(%3)"
-                        : "=a" (exchange_value)
-                        : "r" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
-                        : "cc", "memory");
-  return exchange_value;
-}
-
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
-  return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
-}
-
-inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
-  return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
-}
-
-inline jlong Atomic::load(volatile jlong* src) { return *src; }
-
-#else // !AMD64
-
-inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
-  return (intptr_t)Atomic::add((jint)add_value, (volatile jint*)dest);
-}
-
-inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
-  return (void*)Atomic::add((jint)add_value, (volatile jint*)dest);
-}
-
-
-inline void Atomic::inc_ptr(volatile intptr_t* dest) {
-  inc((volatile jint*)dest);
-}
-
-inline void Atomic::dec_ptr(volatile intptr_t* dest) {
-  dec((volatile jint*)dest);
-}
-
-inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
-  return (intptr_t)xchg((jint)exchange_value, (volatile jint*)dest);
-}
-
-extern "C" {
-  // defined in bsd_x86.s
-  jlong _Atomic_cmpxchg_long(jlong, volatile jlong*, jlong, bool);
-  void _Atomic_move_long(volatile jlong* src, volatile jlong* dst);
-}
-
-inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
-  return _Atomic_cmpxchg_long(exchange_value, dest, compare_value, os::is_MP());
-}
-
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
-  return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
-}
-
-inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
-  return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
-}
-
-inline jlong Atomic::load(volatile jlong* src) {
-  volatile jlong dest;
-  _Atomic_move_long(src, &dest);
-  return dest;
-}
-
-inline void Atomic::store(jlong store_value, jlong* dest) {
-  _Atomic_move_long((volatile jlong*)&store_value, (volatile jlong*)dest);
-}
-
-inline void Atomic::store(jlong store_value, volatile jlong* dest) {
-  _Atomic_move_long((volatile jlong*)&store_value, dest);
-}
-
-#endif // AMD64
-
-#endif // OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_INLINE_HPP
--- a/hotspot/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 #ifndef OS_CPU_BSD_X86_VM_ORDERACCESS_BSD_X86_INLINE_HPP
 #define OS_CPU_BSD_X86_VM_ORDERACCESS_BSD_X86_INLINE_HPP
 
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/orderAccess.hpp"
 #include "runtime/os.hpp"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,333 @@
+/*
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2007, 2008, 2011, 2015, 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 OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_HPP
+#define OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_HPP
+
+#include "runtime/os.hpp"
+
+// Implementation of class atomic
+
+#ifdef M68K
+
+/*
+ * __m68k_cmpxchg
+ *
+ * Atomically store newval in *ptr if *ptr is equal to oldval for user space.
+ * Returns newval on success and oldval if no exchange happened.
+ * This implementation is processor specific and works on
+ * 68020 68030 68040 and 68060.
+ *
+ * It will not work on ColdFire, 68000 and 68010 since they lack the CAS
+ * instruction.
+ * Using a kernelhelper would be better for arch complete implementation.
+ *
+ */
+
+static inline int __m68k_cmpxchg(int oldval, int newval, volatile int *ptr) {
+  int ret;
+  __asm __volatile ("cas%.l %0,%2,%1"
+                   : "=d" (ret), "+m" (*(ptr))
+                   : "d" (newval), "0" (oldval));
+  return ret;
+}
+
+/* Perform an atomic compare and swap: if the current value of `*PTR'
+   is OLDVAL, then write NEWVAL into `*PTR'.  Return the contents of
+   `*PTR' before the operation.*/
+static inline int m68k_compare_and_swap(volatile int *ptr,
+                                        int oldval,
+                                        int newval) {
+  for (;;) {
+      int prev = *ptr;
+      if (prev != oldval)
+        return prev;
+
+      if (__m68k_cmpxchg (prev, newval, ptr) == newval)
+        // Success.
+        return prev;
+
+      // We failed even though prev == oldval.  Try again.
+    }
+}
+
+/* Atomically add an int to memory.  */
+static inline int m68k_add_and_fetch(volatile int *ptr, int add_value) {
+  for (;;) {
+      // Loop until success.
+
+      int prev = *ptr;
+
+      if (__m68k_cmpxchg (prev, prev + add_value, ptr) == prev + add_value)
+        return prev + add_value;
+    }
+}
+
+/* Atomically write VALUE into `*PTR' and returns the previous
+   contents of `*PTR'.  */
+static inline int m68k_lock_test_and_set(volatile int *ptr, int newval) {
+  for (;;) {
+      // Loop until success.
+      int prev = *ptr;
+
+      if (__m68k_cmpxchg (prev, newval, ptr) == prev)
+        return prev;
+    }
+}
+#endif // M68K
+
+#ifdef ARM
+
+/*
+ * __kernel_cmpxchg
+ *
+ * Atomically store newval in *ptr if *ptr is equal to oldval for user space.
+ * Return zero if *ptr was changed or non-zero if no exchange happened.
+ * The C flag is also set if *ptr was changed to allow for assembly
+ * optimization in the calling code.
+ *
+ */
+
+typedef int (__kernel_cmpxchg_t)(int oldval, int newval, volatile int *ptr);
+#define __kernel_cmpxchg (*(__kernel_cmpxchg_t *) 0xffff0fc0)
+
+
+
+/* Perform an atomic compare and swap: if the current value of `*PTR'
+   is OLDVAL, then write NEWVAL into `*PTR'.  Return the contents of
+   `*PTR' before the operation.*/
+static inline int arm_compare_and_swap(volatile int *ptr,
+                                       int oldval,
+                                       int newval) {
+  for (;;) {
+      int prev = *ptr;
+      if (prev != oldval)
+        return prev;
+
+      if (__kernel_cmpxchg (prev, newval, ptr) == 0)
+        // Success.
+        return prev;
+
+      // We failed even though prev == oldval.  Try again.
+    }
+}
+
+/* Atomically add an int to memory.  */
+static inline int arm_add_and_fetch(volatile int *ptr, int add_value) {
+  for (;;) {
+      // Loop until a __kernel_cmpxchg succeeds.
+
+      int prev = *ptr;
+
+      if (__kernel_cmpxchg (prev, prev + add_value, ptr) == 0)
+        return prev + add_value;
+    }
+}
+
+/* Atomically write VALUE into `*PTR' and returns the previous
+   contents of `*PTR'.  */
+static inline int arm_lock_test_and_set(volatile int *ptr, int newval) {
+  for (;;) {
+      // Loop until a __kernel_cmpxchg succeeds.
+      int prev = *ptr;
+
+      if (__kernel_cmpxchg (prev, newval, ptr) == 0)
+        return prev;
+    }
+}
+#endif // ARM
+
+inline void Atomic::store(jint store_value, volatile jint* dest) {
+#if !defined(ARM) && !defined(M68K)
+  __sync_synchronize();
+#endif
+  *dest = store_value;
+}
+
+inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) {
+#if !defined(ARM) && !defined(M68K)
+  __sync_synchronize();
+#endif
+  *dest = store_value;
+}
+
+inline jint Atomic::add(jint add_value, volatile jint* dest) {
+#ifdef ARM
+  return arm_add_and_fetch(dest, add_value);
+#else
+#ifdef M68K
+  return m68k_add_and_fetch(dest, add_value);
+#else
+  return __sync_add_and_fetch(dest, add_value);
+#endif // M68K
+#endif // ARM
+}
+
+inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
+#ifdef ARM
+  return arm_add_and_fetch(dest, add_value);
+#else
+#ifdef M68K
+  return m68k_add_and_fetch(dest, add_value);
+#else
+  return __sync_add_and_fetch(dest, add_value);
+#endif // M68K
+#endif // ARM
+}
+
+inline void* Atomic::add_ptr(intptr_t add_value, volatile void* dest) {
+  return (void *) add_ptr(add_value, (volatile intptr_t *) dest);
+}
+
+inline void Atomic::inc(volatile jint* dest) {
+  add(1, dest);
+}
+
+inline void Atomic::inc_ptr(volatile intptr_t* dest) {
+  add_ptr(1, dest);
+}
+
+inline void Atomic::inc_ptr(volatile void* dest) {
+  add_ptr(1, dest);
+}
+
+inline void Atomic::dec(volatile jint* dest) {
+  add(-1, dest);
+}
+
+inline void Atomic::dec_ptr(volatile intptr_t* dest) {
+  add_ptr(-1, dest);
+}
+
+inline void Atomic::dec_ptr(volatile void* dest) {
+  add_ptr(-1, dest);
+}
+
+inline jint Atomic::xchg(jint exchange_value, volatile jint* dest) {
+#ifdef ARM
+  return arm_lock_test_and_set(dest, exchange_value);
+#else
+#ifdef M68K
+  return m68k_lock_test_and_set(dest, exchange_value);
+#else
+  // __sync_lock_test_and_set is a bizarrely named atomic exchange
+  // operation.  Note that some platforms only support this with the
+  // limitation that the only valid value to store is the immediate
+  // constant 1.  There is a test for this in JNI_CreateJavaVM().
+  jint result = __sync_lock_test_and_set (dest, exchange_value);
+  // All atomic operations are expected to be full memory barriers
+  // (see atomic.hpp). However, __sync_lock_test_and_set is not
+  // a full memory barrier, but an acquire barrier. Hence, this added
+  // barrier.
+  __sync_synchronize();
+  return result;
+#endif // M68K
+#endif // ARM
+}
+
+inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value,
+                                 volatile intptr_t* dest) {
+#ifdef ARM
+  return arm_lock_test_and_set(dest, exchange_value);
+#else
+#ifdef M68K
+  return m68k_lock_test_and_set(dest, exchange_value);
+#else
+  intptr_t result = __sync_lock_test_and_set (dest, exchange_value);
+  __sync_synchronize();
+  return result;
+#endif // M68K
+#endif // ARM
+}
+
+inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) {
+  return (void *) xchg_ptr((intptr_t) exchange_value,
+                           (volatile intptr_t*) dest);
+}
+
+inline jint Atomic::cmpxchg(jint exchange_value,
+                            volatile jint* dest,
+                            jint compare_value,
+                            cmpxchg_memory_order order) {
+#ifdef ARM
+  return arm_compare_and_swap(dest, compare_value, exchange_value);
+#else
+#ifdef M68K
+  return m68k_compare_and_swap(dest, compare_value, exchange_value);
+#else
+  return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
+#endif // M68K
+#endif // ARM
+}
+
+inline jlong Atomic::cmpxchg(jlong exchange_value,
+                             volatile jlong* dest,
+                             jlong compare_value,
+                             cmpxchg_memory_order order) {
+
+  return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
+}
+
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value,
+                                    volatile intptr_t* dest,
+                                    intptr_t compare_value,
+                                    cmpxchg_memory_order order) {
+#ifdef ARM
+  return arm_compare_and_swap(dest, compare_value, exchange_value);
+#else
+#ifdef M68K
+  return m68k_compare_and_swap(dest, compare_value, exchange_value);
+#else
+  return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
+#endif // M68K
+#endif // ARM
+}
+
+inline void* Atomic::cmpxchg_ptr(void* exchange_value,
+                                 volatile void* dest,
+                                 void* compare_value,
+                                 cmpxchg_memory_order order) {
+
+  return (void *) cmpxchg_ptr((intptr_t) exchange_value,
+                              (volatile intptr_t*) dest,
+                              (intptr_t) compare_value,
+                              order);
+}
+
+inline jlong Atomic::load(volatile jlong* src) {
+  volatile jlong dest;
+  os::atomic_copy64(src, &dest);
+  return dest;
+}
+
+inline void Atomic::store(jlong store_value, jlong* dest) {
+  os::atomic_copy64((volatile jlong*)&store_value, (volatile jlong*)dest);
+}
+
+inline void Atomic::store(jlong store_value, volatile jlong* dest) {
+  os::atomic_copy64((volatile jlong*)&store_value, dest);
+}
+
+#endif // OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_HPP
--- a/hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,334 +0,0 @@
-/*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2008, 2011, 2015, 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 OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_INLINE_HPP
-#define OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_INLINE_HPP
-
-#include "runtime/atomic.hpp"
-#include "runtime/os.hpp"
-
-// Implementation of class atomic
-
-#ifdef M68K
-
-/*
- * __m68k_cmpxchg
- *
- * Atomically store newval in *ptr if *ptr is equal to oldval for user space.
- * Returns newval on success and oldval if no exchange happened.
- * This implementation is processor specific and works on
- * 68020 68030 68040 and 68060.
- *
- * It will not work on ColdFire, 68000 and 68010 since they lack the CAS
- * instruction.
- * Using a kernelhelper would be better for arch complete implementation.
- *
- */
-
-static inline int __m68k_cmpxchg(int oldval, int newval, volatile int *ptr) {
-  int ret;
-  __asm __volatile ("cas%.l %0,%2,%1"
-                   : "=d" (ret), "+m" (*(ptr))
-                   : "d" (newval), "0" (oldval));
-  return ret;
-}
-
-/* Perform an atomic compare and swap: if the current value of `*PTR'
-   is OLDVAL, then write NEWVAL into `*PTR'.  Return the contents of
-   `*PTR' before the operation.*/
-static inline int m68k_compare_and_swap(volatile int *ptr,
-                                        int oldval,
-                                        int newval) {
-  for (;;) {
-      int prev = *ptr;
-      if (prev != oldval)
-        return prev;
-
-      if (__m68k_cmpxchg (prev, newval, ptr) == newval)
-        // Success.
-        return prev;
-
-      // We failed even though prev == oldval.  Try again.
-    }
-}
-
-/* Atomically add an int to memory.  */
-static inline int m68k_add_and_fetch(volatile int *ptr, int add_value) {
-  for (;;) {
-      // Loop until success.
-
-      int prev = *ptr;
-
-      if (__m68k_cmpxchg (prev, prev + add_value, ptr) == prev + add_value)
-        return prev + add_value;
-    }
-}
-
-/* Atomically write VALUE into `*PTR' and returns the previous
-   contents of `*PTR'.  */
-static inline int m68k_lock_test_and_set(volatile int *ptr, int newval) {
-  for (;;) {
-      // Loop until success.
-      int prev = *ptr;
-
-      if (__m68k_cmpxchg (prev, newval, ptr) == prev)
-        return prev;
-    }
-}
-#endif // M68K
-
-#ifdef ARM
-
-/*
- * __kernel_cmpxchg
- *
- * Atomically store newval in *ptr if *ptr is equal to oldval for user space.
- * Return zero if *ptr was changed or non-zero if no exchange happened.
- * The C flag is also set if *ptr was changed to allow for assembly
- * optimization in the calling code.
- *
- */
-
-typedef int (__kernel_cmpxchg_t)(int oldval, int newval, volatile int *ptr);
-#define __kernel_cmpxchg (*(__kernel_cmpxchg_t *) 0xffff0fc0)
-
-
-
-/* Perform an atomic compare and swap: if the current value of `*PTR'
-   is OLDVAL, then write NEWVAL into `*PTR'.  Return the contents of
-   `*PTR' before the operation.*/
-static inline int arm_compare_and_swap(volatile int *ptr,
-                                       int oldval,
-                                       int newval) {
-  for (;;) {
-      int prev = *ptr;
-      if (prev != oldval)
-        return prev;
-
-      if (__kernel_cmpxchg (prev, newval, ptr) == 0)
-        // Success.
-        return prev;
-
-      // We failed even though prev == oldval.  Try again.
-    }
-}
-
-/* Atomically add an int to memory.  */
-static inline int arm_add_and_fetch(volatile int *ptr, int add_value) {
-  for (;;) {
-      // Loop until a __kernel_cmpxchg succeeds.
-
-      int prev = *ptr;
-
-      if (__kernel_cmpxchg (prev, prev + add_value, ptr) == 0)
-        return prev + add_value;
-    }
-}
-
-/* Atomically write VALUE into `*PTR' and returns the previous
-   contents of `*PTR'.  */
-static inline int arm_lock_test_and_set(volatile int *ptr, int newval) {
-  for (;;) {
-      // Loop until a __kernel_cmpxchg succeeds.
-      int prev = *ptr;
-
-      if (__kernel_cmpxchg (prev, newval, ptr) == 0)
-        return prev;
-    }
-}
-#endif // ARM
-
-inline void Atomic::store(jint store_value, volatile jint* dest) {
-#if !defined(ARM) && !defined(M68K)
-  __sync_synchronize();
-#endif
-  *dest = store_value;
-}
-
-inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) {
-#if !defined(ARM) && !defined(M68K)
-  __sync_synchronize();
-#endif
-  *dest = store_value;
-}
-
-inline jint Atomic::add(jint add_value, volatile jint* dest) {
-#ifdef ARM
-  return arm_add_and_fetch(dest, add_value);
-#else
-#ifdef M68K
-  return m68k_add_and_fetch(dest, add_value);
-#else
-  return __sync_add_and_fetch(dest, add_value);
-#endif // M68K
-#endif // ARM
-}
-
-inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
-#ifdef ARM
-  return arm_add_and_fetch(dest, add_value);
-#else
-#ifdef M68K
-  return m68k_add_and_fetch(dest, add_value);
-#else
-  return __sync_add_and_fetch(dest, add_value);
-#endif // M68K
-#endif // ARM
-}
-
-inline void* Atomic::add_ptr(intptr_t add_value, volatile void* dest) {
-  return (void *) add_ptr(add_value, (volatile intptr_t *) dest);
-}
-
-inline void Atomic::inc(volatile jint* dest) {
-  add(1, dest);
-}
-
-inline void Atomic::inc_ptr(volatile intptr_t* dest) {
-  add_ptr(1, dest);
-}
-
-inline void Atomic::inc_ptr(volatile void* dest) {
-  add_ptr(1, dest);
-}
-
-inline void Atomic::dec(volatile jint* dest) {
-  add(-1, dest);
-}
-
-inline void Atomic::dec_ptr(volatile intptr_t* dest) {
-  add_ptr(-1, dest);
-}
-
-inline void Atomic::dec_ptr(volatile void* dest) {
-  add_ptr(-1, dest);
-}
-
-inline jint Atomic::xchg(jint exchange_value, volatile jint* dest) {
-#ifdef ARM
-  return arm_lock_test_and_set(dest, exchange_value);
-#else
-#ifdef M68K
-  return m68k_lock_test_and_set(dest, exchange_value);
-#else
-  // __sync_lock_test_and_set is a bizarrely named atomic exchange
-  // operation.  Note that some platforms only support this with the
-  // limitation that the only valid value to store is the immediate
-  // constant 1.  There is a test for this in JNI_CreateJavaVM().
-  jint result = __sync_lock_test_and_set (dest, exchange_value);
-  // All atomic operations are expected to be full memory barriers
-  // (see atomic.hpp). However, __sync_lock_test_and_set is not
-  // a full memory barrier, but an acquire barrier. Hence, this added
-  // barrier.
-  __sync_synchronize();
-  return result;
-#endif // M68K
-#endif // ARM
-}
-
-inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value,
-                                 volatile intptr_t* dest) {
-#ifdef ARM
-  return arm_lock_test_and_set(dest, exchange_value);
-#else
-#ifdef M68K
-  return m68k_lock_test_and_set(dest, exchange_value);
-#else
-  intptr_t result = __sync_lock_test_and_set (dest, exchange_value);
-  __sync_synchronize();
-  return result;
-#endif // M68K
-#endif // ARM
-}
-
-inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) {
-  return (void *) xchg_ptr((intptr_t) exchange_value,
-                           (volatile intptr_t*) dest);
-}
-
-inline jint Atomic::cmpxchg(jint exchange_value,
-                            volatile jint* dest,
-                            jint compare_value,
-                            cmpxchg_memory_order order) {
-#ifdef ARM
-  return arm_compare_and_swap(dest, compare_value, exchange_value);
-#else
-#ifdef M68K
-  return m68k_compare_and_swap(dest, compare_value, exchange_value);
-#else
-  return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
-#endif // M68K
-#endif // ARM
-}
-
-inline jlong Atomic::cmpxchg(jlong exchange_value,
-                             volatile jlong* dest,
-                             jlong compare_value,
-                             cmpxchg_memory_order order) {
-
-  return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
-}
-
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value,
-                                    volatile intptr_t* dest,
-                                    intptr_t compare_value,
-                                    cmpxchg_memory_order order) {
-#ifdef ARM
-  return arm_compare_and_swap(dest, compare_value, exchange_value);
-#else
-#ifdef M68K
-  return m68k_compare_and_swap(dest, compare_value, exchange_value);
-#else
-  return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
-#endif // M68K
-#endif // ARM
-}
-
-inline void* Atomic::cmpxchg_ptr(void* exchange_value,
-                                 volatile void* dest,
-                                 void* compare_value,
-                                 cmpxchg_memory_order order) {
-
-  return (void *) cmpxchg_ptr((intptr_t) exchange_value,
-                              (volatile intptr_t*) dest,
-                              (intptr_t) compare_value,
-                              order);
-}
-
-inline jlong Atomic::load(volatile jlong* src) {
-  volatile jlong dest;
-  os::atomic_copy64(src, &dest);
-  return dest;
-}
-
-inline void Atomic::store(jlong store_value, jlong* dest) {
-  os::atomic_copy64((volatile jlong*)&store_value, (volatile jlong*)dest);
-}
-
-inline void Atomic::store(jlong store_value, volatile jlong* dest) {
-  os::atomic_copy64((volatile jlong*)&store_value, dest);
-}
-
-#endif // OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/os_cpu/linux_aarch64/vm/atomic_linux_aarch64.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, Red Hat Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_HPP
+#define OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_HPP
+
+#include "vm_version_aarch64.hpp"
+
+// Implementation of class atomic
+
+#define FULL_MEM_BARRIER  __sync_synchronize()
+#define READ_MEM_BARRIER  __atomic_thread_fence(__ATOMIC_ACQUIRE);
+#define WRITE_MEM_BARRIER __atomic_thread_fence(__ATOMIC_RELEASE);
+
+inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
+inline void Atomic::store    (jshort   store_value, jshort*   dest) { *dest = store_value; }
+inline void Atomic::store    (jint     store_value, jint*     dest) { *dest = store_value; }
+inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
+inline void Atomic::store_ptr(void*    store_value, void*     dest) { *(void**)dest = store_value; }
+
+inline void Atomic::store    (jbyte    store_value, volatile jbyte*    dest) { *dest = store_value; }
+inline void Atomic::store    (jshort   store_value, volatile jshort*   dest) { *dest = store_value; }
+inline void Atomic::store    (jint     store_value, volatile jint*     dest) { *dest = store_value; }
+inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
+inline void Atomic::store_ptr(void*    store_value, volatile void*     dest) { *(void* volatile *)dest = store_value; }
+
+
+inline jint Atomic::add(jint add_value, volatile jint* dest)
+{
+ return __sync_add_and_fetch(dest, add_value);
+}
+
+inline void Atomic::inc(volatile jint* dest)
+{
+ add(1, dest);
+}
+
+inline void Atomic::inc_ptr(volatile void* dest)
+{
+ add_ptr(1, dest);
+}
+
+inline void Atomic::dec (volatile jint* dest)
+{
+ add(-1, dest);
+}
+
+inline void Atomic::dec_ptr(volatile void* dest)
+{
+ add_ptr(-1, dest);
+}
+
+inline jint Atomic::xchg (jint exchange_value, volatile jint* dest)
+{
+  jint res = __sync_lock_test_and_set (dest, exchange_value);
+  FULL_MEM_BARRIER;
+  return res;
+}
+
+inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest)
+{
+  return (void *) xchg_ptr((intptr_t) exchange_value,
+                           (volatile intptr_t*) dest);
+}
+
+template <typename T> T generic_cmpxchg(T exchange_value, volatile T* dest,
+                                        T compare_value, cmpxchg_memory_order order)
+{
+  if (order == memory_order_relaxed) {
+    T value = compare_value;
+    __atomic_compare_exchange(dest, &value, &exchange_value, /*weak*/false,
+                              __ATOMIC_RELAXED, __ATOMIC_RELAXED);
+    return value;
+  } else {
+    return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
+  }
+}
+
+#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, cmpxchg_memory_order order)
+{
+  return generic_cmpxchg(exchange_value, dest, compare_value, order);
+}
+
+inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order)
+{
+  return generic_cmpxchg(exchange_value, dest, compare_value, order);
+}
+
+inline void Atomic::store (jlong store_value, jlong* dest) { *dest = store_value; }
+inline void Atomic::store (jlong store_value, volatile jlong* dest) { *dest = store_value; }
+
+inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest)
+{
+ return __sync_add_and_fetch(dest, add_value);
+}
+
+inline void* Atomic::add_ptr(intptr_t add_value, volatile void* dest)
+{
+  return (void *) add_ptr(add_value, (volatile intptr_t *) dest);
+}
+
+inline void Atomic::inc_ptr(volatile intptr_t* dest)
+{
+ add_ptr(1, dest);
+}
+
+inline void Atomic::dec_ptr(volatile intptr_t* dest)
+{
+ add_ptr(-1, dest);
+}
+
+inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest)
+{
+  intptr_t res = __sync_lock_test_and_set (dest, exchange_value);
+  FULL_MEM_BARRIER;
+  return res;
+}
+
+inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order)
+{
+  return generic_cmpxchg(exchange_value, dest, compare_value, order);
+}
+
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order)
+{
+  return generic_cmpxchg(exchange_value, dest, compare_value, order);
+}
+
+inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order)
+{
+  return (void *) cmpxchg_ptr((intptr_t) exchange_value,
+                              (volatile intptr_t*) dest,
+                              (intptr_t) compare_value,
+                              order);
+}
+
+inline jlong Atomic::load(volatile jlong* src) { return *src; }
+
+#endif // OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_HPP
--- a/hotspot/src/os_cpu/linux_aarch64/vm/atomic_linux_aarch64.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2014, Red Hat Inc. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_INLINE_HPP
-#define OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_INLINE_HPP
-
-#include "runtime/atomic.hpp"
-#include "runtime/os.hpp"
-#include "vm_version_aarch64.hpp"
-
-// Implementation of class atomic
-
-#define FULL_MEM_BARRIER  __sync_synchronize()
-#define READ_MEM_BARRIER  __atomic_thread_fence(__ATOMIC_ACQUIRE);
-#define WRITE_MEM_BARRIER __atomic_thread_fence(__ATOMIC_RELEASE);
-
-inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
-inline void Atomic::store    (jshort   store_value, jshort*   dest) { *dest = store_value; }
-inline void Atomic::store    (jint     store_value, jint*     dest) { *dest = store_value; }
-inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
-inline void Atomic::store_ptr(void*    store_value, void*     dest) { *(void**)dest = store_value; }
-
-inline void Atomic::store    (jbyte    store_value, volatile jbyte*    dest) { *dest = store_value; }
-inline void Atomic::store    (jshort   store_value, volatile jshort*   dest) { *dest = store_value; }
-inline void Atomic::store    (jint     store_value, volatile jint*     dest) { *dest = store_value; }
-inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
-inline void Atomic::store_ptr(void*    store_value, volatile void*     dest) { *(void* volatile *)dest = store_value; }
-
-
-inline jint Atomic::add(jint add_value, volatile jint* dest)
-{
- return __sync_add_and_fetch(dest, add_value);
-}
-
-inline void Atomic::inc(volatile jint* dest)
-{
- add(1, dest);
-}
-
-inline void Atomic::inc_ptr(volatile void* dest)
-{
- add_ptr(1, dest);
-}
-
-inline void Atomic::dec (volatile jint* dest)
-{
- add(-1, dest);
-}
-
-inline void Atomic::dec_ptr(volatile void* dest)
-{
- add_ptr(-1, dest);
-}
-
-inline jint Atomic::xchg (jint exchange_value, volatile jint* dest)
-{
-  jint res = __sync_lock_test_and_set (dest, exchange_value);
-  FULL_MEM_BARRIER;
-  return res;
-}
-
-inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest)
-{
-  return (void *) xchg_ptr((intptr_t) exchange_value,
-                           (volatile intptr_t*) dest);
-}
-
-template <typename T> T generic_cmpxchg(T exchange_value, volatile T* dest,
-                                        T compare_value, cmpxchg_memory_order order)
-{
-  if (order == memory_order_relaxed) {
-    T value = compare_value;
-    __atomic_compare_exchange(dest, &value, &exchange_value, /*weak*/false,
-                              __ATOMIC_RELAXED, __ATOMIC_RELAXED);
-    return value;
-  } else {
-    return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
-  }
-}
-
-#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
-inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, cmpxchg_memory_order order)
-{
-  return generic_cmpxchg(exchange_value, dest, compare_value, order);
-}
-
-inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order)
-{
-  return generic_cmpxchg(exchange_value, dest, compare_value, order);
-}
-
-inline void Atomic::store (jlong store_value, jlong* dest) { *dest = store_value; }
-inline void Atomic::store (jlong store_value, volatile jlong* dest) { *dest = store_value; }
-
-inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest)
-{
- return __sync_add_and_fetch(dest, add_value);
-}
-
-inline void* Atomic::add_ptr(intptr_t add_value, volatile void* dest)
-{
-  return (void *) add_ptr(add_value, (volatile intptr_t *) dest);
-}
-
-inline void Atomic::inc_ptr(volatile intptr_t* dest)
-{
- add_ptr(1, dest);
-}
-
-inline void Atomic::dec_ptr(volatile intptr_t* dest)
-{
- add_ptr(-1, dest);
-}
-
-inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest)
-{
-  intptr_t res = __sync_lock_test_and_set (dest, exchange_value);
-  FULL_MEM_BARRIER;
-  return res;
-}
-
-inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order)
-{
-  return generic_cmpxchg(exchange_value, dest, compare_value, order);
-}
-
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order)
-{
-  return generic_cmpxchg(exchange_value, dest, compare_value, order);
-}
-
-inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order)
-{
-  return (void *) cmpxchg_ptr((intptr_t) exchange_value,
-                              (volatile intptr_t*) dest,
-                              (intptr_t) compare_value,
-                              order);
-}
-
-inline jlong Atomic::load(volatile jlong* src) { return *src; }
-
-#endif // OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_INLINE_HPP
--- a/hotspot/src/os_cpu/linux_aarch64/vm/orderAccess_linux_aarch64.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/os_cpu/linux_aarch64/vm/orderAccess_linux_aarch64.inline.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -26,7 +26,7 @@
 #ifndef OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_INLINE_HPP
 #define OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_INLINE_HPP
 
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/orderAccess.hpp"
 #include "runtime/os.hpp"
 #include "vm_version_aarch64.hpp"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,479 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014 SAP SE. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef OS_CPU_LINUX_PPC_VM_ATOMIC_LINUX_PPC_HPP
+#define OS_CPU_LINUX_PPC_VM_ATOMIC_LINUX_PPC_HPP
+
+#ifndef PPC64
+#error "Atomic currently only implemented for PPC64"
+#endif
+
+// Implementation of class atomic
+
+inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
+inline void Atomic::store    (jshort   store_value, jshort*   dest) { *dest = store_value; }
+inline void Atomic::store    (jint     store_value, jint*     dest) { *dest = store_value; }
+inline void Atomic::store    (jlong    store_value, jlong*    dest) { *dest = store_value; }
+inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
+inline void Atomic::store_ptr(void*    store_value, void*     dest) { *(void**)dest = store_value; }
+
+inline void Atomic::store    (jbyte    store_value, volatile jbyte*    dest) { *dest = store_value; }
+inline void Atomic::store    (jshort   store_value, volatile jshort*   dest) { *dest = store_value; }
+inline void Atomic::store    (jint     store_value, volatile jint*     dest) { *dest = store_value; }
+inline void Atomic::store    (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
+inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
+inline void Atomic::store_ptr(void*    store_value, volatile void*     dest) { *(void* volatile *)dest = store_value; }
+
+inline jlong Atomic::load(volatile jlong* src) { return *src; }
+
+//
+// machine barrier instructions:
+//
+// - sync            two-way memory barrier, aka fence
+// - lwsync          orders  Store|Store,
+//                            Load|Store,
+//                            Load|Load,
+//                   but not Store|Load
+// - eieio           orders memory accesses for device memory (only)
+// - isync           invalidates speculatively executed instructions
+//                   From the POWER ISA 2.06 documentation:
+//                    "[...] an isync instruction prevents the execution of
+//                   instructions following the isync until instructions
+//                   preceding the isync have completed, [...]"
+//                   From IBM's AIX assembler reference:
+//                    "The isync [...] instructions causes the processor to
+//                   refetch any instructions that might have been fetched
+//                   prior to the isync instruction. The instruction isync
+//                   causes the processor to wait for all previous instructions
+//                   to complete. Then any instructions already fetched are
+//                   discarded and instruction processing continues in the
+//                   environment established by the previous instructions."
+//
+// semantic barrier instructions:
+// (as defined in orderAccess.hpp)
+//
+// - release         orders Store|Store,       (maps to lwsync)
+//                           Load|Store
+// - acquire         orders  Load|Store,       (maps to lwsync)
+//                           Load|Load
+// - fence           orders Store|Store,       (maps to sync)
+//                           Load|Store,
+//                           Load|Load,
+//                          Store|Load
+//
+
+#define strasm_sync                       "\n  sync    \n"
+#define strasm_lwsync                     "\n  lwsync  \n"
+#define strasm_isync                      "\n  isync   \n"
+#define strasm_release                    strasm_lwsync
+#define strasm_acquire                    strasm_lwsync
+#define strasm_fence                      strasm_sync
+#define strasm_nobarrier                  ""
+#define strasm_nobarrier_clobber_memory   ""
+
+inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
+
+  unsigned int result;
+
+  __asm__ __volatile__ (
+    strasm_lwsync
+    "1: lwarx   %0,  0, %2    \n"
+    "   add     %0, %0, %1    \n"
+    "   stwcx.  %0,  0, %2    \n"
+    "   bne-    1b            \n"
+    strasm_isync
+    : /*%0*/"=&r" (result)
+    : /*%1*/"r" (add_value), /*%2*/"r" (dest)
+    : "cc", "memory" );
+
+  return (jint) result;
+}
+
+
+inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
+
+  long result;
+
+  __asm__ __volatile__ (
+    strasm_lwsync
+    "1: ldarx   %0,  0, %2    \n"
+    "   add     %0, %0, %1    \n"
+    "   stdcx.  %0,  0, %2    \n"
+    "   bne-    1b            \n"
+    strasm_isync
+    : /*%0*/"=&r" (result)
+    : /*%1*/"r" (add_value), /*%2*/"r" (dest)
+    : "cc", "memory" );
+
+  return (intptr_t) result;
+}
+
+inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
+  return (void*)add_ptr(add_value, (volatile intptr_t*)dest);
+}
+
+
+inline void Atomic::inc    (volatile jint*     dest) {
+
+  unsigned int temp;
+
+  __asm__ __volatile__ (
+    strasm_nobarrier
+    "1: lwarx   %0,  0, %2    \n"
+    "   addic   %0, %0,  1    \n"
+    "   stwcx.  %0,  0, %2    \n"
+    "   bne-    1b            \n"
+    strasm_nobarrier
+    : /*%0*/"=&r" (temp), "=m" (*dest)
+    : /*%2*/"r" (dest), "m" (*dest)
+    : "cc" strasm_nobarrier_clobber_memory);
+
+}
+
+inline void Atomic::inc_ptr(volatile intptr_t* dest) {
+
+  long temp;
+
+  __asm__ __volatile__ (
+    strasm_nobarrier
+    "1: ldarx   %0,  0, %2    \n"
+    "   addic   %0, %0,  1    \n"
+    "   stdcx.  %0,  0, %2    \n"
+    "   bne-    1b            \n"
+    strasm_nobarrier
+    : /*%0*/"=&r" (temp), "=m" (*dest)
+    : /*%2*/"r" (dest), "m" (*dest)
+    : "cc" strasm_nobarrier_clobber_memory);
+
+}
+
+inline void Atomic::inc_ptr(volatile void*     dest) {
+  inc_ptr((volatile intptr_t*)dest);
+}
+
+
+inline void Atomic::dec    (volatile jint*     dest) {
+
+  unsigned int temp;
+
+  __asm__ __volatile__ (
+    strasm_nobarrier
+    "1: lwarx   %0,  0, %2    \n"
+    "   addic   %0, %0, -1    \n"
+    "   stwcx.  %0,  0, %2    \n"
+    "   bne-    1b            \n"
+    strasm_nobarrier
+    : /*%0*/"=&r" (temp), "=m" (*dest)
+    : /*%2*/"r" (dest), "m" (*dest)
+    : "cc" strasm_nobarrier_clobber_memory);
+
+}
+
+inline void Atomic::dec_ptr(volatile intptr_t* dest) {
+
+  long temp;
+
+  __asm__ __volatile__ (
+    strasm_nobarrier
+    "1: ldarx   %0,  0, %2    \n"
+    "   addic   %0, %0, -1    \n"
+    "   stdcx.  %0,  0, %2    \n"
+    "   bne-    1b            \n"
+    strasm_nobarrier
+    : /*%0*/"=&r" (temp), "=m" (*dest)
+    : /*%2*/"r" (dest), "m" (*dest)
+    : "cc" strasm_nobarrier_clobber_memory);
+
+}
+
+inline void Atomic::dec_ptr(volatile void*     dest) {
+  dec_ptr((volatile intptr_t*)dest);
+}
+
+inline jint Atomic::xchg(jint exchange_value, volatile jint* dest) {
+
+  // Note that xchg_ptr doesn't necessarily do an acquire
+  // (see synchronizer.cpp).
+
+  unsigned int old_value;
+  const uint64_t zero = 0;
+
+  __asm__ __volatile__ (
+    /* lwsync */
+    strasm_lwsync
+    /* atomic loop */
+    "1:                                                 \n"
+    "   lwarx   %[old_value], %[dest], %[zero]          \n"
+    "   stwcx.  %[exchange_value], %[dest], %[zero]     \n"
+    "   bne-    1b                                      \n"
+    /* isync */
+    strasm_sync
+    /* exit */
+    "2:                                                 \n"
+    /* out */
+    : [old_value]       "=&r"   (old_value),
+                        "=m"    (*dest)
+    /* in */
+    : [dest]            "b"     (dest),
+      [zero]            "r"     (zero),
+      [exchange_value]  "r"     (exchange_value),
+                        "m"     (*dest)
+    /* clobber */
+    : "cc",
+      "memory"
+    );
+
+  return (jint) old_value;
+}
+
+inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
+
+  // Note that xchg_ptr doesn't necessarily do an acquire
+  // (see synchronizer.cpp).
+
+  long old_value;
+  const uint64_t zero = 0;
+
+  __asm__ __volatile__ (
+    /* lwsync */
+    strasm_lwsync
+    /* atomic loop */
+    "1:                                                 \n"
+    "   ldarx   %[old_value], %[dest], %[zero]          \n"
+    "   stdcx.  %[exchange_value], %[dest], %[zero]     \n"
+    "   bne-    1b                                      \n"
+    /* isync */
+    strasm_sync
+    /* exit */
+    "2:                                                 \n"
+    /* out */
+    : [old_value]       "=&r"   (old_value),
+                        "=m"    (*dest)
+    /* in */
+    : [dest]            "b"     (dest),
+      [zero]            "r"     (zero),
+      [exchange_value]  "r"     (exchange_value),
+                        "m"     (*dest)
+    /* clobber */
+    : "cc",
+      "memory"
+    );
+
+  return (intptr_t) old_value;
+}
+
+inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) {
+  return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
+}
+
+inline void cmpxchg_pre_membar(cmpxchg_memory_order order) {
+  if (order != memory_order_relaxed) {
+    __asm__ __volatile__ (
+      /* fence */
+      strasm_sync
+      );
+  }
+}
+
+inline void cmpxchg_post_membar(cmpxchg_memory_order order) {
+  if (order != memory_order_relaxed) {
+    __asm__ __volatile__ (
+      /* fence */
+      strasm_sync
+      );
+  }
+}
+
+#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, cmpxchg_memory_order order) {
+
+  // Note that cmpxchg guarantees a two-way memory barrier across
+  // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not
+  // specified otherwise (see atomic.hpp).
+
+  // Using 32 bit internally.
+  volatile int *dest_base = (volatile int*)((uintptr_t)dest & ~3);
+
+#ifdef VM_LITTLE_ENDIAN
+  const unsigned int shift_amount        = ((uintptr_t)dest & 3) * 8;
+#else
+  const unsigned int shift_amount        = ((~(uintptr_t)dest) & 3) * 8;
+#endif
+  const unsigned int masked_compare_val  = ((unsigned int)(unsigned char)compare_value),
+                     masked_exchange_val = ((unsigned int)(unsigned char)exchange_value),
+                     xor_value           = (masked_compare_val ^ masked_exchange_val) << shift_amount;
+
+  unsigned int old_value, value32;
+
+  cmpxchg_pre_membar(order);
+
+  __asm__ __volatile__ (
+    /* simple guard */
+    "   lbz     %[old_value], 0(%[dest])                  \n"
+    "   cmpw    %[masked_compare_val], %[old_value]       \n"
+    "   bne-    2f                                        \n"
+    /* atomic loop */
+    "1:                                                   \n"
+    "   lwarx   %[value32], 0, %[dest_base]               \n"
+    /* extract byte and compare */
+    "   srd     %[old_value], %[value32], %[shift_amount] \n"
+    "   clrldi  %[old_value], %[old_value], 56            \n"
+    "   cmpw    %[masked_compare_val], %[old_value]       \n"
+    "   bne-    2f                                        \n"
+    /* replace byte and try to store */
+    "   xor     %[value32], %[xor_value], %[value32]      \n"
+    "   stwcx.  %[value32], 0, %[dest_base]               \n"
+    "   bne-    1b                                        \n"
+    /* exit */
+    "2:                                                   \n"
+    /* out */
+    : [old_value]           "=&r"   (old_value),
+      [value32]             "=&r"   (value32),
+                            "=m"    (*dest),
+                            "=m"    (*dest_base)
+    /* in */
+    : [dest]                "b"     (dest),
+      [dest_base]           "b"     (dest_base),
+      [shift_amount]        "r"     (shift_amount),
+      [masked_compare_val]  "r"     (masked_compare_val),
+      [xor_value]           "r"     (xor_value),
+                            "m"     (*dest),
+                            "m"     (*dest_base)
+    /* clobber */
+    : "cc",
+      "memory"
+    );
+
+  cmpxchg_post_membar(order);
+
+  return (jbyte)(unsigned char)old_value;
+}
+
+inline jint Atomic::cmpxchg(jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order) {
+
+  // Note that cmpxchg guarantees a two-way memory barrier across
+  // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not
+  // specified otherwise (see atomic.hpp).
+
+  unsigned int old_value;
+  const uint64_t zero = 0;
+
+  cmpxchg_pre_membar(order);
+
+  __asm__ __volatile__ (
+    /* simple guard */
+    "   lwz     %[old_value], 0(%[dest])                \n"
+    "   cmpw    %[compare_value], %[old_value]          \n"
+    "   bne-    2f                                      \n"
+    /* atomic loop */
+    "1:                                                 \n"
+    "   lwarx   %[old_value], %[dest], %[zero]          \n"
+    "   cmpw    %[compare_value], %[old_value]          \n"
+    "   bne-    2f                                      \n"
+    "   stwcx.  %[exchange_value], %[dest], %[zero]     \n"
+    "   bne-    1b                                      \n"
+    /* exit */
+    "2:                                                 \n"
+    /* out */
+    : [old_value]       "=&r"   (old_value),
+                        "=m"    (*dest)
+    /* in */
+    : [dest]            "b"     (dest),
+      [zero]            "r"     (zero),
+      [compare_value]   "r"     (compare_value),
+      [exchange_value]  "r"     (exchange_value),
+                        "m"     (*dest)
+    /* clobber */
+    : "cc",
+      "memory"
+    );
+
+  cmpxchg_post_membar(order);
+
+  return (jint) old_value;
+}
+
+inline jlong Atomic::cmpxchg(jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order) {
+
+  // Note that cmpxchg guarantees a two-way memory barrier across
+  // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not
+  // specified otherwise (see atomic.hpp).
+
+  long old_value;
+  const uint64_t zero = 0;
+
+  cmpxchg_pre_membar(order);
+
+  __asm__ __volatile__ (
+    /* simple guard */
+    "   ld      %[old_value], 0(%[dest])                \n"
+    "   cmpd    %[compare_value], %[old_value]          \n"
+    "   bne-    2f                                      \n"
+    /* atomic loop */
+    "1:                                                 \n"
+    "   ldarx   %[old_value], %[dest], %[zero]          \n"
+    "   cmpd    %[compare_value], %[old_value]          \n"
+    "   bne-    2f                                      \n"
+    "   stdcx.  %[exchange_value], %[dest], %[zero]     \n"
+    "   bne-    1b                                      \n"
+    /* exit */
+    "2:                                                 \n"
+    /* out */
+    : [old_value]       "=&r"   (old_value),
+                        "=m"    (*dest)
+    /* in */
+    : [dest]            "b"     (dest),
+      [zero]            "r"     (zero),
+      [compare_value]   "r"     (compare_value),
+      [exchange_value]  "r"     (exchange_value),
+                        "m"     (*dest)
+    /* clobber */
+    : "cc",
+      "memory"
+    );
+
+  cmpxchg_post_membar(order);
+
+  return (jlong) old_value;
+}
+
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+  return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
+}
+
+inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order) {
+  return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
+}
+
+#undef strasm_sync
+#undef strasm_lwsync
+#undef strasm_isync
+#undef strasm_release
+#undef strasm_acquire
+#undef strasm_fence
+#undef strasm_nobarrier
+#undef strasm_nobarrier_clobber_memory
+
+#endif // OS_CPU_LINUX_PPC_VM_ATOMIC_LINUX_PPC_HPP
--- a/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,482 +0,0 @@
-/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2014 SAP SE. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef OS_CPU_LINUX_PPC_VM_ATOMIC_LINUX_PPC_INLINE_HPP
-#define OS_CPU_LINUX_PPC_VM_ATOMIC_LINUX_PPC_INLINE_HPP
-
-#include "runtime/atomic.hpp"
-#include "runtime/os.hpp"
-
-#ifndef PPC64
-#error "Atomic currently only implemented for PPC64"
-#endif
-
-// Implementation of class atomic
-
-inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
-inline void Atomic::store    (jshort   store_value, jshort*   dest) { *dest = store_value; }
-inline void Atomic::store    (jint     store_value, jint*     dest) { *dest = store_value; }
-inline void Atomic::store    (jlong    store_value, jlong*    dest) { *dest = store_value; }
-inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
-inline void Atomic::store_ptr(void*    store_value, void*     dest) { *(void**)dest = store_value; }
-
-inline void Atomic::store    (jbyte    store_value, volatile jbyte*    dest) { *dest = store_value; }
-inline void Atomic::store    (jshort   store_value, volatile jshort*   dest) { *dest = store_value; }
-inline void Atomic::store    (jint     store_value, volatile jint*     dest) { *dest = store_value; }
-inline void Atomic::store    (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
-inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
-inline void Atomic::store_ptr(void*    store_value, volatile void*     dest) { *(void* volatile *)dest = store_value; }
-
-inline jlong Atomic::load(volatile jlong* src) { return *src; }
-
-//
-// machine barrier instructions:
-//
-// - sync            two-way memory barrier, aka fence
-// - lwsync          orders  Store|Store,
-//                            Load|Store,
-//                            Load|Load,
-//                   but not Store|Load
-// - eieio           orders memory accesses for device memory (only)
-// - isync           invalidates speculatively executed instructions
-//                   From the POWER ISA 2.06 documentation:
-//                    "[...] an isync instruction prevents the execution of
-//                   instructions following the isync until instructions
-//                   preceding the isync have completed, [...]"
-//                   From IBM's AIX assembler reference:
-//                    "The isync [...] instructions causes the processor to
-//                   refetch any instructions that might have been fetched
-//                   prior to the isync instruction. The instruction isync
-//                   causes the processor to wait for all previous instructions
-//                   to complete. Then any instructions already fetched are
-//                   discarded and instruction processing continues in the
-//                   environment established by the previous instructions."
-//
-// semantic barrier instructions:
-// (as defined in orderAccess.hpp)
-//
-// - release         orders Store|Store,       (maps to lwsync)
-//                           Load|Store
-// - acquire         orders  Load|Store,       (maps to lwsync)
-//                           Load|Load
-// - fence           orders Store|Store,       (maps to sync)
-//                           Load|Store,
-//                           Load|Load,
-//                          Store|Load
-//
-
-#define strasm_sync                       "\n  sync    \n"
-#define strasm_lwsync                     "\n  lwsync  \n"
-#define strasm_isync                      "\n  isync   \n"
-#define strasm_release                    strasm_lwsync
-#define strasm_acquire                    strasm_lwsync
-#define strasm_fence                      strasm_sync
-#define strasm_nobarrier                  ""
-#define strasm_nobarrier_clobber_memory   ""
-
-inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
-
-  unsigned int result;
-
-  __asm__ __volatile__ (
-    strasm_lwsync
-    "1: lwarx   %0,  0, %2    \n"
-    "   add     %0, %0, %1    \n"
-    "   stwcx.  %0,  0, %2    \n"
-    "   bne-    1b            \n"
-    strasm_isync
-    : /*%0*/"=&r" (result)
-    : /*%1*/"r" (add_value), /*%2*/"r" (dest)
-    : "cc", "memory" );
-
-  return (jint) result;
-}
-
-
-inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
-
-  long result;
-
-  __asm__ __volatile__ (
-    strasm_lwsync
-    "1: ldarx   %0,  0, %2    \n"
-    "   add     %0, %0, %1    \n"
-    "   stdcx.  %0,  0, %2    \n"
-    "   bne-    1b            \n"
-    strasm_isync
-    : /*%0*/"=&r" (result)
-    : /*%1*/"r" (add_value), /*%2*/"r" (dest)
-    : "cc", "memory" );
-
-  return (intptr_t) result;
-}
-
-inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
-  return (void*)add_ptr(add_value, (volatile intptr_t*)dest);
-}
-
-
-inline void Atomic::inc    (volatile jint*     dest) {
-
-  unsigned int temp;
-
-  __asm__ __volatile__ (
-    strasm_nobarrier
-    "1: lwarx   %0,  0, %2    \n"
-    "   addic   %0, %0,  1    \n"
-    "   stwcx.  %0,  0, %2    \n"
-    "   bne-    1b            \n"
-    strasm_nobarrier
-    : /*%0*/"=&r" (temp), "=m" (*dest)
-    : /*%2*/"r" (dest), "m" (*dest)
-    : "cc" strasm_nobarrier_clobber_memory);
-
-}
-
-inline void Atomic::inc_ptr(volatile intptr_t* dest) {
-
-  long temp;
-
-  __asm__ __volatile__ (
-    strasm_nobarrier
-    "1: ldarx   %0,  0, %2    \n"
-    "   addic   %0, %0,  1    \n"
-    "   stdcx.  %0,  0, %2    \n"
-    "   bne-    1b            \n"
-    strasm_nobarrier
-    : /*%0*/"=&r" (temp), "=m" (*dest)
-    : /*%2*/"r" (dest), "m" (*dest)
-    : "cc" strasm_nobarrier_clobber_memory);
-
-}
-
-inline void Atomic::inc_ptr(volatile void*     dest) {
-  inc_ptr((volatile intptr_t*)dest);
-}
-
-
-inline void Atomic::dec    (volatile jint*     dest) {
-
-  unsigned int temp;
-
-  __asm__ __volatile__ (
-    strasm_nobarrier
-    "1: lwarx   %0,  0, %2    \n"
-    "   addic   %0, %0, -1    \n"
-    "   stwcx.  %0,  0, %2    \n"
-    "   bne-    1b            \n"
-    strasm_nobarrier
-    : /*%0*/"=&r" (temp), "=m" (*dest)
-    : /*%2*/"r" (dest), "m" (*dest)
-    : "cc" strasm_nobarrier_clobber_memory);
-
-}
-
-inline void Atomic::dec_ptr(volatile intptr_t* dest) {
-
-  long temp;
-
-  __asm__ __volatile__ (
-    strasm_nobarrier
-    "1: ldarx   %0,  0, %2    \n"
-    "   addic   %0, %0, -1    \n"
-    "   stdcx.  %0,  0, %2    \n"
-    "   bne-    1b            \n"
-    strasm_nobarrier
-    : /*%0*/"=&r" (temp), "=m" (*dest)
-    : /*%2*/"r" (dest), "m" (*dest)
-    : "cc" strasm_nobarrier_clobber_memory);
-
-}
-
-inline void Atomic::dec_ptr(volatile void*     dest) {
-  dec_ptr((volatile intptr_t*)dest);
-}
-
-inline jint Atomic::xchg(jint exchange_value, volatile jint* dest) {
-
-  // Note that xchg_ptr doesn't necessarily do an acquire
-  // (see synchronizer.cpp).
-
-  unsigned int old_value;
-  const uint64_t zero = 0;
-
-  __asm__ __volatile__ (
-    /* lwsync */
-    strasm_lwsync
-    /* atomic loop */
-    "1:                                                 \n"
-    "   lwarx   %[old_value], %[dest], %[zero]          \n"
-    "   stwcx.  %[exchange_value], %[dest], %[zero]     \n"
-    "   bne-    1b                                      \n"
-    /* isync */
-    strasm_sync
-    /* exit */
-    "2:                                                 \n"
-    /* out */
-    : [old_value]       "=&r"   (old_value),
-                        "=m"    (*dest)
-    /* in */
-    : [dest]            "b"     (dest),
-      [zero]            "r"     (zero),
-      [exchange_value]  "r"     (exchange_value),
-                        "m"     (*dest)
-    /* clobber */
-    : "cc",
-      "memory"
-    );
-
-  return (jint) old_value;
-}
-
-inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
-
-  // Note that xchg_ptr doesn't necessarily do an acquire
-  // (see synchronizer.cpp).
-
-  long old_value;
-  const uint64_t zero = 0;
-
-  __asm__ __volatile__ (
-    /* lwsync */
-    strasm_lwsync
-    /* atomic loop */
-    "1:                                                 \n"
-    "   ldarx   %[old_value], %[dest], %[zero]          \n"
-    "   stdcx.  %[exchange_value], %[dest], %[zero]     \n"
-    "   bne-    1b                                      \n"
-    /* isync */
-    strasm_sync
-    /* exit */
-    "2:                                                 \n"
-    /* out */
-    : [old_value]       "=&r"   (old_value),
-                        "=m"    (*dest)
-    /* in */
-    : [dest]            "b"     (dest),
-      [zero]            "r"     (zero),
-      [exchange_value]  "r"     (exchange_value),
-                        "m"     (*dest)
-    /* clobber */
-    : "cc",
-      "memory"
-    );
-
-  return (intptr_t) old_value;
-}
-
-inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) {
-  return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
-}
-
-inline void cmpxchg_pre_membar(cmpxchg_memory_order order) {
-  if (order != memory_order_relaxed) {
-    __asm__ __volatile__ (
-      /* fence */
-      strasm_sync
-      );
-  }
-}
-
-inline void cmpxchg_post_membar(cmpxchg_memory_order order) {
-  if (order != memory_order_relaxed) {
-    __asm__ __volatile__ (
-      /* fence */
-      strasm_sync
-      );
-  }
-}
-
-#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
-inline jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, cmpxchg_memory_order order) {
-
-  // Note that cmpxchg guarantees a two-way memory barrier across
-  // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not
-  // specified otherwise (see atomic.hpp).
-
-  // Using 32 bit internally.
-  volatile int *dest_base = (volatile int*)((uintptr_t)dest & ~3);
-
-#ifdef VM_LITTLE_ENDIAN
-  const unsigned int shift_amount        = ((uintptr_t)dest & 3) * 8;
-#else
-  const unsigned int shift_amount        = ((~(uintptr_t)dest) & 3) * 8;
-#endif
-  const unsigned int masked_compare_val  = ((unsigned int)(unsigned char)compare_value),
-                     masked_exchange_val = ((unsigned int)(unsigned char)exchange_value),
-                     xor_value           = (masked_compare_val ^ masked_exchange_val) << shift_amount;
-
-  unsigned int old_value, value32;
-
-  cmpxchg_pre_membar(order);
-
-  __asm__ __volatile__ (
-    /* simple guard */
-    "   lbz     %[old_value], 0(%[dest])                  \n"
-    "   cmpw    %[masked_compare_val], %[old_value]       \n"
-    "   bne-    2f                                        \n"
-    /* atomic loop */
-    "1:                                                   \n"
-    "   lwarx   %[value32], 0, %[dest_base]               \n"
-    /* extract byte and compare */
-    "   srd     %[old_value], %[value32], %[shift_amount] \n"
-    "   clrldi  %[old_value], %[old_value], 56            \n"
-    "   cmpw    %[masked_compare_val], %[old_value]       \n"
-    "   bne-    2f                                        \n"
-    /* replace byte and try to store */
-    "   xor     %[value32], %[xor_value], %[value32]      \n"
-    "   stwcx.  %[value32], 0, %[dest_base]               \n"
-    "   bne-    1b                                        \n"
-    /* exit */
-    "2:                                                   \n"
-    /* out */
-    : [old_value]           "=&r"   (old_value),
-      [value32]             "=&r"   (value32),
-                            "=m"    (*dest),
-                            "=m"    (*dest_base)
-    /* in */
-    : [dest]                "b"     (dest),
-      [dest_base]           "b"     (dest_base),
-      [shift_amount]        "r"     (shift_amount),
-      [masked_compare_val]  "r"     (masked_compare_val),
-      [xor_value]           "r"     (xor_value),
-                            "m"     (*dest),
-                            "m"     (*dest_base)
-    /* clobber */
-    : "cc",
-      "memory"
-    );
-
-  cmpxchg_post_membar(order);
-
-  return (jbyte)(unsigned char)old_value;
-}
-
-inline jint Atomic::cmpxchg(jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order) {
-
-  // Note that cmpxchg guarantees a two-way memory barrier across
-  // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not
-  // specified otherwise (see atomic.hpp).
-
-  unsigned int old_value;
-  const uint64_t zero = 0;
-
-  cmpxchg_pre_membar(order);
-
-  __asm__ __volatile__ (
-    /* simple guard */
-    "   lwz     %[old_value], 0(%[dest])                \n"
-    "   cmpw    %[compare_value], %[old_value]          \n"
-    "   bne-    2f                                      \n"
-    /* atomic loop */
-    "1:                                                 \n"
-    "   lwarx   %[old_value], %[dest], %[zero]          \n"
-    "   cmpw    %[compare_value], %[old_value]          \n"
-    "   bne-    2f                                      \n"
-    "   stwcx.  %[exchange_value], %[dest], %[zero]     \n"
-    "   bne-    1b                                      \n"
-    /* exit */
-    "2:                                                 \n"
-    /* out */
-    : [old_value]       "=&r"   (old_value),
-                        "=m"    (*dest)
-    /* in */
-    : [dest]            "b"     (dest),
-      [zero]            "r"     (zero),
-      [compare_value]   "r"     (compare_value),
-      [exchange_value]  "r"     (exchange_value),
-                        "m"     (*dest)
-    /* clobber */
-    : "cc",
-      "memory"
-    );
-
-  cmpxchg_post_membar(order);
-
-  return (jint) old_value;
-}
-
-inline jlong Atomic::cmpxchg(jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order) {
-
-  // Note that cmpxchg guarantees a two-way memory barrier across
-  // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not
-  // specified otherwise (see atomic.hpp).
-
-  long old_value;
-  const uint64_t zero = 0;
-
-  cmpxchg_pre_membar(order);
-
-  __asm__ __volatile__ (
-    /* simple guard */
-    "   ld      %[old_value], 0(%[dest])                \n"
-    "   cmpd    %[compare_value], %[old_value]          \n"
-    "   bne-    2f                                      \n"
-    /* atomic loop */
-    "1:                                                 \n"
-    "   ldarx   %[old_value], %[dest], %[zero]          \n"
-    "   cmpd    %[compare_value], %[old_value]          \n"
-    "   bne-    2f                                      \n"
-    "   stdcx.  %[exchange_value], %[dest], %[zero]     \n"
-    "   bne-    1b                                      \n"
-    /* exit */
-    "2:                                                 \n"
-    /* out */
-    : [old_value]       "=&r"   (old_value),
-                        "=m"    (*dest)
-    /* in */
-    : [dest]            "b"     (dest),
-      [zero]            "r"     (zero),
-      [compare_value]   "r"     (compare_value),
-      [exchange_value]  "r"     (exchange_value),
-                        "m"     (*dest)
-    /* clobber */
-    : "cc",
-      "memory"
-    );
-
-  cmpxchg_post_membar(order);
-
-  return (jlong) old_value;
-}
-
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
-  return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
-}
-
-inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order) {
-  return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
-}
-
-#undef strasm_sync
-#undef strasm_lwsync
-#undef strasm_isync
-#undef strasm_release
-#undef strasm_acquire
-#undef strasm_fence
-#undef strasm_nobarrier
-#undef strasm_nobarrier_clobber_memory
-
-#endif // OS_CPU_LINUX_PPC_VM_ATOMIC_LINUX_PPC_INLINE_HPP
--- a/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,6 @@
 #ifndef OS_CPU_LINUX_SPARC_VM_ATOMIC_LINUX_SPARC_INLINE_HPP
 #define OS_CPU_LINUX_SPARC_VM_ATOMIC_LINUX_SPARC_INLINE_HPP
 
-#include "runtime/atomic.hpp"
-#include "runtime/os.hpp"
-
 // Implementation of class atomic
 
 inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,227 @@
+/*
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef OS_CPU_LINUX_X86_VM_ATOMIC_LINUX_X86_HPP
+#define OS_CPU_LINUX_X86_VM_ATOMIC_LINUX_X86_HPP
+
+#include "runtime/os.hpp"
+
+// Implementation of class atomic
+
+inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
+inline void Atomic::store    (jshort   store_value, jshort*   dest) { *dest = store_value; }
+inline void Atomic::store    (jint     store_value, jint*     dest) { *dest = store_value; }
+inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
+inline void Atomic::store_ptr(void*    store_value, void*     dest) { *(void**)dest = store_value; }
+
+inline void Atomic::store    (jbyte    store_value, volatile jbyte*    dest) { *dest = store_value; }
+inline void Atomic::store    (jshort   store_value, volatile jshort*   dest) { *dest = store_value; }
+inline void Atomic::store    (jint     store_value, volatile jint*     dest) { *dest = store_value; }
+inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
+inline void Atomic::store_ptr(void*    store_value, volatile void*     dest) { *(void* volatile *)dest = store_value; }
+
+
+// Adding a lock prefix to an instruction on MP machine
+#define LOCK_IF_MP(mp) "cmp $0, " #mp "; je 1f; lock; 1: "
+
+inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
+  jint addend = add_value;
+  int mp = os::is_MP();
+  __asm__ volatile (  LOCK_IF_MP(%3) "xaddl %0,(%2)"
+                    : "=r" (addend)
+                    : "0" (addend), "r" (dest), "r" (mp)
+                    : "cc", "memory");
+  return addend + add_value;
+}
+
+inline void Atomic::inc    (volatile jint*     dest) {
+  int mp = os::is_MP();
+  __asm__ volatile (LOCK_IF_MP(%1) "addl $1,(%0)" :
+                    : "r" (dest), "r" (mp) : "cc", "memory");
+}
+
+inline void Atomic::inc_ptr(volatile void*     dest) {
+  inc_ptr((volatile intptr_t*)dest);
+}
+
+inline void Atomic::dec    (volatile jint*     dest) {
+  int mp = os::is_MP();
+  __asm__ volatile (LOCK_IF_MP(%1) "subl $1,(%0)" :
+                    : "r" (dest), "r" (mp) : "cc", "memory");
+}
+
+inline void Atomic::dec_ptr(volatile void*     dest) {
+  dec_ptr((volatile intptr_t*)dest);
+}
+
+inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
+  __asm__ volatile (  "xchgl (%2),%0"
+                    : "=r" (exchange_value)
+                    : "0" (exchange_value), "r" (dest)
+                    : "memory");
+  return exchange_value;
+}
+
+inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
+  return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
+}
+
+#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline jbyte    Atomic::cmpxchg    (jbyte    exchange_value, volatile jbyte*    dest, jbyte    compare_value, cmpxchg_memory_order order) {
+  int mp = os::is_MP();
+  __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)"
+                    : "=a" (exchange_value)
+                    : "q" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
+                    : "cc", "memory");
+  return exchange_value;
+}
+
+inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value, cmpxchg_memory_order order) {
+  int mp = os::is_MP();
+  __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgl %1,(%3)"
+                    : "=a" (exchange_value)
+                    : "r" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
+                    : "cc", "memory");
+  return exchange_value;
+}
+
+#ifdef AMD64
+inline void Atomic::store    (jlong    store_value, jlong*    dest) { *dest = store_value; }
+inline void Atomic::store    (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
+
+inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
+  intptr_t addend = add_value;
+  bool mp = os::is_MP();
+  __asm__ __volatile__ (LOCK_IF_MP(%3) "xaddq %0,(%2)"
+                        : "=r" (addend)
+                        : "0" (addend), "r" (dest), "r" (mp)
+                        : "cc", "memory");
+  return addend + add_value;
+}
+
+inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
+  return (void*)add_ptr(add_value, (volatile intptr_t*)dest);
+}
+
+inline void Atomic::inc_ptr(volatile intptr_t* dest) {
+  bool mp = os::is_MP();
+  __asm__ __volatile__ (LOCK_IF_MP(%1) "addq $1,(%0)"
+                        :
+                        : "r" (dest), "r" (mp)
+                        : "cc", "memory");
+}
+
+inline void Atomic::dec_ptr(volatile intptr_t* dest) {
+  bool mp = os::is_MP();
+  __asm__ __volatile__ (LOCK_IF_MP(%1) "subq $1,(%0)"
+                        :
+                        : "r" (dest), "r" (mp)
+                        : "cc", "memory");
+}
+
+inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
+  __asm__ __volatile__ ("xchgq (%2),%0"
+                        : "=r" (exchange_value)
+                        : "0" (exchange_value), "r" (dest)
+                        : "memory");
+  return exchange_value;
+}
+
+inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
+  bool mp = os::is_MP();
+  __asm__ __volatile__ (LOCK_IF_MP(%4) "cmpxchgq %1,(%3)"
+                        : "=a" (exchange_value)
+                        : "r" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
+                        : "cc", "memory");
+  return exchange_value;
+}
+
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+  return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
+}
+
+inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
+  return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
+}
+
+inline jlong Atomic::load(volatile jlong* src) { return *src; }
+
+#else // !AMD64
+
+inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
+  return (intptr_t)Atomic::add((jint)add_value, (volatile jint*)dest);
+}
+
+inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
+  return (void*)Atomic::add((jint)add_value, (volatile jint*)dest);
+}
+
+
+inline void Atomic::inc_ptr(volatile intptr_t* dest) {
+  inc((volatile jint*)dest);
+}
+
+inline void Atomic::dec_ptr(volatile intptr_t* dest) {
+  dec((volatile jint*)dest);
+}
+
+inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
+  return (intptr_t)xchg((jint)exchange_value, (volatile jint*)dest);
+}
+
+extern "C" {
+  // defined in linux_x86.s
+  jlong _Atomic_cmpxchg_long(jlong, volatile jlong*, jlong, bool);
+  void _Atomic_move_long(volatile jlong* src, volatile jlong* dst);
+}
+
+inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
+  return _Atomic_cmpxchg_long(exchange_value, dest, compare_value, os::is_MP());
+}
+
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+  return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
+}
+
+inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
+  return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
+}
+
+inline jlong Atomic::load(volatile jlong* src) {
+  volatile jlong dest;
+  _Atomic_move_long(src, &dest);
+  return dest;
+}
+
+inline void Atomic::store(jlong store_value, jlong* dest) {
+  _Atomic_move_long((volatile jlong*)&store_value, (volatile jlong*)dest);
+}
+
+inline void Atomic::store(jlong store_value, volatile jlong* dest) {
+  _Atomic_move_long((volatile jlong*)&store_value, dest);
+}
+
+#endif // AMD64
+
+#endif // OS_CPU_LINUX_X86_VM_ATOMIC_LINUX_X86_HPP
--- a/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,228 +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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef OS_CPU_LINUX_X86_VM_ATOMIC_LINUX_X86_INLINE_HPP
-#define OS_CPU_LINUX_X86_VM_ATOMIC_LINUX_X86_INLINE_HPP
-
-#include "runtime/atomic.hpp"
-#include "runtime/os.hpp"
-
-// Implementation of class atomic
-
-inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
-inline void Atomic::store    (jshort   store_value, jshort*   dest) { *dest = store_value; }
-inline void Atomic::store    (jint     store_value, jint*     dest) { *dest = store_value; }
-inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
-inline void Atomic::store_ptr(void*    store_value, void*     dest) { *(void**)dest = store_value; }
-
-inline void Atomic::store    (jbyte    store_value, volatile jbyte*    dest) { *dest = store_value; }
-inline void Atomic::store    (jshort   store_value, volatile jshort*   dest) { *dest = store_value; }
-inline void Atomic::store    (jint     store_value, volatile jint*     dest) { *dest = store_value; }
-inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
-inline void Atomic::store_ptr(void*    store_value, volatile void*     dest) { *(void* volatile *)dest = store_value; }
-
-
-// Adding a lock prefix to an instruction on MP machine
-#define LOCK_IF_MP(mp) "cmp $0, " #mp "; je 1f; lock; 1: "
-
-inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
-  jint addend = add_value;
-  int mp = os::is_MP();
-  __asm__ volatile (  LOCK_IF_MP(%3) "xaddl %0,(%2)"
-                    : "=r" (addend)
-                    : "0" (addend), "r" (dest), "r" (mp)
-                    : "cc", "memory");
-  return addend + add_value;
-}
-
-inline void Atomic::inc    (volatile jint*     dest) {
-  int mp = os::is_MP();
-  __asm__ volatile (LOCK_IF_MP(%1) "addl $1,(%0)" :
-                    : "r" (dest), "r" (mp) : "cc", "memory");
-}
-
-inline void Atomic::inc_ptr(volatile void*     dest) {
-  inc_ptr((volatile intptr_t*)dest);
-}
-
-inline void Atomic::dec    (volatile jint*     dest) {
-  int mp = os::is_MP();
-  __asm__ volatile (LOCK_IF_MP(%1) "subl $1,(%0)" :
-                    : "r" (dest), "r" (mp) : "cc", "memory");
-}
-
-inline void Atomic::dec_ptr(volatile void*     dest) {
-  dec_ptr((volatile intptr_t*)dest);
-}
-
-inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
-  __asm__ volatile (  "xchgl (%2),%0"
-                    : "=r" (exchange_value)
-                    : "0" (exchange_value), "r" (dest)
-                    : "memory");
-  return exchange_value;
-}
-
-inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
-  return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
-}
-
-#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
-inline jbyte    Atomic::cmpxchg    (jbyte    exchange_value, volatile jbyte*    dest, jbyte    compare_value, cmpxchg_memory_order order) {
-  int mp = os::is_MP();
-  __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)"
-                    : "=a" (exchange_value)
-                    : "q" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
-                    : "cc", "memory");
-  return exchange_value;
-}
-
-inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value, cmpxchg_memory_order order) {
-  int mp = os::is_MP();
-  __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgl %1,(%3)"
-                    : "=a" (exchange_value)
-                    : "r" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
-                    : "cc", "memory");
-  return exchange_value;
-}
-
-#ifdef AMD64
-inline void Atomic::store    (jlong    store_value, jlong*    dest) { *dest = store_value; }
-inline void Atomic::store    (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
-
-inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
-  intptr_t addend = add_value;
-  bool mp = os::is_MP();
-  __asm__ __volatile__ (LOCK_IF_MP(%3) "xaddq %0,(%2)"
-                        : "=r" (addend)
-                        : "0" (addend), "r" (dest), "r" (mp)
-                        : "cc", "memory");
-  return addend + add_value;
-}
-
-inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
-  return (void*)add_ptr(add_value, (volatile intptr_t*)dest);
-}
-
-inline void Atomic::inc_ptr(volatile intptr_t* dest) {
-  bool mp = os::is_MP();
-  __asm__ __volatile__ (LOCK_IF_MP(%1) "addq $1,(%0)"
-                        :
-                        : "r" (dest), "r" (mp)
-                        : "cc", "memory");
-}
-
-inline void Atomic::dec_ptr(volatile intptr_t* dest) {
-  bool mp = os::is_MP();
-  __asm__ __volatile__ (LOCK_IF_MP(%1) "subq $1,(%0)"
-                        :
-                        : "r" (dest), "r" (mp)
-                        : "cc", "memory");
-}
-
-inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
-  __asm__ __volatile__ ("xchgq (%2),%0"
-                        : "=r" (exchange_value)
-                        : "0" (exchange_value), "r" (dest)
-                        : "memory");
-  return exchange_value;
-}
-
-inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
-  bool mp = os::is_MP();
-  __asm__ __volatile__ (LOCK_IF_MP(%4) "cmpxchgq %1,(%3)"
-                        : "=a" (exchange_value)
-                        : "r" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
-                        : "cc", "memory");
-  return exchange_value;
-}
-
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
-  return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
-}
-
-inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
-  return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
-}
-
-inline jlong Atomic::load(volatile jlong* src) { return *src; }
-
-#else // !AMD64
-
-inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
-  return (intptr_t)Atomic::add((jint)add_value, (volatile jint*)dest);
-}
-
-inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
-  return (void*)Atomic::add((jint)add_value, (volatile jint*)dest);
-}
-
-
-inline void Atomic::inc_ptr(volatile intptr_t* dest) {
-  inc((volatile jint*)dest);
-}
-
-inline void Atomic::dec_ptr(volatile intptr_t* dest) {
-  dec((volatile jint*)dest);
-}
-
-inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
-  return (intptr_t)xchg((jint)exchange_value, (volatile jint*)dest);
-}
-
-extern "C" {
-  // defined in linux_x86.s
-  jlong _Atomic_cmpxchg_long(jlong, volatile jlong*, jlong, bool);
-  void _Atomic_move_long(volatile jlong* src, volatile jlong* dst);
-}
-
-inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
-  return _Atomic_cmpxchg_long(exchange_value, dest, compare_value, os::is_MP());
-}
-
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
-  return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
-}
-
-inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
-  return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
-}
-
-inline jlong Atomic::load(volatile jlong* src) {
-  volatile jlong dest;
-  _Atomic_move_long(src, &dest);
-  return dest;
-}
-
-inline void Atomic::store(jlong store_value, jlong* dest) {
-  _Atomic_move_long((volatile jlong*)&store_value, (volatile jlong*)dest);
-}
-
-inline void Atomic::store(jlong store_value, volatile jlong* dest) {
-  _Atomic_move_long((volatile jlong*)&store_value, dest);
-}
-
-#endif // AMD64
-
-#endif // OS_CPU_LINUX_X86_VM_ATOMIC_LINUX_X86_INLINE_HPP
--- a/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 #ifndef OS_CPU_LINUX_X86_VM_ORDERACCESS_LINUX_X86_INLINE_HPP
 #define OS_CPU_LINUX_X86_VM_ORDERACCESS_LINUX_X86_INLINE_HPP
 
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/orderAccess.hpp"
 #include "runtime/os.hpp"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,327 @@
+/*
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2007, 2008, 2011, 2015, 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 OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_HPP
+#define OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_HPP
+
+#include "runtime/os.hpp"
+
+// Implementation of class atomic
+
+#ifdef M68K
+
+/*
+ * __m68k_cmpxchg
+ *
+ * Atomically store newval in *ptr if *ptr is equal to oldval for user space.
+ * Returns newval on success and oldval if no exchange happened.
+ * This implementation is processor specific and works on
+ * 68020 68030 68040 and 68060.
+ *
+ * It will not work on ColdFire, 68000 and 68010 since they lack the CAS
+ * instruction.
+ * Using a kernelhelper would be better for arch complete implementation.
+ *
+ */
+
+static inline int __m68k_cmpxchg(int oldval, int newval, volatile int *ptr) {
+  int ret;
+  __asm __volatile ("cas%.l %0,%2,%1"
+                   : "=d" (ret), "+m" (*(ptr))
+                   : "d" (newval), "0" (oldval));
+  return ret;
+}
+
+/* Perform an atomic compare and swap: if the current value of `*PTR'
+   is OLDVAL, then write NEWVAL into `*PTR'.  Return the contents of
+   `*PTR' before the operation.*/
+static inline int m68k_compare_and_swap(volatile int *ptr,
+                                        int oldval,
+                                        int newval) {
+  for (;;) {
+      int prev = *ptr;
+      if (prev != oldval)
+        return prev;
+
+      if (__m68k_cmpxchg (prev, newval, ptr) == newval)
+        // Success.
+        return prev;
+
+      // We failed even though prev == oldval.  Try again.
+    }
+}
+
+/* Atomically add an int to memory.  */
+static inline int m68k_add_and_fetch(volatile int *ptr, int add_value) {
+  for (;;) {
+      // Loop until success.
+
+      int prev = *ptr;
+
+      if (__m68k_cmpxchg (prev, prev + add_value, ptr) == prev + add_value)
+        return prev + add_value;
+    }
+}
+
+/* Atomically write VALUE into `*PTR' and returns the previous
+   contents of `*PTR'.  */
+static inline int m68k_lock_test_and_set(volatile int *ptr, int newval) {
+  for (;;) {
+      // Loop until success.
+      int prev = *ptr;
+
+      if (__m68k_cmpxchg (prev, newval, ptr) == prev)
+        return prev;
+    }
+}
+#endif // M68K
+
+#ifdef ARM
+
+/*
+ * __kernel_cmpxchg
+ *
+ * Atomically store newval in *ptr if *ptr is equal to oldval for user space.
+ * Return zero if *ptr was changed or non-zero if no exchange happened.
+ * The C flag is also set if *ptr was changed to allow for assembly
+ * optimization in the calling code.
+ *
+ */
+
+typedef int (__kernel_cmpxchg_t)(int oldval, int newval, volatile int *ptr);
+#define __kernel_cmpxchg (*(__kernel_cmpxchg_t *) 0xffff0fc0)
+
+
+
+/* Perform an atomic compare and swap: if the current value of `*PTR'
+   is OLDVAL, then write NEWVAL into `*PTR'.  Return the contents of
+   `*PTR' before the operation.*/
+static inline int arm_compare_and_swap(volatile int *ptr,
+                                       int oldval,
+                                       int newval) {
+  for (;;) {
+      int prev = *ptr;
+      if (prev != oldval)
+        return prev;
+
+      if (__kernel_cmpxchg (prev, newval, ptr) == 0)
+        // Success.
+        return prev;
+
+      // We failed even though prev == oldval.  Try again.
+    }
+}
+
+/* Atomically add an int to memory.  */
+static inline int arm_add_and_fetch(volatile int *ptr, int add_value) {
+  for (;;) {
+      // Loop until a __kernel_cmpxchg succeeds.
+
+      int prev = *ptr;
+
+      if (__kernel_cmpxchg (prev, prev + add_value, ptr) == 0)
+        return prev + add_value;
+    }
+}
+
+/* Atomically write VALUE into `*PTR' and returns the previous
+   contents of `*PTR'.  */
+static inline int arm_lock_test_and_set(volatile int *ptr, int newval) {
+  for (;;) {
+      // Loop until a __kernel_cmpxchg succeeds.
+      int prev = *ptr;
+
+      if (__kernel_cmpxchg (prev, newval, ptr) == 0)
+        return prev;
+    }
+}
+#endif // ARM
+
+inline void Atomic::store(jint store_value, volatile jint* dest) {
+  *dest = store_value;
+}
+
+inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) {
+  *dest = store_value;
+}
+
+inline jint Atomic::add(jint add_value, volatile jint* dest) {
+#ifdef ARM
+  return arm_add_and_fetch(dest, add_value);
+#else
+#ifdef M68K
+  return m68k_add_and_fetch(dest, add_value);
+#else
+  return __sync_add_and_fetch(dest, add_value);
+#endif // M68K
+#endif // ARM
+}
+
+inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
+#ifdef ARM
+  return arm_add_and_fetch(dest, add_value);
+#else
+#ifdef M68K
+  return m68k_add_and_fetch(dest, add_value);
+#else
+  return __sync_add_and_fetch(dest, add_value);
+#endif // M68K
+#endif // ARM
+}
+
+inline void* Atomic::add_ptr(intptr_t add_value, volatile void* dest) {
+  return (void *) add_ptr(add_value, (volatile intptr_t *) dest);
+}
+
+inline void Atomic::inc(volatile jint* dest) {
+  add(1, dest);
+}
+
+inline void Atomic::inc_ptr(volatile intptr_t* dest) {
+  add_ptr(1, dest);
+}
+
+inline void Atomic::inc_ptr(volatile void* dest) {
+  add_ptr(1, dest);
+}
+
+inline void Atomic::dec(volatile jint* dest) {
+  add(-1, dest);
+}
+
+inline void Atomic::dec_ptr(volatile intptr_t* dest) {
+  add_ptr(-1, dest);
+}
+
+inline void Atomic::dec_ptr(volatile void* dest) {
+  add_ptr(-1, dest);
+}
+
+inline jint Atomic::xchg(jint exchange_value, volatile jint* dest) {
+#ifdef ARM
+  return arm_lock_test_and_set(dest, exchange_value);
+#else
+#ifdef M68K
+  return m68k_lock_test_and_set(dest, exchange_value);
+#else
+  // __sync_lock_test_and_set is a bizarrely named atomic exchange
+  // operation.  Note that some platforms only support this with the
+  // limitation that the only valid value to store is the immediate
+  // constant 1.  There is a test for this in JNI_CreateJavaVM().
+  jint result = __sync_lock_test_and_set (dest, exchange_value);
+  // All atomic operations are expected to be full memory barriers
+  // (see atomic.hpp). However, __sync_lock_test_and_set is not
+  // a full memory barrier, but an acquire barrier. Hence, this added
+  // barrier.
+  __sync_synchronize();
+  return result;
+#endif // M68K
+#endif // ARM
+}
+
+inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value,
+                                 volatile intptr_t* dest) {
+#ifdef ARM
+  return arm_lock_test_and_set(dest, exchange_value);
+#else
+#ifdef M68K
+  return m68k_lock_test_and_set(dest, exchange_value);
+#else
+  intptr_t result = __sync_lock_test_and_set (dest, exchange_value);
+  __sync_synchronize();
+  return result;
+#endif // M68K
+#endif // ARM
+}
+
+inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) {
+  return (void *) xchg_ptr((intptr_t) exchange_value,
+                           (volatile intptr_t*) dest);
+}
+
+inline jint Atomic::cmpxchg(jint exchange_value,
+                            volatile jint* dest,
+                            jint compare_value,
+                            cmpxchg_memory_order order) {
+#ifdef ARM
+  return arm_compare_and_swap(dest, compare_value, exchange_value);
+#else
+#ifdef M68K
+  return m68k_compare_and_swap(dest, compare_value, exchange_value);
+#else
+  return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
+#endif // M68K
+#endif // ARM
+}
+
+inline jlong Atomic::cmpxchg(jlong exchange_value,
+                             volatile jlong* dest,
+                             jlong compare_value,
+                             cmpxchg_memory_order order) {
+
+  return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
+}
+
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value,
+                                    volatile intptr_t* dest,
+                                    intptr_t compare_value,
+                                    cmpxchg_memory_order order) {
+#ifdef ARM
+  return arm_compare_and_swap(dest, compare_value, exchange_value);
+#else
+#ifdef M68K
+  return m68k_compare_and_swap(dest, compare_value, exchange_value);
+#else
+  return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
+#endif // M68K
+#endif // ARM
+}
+
+inline void* Atomic::cmpxchg_ptr(void* exchange_value,
+                                 volatile void* dest,
+                                 void* compare_value,
+                                 cmpxchg_memory_order order) {
+
+  return (void *) cmpxchg_ptr((intptr_t) exchange_value,
+                              (volatile intptr_t*) dest,
+                              (intptr_t) compare_value,
+                              order);
+}
+
+inline jlong Atomic::load(volatile jlong* src) {
+  volatile jlong dest;
+  os::atomic_copy64(src, &dest);
+  return dest;
+}
+
+inline void Atomic::store(jlong store_value, jlong* dest) {
+  os::atomic_copy64((volatile jlong*)&store_value, (volatile jlong*)dest);
+}
+
+inline void Atomic::store(jlong store_value, volatile jlong* dest) {
+  os::atomic_copy64((volatile jlong*)&store_value, dest);
+}
+
+#endif // OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_HPP
--- a/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,328 +0,0 @@
-/*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2008, 2011, 2015, 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 OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_INLINE_HPP
-#define OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_INLINE_HPP
-
-#include "runtime/atomic.hpp"
-#include "runtime/os.hpp"
-
-// Implementation of class atomic
-
-#ifdef M68K
-
-/*
- * __m68k_cmpxchg
- *
- * Atomically store newval in *ptr if *ptr is equal to oldval for user space.
- * Returns newval on success and oldval if no exchange happened.
- * This implementation is processor specific and works on
- * 68020 68030 68040 and 68060.
- *
- * It will not work on ColdFire, 68000 and 68010 since they lack the CAS
- * instruction.
- * Using a kernelhelper would be better for arch complete implementation.
- *
- */
-
-static inline int __m68k_cmpxchg(int oldval, int newval, volatile int *ptr) {
-  int ret;
-  __asm __volatile ("cas%.l %0,%2,%1"
-                   : "=d" (ret), "+m" (*(ptr))
-                   : "d" (newval), "0" (oldval));
-  return ret;
-}
-
-/* Perform an atomic compare and swap: if the current value of `*PTR'
-   is OLDVAL, then write NEWVAL into `*PTR'.  Return the contents of
-   `*PTR' before the operation.*/
-static inline int m68k_compare_and_swap(volatile int *ptr,
-                                        int oldval,
-                                        int newval) {
-  for (;;) {
-      int prev = *ptr;
-      if (prev != oldval)
-        return prev;
-
-      if (__m68k_cmpxchg (prev, newval, ptr) == newval)
-        // Success.
-        return prev;
-
-      // We failed even though prev == oldval.  Try again.
-    }
-}
-
-/* Atomically add an int to memory.  */
-static inline int m68k_add_and_fetch(volatile int *ptr, int add_value) {
-  for (;;) {
-      // Loop until success.
-
-      int prev = *ptr;
-
-      if (__m68k_cmpxchg (prev, prev + add_value, ptr) == prev + add_value)
-        return prev + add_value;
-    }
-}
-
-/* Atomically write VALUE into `*PTR' and returns the previous
-   contents of `*PTR'.  */
-static inline int m68k_lock_test_and_set(volatile int *ptr, int newval) {
-  for (;;) {
-      // Loop until success.
-      int prev = *ptr;
-
-      if (__m68k_cmpxchg (prev, newval, ptr) == prev)
-        return prev;
-    }
-}
-#endif // M68K
-
-#ifdef ARM
-
-/*
- * __kernel_cmpxchg
- *
- * Atomically store newval in *ptr if *ptr is equal to oldval for user space.
- * Return zero if *ptr was changed or non-zero if no exchange happened.
- * The C flag is also set if *ptr was changed to allow for assembly
- * optimization in the calling code.
- *
- */
-
-typedef int (__kernel_cmpxchg_t)(int oldval, int newval, volatile int *ptr);
-#define __kernel_cmpxchg (*(__kernel_cmpxchg_t *) 0xffff0fc0)
-
-
-
-/* Perform an atomic compare and swap: if the current value of `*PTR'
-   is OLDVAL, then write NEWVAL into `*PTR'.  Return the contents of
-   `*PTR' before the operation.*/
-static inline int arm_compare_and_swap(volatile int *ptr,
-                                       int oldval,
-                                       int newval) {
-  for (;;) {
-      int prev = *ptr;
-      if (prev != oldval)
-        return prev;
-
-      if (__kernel_cmpxchg (prev, newval, ptr) == 0)
-        // Success.
-        return prev;
-
-      // We failed even though prev == oldval.  Try again.
-    }
-}
-
-/* Atomically add an int to memory.  */
-static inline int arm_add_and_fetch(volatile int *ptr, int add_value) {
-  for (;;) {
-      // Loop until a __kernel_cmpxchg succeeds.
-
-      int prev = *ptr;
-
-      if (__kernel_cmpxchg (prev, prev + add_value, ptr) == 0)
-        return prev + add_value;
-    }
-}
-
-/* Atomically write VALUE into `*PTR' and returns the previous
-   contents of `*PTR'.  */
-static inline int arm_lock_test_and_set(volatile int *ptr, int newval) {
-  for (;;) {
-      // Loop until a __kernel_cmpxchg succeeds.
-      int prev = *ptr;
-
-      if (__kernel_cmpxchg (prev, newval, ptr) == 0)
-        return prev;
-    }
-}
-#endif // ARM
-
-inline void Atomic::store(jint store_value, volatile jint* dest) {
-  *dest = store_value;
-}
-
-inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) {
-  *dest = store_value;
-}
-
-inline jint Atomic::add(jint add_value, volatile jint* dest) {
-#ifdef ARM
-  return arm_add_and_fetch(dest, add_value);
-#else
-#ifdef M68K
-  return m68k_add_and_fetch(dest, add_value);
-#else
-  return __sync_add_and_fetch(dest, add_value);
-#endif // M68K
-#endif // ARM
-}
-
-inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
-#ifdef ARM
-  return arm_add_and_fetch(dest, add_value);
-#else
-#ifdef M68K
-  return m68k_add_and_fetch(dest, add_value);
-#else
-  return __sync_add_and_fetch(dest, add_value);
-#endif // M68K
-#endif // ARM
-}
-
-inline void* Atomic::add_ptr(intptr_t add_value, volatile void* dest) {
-  return (void *) add_ptr(add_value, (volatile intptr_t *) dest);
-}
-
-inline void Atomic::inc(volatile jint* dest) {
-  add(1, dest);
-}
-
-inline void Atomic::inc_ptr(volatile intptr_t* dest) {
-  add_ptr(1, dest);
-}
-
-inline void Atomic::inc_ptr(volatile void* dest) {
-  add_ptr(1, dest);
-}
-
-inline void Atomic::dec(volatile jint* dest) {
-  add(-1, dest);
-}
-
-inline void Atomic::dec_ptr(volatile intptr_t* dest) {
-  add_ptr(-1, dest);
-}
-
-inline void Atomic::dec_ptr(volatile void* dest) {
-  add_ptr(-1, dest);
-}
-
-inline jint Atomic::xchg(jint exchange_value, volatile jint* dest) {
-#ifdef ARM
-  return arm_lock_test_and_set(dest, exchange_value);
-#else
-#ifdef M68K
-  return m68k_lock_test_and_set(dest, exchange_value);
-#else
-  // __sync_lock_test_and_set is a bizarrely named atomic exchange
-  // operation.  Note that some platforms only support this with the
-  // limitation that the only valid value to store is the immediate
-  // constant 1.  There is a test for this in JNI_CreateJavaVM().
-  jint result = __sync_lock_test_and_set (dest, exchange_value);
-  // All atomic operations are expected to be full memory barriers
-  // (see atomic.hpp). However, __sync_lock_test_and_set is not
-  // a full memory barrier, but an acquire barrier. Hence, this added
-  // barrier.
-  __sync_synchronize();
-  return result;
-#endif // M68K
-#endif // ARM
-}
-
-inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value,
-                                 volatile intptr_t* dest) {
-#ifdef ARM
-  return arm_lock_test_and_set(dest, exchange_value);
-#else
-#ifdef M68K
-  return m68k_lock_test_and_set(dest, exchange_value);
-#else
-  intptr_t result = __sync_lock_test_and_set (dest, exchange_value);
-  __sync_synchronize();
-  return result;
-#endif // M68K
-#endif // ARM
-}
-
-inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) {
-  return (void *) xchg_ptr((intptr_t) exchange_value,
-                           (volatile intptr_t*) dest);
-}
-
-inline jint Atomic::cmpxchg(jint exchange_value,
-                            volatile jint* dest,
-                            jint compare_value,
-                            cmpxchg_memory_order order) {
-#ifdef ARM
-  return arm_compare_and_swap(dest, compare_value, exchange_value);
-#else
-#ifdef M68K
-  return m68k_compare_and_swap(dest, compare_value, exchange_value);
-#else
-  return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
-#endif // M68K
-#endif // ARM
-}
-
-inline jlong Atomic::cmpxchg(jlong exchange_value,
-                             volatile jlong* dest,
-                             jlong compare_value,
-                             cmpxchg_memory_order order) {
-
-  return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
-}
-
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value,
-                                    volatile intptr_t* dest,
-                                    intptr_t compare_value,
-                                    cmpxchg_memory_order order) {
-#ifdef ARM
-  return arm_compare_and_swap(dest, compare_value, exchange_value);
-#else
-#ifdef M68K
-  return m68k_compare_and_swap(dest, compare_value, exchange_value);
-#else
-  return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
-#endif // M68K
-#endif // ARM
-}
-
-inline void* Atomic::cmpxchg_ptr(void* exchange_value,
-                                 volatile void* dest,
-                                 void* compare_value,
-                                 cmpxchg_memory_order order) {
-
-  return (void *) cmpxchg_ptr((intptr_t) exchange_value,
-                              (volatile intptr_t*) dest,
-                              (intptr_t) compare_value,
-                              order);
-}
-
-inline jlong Atomic::load(volatile jlong* src) {
-  volatile jlong dest;
-  os::atomic_copy64(src, &dest);
-  return dest;
-}
-
-inline void Atomic::store(jlong store_value, jlong* dest) {
-  os::atomic_copy64((volatile jlong*)&store_value, (volatile jlong*)dest);
-}
-
-inline void Atomic::store(jlong store_value, volatile jlong* dest) {
-  os::atomic_copy64((volatile jlong*)&store_value, dest);
-}
-
-#endif // OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,376 @@
+/*
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef OS_CPU_SOLARIS_SPARC_VM_ATOMIC_SOLARIS_SPARC_HPP
+#define OS_CPU_SOLARIS_SPARC_VM_ATOMIC_SOLARIS_SPARC_HPP
+
+#include "runtime/os.hpp"
+
+// Implementation of class atomic
+
+inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
+inline void Atomic::store    (jshort   store_value, jshort*   dest) { *dest = store_value; }
+inline void Atomic::store    (jint     store_value, jint*     dest) { *dest = store_value; }
+inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
+inline void Atomic::store_ptr(void*    store_value, void*     dest) { *(void**)dest = store_value; }
+
+inline void Atomic::store    (jbyte    store_value, volatile jbyte*    dest) { *dest = store_value; }
+inline void Atomic::store    (jshort   store_value, volatile jshort*   dest) { *dest = store_value; }
+inline void Atomic::store    (jint     store_value, volatile jint*     dest) { *dest = store_value; }
+inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
+inline void Atomic::store_ptr(void*    store_value, volatile void*     dest) { *(void* volatile *)dest = store_value; }
+
+inline void Atomic::inc    (volatile jint*     dest) { (void)add    (1, dest); }
+inline void Atomic::inc_ptr(volatile intptr_t* dest) { (void)add_ptr(1, dest); }
+inline void Atomic::inc_ptr(volatile void*     dest) { (void)add_ptr(1, dest); }
+
+inline void Atomic::dec    (volatile jint*     dest) { (void)add    (-1, dest); }
+inline void Atomic::dec_ptr(volatile intptr_t* dest) { (void)add_ptr(-1, dest); }
+inline void Atomic::dec_ptr(volatile void*     dest) { (void)add_ptr(-1, dest); }
+
+
+#ifdef _LP64
+
+inline void Atomic::store(jlong store_value, jlong* dest) { *dest = store_value; }
+inline void Atomic::store(jlong store_value, volatile jlong* dest) { *dest = store_value; }
+inline jlong Atomic::load(volatile jlong* src) { return *src; }
+
+#else
+
+extern "C" void _Atomic_move_long_v9(volatile jlong* src, volatile jlong* dst);
+
+inline void Atomic_move_long(volatile jlong* src, volatile jlong* dst) {
+  _Atomic_move_long_v9(src, dst);
+}
+
+inline jlong Atomic::load(volatile jlong* src) {
+  volatile jlong dest;
+  Atomic_move_long(src, &dest);
+  return dest;
+}
+
+inline void Atomic::store(jlong store_value, jlong* dest) {
+  Atomic_move_long((volatile jlong*)&store_value, (volatile jlong*)dest);
+}
+
+inline void Atomic::store(jlong store_value, volatile jlong* dest) {
+  Atomic_move_long((volatile jlong*)&store_value, dest);
+}
+
+#endif
+
+#ifdef _GNU_SOURCE
+
+inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
+  intptr_t rv;
+  __asm__ volatile(
+    "1: \n\t"
+    " ld     [%2], %%o2\n\t"
+    " add    %1, %%o2, %%o3\n\t"
+    " cas    [%2], %%o2, %%o3\n\t"
+    " cmp    %%o2, %%o3\n\t"
+    " bne    1b\n\t"
+    "  nop\n\t"
+    " add    %1, %%o2, %0\n\t"
+    : "=r" (rv)
+    : "r" (add_value), "r" (dest)
+    : "memory", "o2", "o3");
+  return rv;
+}
+
+inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
+  intptr_t rv;
+#ifdef _LP64
+  __asm__ volatile(
+    "1: \n\t"
+    " ldx    [%2], %%o2\n\t"
+    " add    %0, %%o2, %%o3\n\t"
+    " casx   [%2], %%o2, %%o3\n\t"
+    " cmp    %%o2, %%o3\n\t"
+    " bne    %%xcc, 1b\n\t"
+    "  nop\n\t"
+    " add    %0, %%o2, %0\n\t"
+    : "=r" (rv)
+    : "r" (add_value), "r" (dest)
+    : "memory", "o2", "o3");
+#else //_LP64
+  __asm__ volatile(
+    "1: \n\t"
+    " ld     [%2], %%o2\n\t"
+    " add    %1, %%o2, %%o3\n\t"
+    " cas    [%2], %%o2, %%o3\n\t"
+    " cmp    %%o2, %%o3\n\t"
+    " bne    1b\n\t"
+    "  nop\n\t"
+    " add    %1, %%o2, %0\n\t"
+    : "=r" (rv)
+    : "r" (add_value), "r" (dest)
+    : "memory", "o2", "o3");
+#endif // _LP64
+  return rv;
+}
+
+inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
+  return (void*)add_ptr((intptr_t)add_value, (volatile intptr_t*)dest);
+}
+
+
+inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
+  intptr_t rv = exchange_value;
+  __asm__ volatile(
+    " swap   [%2],%1\n\t"
+    : "=r" (rv)
+    : "0" (exchange_value) /* we use same register as for return value */, "r" (dest)
+    : "memory");
+  return rv;
+}
+
+inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
+  intptr_t rv = exchange_value;
+#ifdef _LP64
+  __asm__ volatile(
+    "1:\n\t"
+    " mov    %1, %%o3\n\t"
+    " ldx    [%2], %%o2\n\t"
+    " casx   [%2], %%o2, %%o3\n\t"
+    " cmp    %%o2, %%o3\n\t"
+    " bne    %%xcc, 1b\n\t"
+    "  nop\n\t"
+    " mov    %%o2, %0\n\t"
+    : "=r" (rv)
+    : "r" (exchange_value), "r" (dest)
+    : "memory", "o2", "o3");
+#else  //_LP64
+  __asm__ volatile(
+    "swap    [%2],%1\n\t"
+    : "=r" (rv)
+    : "0" (exchange_value) /* we use same register as for return value */, "r" (dest)
+    : "memory");
+#endif // _LP64
+  return rv;
+}
+
+inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
+  return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
+}
+
+
+inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value, cmpxchg_memory_order order) {
+  jint rv;
+  __asm__ volatile(
+    " cas    [%2], %3, %0"
+    : "=r" (rv)
+    : "0" (exchange_value), "r" (dest), "r" (compare_value)
+    : "memory");
+  return rv;
+}
+
+inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
+#ifdef _LP64
+  jlong rv;
+  __asm__ volatile(
+    " casx   [%2], %3, %0"
+    : "=r" (rv)
+    : "0" (exchange_value), "r" (dest), "r" (compare_value)
+    : "memory");
+  return rv;
+#else  //_LP64
+  volatile jlong_accessor evl, cvl, rv;
+  evl.long_value = exchange_value;
+  cvl.long_value = compare_value;
+
+  __asm__ volatile(
+    " sllx   %2, 32, %2\n\t"
+    " srl    %3, 0,  %3\n\t"
+    " or     %2, %3, %2\n\t"
+    " sllx   %5, 32, %5\n\t"
+    " srl    %6, 0,  %6\n\t"
+    " or     %5, %6, %5\n\t"
+    " casx   [%4], %5, %2\n\t"
+    " srl    %2, 0, %1\n\t"
+    " srlx   %2, 32, %0\n\t"
+    : "=r" (rv.words[0]), "=r" (rv.words[1])
+    : "r"  (evl.words[0]), "r" (evl.words[1]), "r" (dest), "r" (cvl.words[0]), "r" (cvl.words[1])
+    : "memory");
+
+  return rv.long_value;
+#endif  //_LP64
+}
+
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+  intptr_t rv;
+#ifdef _LP64
+  __asm__ volatile(
+    " casx    [%2], %3, %0"
+    : "=r" (rv)
+    : "0" (exchange_value), "r" (dest), "r" (compare_value)
+    : "memory");
+#else  //_LP64
+  __asm__ volatile(
+    " cas     [%2], %3, %0"
+    : "=r" (rv)
+    : "0" (exchange_value), "r" (dest), "r" (compare_value)
+    : "memory");
+#endif // _LP64
+  return rv;
+}
+
+inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
+  return (void*)cmpxchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest, (intptr_t)compare_value, order);
+}
+
+#else // _GNU_SOURCE
+
+#if defined(COMPILER2) || defined(_LP64)
+
+// This is the interface to the atomic instructions in solaris_sparc.il.
+// It's very messy because we need to support v8 and these instructions
+// are illegal there.  When sparc v8 is dropped, we can drop out lots of
+// this code.  Also compiler2 does not support v8 so the conditional code
+// omits the instruction set check.
+
+extern "C" jint     _Atomic_swap32(jint     exchange_value, volatile jint*     dest);
+extern "C" intptr_t _Atomic_swap64(intptr_t exchange_value, volatile intptr_t* dest);
+
+extern "C" jint     _Atomic_cas32(jint     exchange_value, volatile jint*     dest, jint     compare_value);
+extern "C" intptr_t _Atomic_cas64(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value);
+extern "C" jlong    _Atomic_casl (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value);
+
+extern "C" jint     _Atomic_add32(jint     inc,       volatile jint*     dest);
+extern "C" intptr_t _Atomic_add64(intptr_t add_value, volatile intptr_t* dest);
+
+
+inline jint     Atomic::add     (jint    add_value, volatile jint*     dest) {
+  return _Atomic_add32(add_value, dest);
+}
+
+inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
+#ifdef _LP64
+  return _Atomic_add64(add_value, dest);
+#else  //_LP64
+  return _Atomic_add32(add_value, dest);
+#endif // _LP64
+}
+
+inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
+  return (void*)add_ptr((intptr_t)add_value, (volatile intptr_t*)dest);
+}
+
+
+inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
+  return _Atomic_swap32(exchange_value, dest);
+}
+
+inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
+#ifdef _LP64
+  return _Atomic_swap64(exchange_value, dest);
+#else  // _LP64
+  return _Atomic_swap32(exchange_value, dest);
+#endif // _LP64
+}
+
+inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
+  return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
+}
+
+
+inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value, cmpxchg_memory_order order) {
+  return _Atomic_cas32(exchange_value, dest, compare_value);
+}
+
+inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
+#ifdef _LP64
+  // Return 64 bit value in %o0
+  return _Atomic_cas64((intptr_t)exchange_value, (intptr_t *)dest, (intptr_t)compare_value);
+#else  // _LP64
+  // Return 64 bit value in %o0,%o1 by hand
+  return _Atomic_casl(exchange_value, dest, compare_value);
+#endif // _LP64
+}
+
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+#ifdef _LP64
+  return _Atomic_cas64(exchange_value, dest, compare_value);
+#else  // _LP64
+  return _Atomic_cas32(exchange_value, dest, compare_value);
+#endif // _LP64
+}
+
+inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
+  return (void*)cmpxchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest, (intptr_t)compare_value, order);
+}
+
+
+#else // _LP64 || COMPILER2
+
+
+// 32-bit compiler1 only
+
+inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
+  return (*os::atomic_add_func)(add_value, dest);
+}
+
+inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
+  return (intptr_t)add((jint)add_value, (volatile jint*)dest);
+}
+
+inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
+  return (void*)add((jint)add_value, (volatile jint*)dest);
+}
+
+
+inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
+  return (*os::atomic_xchg_func)(exchange_value, dest);
+}
+
+inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
+  return (intptr_t)xchg((jint)exchange_value, (volatile jint*)dest);
+}
+
+inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
+  return (void*)xchg((jint)exchange_value, (volatile jint*)dest);
+}
+
+
+inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value, cmpxchg_memory_order order) {
+  return (*os::atomic_cmpxchg_func)(exchange_value, dest, compare_value);
+}
+
+inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
+  return (*os::atomic_cmpxchg_long_func)(exchange_value, dest, compare_value);
+}
+
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+  return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
+}
+
+inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
+  return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
+}
+
+#endif // _LP64 || COMPILER2
+
+#endif // _GNU_SOURCE
+
+#endif // OS_CPU_SOLARIS_SPARC_VM_ATOMIC_SOLARIS_SPARC_HPP
--- a/hotspot/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,377 +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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef OS_CPU_SOLARIS_SPARC_VM_ATOMIC_SOLARIS_SPARC_INLINE_HPP
-#define OS_CPU_SOLARIS_SPARC_VM_ATOMIC_SOLARIS_SPARC_INLINE_HPP
-
-#include "runtime/atomic.hpp"
-#include "runtime/os.hpp"
-
-// Implementation of class atomic
-
-inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
-inline void Atomic::store    (jshort   store_value, jshort*   dest) { *dest = store_value; }
-inline void Atomic::store    (jint     store_value, jint*     dest) { *dest = store_value; }
-inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
-inline void Atomic::store_ptr(void*    store_value, void*     dest) { *(void**)dest = store_value; }
-
-inline void Atomic::store    (jbyte    store_value, volatile jbyte*    dest) { *dest = store_value; }
-inline void Atomic::store    (jshort   store_value, volatile jshort*   dest) { *dest = store_value; }
-inline void Atomic::store    (jint     store_value, volatile jint*     dest) { *dest = store_value; }
-inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
-inline void Atomic::store_ptr(void*    store_value, volatile void*     dest) { *(void* volatile *)dest = store_value; }
-
-inline void Atomic::inc    (volatile jint*     dest) { (void)add    (1, dest); }
-inline void Atomic::inc_ptr(volatile intptr_t* dest) { (void)add_ptr(1, dest); }
-inline void Atomic::inc_ptr(volatile void*     dest) { (void)add_ptr(1, dest); }
-
-inline void Atomic::dec    (volatile jint*     dest) { (void)add    (-1, dest); }
-inline void Atomic::dec_ptr(volatile intptr_t* dest) { (void)add_ptr(-1, dest); }
-inline void Atomic::dec_ptr(volatile void*     dest) { (void)add_ptr(-1, dest); }
-
-
-#ifdef _LP64
-
-inline void Atomic::store(jlong store_value, jlong* dest) { *dest = store_value; }
-inline void Atomic::store(jlong store_value, volatile jlong* dest) { *dest = store_value; }
-inline jlong Atomic::load(volatile jlong* src) { return *src; }
-
-#else
-
-extern "C" void _Atomic_move_long_v9(volatile jlong* src, volatile jlong* dst);
-
-inline void Atomic_move_long(volatile jlong* src, volatile jlong* dst) {
-  _Atomic_move_long_v9(src, dst);
-}
-
-inline jlong Atomic::load(volatile jlong* src) {
-  volatile jlong dest;
-  Atomic_move_long(src, &dest);
-  return dest;
-}
-
-inline void Atomic::store(jlong store_value, jlong* dest) {
-  Atomic_move_long((volatile jlong*)&store_value, (volatile jlong*)dest);
-}
-
-inline void Atomic::store(jlong store_value, volatile jlong* dest) {
-  Atomic_move_long((volatile jlong*)&store_value, dest);
-}
-
-#endif
-
-#ifdef _GNU_SOURCE
-
-inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
-  intptr_t rv;
-  __asm__ volatile(
-    "1: \n\t"
-    " ld     [%2], %%o2\n\t"
-    " add    %1, %%o2, %%o3\n\t"
-    " cas    [%2], %%o2, %%o3\n\t"
-    " cmp    %%o2, %%o3\n\t"
-    " bne    1b\n\t"
-    "  nop\n\t"
-    " add    %1, %%o2, %0\n\t"
-    : "=r" (rv)
-    : "r" (add_value), "r" (dest)
-    : "memory", "o2", "o3");
-  return rv;
-}
-
-inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
-  intptr_t rv;
-#ifdef _LP64
-  __asm__ volatile(
-    "1: \n\t"
-    " ldx    [%2], %%o2\n\t"
-    " add    %0, %%o2, %%o3\n\t"
-    " casx   [%2], %%o2, %%o3\n\t"
-    " cmp    %%o2, %%o3\n\t"
-    " bne    %%xcc, 1b\n\t"
-    "  nop\n\t"
-    " add    %0, %%o2, %0\n\t"
-    : "=r" (rv)
-    : "r" (add_value), "r" (dest)
-    : "memory", "o2", "o3");
-#else //_LP64
-  __asm__ volatile(
-    "1: \n\t"
-    " ld     [%2], %%o2\n\t"
-    " add    %1, %%o2, %%o3\n\t"
-    " cas    [%2], %%o2, %%o3\n\t"
-    " cmp    %%o2, %%o3\n\t"
-    " bne    1b\n\t"
-    "  nop\n\t"
-    " add    %1, %%o2, %0\n\t"
-    : "=r" (rv)
-    : "r" (add_value), "r" (dest)
-    : "memory", "o2", "o3");
-#endif // _LP64
-  return rv;
-}
-
-inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
-  return (void*)add_ptr((intptr_t)add_value, (volatile intptr_t*)dest);
-}
-
-
-inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
-  intptr_t rv = exchange_value;
-  __asm__ volatile(
-    " swap   [%2],%1\n\t"
-    : "=r" (rv)
-    : "0" (exchange_value) /* we use same register as for return value */, "r" (dest)
-    : "memory");
-  return rv;
-}
-
-inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
-  intptr_t rv = exchange_value;
-#ifdef _LP64
-  __asm__ volatile(
-    "1:\n\t"
-    " mov    %1, %%o3\n\t"
-    " ldx    [%2], %%o2\n\t"
-    " casx   [%2], %%o2, %%o3\n\t"
-    " cmp    %%o2, %%o3\n\t"
-    " bne    %%xcc, 1b\n\t"
-    "  nop\n\t"
-    " mov    %%o2, %0\n\t"
-    : "=r" (rv)
-    : "r" (exchange_value), "r" (dest)
-    : "memory", "o2", "o3");
-#else  //_LP64
-  __asm__ volatile(
-    "swap    [%2],%1\n\t"
-    : "=r" (rv)
-    : "0" (exchange_value) /* we use same register as for return value */, "r" (dest)
-    : "memory");
-#endif // _LP64
-  return rv;
-}
-
-inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
-  return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
-}
-
-
-inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value, cmpxchg_memory_order order) {
-  jint rv;
-  __asm__ volatile(
-    " cas    [%2], %3, %0"
-    : "=r" (rv)
-    : "0" (exchange_value), "r" (dest), "r" (compare_value)
-    : "memory");
-  return rv;
-}
-
-inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
-#ifdef _LP64
-  jlong rv;
-  __asm__ volatile(
-    " casx   [%2], %3, %0"
-    : "=r" (rv)
-    : "0" (exchange_value), "r" (dest), "r" (compare_value)
-    : "memory");
-  return rv;
-#else  //_LP64
-  volatile jlong_accessor evl, cvl, rv;
-  evl.long_value = exchange_value;
-  cvl.long_value = compare_value;
-
-  __asm__ volatile(
-    " sllx   %2, 32, %2\n\t"
-    " srl    %3, 0,  %3\n\t"
-    " or     %2, %3, %2\n\t"
-    " sllx   %5, 32, %5\n\t"
-    " srl    %6, 0,  %6\n\t"
-    " or     %5, %6, %5\n\t"
-    " casx   [%4], %5, %2\n\t"
-    " srl    %2, 0, %1\n\t"
-    " srlx   %2, 32, %0\n\t"
-    : "=r" (rv.words[0]), "=r" (rv.words[1])
-    : "r"  (evl.words[0]), "r" (evl.words[1]), "r" (dest), "r" (cvl.words[0]), "r" (cvl.words[1])
-    : "memory");
-
-  return rv.long_value;
-#endif  //_LP64
-}
-
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
-  intptr_t rv;
-#ifdef _LP64
-  __asm__ volatile(
-    " casx    [%2], %3, %0"
-    : "=r" (rv)
-    : "0" (exchange_value), "r" (dest), "r" (compare_value)
-    : "memory");
-#else  //_LP64
-  __asm__ volatile(
-    " cas     [%2], %3, %0"
-    : "=r" (rv)
-    : "0" (exchange_value), "r" (dest), "r" (compare_value)
-    : "memory");
-#endif // _LP64
-  return rv;
-}
-
-inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
-  return (void*)cmpxchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest, (intptr_t)compare_value, order);
-}
-
-#else // _GNU_SOURCE
-
-#if defined(COMPILER2) || defined(_LP64)
-
-// This is the interface to the atomic instructions in solaris_sparc.il.
-// It's very messy because we need to support v8 and these instructions
-// are illegal there.  When sparc v8 is dropped, we can drop out lots of
-// this code.  Also compiler2 does not support v8 so the conditional code
-// omits the instruction set check.
-
-extern "C" jint     _Atomic_swap32(jint     exchange_value, volatile jint*     dest);
-extern "C" intptr_t _Atomic_swap64(intptr_t exchange_value, volatile intptr_t* dest);
-
-extern "C" jint     _Atomic_cas32(jint     exchange_value, volatile jint*     dest, jint     compare_value);
-extern "C" intptr_t _Atomic_cas64(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value);
-extern "C" jlong    _Atomic_casl (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value);
-
-extern "C" jint     _Atomic_add32(jint     inc,       volatile jint*     dest);
-extern "C" intptr_t _Atomic_add64(intptr_t add_value, volatile intptr_t* dest);
-
-
-inline jint     Atomic::add     (jint    add_value, volatile jint*     dest) {
-  return _Atomic_add32(add_value, dest);
-}
-
-inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
-#ifdef _LP64
-  return _Atomic_add64(add_value, dest);
-#else  //_LP64
-  return _Atomic_add32(add_value, dest);
-#endif // _LP64
-}
-
-inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
-  return (void*)add_ptr((intptr_t)add_value, (volatile intptr_t*)dest);
-}
-
-
-inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
-  return _Atomic_swap32(exchange_value, dest);
-}
-
-inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
-#ifdef _LP64
-  return _Atomic_swap64(exchange_value, dest);
-#else  // _LP64
-  return _Atomic_swap32(exchange_value, dest);
-#endif // _LP64
-}
-
-inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
-  return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
-}
-
-
-inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value, cmpxchg_memory_order order) {
-  return _Atomic_cas32(exchange_value, dest, compare_value);
-}
-
-inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
-#ifdef _LP64
-  // Return 64 bit value in %o0
-  return _Atomic_cas64((intptr_t)exchange_value, (intptr_t *)dest, (intptr_t)compare_value);
-#else  // _LP64
-  // Return 64 bit value in %o0,%o1 by hand
-  return _Atomic_casl(exchange_value, dest, compare_value);
-#endif // _LP64
-}
-
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
-#ifdef _LP64
-  return _Atomic_cas64(exchange_value, dest, compare_value);
-#else  // _LP64
-  return _Atomic_cas32(exchange_value, dest, compare_value);
-#endif // _LP64
-}
-
-inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
-  return (void*)cmpxchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest, (intptr_t)compare_value, order);
-}
-
-
-#else // _LP64 || COMPILER2
-
-
-// 32-bit compiler1 only
-
-inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
-  return (*os::atomic_add_func)(add_value, dest);
-}
-
-inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
-  return (intptr_t)add((jint)add_value, (volatile jint*)dest);
-}
-
-inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
-  return (void*)add((jint)add_value, (volatile jint*)dest);
-}
-
-
-inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
-  return (*os::atomic_xchg_func)(exchange_value, dest);
-}
-
-inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
-  return (intptr_t)xchg((jint)exchange_value, (volatile jint*)dest);
-}
-
-inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
-  return (void*)xchg((jint)exchange_value, (volatile jint*)dest);
-}
-
-
-inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value, cmpxchg_memory_order order) {
-  return (*os::atomic_cmpxchg_func)(exchange_value, dest, compare_value);
-}
-
-inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
-  return (*os::atomic_cmpxchg_long_func)(exchange_value, dest, compare_value);
-}
-
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
-  return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
-}
-
-inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
-  return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
-}
-
-#endif // _LP64 || COMPILER2
-
-#endif // _GNU_SOURCE
-
-#endif // OS_CPU_SOLARIS_SPARC_VM_ATOMIC_SOLARIS_SPARC_INLINE_HPP
--- a/hotspot/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 #ifndef OS_CPU_SOLARIS_SPARC_VM_ORDERACCESS_SOLARIS_SPARC_INLINE_HPP
 #define OS_CPU_SOLARIS_SPARC_VM_ORDERACCESS_SOLARIS_SPARC_INLINE_HPP
 
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/orderAccess.hpp"
 
 // Compiler version last used for testing: solaris studio 12u3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,278 @@
+/*
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_HPP
+#define OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_HPP
+
+#include "runtime/os.hpp"
+
+inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
+inline void Atomic::store    (jshort   store_value, jshort*   dest) { *dest = store_value; }
+inline void Atomic::store    (jint     store_value, jint*     dest) { *dest = store_value; }
+
+
+inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
+inline void Atomic::store_ptr(void*    store_value, void*     dest) { *(void**)dest = store_value; }
+
+inline void Atomic::store    (jbyte    store_value, volatile jbyte*    dest) { *dest = store_value; }
+inline void Atomic::store    (jshort   store_value, volatile jshort*   dest) { *dest = store_value; }
+inline void Atomic::store    (jint     store_value, volatile jint*     dest) { *dest = store_value; }
+inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
+inline void Atomic::store_ptr(void*    store_value, volatile void*     dest) { *(void* volatile *)dest = store_value; }
+
+inline void Atomic::inc    (volatile jint*     dest) { (void)add    (1, dest); }
+inline void Atomic::inc_ptr(volatile intptr_t* dest) { (void)add_ptr(1, dest); }
+inline void Atomic::inc_ptr(volatile void*     dest) { (void)add_ptr(1, dest); }
+
+inline void Atomic::dec    (volatile jint*     dest) { (void)add    (-1, dest); }
+inline void Atomic::dec_ptr(volatile intptr_t* dest) { (void)add_ptr(-1, dest); }
+inline void Atomic::dec_ptr(volatile void*     dest) { (void)add_ptr(-1, dest); }
+
+// For Sun Studio - implementation is in solaris_x86_[32/64].il.
+// For gcc - implementation is just below.
+
+// The lock prefix can be omitted for certain instructions on uniprocessors; to
+// facilitate this, os::is_MP() is passed as an additional argument.  64-bit
+// processors are assumed to be multi-threaded and/or multi-core, so the extra
+// argument is unnecessary.
+#ifndef _LP64
+#define IS_MP_DECL() , int is_mp
+#define IS_MP_ARG()  , (int) os::is_MP()
+#else
+#define IS_MP_DECL()
+#define IS_MP_ARG()
+#endif // _LP64
+
+extern "C" {
+  jint _Atomic_add(jint add_value, volatile jint* dest IS_MP_DECL());
+  jint _Atomic_xchg(jint exchange_value, volatile jint* dest);
+  jbyte _Atomic_cmpxchg_byte(jbyte exchange_value, volatile jbyte* dest,
+                       jbyte compare_value IS_MP_DECL());
+  jint _Atomic_cmpxchg(jint exchange_value, volatile jint* dest,
+                       jint compare_value IS_MP_DECL());
+  jlong _Atomic_cmpxchg_long(jlong exchange_value, volatile jlong* dest,
+                             jlong compare_value IS_MP_DECL());
+}
+
+inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
+  return _Atomic_add(add_value, dest IS_MP_ARG());
+}
+
+inline jint     Atomic::xchg       (jint     exchange_value, volatile jint*     dest) {
+  return _Atomic_xchg(exchange_value, dest);
+}
+
+#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline jbyte    Atomic::cmpxchg    (jbyte    exchange_value, volatile jbyte*    dest, jbyte    compare_value, cmpxchg_memory_order order) {
+  return _Atomic_cmpxchg_byte(exchange_value, dest, compare_value IS_MP_ARG());
+}
+
+inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value, cmpxchg_memory_order order) {
+  return _Atomic_cmpxchg(exchange_value, dest, compare_value IS_MP_ARG());
+}
+
+inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
+  return _Atomic_cmpxchg_long(exchange_value, dest, compare_value IS_MP_ARG());
+}
+
+
+#ifdef AMD64
+inline void Atomic::store    (jlong    store_value, jlong*             dest) { *dest = store_value; }
+inline void Atomic::store    (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
+extern "C" jlong _Atomic_add_long(jlong add_value, volatile jlong* dest);
+extern "C" jlong _Atomic_xchg_long(jlong exchange_value, volatile jlong* dest);
+
+inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
+  return (intptr_t)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest);
+}
+
+inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
+  return (void*)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest);
+}
+
+inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
+  return (intptr_t)_Atomic_xchg_long((jlong)exchange_value, (volatile jlong*)dest);
+}
+
+inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
+  return (void*)_Atomic_xchg_long((jlong)exchange_value, (volatile jlong*)dest);
+}
+
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+  return (intptr_t)_Atomic_cmpxchg_long((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
+}
+
+inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
+  return (void*)_Atomic_cmpxchg_long((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
+}
+
+inline jlong Atomic::load(volatile jlong* src) { return *src; }
+
+#else // !AMD64
+
+inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
+  return (intptr_t)add((jint)add_value, (volatile jint*)dest);
+}
+
+inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
+  return (void*)add((jint)add_value, (volatile jint*)dest);
+}
+
+inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
+  return (intptr_t)xchg((jint)exchange_value, (volatile jint*)dest);
+}
+
+inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
+  return (void*)xchg((jint)exchange_value, (volatile jint*)dest);
+}
+
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+  return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
+}
+
+inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
+  return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
+}
+
+extern "C" void _Atomic_move_long(volatile jlong* src, volatile jlong* dst);
+
+inline jlong Atomic::load(volatile jlong* src) {
+  volatile jlong dest;
+  _Atomic_move_long(src, &dest);
+  return dest;
+}
+
+inline void Atomic::store(jlong store_value, jlong* dest) {
+  _Atomic_move_long((volatile jlong*)&store_value, (volatile jlong*)dest);
+}
+
+inline void Atomic::store(jlong store_value, volatile jlong* dest) {
+  _Atomic_move_long((volatile jlong*)&store_value, dest);
+}
+
+#endif // AMD64
+
+#ifdef _GNU_SOURCE
+// Add a lock prefix to an instruction on an MP machine
+#define LOCK_IF_MP(mp) "cmp $0, " #mp "; je 1f; lock; 1: "
+
+extern "C" {
+  inline jint _Atomic_add(jint add_value, volatile jint* dest, int mp) {
+    jint addend = add_value;
+    __asm__ volatile (  LOCK_IF_MP(%3) "xaddl %0,(%2)"
+                    : "=r" (addend)
+                    : "0" (addend), "r" (dest), "r" (mp)
+                    : "cc", "memory");
+    return addend + add_value;
+  }
+
+#ifdef AMD64
+  inline jlong _Atomic_add_long(jlong add_value, volatile jlong* dest, int mp) {
+    intptr_t addend = add_value;
+    __asm__ __volatile__ (LOCK_IF_MP(%3) "xaddq %0,(%2)"
+                        : "=r" (addend)
+                        : "0" (addend), "r" (dest), "r" (mp)
+                        : "cc", "memory");
+    return addend + add_value;
+  }
+
+  inline jlong _Atomic_xchg_long(jlong exchange_value, volatile jlong* dest) {
+    __asm__ __volatile__ ("xchgq (%2),%0"
+                        : "=r" (exchange_value)
+                        : "0" (exchange_value), "r" (dest)
+                        : "memory");
+    return exchange_value;
+  }
+
+#endif // AMD64
+
+  inline jint _Atomic_xchg(jint exchange_value, volatile jint* dest) {
+    __asm__ __volatile__ ("xchgl (%2),%0"
+                          : "=r" (exchange_value)
+                        : "0" (exchange_value), "r" (dest)
+                        : "memory");
+    return exchange_value;
+  }
+
+  inline jint _Atomic_cmpxchg(jint exchange_value, volatile jint* dest, jint compare_value, int mp) {
+    __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgl %1,(%3)"
+                    : "=a" (exchange_value)
+                    : "r" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
+                    : "cc", "memory");
+    return exchange_value;
+  }
+
+
+  inline jbyte _Atomic_cmpxchg_byte(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, int mp) {
+    __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)"
+                    : "=a" (exchange_value)
+                    : "q" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
+                    : "cc", "memory");
+    return exchange_value;
+  }
+
+  // This is the interface to the atomic instruction in solaris_i486.s.
+  jlong _Atomic_cmpxchg_long_gcc(jlong exchange_value, volatile jlong* dest, jlong compare_value, int mp);
+
+  inline jlong _Atomic_cmpxchg_long(jlong exchange_value, volatile jlong* dest, jlong compare_value, int mp) {
+#ifdef AMD64
+    __asm__ __volatile__ (LOCK_IF_MP(%4) "cmpxchgq %1,(%3)"
+                        : "=a" (exchange_value)
+                        : "r" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
+                        : "cc", "memory");
+    return exchange_value;
+#else
+    return _Atomic_cmpxchg_long_gcc(exchange_value, dest, compare_value, os::is_MP());
+
+    #if 0
+    // The code below does not work presumably because of the bug in gcc
+    // The error message says:
+    //   can't find a register in class BREG while reloading asm
+    // However I want to save this code and later replace _Atomic_cmpxchg_long_gcc
+    // with such inline asm code:
+
+    volatile jlong_accessor evl, cvl, rv;
+    evl.long_value = exchange_value;
+    cvl.long_value = compare_value;
+    int mp = os::is_MP();
+
+    __asm__ volatile ("cmp $0, %%esi\n\t"
+       "je 1f \n\t"
+       "lock\n\t"
+       "1: cmpxchg8b (%%edi)\n\t"
+       : "=a"(cvl.words[0]),   "=d"(cvl.words[1])
+       : "a"(cvl.words[0]), "d"(cvl.words[1]),
+         "b"(evl.words[0]), "c"(evl.words[1]),
+         "D"(dest), "S"(mp)
+       :  "cc", "memory");
+    return cvl.long_value;
+    #endif // if 0
+#endif // AMD64
+  }
+}
+#undef LOCK_IF_MP
+
+#endif // _GNU_SOURCE
+
+#endif // OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_HPP
--- a/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,279 +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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_INLINE_HPP
-#define OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_INLINE_HPP
-
-#include "runtime/atomic.hpp"
-#include "runtime/os.hpp"
-
-inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
-inline void Atomic::store    (jshort   store_value, jshort*   dest) { *dest = store_value; }
-inline void Atomic::store    (jint     store_value, jint*     dest) { *dest = store_value; }
-
-
-inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
-inline void Atomic::store_ptr(void*    store_value, void*     dest) { *(void**)dest = store_value; }
-
-inline void Atomic::store    (jbyte    store_value, volatile jbyte*    dest) { *dest = store_value; }
-inline void Atomic::store    (jshort   store_value, volatile jshort*   dest) { *dest = store_value; }
-inline void Atomic::store    (jint     store_value, volatile jint*     dest) { *dest = store_value; }
-inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
-inline void Atomic::store_ptr(void*    store_value, volatile void*     dest) { *(void* volatile *)dest = store_value; }
-
-inline void Atomic::inc    (volatile jint*     dest) { (void)add    (1, dest); }
-inline void Atomic::inc_ptr(volatile intptr_t* dest) { (void)add_ptr(1, dest); }
-inline void Atomic::inc_ptr(volatile void*     dest) { (void)add_ptr(1, dest); }
-
-inline void Atomic::dec    (volatile jint*     dest) { (void)add    (-1, dest); }
-inline void Atomic::dec_ptr(volatile intptr_t* dest) { (void)add_ptr(-1, dest); }
-inline void Atomic::dec_ptr(volatile void*     dest) { (void)add_ptr(-1, dest); }
-
-// For Sun Studio - implementation is in solaris_x86_[32/64].il.
-// For gcc - implementation is just below.
-
-// The lock prefix can be omitted for certain instructions on uniprocessors; to
-// facilitate this, os::is_MP() is passed as an additional argument.  64-bit
-// processors are assumed to be multi-threaded and/or multi-core, so the extra
-// argument is unnecessary.
-#ifndef _LP64
-#define IS_MP_DECL() , int is_mp
-#define IS_MP_ARG()  , (int) os::is_MP()
-#else
-#define IS_MP_DECL()
-#define IS_MP_ARG()
-#endif // _LP64
-
-extern "C" {
-  jint _Atomic_add(jint add_value, volatile jint* dest IS_MP_DECL());
-  jint _Atomic_xchg(jint exchange_value, volatile jint* dest);
-  jbyte _Atomic_cmpxchg_byte(jbyte exchange_value, volatile jbyte* dest,
-                       jbyte compare_value IS_MP_DECL());
-  jint _Atomic_cmpxchg(jint exchange_value, volatile jint* dest,
-                       jint compare_value IS_MP_DECL());
-  jlong _Atomic_cmpxchg_long(jlong exchange_value, volatile jlong* dest,
-                             jlong compare_value IS_MP_DECL());
-}
-
-inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
-  return _Atomic_add(add_value, dest IS_MP_ARG());
-}
-
-inline jint     Atomic::xchg       (jint     exchange_value, volatile jint*     dest) {
-  return _Atomic_xchg(exchange_value, dest);
-}
-
-#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
-inline jbyte    Atomic::cmpxchg    (jbyte    exchange_value, volatile jbyte*    dest, jbyte    compare_value, cmpxchg_memory_order order) {
-  return _Atomic_cmpxchg_byte(exchange_value, dest, compare_value IS_MP_ARG());
-}
-
-inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value, cmpxchg_memory_order order) {
-  return _Atomic_cmpxchg(exchange_value, dest, compare_value IS_MP_ARG());
-}
-
-inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
-  return _Atomic_cmpxchg_long(exchange_value, dest, compare_value IS_MP_ARG());
-}
-
-
-#ifdef AMD64
-inline void Atomic::store    (jlong    store_value, jlong*             dest) { *dest = store_value; }
-inline void Atomic::store    (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
-extern "C" jlong _Atomic_add_long(jlong add_value, volatile jlong* dest);
-extern "C" jlong _Atomic_xchg_long(jlong exchange_value, volatile jlong* dest);
-
-inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
-  return (intptr_t)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest);
-}
-
-inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
-  return (void*)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest);
-}
-
-inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
-  return (intptr_t)_Atomic_xchg_long((jlong)exchange_value, (volatile jlong*)dest);
-}
-
-inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
-  return (void*)_Atomic_xchg_long((jlong)exchange_value, (volatile jlong*)dest);
-}
-
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
-  return (intptr_t)_Atomic_cmpxchg_long((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
-}
-
-inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
-  return (void*)_Atomic_cmpxchg_long((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
-}
-
-inline jlong Atomic::load(volatile jlong* src) { return *src; }
-
-#else // !AMD64
-
-inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
-  return (intptr_t)add((jint)add_value, (volatile jint*)dest);
-}
-
-inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
-  return (void*)add((jint)add_value, (volatile jint*)dest);
-}
-
-inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
-  return (intptr_t)xchg((jint)exchange_value, (volatile jint*)dest);
-}
-
-inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
-  return (void*)xchg((jint)exchange_value, (volatile jint*)dest);
-}
-
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
-  return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
-}
-
-inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
-  return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
-}
-
-extern "C" void _Atomic_move_long(volatile jlong* src, volatile jlong* dst);
-
-inline jlong Atomic::load(volatile jlong* src) {
-  volatile jlong dest;
-  _Atomic_move_long(src, &dest);
-  return dest;
-}
-
-inline void Atomic::store(jlong store_value, jlong* dest) {
-  _Atomic_move_long((volatile jlong*)&store_value, (volatile jlong*)dest);
-}
-
-inline void Atomic::store(jlong store_value, volatile jlong* dest) {
-  _Atomic_move_long((volatile jlong*)&store_value, dest);
-}
-
-#endif // AMD64
-
-#ifdef _GNU_SOURCE
-// Add a lock prefix to an instruction on an MP machine
-#define LOCK_IF_MP(mp) "cmp $0, " #mp "; je 1f; lock; 1: "
-
-extern "C" {
-  inline jint _Atomic_add(jint add_value, volatile jint* dest, int mp) {
-    jint addend = add_value;
-    __asm__ volatile (  LOCK_IF_MP(%3) "xaddl %0,(%2)"
-                    : "=r" (addend)
-                    : "0" (addend), "r" (dest), "r" (mp)
-                    : "cc", "memory");
-    return addend + add_value;
-  }
-
-#ifdef AMD64
-  inline jlong _Atomic_add_long(jlong add_value, volatile jlong* dest, int mp) {
-    intptr_t addend = add_value;
-    __asm__ __volatile__ (LOCK_IF_MP(%3) "xaddq %0,(%2)"
-                        : "=r" (addend)
-                        : "0" (addend), "r" (dest), "r" (mp)
-                        : "cc", "memory");
-    return addend + add_value;
-  }
-
-  inline jlong _Atomic_xchg_long(jlong exchange_value, volatile jlong* dest) {
-    __asm__ __volatile__ ("xchgq (%2),%0"
-                        : "=r" (exchange_value)
-                        : "0" (exchange_value), "r" (dest)
-                        : "memory");
-    return exchange_value;
-  }
-
-#endif // AMD64
-
-  inline jint _Atomic_xchg(jint exchange_value, volatile jint* dest) {
-    __asm__ __volatile__ ("xchgl (%2),%0"
-                          : "=r" (exchange_value)
-                        : "0" (exchange_value), "r" (dest)
-                        : "memory");
-    return exchange_value;
-  }
-
-  inline jint _Atomic_cmpxchg(jint exchange_value, volatile jint* dest, jint compare_value, int mp) {
-    __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgl %1,(%3)"
-                    : "=a" (exchange_value)
-                    : "r" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
-                    : "cc", "memory");
-    return exchange_value;
-  }
-
-
-  inline jbyte _Atomic_cmpxchg_byte(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, int mp) {
-    __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)"
-                    : "=a" (exchange_value)
-                    : "q" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
-                    : "cc", "memory");
-    return exchange_value;
-  }
-
-  // This is the interface to the atomic instruction in solaris_i486.s.
-  jlong _Atomic_cmpxchg_long_gcc(jlong exchange_value, volatile jlong* dest, jlong compare_value, int mp);
-
-  inline jlong _Atomic_cmpxchg_long(jlong exchange_value, volatile jlong* dest, jlong compare_value, int mp) {
-#ifdef AMD64
-    __asm__ __volatile__ (LOCK_IF_MP(%4) "cmpxchgq %1,(%3)"
-                        : "=a" (exchange_value)
-                        : "r" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
-                        : "cc", "memory");
-    return exchange_value;
-#else
-    return _Atomic_cmpxchg_long_gcc(exchange_value, dest, compare_value, os::is_MP());
-
-    #if 0
-    // The code below does not work presumably because of the bug in gcc
-    // The error message says:
-    //   can't find a register in class BREG while reloading asm
-    // However I want to save this code and later replace _Atomic_cmpxchg_long_gcc
-    // with such inline asm code:
-
-    volatile jlong_accessor evl, cvl, rv;
-    evl.long_value = exchange_value;
-    cvl.long_value = compare_value;
-    int mp = os::is_MP();
-
-    __asm__ volatile ("cmp $0, %%esi\n\t"
-       "je 1f \n\t"
-       "lock\n\t"
-       "1: cmpxchg8b (%%edi)\n\t"
-       : "=a"(cvl.words[0]),   "=d"(cvl.words[1])
-       : "a"(cvl.words[0]), "d"(cvl.words[1]),
-         "b"(evl.words[0]), "c"(evl.words[1]),
-         "D"(dest), "S"(mp)
-       :  "cc", "memory");
-    return cvl.long_value;
-    #endif // if 0
-#endif // AMD64
-  }
-}
-#undef LOCK_IF_MP
-
-#endif // _GNU_SOURCE
-
-#endif // OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_INLINE_HPP
--- a/hotspot/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 #ifndef OS_CPU_SOLARIS_X86_VM_ORDERACCESS_SOLARIS_X86_INLINE_HPP
 #define OS_CPU_SOLARIS_X86_VM_ORDERACCESS_SOLARIS_X86_INLINE_HPP
 
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/orderAccess.hpp"
 #include "runtime/os.hpp"
 
--- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -38,7 +38,7 @@
 #include "prims/jvm.h"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/extendedPC.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,303 @@
+/*
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_HPP
+#define OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_HPP
+
+#include "runtime/os.hpp"
+
+// The following alternative implementations are needed because
+// Windows 95 doesn't support (some of) the corresponding Windows NT
+// calls. Furthermore, these versions allow inlining in the caller.
+// (More precisely: The documentation for InterlockedExchange says
+// it is supported for Windows 95. However, when single-stepping
+// through the assembly code we cannot step into the routine and
+// when looking at the routine address we see only garbage code.
+// Better safe then sorry!). Was bug 7/31/98 (gri).
+//
+// Performance note: On uniprocessors, the 'lock' prefixes are not
+// necessary (and expensive). We should generate separate cases if
+// this becomes a performance problem.
+
+#pragma warning(disable: 4035) // Disables warnings reporting missing return statement
+
+inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
+inline void Atomic::store    (jshort   store_value, jshort*   dest) { *dest = store_value; }
+inline void Atomic::store    (jint     store_value, jint*     dest) { *dest = store_value; }
+
+inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
+inline void Atomic::store_ptr(void*    store_value, void*     dest) { *(void**)dest = store_value; }
+
+inline void Atomic::store    (jbyte    store_value, volatile jbyte*    dest) { *dest = store_value; }
+inline void Atomic::store    (jshort   store_value, volatile jshort*   dest) { *dest = store_value; }
+inline void Atomic::store    (jint     store_value, volatile jint*     dest) { *dest = store_value; }
+
+
+inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
+inline void Atomic::store_ptr(void*    store_value, volatile void*     dest) { *(void* volatile *)dest = store_value; }
+
+// Adding a lock prefix to an instruction on MP machine
+// VC++ doesn't like the lock prefix to be on a single line
+// so we can't insert a label after the lock prefix.
+// By emitting a lock prefix, we can define a label after it.
+#define LOCK_IF_MP(mp) __asm cmp mp, 0  \
+                       __asm je L0      \
+                       __asm _emit 0xF0 \
+                       __asm L0:
+
+#ifdef AMD64
+inline void Atomic::store    (jlong    store_value, jlong*    dest) { *dest = store_value; }
+inline void Atomic::store    (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
+
+inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
+  return (jint)(*os::atomic_add_func)(add_value, dest);
+}
+
+inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
+  return (intptr_t)(*os::atomic_add_ptr_func)(add_value, dest);
+}
+
+inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
+  return (void*)(*os::atomic_add_ptr_func)(add_value, (volatile intptr_t*)dest);
+}
+
+inline void Atomic::inc    (volatile jint*     dest) {
+  (void)add    (1, dest);
+}
+
+inline void Atomic::inc_ptr(volatile intptr_t* dest) {
+  (void)add_ptr(1, dest);
+}
+
+inline void Atomic::inc_ptr(volatile void*     dest) {
+  (void)add_ptr(1, dest);
+}
+
+inline void Atomic::dec    (volatile jint*     dest) {
+  (void)add    (-1, dest);
+}
+
+inline void Atomic::dec_ptr(volatile intptr_t* dest) {
+  (void)add_ptr(-1, dest);
+}
+
+inline void Atomic::dec_ptr(volatile void*     dest) {
+  (void)add_ptr(-1, dest);
+}
+
+inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
+  return (jint)(*os::atomic_xchg_func)(exchange_value, dest);
+}
+
+inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
+  return (intptr_t)(os::atomic_xchg_ptr_func)(exchange_value, dest);
+}
+
+inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
+  return (void *)(os::atomic_xchg_ptr_func)((intptr_t)exchange_value, (volatile intptr_t*)dest);
+}
+
+inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value, cmpxchg_memory_order order) {
+  return (*os::atomic_cmpxchg_func)(exchange_value, dest, compare_value);
+}
+
+#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline jbyte    Atomic::cmpxchg    (jbyte    exchange_value, volatile jbyte*    dest, jbyte    compare_value, cmpxchg_memory_order order) {
+    return (*os::atomic_cmpxchg_byte_func)(exchange_value, dest, compare_value);
+}
+
+inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
+  return (*os::atomic_cmpxchg_long_func)(exchange_value, dest, compare_value);
+}
+
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+  return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
+}
+
+inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
+  return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
+}
+
+inline jlong Atomic::load(volatile jlong* src) { return *src; }
+
+#else // !AMD64
+
+inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
+  int mp = os::is_MP();
+  __asm {
+    mov edx, dest;
+    mov eax, add_value;
+    mov ecx, eax;
+    LOCK_IF_MP(mp)
+    xadd dword ptr [edx], eax;
+    add eax, ecx;
+  }
+}
+
+inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
+  return (intptr_t)add((jint)add_value, (volatile jint*)dest);
+}
+
+inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
+  return (void*)add((jint)add_value, (volatile jint*)dest);
+}
+
+inline void Atomic::inc    (volatile jint*     dest) {
+  // alternative for InterlockedIncrement
+  int mp = os::is_MP();
+  __asm {
+    mov edx, dest;
+    LOCK_IF_MP(mp)
+    add dword ptr [edx], 1;
+  }
+}
+
+inline void Atomic::inc_ptr(volatile intptr_t* dest) {
+  inc((volatile jint*)dest);
+}
+
+inline void Atomic::inc_ptr(volatile void*     dest) {
+  inc((volatile jint*)dest);
+}
+
+inline void Atomic::dec    (volatile jint*     dest) {
+  // alternative for InterlockedDecrement
+  int mp = os::is_MP();
+  __asm {
+    mov edx, dest;
+    LOCK_IF_MP(mp)
+    sub dword ptr [edx], 1;
+  }
+}
+
+inline void Atomic::dec_ptr(volatile intptr_t* dest) {
+  dec((volatile jint*)dest);
+}
+
+inline void Atomic::dec_ptr(volatile void*     dest) {
+  dec((volatile jint*)dest);
+}
+
+inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
+  // alternative for InterlockedExchange
+  __asm {
+    mov eax, exchange_value;
+    mov ecx, dest;
+    xchg eax, dword ptr [ecx];
+  }
+}
+
+inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
+  return (intptr_t)xchg((jint)exchange_value, (volatile jint*)dest);
+}
+
+inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
+  return (void*)xchg((jint)exchange_value, (volatile jint*)dest);
+}
+
+#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline jbyte    Atomic::cmpxchg    (jbyte    exchange_value, volatile jbyte*    dest, jbyte    compare_value, cmpxchg_memory_order order) {
+  // alternative for InterlockedCompareExchange
+  int mp = os::is_MP();
+  __asm {
+    mov edx, dest
+    mov cl, exchange_value
+    mov al, compare_value
+    LOCK_IF_MP(mp)
+    cmpxchg byte ptr [edx], cl
+  }
+}
+
+inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value, cmpxchg_memory_order order) {
+  // alternative for InterlockedCompareExchange
+  int mp = os::is_MP();
+  __asm {
+    mov edx, dest
+    mov ecx, exchange_value
+    mov eax, compare_value
+    LOCK_IF_MP(mp)
+    cmpxchg dword ptr [edx], ecx
+  }
+}
+
+inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
+  int mp = os::is_MP();
+  jint ex_lo  = (jint)exchange_value;
+  jint ex_hi  = *( ((jint*)&exchange_value) + 1 );
+  jint cmp_lo = (jint)compare_value;
+  jint cmp_hi = *( ((jint*)&compare_value) + 1 );
+  __asm {
+    push ebx
+    push edi
+    mov eax, cmp_lo
+    mov edx, cmp_hi
+    mov edi, dest
+    mov ebx, ex_lo
+    mov ecx, ex_hi
+    LOCK_IF_MP(mp)
+    cmpxchg8b qword ptr [edi]
+    pop edi
+    pop ebx
+  }
+}
+
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+  return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
+}
+
+inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
+  return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
+}
+
+inline jlong Atomic::load(volatile jlong* src) {
+  volatile jlong dest;
+  volatile jlong* pdest = &dest;
+  __asm {
+    mov eax, src
+    fild     qword ptr [eax]
+    mov eax, pdest
+    fistp    qword ptr [eax]
+  }
+  return dest;
+}
+
+inline void Atomic::store(jlong store_value, volatile jlong* dest) {
+  volatile jlong* src = &store_value;
+  __asm {
+    mov eax, src
+    fild     qword ptr [eax]
+    mov eax, dest
+    fistp    qword ptr [eax]
+  }
+}
+
+inline void Atomic::store(jlong store_value, jlong* dest) {
+  Atomic::store(store_value, (volatile jlong*)dest);
+}
+
+#endif // AMD64
+
+#pragma warning(default: 4035) // Enables warnings reporting missing return statement
+
+#endif // OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_HPP
--- a/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,304 +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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_INLINE_HPP
-#define OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_INLINE_HPP
-
-#include "runtime/atomic.hpp"
-#include "runtime/os.hpp"
-
-// The following alternative implementations are needed because
-// Windows 95 doesn't support (some of) the corresponding Windows NT
-// calls. Furthermore, these versions allow inlining in the caller.
-// (More precisely: The documentation for InterlockedExchange says
-// it is supported for Windows 95. However, when single-stepping
-// through the assembly code we cannot step into the routine and
-// when looking at the routine address we see only garbage code.
-// Better safe then sorry!). Was bug 7/31/98 (gri).
-//
-// Performance note: On uniprocessors, the 'lock' prefixes are not
-// necessary (and expensive). We should generate separate cases if
-// this becomes a performance problem.
-
-#pragma warning(disable: 4035) // Disables warnings reporting missing return statement
-
-inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
-inline void Atomic::store    (jshort   store_value, jshort*   dest) { *dest = store_value; }
-inline void Atomic::store    (jint     store_value, jint*     dest) { *dest = store_value; }
-
-inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
-inline void Atomic::store_ptr(void*    store_value, void*     dest) { *(void**)dest = store_value; }
-
-inline void Atomic::store    (jbyte    store_value, volatile jbyte*    dest) { *dest = store_value; }
-inline void Atomic::store    (jshort   store_value, volatile jshort*   dest) { *dest = store_value; }
-inline void Atomic::store    (jint     store_value, volatile jint*     dest) { *dest = store_value; }
-
-
-inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
-inline void Atomic::store_ptr(void*    store_value, volatile void*     dest) { *(void* volatile *)dest = store_value; }
-
-// Adding a lock prefix to an instruction on MP machine
-// VC++ doesn't like the lock prefix to be on a single line
-// so we can't insert a label after the lock prefix.
-// By emitting a lock prefix, we can define a label after it.
-#define LOCK_IF_MP(mp) __asm cmp mp, 0  \
-                       __asm je L0      \
-                       __asm _emit 0xF0 \
-                       __asm L0:
-
-#ifdef AMD64
-inline void Atomic::store    (jlong    store_value, jlong*    dest) { *dest = store_value; }
-inline void Atomic::store    (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
-
-inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
-  return (jint)(*os::atomic_add_func)(add_value, dest);
-}
-
-inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
-  return (intptr_t)(*os::atomic_add_ptr_func)(add_value, dest);
-}
-
-inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
-  return (void*)(*os::atomic_add_ptr_func)(add_value, (volatile intptr_t*)dest);
-}
-
-inline void Atomic::inc    (volatile jint*     dest) {
-  (void)add    (1, dest);
-}
-
-inline void Atomic::inc_ptr(volatile intptr_t* dest) {
-  (void)add_ptr(1, dest);
-}
-
-inline void Atomic::inc_ptr(volatile void*     dest) {
-  (void)add_ptr(1, dest);
-}
-
-inline void Atomic::dec    (volatile jint*     dest) {
-  (void)add    (-1, dest);
-}
-
-inline void Atomic::dec_ptr(volatile intptr_t* dest) {
-  (void)add_ptr(-1, dest);
-}
-
-inline void Atomic::dec_ptr(volatile void*     dest) {
-  (void)add_ptr(-1, dest);
-}
-
-inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
-  return (jint)(*os::atomic_xchg_func)(exchange_value, dest);
-}
-
-inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
-  return (intptr_t)(os::atomic_xchg_ptr_func)(exchange_value, dest);
-}
-
-inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
-  return (void *)(os::atomic_xchg_ptr_func)((intptr_t)exchange_value, (volatile intptr_t*)dest);
-}
-
-inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value, cmpxchg_memory_order order) {
-  return (*os::atomic_cmpxchg_func)(exchange_value, dest, compare_value);
-}
-
-#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
-inline jbyte    Atomic::cmpxchg    (jbyte    exchange_value, volatile jbyte*    dest, jbyte    compare_value, cmpxchg_memory_order order) {
-    return (*os::atomic_cmpxchg_byte_func)(exchange_value, dest, compare_value);
-}
-
-inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
-  return (*os::atomic_cmpxchg_long_func)(exchange_value, dest, compare_value);
-}
-
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
-  return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
-}
-
-inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
-  return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
-}
-
-inline jlong Atomic::load(volatile jlong* src) { return *src; }
-
-#else // !AMD64
-
-inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
-  int mp = os::is_MP();
-  __asm {
-    mov edx, dest;
-    mov eax, add_value;
-    mov ecx, eax;
-    LOCK_IF_MP(mp)
-    xadd dword ptr [edx], eax;
-    add eax, ecx;
-  }
-}
-
-inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
-  return (intptr_t)add((jint)add_value, (volatile jint*)dest);
-}
-
-inline void*    Atomic::add_ptr(intptr_t add_value, volatile void*     dest) {
-  return (void*)add((jint)add_value, (volatile jint*)dest);
-}
-
-inline void Atomic::inc    (volatile jint*     dest) {
-  // alternative for InterlockedIncrement
-  int mp = os::is_MP();
-  __asm {
-    mov edx, dest;
-    LOCK_IF_MP(mp)
-    add dword ptr [edx], 1;
-  }
-}
-
-inline void Atomic::inc_ptr(volatile intptr_t* dest) {
-  inc((volatile jint*)dest);
-}
-
-inline void Atomic::inc_ptr(volatile void*     dest) {
-  inc((volatile jint*)dest);
-}
-
-inline void Atomic::dec    (volatile jint*     dest) {
-  // alternative for InterlockedDecrement
-  int mp = os::is_MP();
-  __asm {
-    mov edx, dest;
-    LOCK_IF_MP(mp)
-    sub dword ptr [edx], 1;
-  }
-}
-
-inline void Atomic::dec_ptr(volatile intptr_t* dest) {
-  dec((volatile jint*)dest);
-}
-
-inline void Atomic::dec_ptr(volatile void*     dest) {
-  dec((volatile jint*)dest);
-}
-
-inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
-  // alternative for InterlockedExchange
-  __asm {
-    mov eax, exchange_value;
-    mov ecx, dest;
-    xchg eax, dword ptr [ecx];
-  }
-}
-
-inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
-  return (intptr_t)xchg((jint)exchange_value, (volatile jint*)dest);
-}
-
-inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
-  return (void*)xchg((jint)exchange_value, (volatile jint*)dest);
-}
-
-#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
-inline jbyte    Atomic::cmpxchg    (jbyte    exchange_value, volatile jbyte*    dest, jbyte    compare_value, cmpxchg_memory_order order) {
-  // alternative for InterlockedCompareExchange
-  int mp = os::is_MP();
-  __asm {
-    mov edx, dest
-    mov cl, exchange_value
-    mov al, compare_value
-    LOCK_IF_MP(mp)
-    cmpxchg byte ptr [edx], cl
-  }
-}
-
-inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value, cmpxchg_memory_order order) {
-  // alternative for InterlockedCompareExchange
-  int mp = os::is_MP();
-  __asm {
-    mov edx, dest
-    mov ecx, exchange_value
-    mov eax, compare_value
-    LOCK_IF_MP(mp)
-    cmpxchg dword ptr [edx], ecx
-  }
-}
-
-inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value, cmpxchg_memory_order order) {
-  int mp = os::is_MP();
-  jint ex_lo  = (jint)exchange_value;
-  jint ex_hi  = *( ((jint*)&exchange_value) + 1 );
-  jint cmp_lo = (jint)compare_value;
-  jint cmp_hi = *( ((jint*)&compare_value) + 1 );
-  __asm {
-    push ebx
-    push edi
-    mov eax, cmp_lo
-    mov edx, cmp_hi
-    mov edi, dest
-    mov ebx, ex_lo
-    mov ecx, ex_hi
-    LOCK_IF_MP(mp)
-    cmpxchg8b qword ptr [edi]
-    pop edi
-    pop ebx
-  }
-}
-
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
-  return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
-}
-
-inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value, cmpxchg_memory_order order) {
-  return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
-}
-
-inline jlong Atomic::load(volatile jlong* src) {
-  volatile jlong dest;
-  volatile jlong* pdest = &dest;
-  __asm {
-    mov eax, src
-    fild     qword ptr [eax]
-    mov eax, pdest
-    fistp    qword ptr [eax]
-  }
-  return dest;
-}
-
-inline void Atomic::store(jlong store_value, volatile jlong* dest) {
-  volatile jlong* src = &store_value;
-  __asm {
-    mov eax, src
-    fild     qword ptr [eax]
-    mov eax, dest
-    fistp    qword ptr [eax]
-  }
-}
-
-inline void Atomic::store(jlong store_value, jlong* dest) {
-  Atomic::store(store_value, (volatile jlong*)dest);
-}
-
-#endif // AMD64
-
-#pragma warning(default: 4035) // Enables warnings reporting missing return statement
-
-#endif // OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_INLINE_HPP
--- a/hotspot/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #define OS_CPU_WINDOWS_X86_VM_ORDERACCESS_WINDOWS_X86_INLINE_HPP
 
 #include <intrin.h>
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/orderAccess.hpp"
 #include "runtime/os.hpp"
 
--- a/hotspot/src/share/vm/asm/assembler.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/asm/assembler.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #include "asm/codeBuffer.hpp"
 #include "asm/macroAssembler.hpp"
 #include "asm/macroAssembler.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/icache.hpp"
 #include "runtime/os.hpp"
 #include "runtime/thread.hpp"
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -4266,7 +4266,7 @@
 #if INCLUDE_TRACE
   EventCompilerInlining event;
   if (event.should_commit()) {
-    event.set_compileID(compilation()->env()->task()->compile_id());
+    event.set_compileId(compilation()->env()->task()->compile_id());
     event.set_message(msg);
     event.set_succeeded(success);
     event.set_bci(bci());
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -49,7 +49,7 @@
 #include "memory/resourceArea.hpp"
 #include "oops/objArrayKlass.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/interfaceSupport.hpp"
--- a/hotspot/src/share/vm/ci/ciEnv.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1149,10 +1149,10 @@
 
 void ciEnv::report_failure(const char* reason) {
   // Create and fire JFR event
-  EventCompilerFailure event;
+  EventCompilationFailure event;
   if (event.should_commit()) {
-    event.set_compileID(compile_id());
-    event.set_failure(reason);
+    event.set_compileId(compile_id());
+    event.set_failureMessage(reason);
     event.commit();
   }
 }
--- a/hotspot/src/share/vm/ci/ciMethod.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/ci/ciMethod.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1410,11 +1410,11 @@
 }
 
 #if INCLUDE_TRACE
-TraceStructCiMethod ciMethod::to_trace_struct() const {
-  TraceStructCiMethod result;
-  result.set_class(holder()->name()->as_utf8());
+TraceStructCalleeMethod ciMethod::to_trace_struct() const {
+  TraceStructCalleeMethod result;
+  result.set_type(holder()->name()->as_utf8());
   result.set_name(name()->as_utf8());
-  result.set_signature(signature()->as_symbol()->as_utf8());
+  result.set_descriptor(signature()->as_symbol()->as_utf8());
   return result;
 }
 #endif
--- a/hotspot/src/share/vm/ci/ciMethod.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/ci/ciMethod.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -342,7 +342,7 @@
   void print_short_name(outputStream* st = tty);
 
 #if INCLUDE_TRACE
-  TraceStructCiMethod to_trace_struct() const;
+  TraceStructCalleeMethod to_trace_struct() const;
 #endif
 };
 
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -5402,6 +5402,17 @@
   debug_only(ik->verify();)
 }
 
+static bool relax_format_check_for(ClassLoaderData* loader_data) {
+  bool trusted = (loader_data->is_the_null_class_loader_data() ||
+                  SystemDictionary::is_platform_class_loader(loader_data->class_loader()));
+  bool need_verify =
+    // verifyAll
+    (BytecodeVerificationLocal && BytecodeVerificationRemote) ||
+    // verifyRemote
+    (!BytecodeVerificationLocal && BytecodeVerificationRemote && !trusted);
+  return !need_verify;
+}
+
 ClassFileParser::ClassFileParser(ClassFileStream* stream,
                                  Symbol* name,
                                  ClassLoaderData* loader_data,
@@ -5490,7 +5501,7 @@
 
   // Check if verification needs to be relaxed for this class file
   // Do not restrict it to jdk1.0 or jdk1.1 to maintain backward compatibility (4982376)
-  _relax_verify = Verifier::relax_verify_for(_loader_data->class_loader());
+  _relax_verify = relax_format_check_for(_loader_data);
 
   parse_stream(stream, CHECK);
 
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -63,7 +63,7 @@
 #include "memory/resourceArea.hpp"
 #include "oops/objArrayOop.inline.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/javaCalls.hpp"
 #include "runtime/jniHandles.hpp"
 #include "runtime/mutex.hpp"
--- a/hotspot/src/share/vm/classfile/klassFactory.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/classfile/klassFactory.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -31,12 +31,12 @@
 #include "prims/jvmtiEnvBase.hpp"
 #include "trace/traceMacros.hpp"
 
-static ClassFileStream* prologue(ClassFileStream* stream,
-                                 Symbol* name,
-                                 ClassLoaderData* loader_data,
-                                 Handle protection_domain,
-                                 JvmtiCachedClassFileData** cached_class_file,
-                                 TRAPS) {
+static ClassFileStream* check_class_file_load_hook(ClassFileStream* stream,
+                                                   Symbol* name,
+                                                   ClassLoaderData* loader_data,
+                                                   Handle protection_domain,
+                                                   JvmtiCachedClassFileData** cached_class_file,
+                                                   TRAPS) {
 
   assert(stream != NULL, "invariant");
 
@@ -102,8 +102,6 @@
   assert(loader_data != NULL, "invariant");
   assert(THREAD->is_Java_thread(), "must be a JavaThread");
 
-  bool changed_by_loadhook = false;
-
   ResourceMark rm;
   HandleMark hm;
 
@@ -111,12 +109,15 @@
 
   ClassFileStream* old_stream = stream;
 
-  stream = prologue(stream,
-                    name,
-                    loader_data,
-                    protection_domain,
-                    &cached_class_file,
-                    CHECK_NULL);
+  // Skip this processing for VM anonymous classes
+  if (host_klass == NULL) {
+    stream = check_class_file_load_hook(stream,
+                                        name,
+                                        loader_data,
+                                        protection_domain,
+                                        &cached_class_file,
+                                        CHECK_NULL);
+  }
 
   ClassFileParser parser(stream,
                          name,
--- a/hotspot/src/share/vm/classfile/stringTable.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/classfile/stringTable.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -34,7 +34,7 @@
 #include "memory/filemap.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "utilities/hashtable.inline.hpp"
 #include "utilities/macros.hpp"
--- a/hotspot/src/share/vm/classfile/symbolTable.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/classfile/symbolTable.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -34,7 +34,7 @@
 #include "memory/filemap.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "utilities/hashtable.inline.hpp"
 
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1641,7 +1641,6 @@
       JvmtiExport::post_class_load((JavaThread *) THREAD, k());
 
   }
-  TRACE_KLASS_DEFINITION(k, THREAD);
   class_define_event(k);
 }
 
--- a/hotspot/src/share/vm/classfile/verifier.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/classfile/verifier.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -88,7 +88,7 @@
     BytecodeVerificationLocal : BytecodeVerificationRemote;
 }
 
-bool Verifier::relax_verify_for(oop loader) {
+bool Verifier::relax_access_for(oop loader) {
   bool trusted = java_lang_ClassLoader::is_trusted_loader(loader);
   bool need_verify =
     // verifyAll
--- a/hotspot/src/share/vm/classfile/verifier.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/classfile/verifier.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -58,8 +58,8 @@
   // -Xverify:all/none override this value
   static bool should_verify_for(oop class_loader, bool should_verify_class);
 
-  // Relax certain verifier checks to enable some broken 1.1 apps to run on 1.2.
-  static bool relax_verify_for(oop class_loader);
+  // Relax certain access checks to enable some broken 1.1 apps to run on 1.2.
+  static bool relax_access_for(oop class_loader);
 
   // Print output for class+resolve
   static void trace_class_resolution(Klass* resolve_class, InstanceKlass* verify_class);
--- a/hotspot/src/share/vm/code/nmethod.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -41,7 +41,7 @@
 #include "oops/methodData.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiImpl.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/os.hpp"
 #include "runtime/sharedRuntime.hpp"
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -42,7 +42,7 @@
 #include "prims/nativeLookup.hpp"
 #include "prims/whitebox.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/init.hpp"
 #include "runtime/interfaceSupport.hpp"
@@ -1755,7 +1755,7 @@
   assert(task->compile_id() != CICrashAt, "just as planned");
   if (event.should_commit()) {
     event.set_method(task->method());
-    event.set_compileID(task->compile_id());
+    event.set_compileId(task->compile_id());
     event.set_compileLevel(task->comp_level());
     event.set_succeded(task->is_success());
     event.set_isOsr(task->osr_bci() != CompileBroker::standard_entry_bci);
@@ -2399,4 +2399,3 @@
     }
   }
 }
-
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -61,7 +61,7 @@
 #include "memory/resourceArea.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiExport.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/globals_extension.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/java.hpp"
--- a/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -50,7 +50,7 @@
 #include "memory/resourceArea.hpp"
 #include "oops/objArrayOop.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/handles.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/java.hpp"
--- a/hotspot/src/share/vm/gc/g1/collectionSetChooser.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/collectionSetChooser.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -26,7 +26,7 @@
 #include "gc/g1/collectionSetChooser.hpp"
 #include "gc/g1/g1CollectedHeap.inline.hpp"
 #include "gc/shared/space.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.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/g1/dirtyCardQueue.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -27,7 +27,7 @@
 #include "gc/g1/g1CollectedHeap.inline.hpp"
 #include "gc/g1/heapRegionRemSet.hpp"
 #include "gc/shared/workgroup.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/safepoint.hpp"
 #include "runtime/thread.inline.hpp"
--- a/hotspot/src/share/vm/gc/g1/g1Analytics.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1Analytics.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -316,14 +316,10 @@
   return get_new_size_prediction(_pending_cards_seq);
 }
 
-double G1Analytics::oldest_known_gc_end_time_sec() const {
+double G1Analytics::last_known_gc_end_time_sec() const {
   return _recent_prev_end_times_for_all_gcs_sec->oldest();
 }
 
-double G1Analytics::last_known_gc_end_time_sec() const {
-  return _recent_prev_end_times_for_all_gcs_sec->last();
-}
-
 void G1Analytics::update_recent_gc_times(double end_time_sec,
                                          double pause_time_ms) {
   _recent_gc_times_ms->add(pause_time_ms);
--- a/hotspot/src/share/vm/gc/g1/g1Analytics.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1Analytics.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -155,7 +155,6 @@
   void update_recent_gc_times(double end_time_sec, double elapsed_ms);
   void compute_pause_time_ratio(double interval_ms, double pause_time_ms);
 
-  double oldest_known_gc_end_time_sec() const;
   double last_known_gc_end_time_sec() const;
 };
 
--- a/hotspot/src/share/vm/gc/g1/g1CardLiveData.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1CardLiveData.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -30,7 +30,7 @@
 #include "gc/shared/workgroup.hpp"
 #include "logging/log.hpp"
 #include "memory/universe.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/os.hpp"
 #include "utilities/bitMap.inline.hpp"
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -28,7 +28,6 @@
 #include "classfile/symbolTable.hpp"
 #include "code/codeCache.hpp"
 #include "code/icBuffer.hpp"
-#include "gc/g1/g1Analytics.hpp"
 #include "gc/g1/bufferingOopClosure.hpp"
 #include "gc/g1/concurrentG1Refine.hpp"
 #include "gc/g1/concurrentG1RefineThread.hpp"
@@ -75,7 +74,7 @@
 #include "memory/iterator.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/init.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/vmThread.hpp"
@@ -2474,19 +2473,8 @@
 }
 
 jlong G1CollectedHeap::millis_since_last_gc() {
-  jlong now = os::elapsed_counter() / NANOSECS_PER_MILLISEC;
-  const G1Analytics* analytics = _g1_policy->analytics();
-  double last = analytics->last_known_gc_end_time_sec();
-  jlong ret_val = now - (last * 1000);
-  if (ret_val < 0) {
-    // See the notes in GenCollectedHeap::millis_since_last_gc()
-    // for more information about the implementation.
-    log_warning(gc)("Detected clock going backwards. "
-      "Milliseconds since last GC would be " JLONG_FORMAT
-      ". returning zero instead.", ret_val);
-    return 0;
-  }
-  return ret_val;
+  // assert(false, "NYI");
+  return 0;
 }
 
 void G1CollectedHeap::prepare_for_verify() {
--- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -52,7 +52,7 @@
 #include "memory/allocation.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/java.hpp"
 #include "runtime/prefetch.inline.hpp"
--- a/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -604,7 +604,7 @@
     _analytics->report_alloc_rate_ms(alloc_rate_ms);
 
     double interval_ms =
-      (end_time_sec - _analytics->oldest_known_gc_end_time_sec()) * 1000.0;
+      (end_time_sec - _analytics->last_known_gc_end_time_sec()) * 1000.0;
     _analytics->update_recent_gc_times(end_time_sec, pause_time_ms);
     _analytics->compute_pause_time_ratio(interval_ms, pause_time_ms);
   }
--- a/hotspot/src/share/vm/gc/g1/g1EvacStats.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1EvacStats.inline.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #define SHARE_VM_GC_G1_G1EVACSTATS_INLINE_HPP
 
 #include "gc/g1/g1EvacStats.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 
 inline void G1EvacStats::add_direct_allocated(size_t value) {
   Atomic::add_ptr(value, &_direct_allocated);
--- a/hotspot/src/share/vm/gc/g1/g1HotCardCache.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1HotCardCache.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #include "gc/g1/dirtyCardQueue.hpp"
 #include "gc/g1/g1CollectedHeap.inline.hpp"
 #include "gc/g1/g1HotCardCache.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 
 G1HotCardCache::G1HotCardCache(G1CollectedHeap *g1h):
   _g1h(g1h), _hot_cache(NULL), _use_cache(false), _card_counts(g1h) {}
--- a/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,7 +45,7 @@
 #include "oops/instanceRefKlass.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiExport.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/fprofiler.hpp"
 #include "runtime/synchronizer.hpp"
--- a/hotspot/src/share/vm/gc/g1/g1SATBCardTableModRefBS.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1SATBCardTableModRefBS.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -30,7 +30,7 @@
 #include "gc/shared/memset_with_concurrent_readers.hpp"
 #include "logging/log.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/thread.inline.hpp"
--- a/hotspot/src/share/vm/gc/g1/g1StringDedup.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1StringDedup.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -31,7 +31,7 @@
 #include "gc/g1/g1StringDedupStat.hpp"
 #include "gc/g1/g1StringDedupTable.hpp"
 #include "gc/g1/g1StringDedupThread.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 
 bool G1StringDedup::_enabled = false;
 
--- a/hotspot/src/share/vm/gc/g1/g1StringDedup.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1StringDedup.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -84,7 +84,6 @@
 
 #include "memory/allocation.hpp"
 #include "oops/oop.hpp"
-#include "runtime/atomic.hpp"
 
 class OopClosure;
 class BoolObjectClosure;
--- a/hotspot/src/share/vm/gc/g1/g1StringDedupQueue.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1StringDedupQueue.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -30,7 +30,7 @@
 #include "gc/shared/gcLocker.hpp"
 #include "logging/log.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "utilities/stack.inline.hpp"
 
--- a/hotspot/src/share/vm/gc/g1/g1StringDedupThread.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1StringDedupThread.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -31,7 +31,7 @@
 #include "gc/g1/suspendibleThreadSet.hpp"
 #include "logging/log.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 
 G1StringDedupThread* G1StringDedupThread::_thread = NULL;
 
--- a/hotspot/src/share/vm/gc/g1/heapRegion.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/heapRegion.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -39,7 +39,7 @@
 #include "memory/iterator.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/orderAccess.inline.hpp"
 
 int    HeapRegion::LogOfHRGrainBytes = 0;
--- a/hotspot/src/share/vm/gc/g1/heapRegion.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/heapRegion.inline.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -30,7 +30,7 @@
 #include "gc/g1/heapRegion.hpp"
 #include "gc/shared/space.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 
 inline HeapWord* G1ContiguousSpace::allocate_impl(size_t min_word_size,
                                                   size_t desired_word_size,
--- a/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -33,7 +33,7 @@
 #include "memory/allocation.hpp"
 #include "memory/padded.inline.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "utilities/bitMap.inline.hpp"
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/growableArray.hpp"
--- a/hotspot/src/share/vm/gc/g1/heapRegionTracer.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/heapRegionTracer.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -39,7 +39,7 @@
     e.set_to(to);
     e.set_start(start);
     e.set_used(used);
-    e.set_allocContext(allocationContext);
+    e.set_allocationContext(allocationContext);
     e.commit();
   }
 }
--- a/hotspot/src/share/vm/gc/g1/sparsePRT.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/sparsePRT.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -30,7 +30,7 @@
 #include "gc/shared/cardTableModRefBS.hpp"
 #include "gc/shared/space.inline.hpp"
 #include "memory/allocation.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/mutexLocker.hpp"
 
 // Check that the size of the SparsePRTEntry is evenly divisible by the maximum
--- a/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -30,7 +30,7 @@
 #include "memory/allocation.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/handles.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/os.hpp"
--- a/hotspot/src/share/vm/gc/parallel/mutableNUMASpace.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/parallel/mutableNUMASpace.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,6 +1,5 @@
-
 /*
- * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +27,7 @@
 #include "gc/shared/collectedHeap.hpp"
 #include "gc/shared/spaceDecorator.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/thread.inline.hpp"
 
 MutableNUMASpace::MutableNUMASpace(size_t alignment) : MutableSpace(alignment) {
--- a/hotspot/src/share/vm/gc/parallel/mutableSpace.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/parallel/mutableSpace.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #include "gc/parallel/mutableSpace.hpp"
 #include "gc/shared/spaceDecorator.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/safepoint.hpp"
 #include "runtime/thread.hpp"
 #include "utilities/macros.hpp"
--- a/hotspot/src/share/vm/gc/parallel/parMarkBitMap.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/parallel/parMarkBitMap.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -27,7 +27,7 @@
 #include "gc/parallel/psCompactionManager.inline.hpp"
 #include "gc/parallel/psParallelCompact.inline.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/os.hpp"
 #include "services/memTracker.hpp"
 #include "utilities/bitMap.inline.hpp"
--- a/hotspot/src/share/vm/gc/parallel/psCompactionManager.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/parallel/psCompactionManager.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -38,7 +38,7 @@
 #include "oops/instanceMirrorKlass.inline.hpp"
 #include "oops/objArrayKlass.inline.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 
 PSOldGen*            ParCompactionManager::_old_gen = NULL;
 ParCompactionManager**  ParCompactionManager::_manager_array = NULL;
--- a/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -57,7 +57,7 @@
 #include "oops/methodData.hpp"
 #include "oops/objArrayKlass.inline.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/fprofiler.hpp"
 #include "runtime/safepoint.hpp"
 #include "runtime/vmThread.hpp"
--- a/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -46,7 +46,7 @@
 #include "memory/resourceArea.hpp"
 #include "oops/instanceRefKlass.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/java.hpp"
 #include "runtime/prefetch.inline.hpp"
 #include "runtime/thread.inline.hpp"
--- a/hotspot/src/share/vm/gc/shared/allocTracer.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/shared/allocTracer.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -29,18 +29,18 @@
 #include "utilities/globalDefinitions.hpp"
 
 void AllocTracer::send_allocation_outside_tlab_event(KlassHandle klass, size_t alloc_size) {
-  EventAllocObjectOutsideTLAB event;
+  EventObjectAllocationOutsideTLAB event;
   if (event.should_commit()) {
-    event.set_class(klass());
+    event.set_objectClass(klass());
     event.set_allocationSize(alloc_size);
     event.commit();
   }
 }
 
 void AllocTracer::send_allocation_in_new_tlab_event(KlassHandle klass, size_t tlab_size, size_t alloc_size) {
-  EventAllocObjectInNewTLAB event;
+  EventObjectAllocationInNewTLAB event;
   if (event.should_commit()) {
-    event.set_class(klass());
+    event.set_objectClass(klass());
     event.set_allocationSize(alloc_size);
     event.set_tlabSize(tlab_size);
     event.commit();
--- a/hotspot/src/share/vm/gc/shared/cardTableRS.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/shared/cardTableRS.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -29,7 +29,7 @@
 #include "gc/shared/space.inline.hpp"
 #include "memory/allocation.inline.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/java.hpp"
 #include "runtime/os.hpp"
 #include "utilities/macros.hpp"
--- a/hotspot/src/share/vm/gc/shared/gcLocker.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/shared/gcLocker.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
 #include "gc/shared/gcLocker.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "logging/log.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/thread.inline.hpp"
 
 volatile jint GCLocker::_jni_lock_count = 0;
--- a/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -43,7 +43,7 @@
 typedef uintptr_t TraceAddress;
 
 void GCTracer::send_garbage_collection_event() const {
-  EventGCGarbageCollection event(UNTIMED);
+  EventGarbageCollection event(UNTIMED);
   if (event.should_commit()) {
     event.set_gcId(GCId::current());
     event.set_name(_shared_gc_info.name());
@@ -91,7 +91,7 @@
 }
 
 void ParallelOldTracer::send_parallel_old_event() const {
-  EventGCParallelOld e(UNTIMED);
+  EventParallelOldGarbageCollection e(UNTIMED);
   if (e.should_commit()) {
     e.set_gcId(GCId::current());
     e.set_densePrefix((TraceAddress)_parallel_old_gc_info.dense_prefix());
@@ -102,7 +102,7 @@
 }
 
 void YoungGCTracer::send_young_gc_event() const {
-  EventGCYoungGarbageCollection e(UNTIMED);
+  EventYoungGarbageCollection e(UNTIMED);
   if (e.should_commit()) {
     e.set_gcId(GCId::current());
     e.set_tenuringThreshold(_tenuring_threshold);
@@ -127,7 +127,7 @@
   EventPromoteObjectInNewPLAB event;
   if (event.should_commit()) {
     event.set_gcId(GCId::current());
-    event.set_class(klass);
+    event.set_objectClass(klass);
     event.set_objectSize(obj_size);
     event.set_tenured(tenured);
     event.set_tenuringAge(age);
@@ -142,7 +142,7 @@
   EventPromoteObjectOutsidePLAB event;
   if (event.should_commit()) {
     event.set_gcId(GCId::current());
-    event.set_class(klass);
+    event.set_objectClass(klass);
     event.set_objectSize(obj_size);
     event.set_tenured(tenured);
     event.set_tenuringAge(age);
@@ -151,7 +151,7 @@
 }
 
 void OldGCTracer::send_old_gc_event() const {
-  EventGCOldGarbageCollection e(UNTIMED);
+  EventOldGarbageCollection e(UNTIMED);
   if (e.should_commit()) {
     e.set_gcId(GCId::current());
     e.set_starttime(_shared_gc_info.start_timestamp());
@@ -173,7 +173,7 @@
   EventPromotionFailed e;
   if (e.should_commit()) {
     e.set_gcId(GCId::current());
-    e.set_data(to_trace_struct(pf_info));
+    e.set_promotionFailed(to_trace_struct(pf_info));
     e.set_thread(pf_info.thread_trace_id());
     e.commit();
   }
@@ -190,7 +190,7 @@
 
 #if INCLUDE_ALL_GCS
 void G1NewTracer::send_g1_young_gc_event() {
-  EventGCG1GarbageCollection e(UNTIMED);
+  EventG1GarbageCollection e(UNTIMED);
   if (e.should_commit()) {
     e.set_gcId(GCId::current());
     e.set_type(_g1_young_gc_info.type());
@@ -201,7 +201,7 @@
 }
 
 void G1MMUTracer::send_g1_mmu_event(double timeSlice, double gcTime, double maxTime) {
-  EventGCG1MMU e;
+  EventG1MMU e;
   if (e.should_commit()) {
     e.set_gcId(GCId::current());
     e.set_timeSlice(timeSlice);
@@ -212,15 +212,15 @@
 }
 
 void G1NewTracer::send_evacuation_info_event(EvacuationInfo* info) {
-  EventEvacuationInfo e;
+  EventEvacuationInformation e;
   if (e.should_commit()) {
     e.set_gcId(GCId::current());
     e.set_cSetRegions(info->collectionset_regions());
     e.set_cSetUsedBefore(info->collectionset_used_before());
     e.set_cSetUsedAfter(info->collectionset_used_after());
     e.set_allocationRegions(info->allocation_regions());
-    e.set_allocRegionsUsedBefore(info->alloc_regions_used_before());
-    e.set_allocRegionsUsedAfter(info->alloc_regions_used_before() + info->bytes_copied());
+    e.set_allocationRegionsUsedBefore(info->alloc_regions_used_before());
+    e.set_allocationRegionsUsedAfter(info->alloc_regions_used_before() + info->bytes_copied());
     e.set_bytesCopied(info->bytes_copied());
     e.set_regionsFreed(info->regions_freed());
     e.commit();
@@ -231,13 +231,14 @@
   EventEvacuationFailed e;
   if (e.should_commit()) {
     e.set_gcId(GCId::current());
-    e.set_data(to_trace_struct(ef_info));
+    e.set_evacuationFailed(to_trace_struct(ef_info));
     e.commit();
   }
 }
 
-static TraceStructG1EvacStats create_g1_evacstats(unsigned gcid, const G1EvacSummary& summary) {
-  TraceStructG1EvacStats s;
+static TraceStructG1EvacuationStatistics
+create_g1_evacstats(unsigned gcid, const G1EvacSummary& summary) {
+  TraceStructG1EvacuationStatistics s;
   s.set_gcId(gcid);
   s.set_allocated(summary.allocated() * HeapWordSize);
   s.set_wasted(summary.wasted() * HeapWordSize);
@@ -252,17 +253,17 @@
 }
 
 void G1NewTracer::send_young_evacuation_statistics(const G1EvacSummary& summary) const {
-  EventGCG1EvacuationYoungStatistics surv_evt;
+  EventG1EvacuationYoungStatistics surv_evt;
   if (surv_evt.should_commit()) {
-    surv_evt.set_stats(create_g1_evacstats(GCId::current(), summary));
+    surv_evt.set_statistics(create_g1_evacstats(GCId::current(), summary));
     surv_evt.commit();
   }
 }
 
 void G1NewTracer::send_old_evacuation_statistics(const G1EvacSummary& summary) const {
-  EventGCG1EvacuationOldStatistics old_evt;
+  EventG1EvacuationOldStatistics old_evt;
   if (old_evt.should_commit()) {
-    old_evt.set_stats(create_g1_evacstats(GCId::current(), summary));
+    old_evt.set_statistics(create_g1_evacstats(GCId::current(), summary));
     old_evt.commit();
   }
 }
@@ -273,7 +274,7 @@
                                              size_t last_allocation_size,
                                              double last_allocation_duration,
                                              double last_marking_length) {
-  EventGCG1BasicIHOP evt;
+  EventG1BasicIHOP evt;
   if (evt.should_commit()) {
     evt.set_gcId(GCId::current());
     evt.set_threshold(threshold);
@@ -295,7 +296,7 @@
                                                 double predicted_allocation_rate,
                                                 double predicted_marking_length,
                                                 bool prediction_active) {
-  EventGCG1AdaptiveIHOP evt;
+  EventG1AdaptiveIHOP evt;
   if (evt.should_commit()) {
     evt.set_gcId(GCId::current());
     evt.set_threshold(threshold);
--- a/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1256,21 +1256,21 @@
 };
 
 jlong GenCollectedHeap::millis_since_last_gc() {
-  // javaTimeNanos() is guaranteed to be monotonically non-decreasing
-  // provided the underlying platform provides such a time source
-  // (and it is bug free). So we still have to guard against getting
-  // back a time later than 'now'.
+  // We need a monotonically non-decreasing time in ms but
+  // os::javaTimeMillis() does not guarantee monotonicity.
   jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
   GenTimeOfLastGCClosure tolgc_cl(now);
   // iterate over generations getting the oldest
   // time that a generation was collected
   generation_iterate(&tolgc_cl, false);
 
+  // javaTimeNanos() is guaranteed to be monotonically non-decreasing
+  // provided the underlying platform provides such a time source
+  // (and it is bug free). So we still have to guard against getting
+  // back a time later than 'now'.
   jlong retVal = now - tolgc_cl.time();
   if (retVal < 0) {
-    log_warning(gc)("Detected clock going backwards. "
-      "Milliseconds since last GC would be " JLONG_FORMAT
-      ". returning zero instead.", retVal);
+    NOT_PRODUCT(log_warning(gc)("time warp: " JLONG_FORMAT, retVal);)
     return 0;
   }
   return retVal;
--- a/hotspot/src/share/vm/gc/shared/objectCountEventSender.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/shared/objectCountEventSender.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -40,7 +40,7 @@
 
   EventObjectCountAfterGC event(UNTIMED);
   event.set_gcId(GCId::current());
-  event.set_class(entry->klass());
+  event.set_objectClass(entry->klass());
   event.set_count(entry->count());
   event.set_totalSize(entry->words() * BytesPerWord);
   event.set_endtime(timestamp);
--- a/hotspot/src/share/vm/gc/shared/plab.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/shared/plab.inline.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
 #include "gc/shared/collectedHeap.inline.hpp"
 #include "gc/shared/plab.hpp"
 #include "memory/allocation.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 
 inline HeapWord* PLAB::allocate_aligned(size_t word_sz, unsigned short alignment_in_bytes) {
   HeapWord* res = CollectedHeap::align_allocation_or_fail(_top, _end, alignment_in_bytes);
--- a/hotspot/src/share/vm/gc/shared/space.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/shared/space.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,7 @@
 #include "gc/shared/spaceDecorator.hpp"
 #include "memory/universe.inline.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/java.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/prefetch.inline.hpp"
--- a/hotspot/src/share/vm/gc/shared/taskqueue.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/shared/taskqueue.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #include "gc/shared/taskqueue.hpp"
 #include "oops/oop.inline.hpp"
 #include "logging/log.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/os.hpp"
 #include "runtime/thread.inline.hpp"
 #include "utilities/debug.hpp"
--- a/hotspot/src/share/vm/gc/shared/taskqueue.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/shared/taskqueue.inline.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
 #include "gc/shared/taskqueue.hpp"
 #include "memory/allocation.inline.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "utilities/debug.hpp"
 #include "utilities/stack.inline.hpp"
--- a/hotspot/src/share/vm/gc/shared/workgroup.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/gc/shared/workgroup.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -28,7 +28,7 @@
 #include "gc/shared/workerManager.hpp"
 #include "memory/allocation.hpp"
 #include "memory/allocation.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/os.hpp"
 #include "runtime/semaphore.hpp"
 #include "runtime/thread.inline.hpp"
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -39,7 +39,7 @@
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "prims/jvmtiThreadState.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/handles.inline.hpp"
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -48,7 +48,7 @@
 #include "oops/symbol.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "prims/nativeLookup.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/deoptimization.hpp"
--- a/hotspot/src/share/vm/logging/logDecorations.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/logging/logDecorations.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -53,10 +53,6 @@
 
   LogDecorations(LogLevelType level, const LogTagSet& tagset, const LogDecorators& decorators);
 
-  LogLevelType level() const {
-    return _level;
-  }
-
   void set_level(LogLevelType level) {
     _level = level;
   }
--- a/hotspot/src/share/vm/logging/logOutputList.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/logging/logOutputList.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 #include "logging/logLevel.hpp"
 #include "logging/logOutputList.hpp"
 #include "memory/allocation.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "utilities/globalDefinitions.hpp"
 
--- a/hotspot/src/share/vm/logging/logOutputList.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/logging/logOutputList.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
 
 #include "logging/logLevel.hpp"
 #include "memory/allocation.hpp"
-#include "runtime/atomic.hpp"
 #include "utilities/globalDefinitions.hpp"
 
 class LogOutput;
@@ -61,6 +60,11 @@
   void add_output(LogOutput* output, LogLevelType level);
   void update_output_level(LogOutputNode* node, LogLevelType level);
 
+  // Bookkeeping functions to keep track of number of active readers/iterators for the list.
+  jint increase_readers();
+  jint decrease_readers();
+  void wait_until_no_readers() const;
+
  public:
   LogOutputList() : _active_readers(0) {
     for (size_t i = 0; i < LogLevel::Count; i++) {
@@ -84,11 +88,6 @@
   // Set (add/update/remove) the output to the specified level.
   void set_output_level(LogOutput* output, LogLevelType level);
 
-  // Bookkeeping functions to keep track of number of active readers/iterators for the list.
-  jint increase_readers();
-  jint decrease_readers();
-  void wait_until_no_readers() const;
-
   class Iterator VALUE_OBJ_CLASS_SPEC {
     friend class LogOutputList;
    private:
--- a/hotspot/src/share/vm/memory/allocation.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/memory/allocation.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
 #include "memory/metaspaceShared.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/os.hpp"
 #include "runtime/task.hpp"
 #include "runtime/threadCritical.hpp"
--- a/hotspot/src/share/vm/memory/allocation.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/memory/allocation.inline.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 #ifndef SHARE_VM_MEMORY_ALLOCATION_INLINE_HPP
 #define SHARE_VM_MEMORY_ALLOCATION_INLINE_HPP
 
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/os.hpp"
 #include "services/memTracker.hpp"
 #include "utilities/globalDefinitions.hpp"
--- a/hotspot/src/share/vm/memory/metaspace.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -37,7 +37,7 @@
 #include "memory/metaspaceTracer.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/init.hpp"
 #include "runtime/java.hpp"
--- a/hotspot/src/share/vm/memory/universe.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/memory/universe.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -56,7 +56,7 @@
 #include "oops/oop.inline.hpp"
 #include "oops/typeArrayKlass.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/commandLineFlagConstraintList.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/fprofiler.hpp"
@@ -1129,8 +1129,6 @@
       verify_flags |= Verify_MetaspaceAux;
     } else if (strcmp(token, "jni_handles") == 0) {
       verify_flags |= Verify_JNIHandles;
-    } else if (strcmp(token, "c-heap") == 0) {
-      verify_flags |= Verify_CHeap;
     } else if (strcmp(token, "codecache_oops") == 0) {
       verify_flags |= Verify_CodeCacheOops;
     } else {
@@ -1208,10 +1206,6 @@
     log_debug(gc, verify)("JNIHandles");
     JNIHandles::verify();
   }
-  if (should_verify_subset(Verify_CHeap)) {
-    log_debug(gc, verify)("C-heap");
-    os::check_heap();
-  }
   if (should_verify_subset(Verify_CodeCacheOops)) {
     log_debug(gc, verify)("CodeCache Oops");
     CodeCache::verify_oops();
--- a/hotspot/src/share/vm/memory/universe.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/memory/universe.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -480,8 +480,7 @@
     Verify_ClassLoaderDataGraph = 64,
     Verify_MetaspaceAux = 128,
     Verify_JNIHandles = 256,
-    Verify_CHeap = 512,
-    Verify_CodeCacheOops = 1024,
+    Verify_CodeCacheOops = 512,
     Verify_All = -1
   };
   static void initialize_verify_flags();
--- a/hotspot/src/share/vm/oops/compiledICHolder.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/oops/compiledICHolder.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #include "oops/compiledICHolder.hpp"
 #include "oops/klass.hpp"
 #include "oops/method.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 
 volatile int CompiledICHolder::_live_count;
 volatile int CompiledICHolder::_live_not_claimed_count;
--- a/hotspot/src/share/vm/oops/cpCache.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/oops/cpCache.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -32,7 +32,7 @@
 #include "oops/objArrayOop.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/methodHandles.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "utilities/macros.hpp"
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -56,7 +56,7 @@
 #include "prims/jvmtiRedefineClasses.hpp"
 #include "prims/jvmtiThreadState.hpp"
 #include "prims/methodComparator.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/fieldDescriptor.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/javaCalls.hpp"
--- a/hotspot/src/share/vm/oops/klass.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/oops/klass.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -36,7 +36,7 @@
 #include "oops/instanceKlass.hpp"
 #include "oops/klass.inline.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "trace/traceMacros.hpp"
 #include "utilities/macros.hpp"
--- a/hotspot/src/share/vm/oops/oop.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/oops/oop.inline.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -36,7 +36,7 @@
 #include "oops/klass.inline.hpp"
 #include "oops/markOop.inline.hpp"
 #include "oops/oop.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/os.hpp"
 #include "utilities/macros.hpp"
--- a/hotspot/src/share/vm/oops/symbol.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/oops/symbol.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -29,7 +29,7 @@
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/symbol.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/os.hpp"
 
 Symbol::Symbol(const u1* name, int length, int refcount) {
@@ -229,24 +229,25 @@
 }
 
 void Symbol::increment_refcount() {
-  // Only increment the refcount if positive.  If negative either
+  // Only increment the refcount if non-negative.  If negative either
   // overflow has occurred or it is a permanent symbol in a read only
   // shared archive.
-  if (_refcount >= 0) {
+  if (_refcount >= 0) { // not a permanent symbol
     Atomic::inc(&_refcount);
     NOT_PRODUCT(Atomic::inc(&_total_count);)
   }
 }
 
 void Symbol::decrement_refcount() {
-  if (_refcount >= 0) {
-    Atomic::dec(&_refcount);
+  if (_refcount >= 0) { // not a permanent symbol
+    jshort new_value = Atomic::add(-1, &_refcount);
 #ifdef ASSERT
-    if (_refcount < 0) {
+    if (new_value == -1) { // we have transitioned from 0 -> -1
       print();
       assert(false, "reference count underflow for symbol");
     }
 #endif
+    (void)new_value;
   }
 }
 
--- a/hotspot/src/share/vm/oops/symbol.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/oops/symbol.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -26,8 +26,8 @@
 #define SHARE_VM_OOPS_SYMBOL_HPP
 
 #include "memory/allocation.hpp"
-#include "runtime/atomic.hpp"
 #include "utilities/exceptions.hpp"
+#include "utilities/macros.hpp"
 #include "utilities/utf8.hpp"
 
 // A Symbol is a canonicalized string.
--- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -508,7 +508,7 @@
 #if INCLUDE_TRACE
   EventCompilerInlining event;
   if (event.should_commit()) {
-    event.set_compileID(C->compile_id());
+    event.set_compileId(C->compile_id());
     event.set_message(inline_msg);
     event.set_succeeded(success);
     event.set_bci(caller_bci);
--- a/hotspot/src/share/vm/opto/compile.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/opto/compile.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -729,7 +729,7 @@
     if (event.should_commit()) {
       event.set_starttime(C->_latest_stage_start_counter);
       event.set_phase((u1) cpt);
-      event.set_compileID(C->_compile_id);
+      event.set_compileId(C->_compile_id);
       event.set_phaseLevel(level);
       event.commit();
     }
@@ -748,7 +748,7 @@
     if (event.should_commit()) {
       event.set_starttime(C->_latest_stage_start_counter);
       event.set_phase((u1) PHASE_END);
-      event.set_compileID(C->_compile_id);
+      event.set_compileId(C->_compile_id);
       event.set_phaseLevel(level);
       event.commit();
     }
--- a/hotspot/src/share/vm/opto/runtime.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/opto/runtime.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -60,7 +60,7 @@
 #include "opto/runtime.hpp"
 #include "opto/subnode.hpp"
 #include "prims/jvmtiThreadState.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/fprofiler.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
--- a/hotspot/src/share/vm/prims/jni.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/prims/jni.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -59,7 +59,7 @@
 #include "prims/jvm_misc.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "prims/jvmtiThreadState.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/fieldDescriptor.hpp"
 #include "runtime/fprofiler.hpp"
--- a/hotspot/src/share/vm/prims/jvm.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -54,7 +54,7 @@
 #include "prims/privilegedStack.hpp"
 #include "prims/stackwalk.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/init.hpp"
 #include "runtime/interfaceSupport.hpp"
--- a/hotspot/src/share/vm/prims/jvmtiImpl.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiImpl.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
 #include "prims/jvmtiEventController.inline.hpp"
 #include "prims/jvmtiImpl.hpp"
 #include "prims/jvmtiRedefineClasses.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/handles.hpp"
 #include "runtime/handles.inline.hpp"
--- a/hotspot/src/share/vm/prims/jvmtiRawMonitor.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiRawMonitor.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "prims/jvmtiRawMonitor.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/thread.inline.hpp"
--- a/hotspot/src/share/vm/prims/jvmtiTagMap.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiTagMap.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -3119,6 +3119,11 @@
             }
           }
 
+          // Follow oops from compiled nmethod
+          if (jvf->cb() != NULL && jvf->cb()->is_nmethod()) {
+            blk->set_context(thread_tag, tid, depth, method);
+            jvf->cb()->as_nmethod()->oops_do(blk);
+          }
         } else {
           blk->set_context(thread_tag, tid, depth, method);
           if (is_top_frame) {
--- a/hotspot/src/share/vm/prims/unsafe.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/prims/unsafe.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -32,7 +32,7 @@
 #include "prims/jni.h"
 #include "prims/jvm.h"
 #include "prims/unsafe.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/orderAccess.inline.hpp"
@@ -1047,7 +1047,7 @@
 
   if (event.should_commit()) {
     oop obj = thread->current_park_blocker();
-    event.set_klass((obj != NULL) ? obj->klass() : NULL);
+    event.set_parkedClass((obj != NULL) ? obj->klass() : NULL);
     event.set_timeout(time);
     event.set_address((obj != NULL) ? (TYPE_ADDRESS) cast_from_oop<uintptr_t>(obj) : 0);
     event.commit();
--- a/hotspot/src/share/vm/runtime/atomic.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/runtime/atomic.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 #define SHARE_VM_RUNTIME_ATOMIC_HPP
 
 #include "memory/allocation.hpp"
+#include "utilities/macros.hpp"
 
 enum cmpxchg_memory_order {
   memory_order_relaxed,
@@ -75,6 +76,7 @@
 
   // Atomically add to a location. Returns updated value. add*() provide:
   // <fence> add-value-to-dest <membar StoreLoad|StoreStore>
+  inline static jshort   add    (jshort   add_value, volatile jshort*   dest);
   inline static jint     add    (jint     add_value, volatile jint*     dest);
   inline static size_t   add    (size_t   add_value, volatile size_t*   dest);
   inline static intptr_t add_ptr(intptr_t add_value, volatile intptr_t* dest);
@@ -119,24 +121,120 @@
   inline static void*        cmpxchg_ptr(void*        exchange_value, volatile void*         dest, void*        compare_value, cmpxchg_memory_order order = memory_order_conservative);
 };
 
-// To use Atomic::inc(jshort* dest) and Atomic::dec(jshort* dest), the address must be specially
-// aligned, such that (*dest) occupies the upper 16 bits of an aligned 32-bit word. The best way to
-// achieve is to place your short value next to another short value, which doesn't need atomic ops.
-//
-// Example
-//  ATOMIC_SHORT_PAIR(
-//    volatile short _refcount,  // needs atomic operation
-//    unsigned short _length     // number of UTF8 characters in the symbol (does not need atomic op)
-//  );
+// platform specific in-line definitions - must come before shared definitions
+
+#include OS_CPU_HEADER(atomic)
 
-#ifdef VM_LITTLE_ENDIAN
-  #define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl)  \
-    non_atomic_decl;                                       \
-    atomic_decl
-#else
-  #define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl)  \
-    atomic_decl;                                           \
-    non_atomic_decl
+// shared in-line definitions
+
+// size_t casts...
+#if (SIZE_MAX != UINTPTR_MAX)
+#error size_t is not WORD_SIZE, interesting platform, but missing implementation here
 #endif
 
+inline size_t Atomic::add(size_t add_value, volatile size_t* dest) {
+  return (size_t) add_ptr((intptr_t) add_value, (volatile intptr_t*) dest);
+}
+
+inline void Atomic::inc(volatile size_t* dest) {
+  inc_ptr((volatile intptr_t*) dest);
+}
+
+inline void Atomic::dec(volatile size_t* dest) {
+  dec_ptr((volatile intptr_t*) dest);
+}
+
+#ifndef VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+/*
+ * This is the default implementation of byte-sized cmpxchg. It emulates jbyte-sized cmpxchg
+ * in terms of jint-sized cmpxchg. Platforms may override this by defining their own inline definition
+ * as well as defining VM_HAS_SPECIALIZED_CMPXCHG_BYTE. This will cause the platform specific
+ * implementation to be used instead.
+ */
+inline jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte* dest,
+                             jbyte compare_value, cmpxchg_memory_order order) {
+  STATIC_ASSERT(sizeof(jbyte) == 1);
+  volatile jint* dest_int =
+      static_cast<volatile jint*>(align_ptr_down(dest, sizeof(jint)));
+  size_t offset = pointer_delta(dest, dest_int, 1);
+  jint cur = *dest_int;
+  jbyte* cur_as_bytes = reinterpret_cast<jbyte*>(&cur);
+
+  // current value may not be what we are looking for, so force it
+  // to that value so the initial cmpxchg will fail if it is different
+  cur_as_bytes[offset] = compare_value;
+
+  // always execute a real cmpxchg so that we get the required memory
+  // barriers even on initial failure
+  do {
+    // value to swap in matches current value ...
+    jint new_value = cur;
+    // ... except for the one jbyte we want to update
+    reinterpret_cast<jbyte*>(&new_value)[offset] = exchange_value;
+
+    jint res = cmpxchg(new_value, dest_int, cur, order);
+    if (res == cur) break; // success
+
+    // at least one jbyte in the jint changed value, so update
+    // our view of the current jint
+    cur = res;
+    // if our jbyte is still as cur we loop and try again
+  } while (cur_as_bytes[offset] == compare_value);
+
+  return cur_as_bytes[offset];
+}
+
+#endif // VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+
+inline unsigned Atomic::xchg(unsigned int exchange_value, volatile unsigned int* dest) {
+  assert(sizeof(unsigned int) == sizeof(jint), "more work to do");
+  return (unsigned int)Atomic::xchg((jint)exchange_value, (volatile jint*)dest);
+}
+
+inline unsigned Atomic::cmpxchg(unsigned int exchange_value,
+                         volatile unsigned int* dest, unsigned int compare_value,
+                         cmpxchg_memory_order order) {
+  assert(sizeof(unsigned int) == sizeof(jint), "more work to do");
+  return (unsigned int)Atomic::cmpxchg((jint)exchange_value, (volatile jint*)dest,
+                                       (jint)compare_value, order);
+}
+
+inline jlong Atomic::add(jlong    add_value, volatile jlong*    dest) {
+  jlong old = load(dest);
+  jlong new_value = old + add_value;
+  while (old != cmpxchg(new_value, dest, old)) {
+    old = load(dest);
+    new_value = old + add_value;
+  }
+  return old;
+}
+
+inline jshort Atomic::add(jshort add_value, volatile jshort* dest) {
+  // Most platforms do not support atomic add on a 2-byte value. However,
+  // if the value occupies the most significant 16 bits of an aligned 32-bit
+  // word, then we can do this with an atomic add of (add_value << 16)
+  // to the 32-bit word.
+  //
+  // The least significant parts of this 32-bit word will never be affected, even
+  // in case of overflow/underflow.
+  //
+  // Use the ATOMIC_SHORT_PAIR macro (see macros.hpp) to get the desired alignment.
+#ifdef VM_LITTLE_ENDIAN
+  assert((intx(dest) & 0x03) == 0x02, "wrong alignment");
+  jint new_value = Atomic::add(add_value << 16, (volatile jint*)(dest-1));
+#else
+  assert((intx(dest) & 0x03) == 0x00, "wrong alignment");
+  jint new_value = Atomic::add(add_value << 16, (volatile jint*)(dest));
+#endif
+  return (jshort)(new_value >> 16); // preserves sign
+}
+
+inline void Atomic::inc(volatile jshort* dest) {
+  (void)add(1, dest);
+}
+
+inline void Atomic::dec(volatile jshort* dest) {
+  (void)add(-1, dest);
+}
+
 #endif // SHARE_VM_RUNTIME_ATOMIC_HPP
--- a/hotspot/src/share/vm/runtime/atomic.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef SHARE_VM_RUNTIME_ATOMIC_INLINE_HPP
-#define SHARE_VM_RUNTIME_ATOMIC_INLINE_HPP
-
-#include "runtime/atomic.hpp"
-#include "utilities/macros.hpp"
-
-#include OS_CPU_HEADER_INLINE(atomic)
-
-// size_t casts...
-#if (SIZE_MAX != UINTPTR_MAX)
-#error size_t is not WORD_SIZE, interesting platform, but missing implementation here
-#endif
-
-inline size_t Atomic::add(size_t add_value, volatile size_t* dest) {
-  return (size_t) add_ptr((intptr_t) add_value, (volatile intptr_t*) dest);
-}
-
-inline void Atomic::inc(volatile size_t* dest) {
-  inc_ptr((volatile intptr_t*) dest);
-}
-
-inline void Atomic::dec(volatile size_t* dest) {
-  dec_ptr((volatile intptr_t*) dest);
-}
-
-#ifndef VM_HAS_SPECIALIZED_CMPXCHG_BYTE
-/*
- * This is the default implementation of byte-sized cmpxchg. It emulates jbyte-sized cmpxchg
- * in terms of jint-sized cmpxchg. Platforms may override this by defining their own inline definition
- * as well as defining VM_HAS_SPECIALIZED_CMPXCHG_BYTE. This will cause the platform specific
- * implementation to be used instead.
- */
-inline jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte *dest, jbyte comparand, cmpxchg_memory_order order)
-{
-  assert(sizeof(jbyte) == 1, "assumption.");
-  uintptr_t dest_addr = (uintptr_t)dest;
-  uintptr_t offset = dest_addr % sizeof(jint);
-  volatile jint* dest_int = (volatile jint*)(dest_addr - offset);
-  jint cur = *dest_int;
-  jbyte* cur_as_bytes = (jbyte*)(&cur);
-  jint new_val = cur;
-  jbyte* new_val_as_bytes = (jbyte*)(&new_val);
-  new_val_as_bytes[offset] = exchange_value;
-  while (cur_as_bytes[offset] == comparand) {
-    jint res = cmpxchg(new_val, dest_int, cur, order);
-    if (res == cur) break;
-    cur = res;
-    new_val = cur;
-    new_val_as_bytes[offset] = exchange_value;
-  }
-  return cur_as_bytes[offset];
-}
-#endif // VM_HAS_SPECIALIZED_CMPXCHG_BYTE
-
-inline unsigned Atomic::xchg(unsigned int exchange_value, volatile unsigned int* dest) {
-  assert(sizeof(unsigned int) == sizeof(jint), "more work to do");
-  return (unsigned int)Atomic::xchg((jint)exchange_value, (volatile jint*)dest);
-}
-
-inline unsigned Atomic::cmpxchg(unsigned int exchange_value,
-                         volatile unsigned int* dest, unsigned int compare_value,
-                         cmpxchg_memory_order order) {
-  assert(sizeof(unsigned int) == sizeof(jint), "more work to do");
-  return (unsigned int)Atomic::cmpxchg((jint)exchange_value, (volatile jint*)dest,
-                                       (jint)compare_value, order);
-}
-
-inline jlong Atomic::add(jlong    add_value, volatile jlong*    dest) {
-  jlong old = load(dest);
-  jlong new_value = old + add_value;
-  while (old != cmpxchg(new_value, dest, old)) {
-    old = load(dest);
-    new_value = old + add_value;
-  }
-  return old;
-}
-
-inline void Atomic::inc(volatile short* dest) {
-  // Most platforms do not support atomic increment on a 2-byte value. However,
-  // if the value occupies the most significant 16 bits of an aligned 32-bit
-  // word, then we can do this with an atomic add of 0x10000 to the 32-bit word.
-  //
-  // The least significant parts of this 32-bit word will never be affected, even
-  // in case of overflow/underflow.
-  //
-  // Use the ATOMIC_SHORT_PAIR macro to get the desired alignment.
-#ifdef VM_LITTLE_ENDIAN
-  assert((intx(dest) & 0x03) == 0x02, "wrong alignment");
-  (void)Atomic::add(0x10000, (volatile int*)(dest-1));
-#else
-  assert((intx(dest) & 0x03) == 0x00, "wrong alignment");
-  (void)Atomic::add(0x10000, (volatile int*)(dest));
-#endif
-}
-
-inline void Atomic::dec(volatile short* dest) {
-#ifdef VM_LITTLE_ENDIAN
-  assert((intx(dest) & 0x03) == 0x02, "wrong alignment");
-  (void)Atomic::add(-0x10000, (volatile int*)(dest-1));
-#else
-  assert((intx(dest) & 0x03) == 0x00, "wrong alignment");
-  (void)Atomic::add(-0x10000, (volatile int*)(dest));
-#endif
-}
-
-#endif // SHARE_VM_RUNTIME_ATOMIC_INLINE_HPP
--- a/hotspot/src/share/vm/runtime/biasedLocking.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/runtime/biasedLocking.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -28,7 +28,7 @@
 #include "oops/klass.inline.hpp"
 #include "oops/markOop.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/basicLock.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/task.hpp"
--- a/hotspot/src/share/vm/runtime/globals.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/runtime/globals.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -975,8 +975,8 @@
 static void trace_flag_changed(const char* name, const T old_value, const T new_value, const Flag::Flags origin) {
   E e;
   e.set_name(name);
-  e.set_old_value(old_value);
-  e.set_new_value(new_value);
+  e.set_oldValue(old_value);
+  e.set_newValue(new_value);
   e.set_origin(origin);
   e.commit();
 }
--- a/hotspot/src/share/vm/runtime/globals.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -2242,7 +2242,7 @@
           "in a comma separated string. Sub-systems are: "                  \
           "threads, heap, symbol_table, string_table, codecache, "          \
           "dictionary, classloader_data_graph, metaspace, jni_handles, "    \
-          "c-heap, codecache_oops")                                         \
+          "codecache_oops")                                                 \
                                                                             \
   diagnostic(bool, GCParallelVerificationEnabled, true,                     \
           "Enable parallel memory system verification")                     \
@@ -3008,16 +3008,6 @@
   notproduct(intx, ZombieALotInterval,     5,                               \
           "Number of exits until ZombieALot kicks in")                      \
                                                                             \
-  diagnostic(intx, MallocVerifyInterval,     0,                             \
-          "If non-zero, verify C heap after every N calls to "              \
-          "malloc/realloc/free")                                            \
-          range(0, max_intx)                                                \
-                                                                            \
-  diagnostic(intx, MallocVerifyStart,     0,                                \
-          "If non-zero, start verifying C heap after Nth call to "          \
-          "malloc/realloc/free")                                            \
-          range(0, max_intx)                                                \
-                                                                            \
   diagnostic(uintx, MallocMaxTestWords,     0,                              \
           "If non-zero, maximum number of words that malloc/realloc can "   \
           "allocate (for testing only)")                                    \
--- a/hotspot/src/share/vm/runtime/handles.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/runtime/handles.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -26,7 +26,7 @@
 #include "memory/allocation.inline.hpp"
 #include "oops/constantPool.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/thread.inline.hpp"
 
--- a/hotspot/src/share/vm/runtime/interfaceSupport.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/runtime/interfaceSupport.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
 #include "gc/shared/collectedHeap.inline.hpp"
 #include "gc/shared/genCollectedHeap.hpp"
 #include "memory/resourceArea.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/init.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/orderAccess.inline.hpp"
--- a/hotspot/src/share/vm/runtime/mutex.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/runtime/mutex.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/mutex.hpp"
 #include "runtime/orderAccess.inline.hpp"
--- a/hotspot/src/share/vm/runtime/objectMonitor.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/runtime/objectMonitor.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -27,7 +27,7 @@
 #include "memory/resourceArea.hpp"
 #include "oops/markOop.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/mutexLocker.hpp"
@@ -390,7 +390,7 @@
   }
 
   if (event.should_commit()) {
-    event.set_klass(((oop)this->object())->klass());
+    event.set_monitorClass(((oop)this->object())->klass());
     event.set_previousOwner((TYPE_THREAD)_previous_owner_tid);
     event.set_address((TYPE_ADDRESS)(uintptr_t)(this->object_addr()));
     event.commit();
@@ -1381,7 +1381,7 @@
                                             jlong timeout,
                                             bool timedout) {
   assert(event != NULL, "invariant");
-  event->set_klass(((oop)this->object())->klass());
+  event->set_monitorClass(((oop)this->object())->klass());
   event->set_timeout(timeout);
   event->set_address((TYPE_ADDRESS)this->object_addr());
   event->set_notifier(notifier_tid);
--- a/hotspot/src/share/vm/runtime/orderAccess.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/runtime/orderAccess.inline.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -26,7 +26,7 @@
 #ifndef SHARE_VM_RUNTIME_ORDERACCESS_INLINE_HPP
 #define SHARE_VM_RUNTIME_ORDERACCESS_INLINE_HPP
 
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/orderAccess.hpp"
 #include "utilities/macros.hpp"
 
--- a/hotspot/src/share/vm/runtime/os.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/runtime/os.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -44,7 +44,7 @@
 #include "prims/jvm_misc.hpp"
 #include "prims/privilegedStack.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/java.hpp"
@@ -596,8 +596,6 @@
   }
 #endif
 
-  NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap());
-
   // For the test flag -XX:MallocMaxTestWords
   if (has_reached_max_malloc_test_peak(size)) {
     return NULL;
@@ -658,7 +656,6 @@
   // NMT support
   void* membase = MemTracker::malloc_base(memblock);
   verify_memory(membase);
-  NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap());
   if (size == 0) {
     return NULL;
   }
@@ -695,7 +692,6 @@
   }
   void* membase = MemTracker::record_free(memblock);
   verify_memory(membase);
-  NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap());
 
   GuardedMemory guarded(membase);
   size_t size = guarded.get_user_size();
--- a/hotspot/src/share/vm/runtime/os.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/runtime/os.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -709,7 +709,6 @@
   static void* realloc (void *memblock, size_t size, MEMFLAGS flag);
 
   static void  free    (void *memblock);
-  static bool  check_heap(bool force = false);      // verify C heap integrity
   static char* strdup(const char *, MEMFLAGS flags = mtInternal);  // Like strdup
   // Like strdup, but exit VM when strdup() returns NULL
   static char* strdup_check_oom(const char*, MEMFLAGS flags = mtInternal);
--- a/hotspot/src/share/vm/runtime/reflection.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/runtime/reflection.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -446,7 +446,7 @@
     (accessor_ik->major_version() < Verifier::STRICTER_ACCESS_CTRL_CHECK_VERSION &&
     accessee_ik->major_version() < Verifier::STRICTER_ACCESS_CTRL_CHECK_VERSION)) {
     return classloader_only &&
-      Verifier::relax_verify_for(accessor_ik->class_loader()) &&
+      Verifier::relax_access_for(accessor_ik->class_loader()) &&
       accessor_ik->protection_domain() == accessee_ik->protection_domain() &&
       accessor_ik->class_loader() == accessee_ik->class_loader();
   }
--- a/hotspot/src/share/vm/runtime/safepoint.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/runtime/safepoint.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -39,7 +39,7 @@
 #include "memory/universe.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/symbol.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/frame.inline.hpp"
@@ -173,7 +173,7 @@
   //     block itself when it attempts transitions to a new state.
   //
   {
-    EventSafepointStateSync sync_event;
+    EventSafepointStateSynchronization sync_event;
     int initial_running = 0;
 
     _state            = _synchronizing;
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -49,7 +49,7 @@
 #include "prims/methodHandles.hpp"
 #include "prims/nativeLookup.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/handles.inline.hpp"
--- a/hotspot/src/share/vm/runtime/sweeper.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -30,7 +30,7 @@
 #include "compiler/compileBroker.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/method.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/orderAccess.inline.hpp"
@@ -485,7 +485,7 @@
   if (event.should_commit()) {
     event.set_starttime(sweep_start_counter);
     event.set_endtime(sweep_end_counter);
-    event.set_sweepIndex(_traversals);
+    event.set_sweepId(_traversals);
     event.set_sweptCount(swept_count);
     event.set_flushedCount(flushed_count);
     event.set_zombifiedCount(zombified_count);
--- a/hotspot/src/share/vm/runtime/synchronizer.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/runtime/synchronizer.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -30,7 +30,7 @@
 #include "memory/resourceArea.hpp"
 #include "oops/markOop.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
@@ -1819,7 +1819,7 @@
                                        const ObjectSynchronizer::InflateCause cause) {
 #if INCLUDE_TRACE
   assert(event.should_commit(), "check outside");
-  event.set_klass(obj->klass());
+  event.set_monitorClass(obj->klass());
   event.set_address((TYPE_ADDRESS)(uintptr_t)(void*)obj);
   event.set_cause((u1)cause);
   event.commit();
--- a/hotspot/src/share/vm/runtime/thread.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -57,7 +57,7 @@
 #include "prims/jvmtiThreadState.hpp"
 #include "prims/privilegedStack.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/commandLineFlagConstraintList.hpp"
 #include "runtime/commandLineFlagWriteableList.hpp"
--- a/hotspot/src/share/vm/runtime/thread.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/runtime/thread.inline.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
 
 #define SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE
 
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/os.inline.hpp"
 #include "runtime/thread.hpp"
 
--- a/hotspot/src/share/vm/runtime/vmThread.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/runtime/vmThread.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -279,7 +279,6 @@
     HandleMark hm(VMThread::vm_thread());
     // Among other things, this ensures that Eden top is correct.
     Universe::heap()->prepare_for_verify();
-    os::check_heap();
     // Silent verification so as not to pollute normal output,
     // unless we really asked for it.
     Universe::verify();
--- a/hotspot/src/share/vm/services/mallocTracker.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/services/mallocTracker.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,6 @@
 #include "precompiled.hpp"
 
 #include "runtime/atomic.hpp"
-#include "runtime/atomic.inline.hpp"
 #include "services/mallocSiteTable.hpp"
 #include "services/mallocTracker.hpp"
 #include "services/mallocTracker.inline.hpp"
--- a/hotspot/src/share/vm/services/memTracker.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/services/memTracker.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -75,7 +75,6 @@
 
 #else
 
-#include "runtime/atomic.hpp"
 #include "runtime/threadCritical.hpp"
 #include "services/mallocTracker.hpp"
 #include "services/virtualMemoryTracker.hpp"
--- a/hotspot/src/share/vm/services/threadService.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/services/threadService.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -31,7 +31,7 @@
 #include "oops/instanceKlass.hpp"
 #include "oops/objArrayOop.inline.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/init.hpp"
 #include "runtime/thread.hpp"
--- a/hotspot/src/share/vm/services/virtualMemoryTracker.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/services/virtualMemoryTracker.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -23,7 +23,7 @@
  */
 #include "precompiled.hpp"
 
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/os.hpp"
 #include "runtime/threadCritical.hpp"
 #include "services/memTracker.hpp"
--- a/hotspot/src/share/vm/shark/sharkRuntime.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/shark/sharkRuntime.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -24,7 +24,7 @@
  */
 
 #include "precompiled.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/thread.hpp"
--- a/hotspot/src/share/vm/trace/traceDataTypes.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/trace/traceDataTypes.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -32,7 +32,6 @@
 enum {
   CONTENT_TYPE_NONE             = 0,
   CONTENT_TYPE_CLASS            = 20,
-  CONTENT_TYPE_UTF8             = 21,
   CONTENT_TYPE_THREAD           = 22,
   CONTENT_TYPE_STACKTRACE       = 23,
   CONTENT_TYPE_BYTES            = 24,
--- a/hotspot/src/share/vm/trace/traceMacros.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/trace/traceMacros.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -30,7 +30,6 @@
 #define EVENT_THREAD_EXIT(thread)
 #define EVENT_THREAD_DESTRUCT(thread)
 #define TRACE_KLASS_CREATION(k, p, t)
-#define TRACE_KLASS_DEFINITION(k, t)
 
 #define TRACE_INIT_KLASS_ID(k)
 #define TRACE_REMOVE_KLASS_ID(k)
--- a/hotspot/src/share/vm/trace/traceevents.xml	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/trace/traceevents.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -76,111 +76,112 @@
 
   <event id="ThreadPark" path="java/thread_park" label="Java Thread Park"
           has_thread="true" has_stacktrace="true" is_instant="false">
-    <value type="CLASS" field="klass" label="Class Parked On"/>
+    <value type="CLASS" field="parkedClass" label="Class Parked On"/>
     <value type="MILLIS" field="timeout" label="Park Timeout"/>
-    <value type="ADDRESS" field="address" label="Address of Object Parked" relation="JAVA_MONITOR_ADDRESS"/>
+    <value type="ADDRESS" field="address" label="Address of Object Parked" relation="JavaMonitorAddress"/>
   </event>
 
   <event id="JavaMonitorEnter" path="java/monitor_enter" label="Java Monitor Blocked"
           has_thread="true" has_stacktrace="true" is_instant="false">
-    <value type="CLASS" field="klass" label="Monitor Class"/>
+    <value type="CLASS" field="monitorClass" label="Monitor Class"/>
     <value type="THREAD" field="previousOwner" label="Previous Monitor Owner"/>
-    <value type="ADDRESS" field="address" label="Monitor Address" relation="JAVA_MONITOR_ADDRESS"/>
+    <value type="ADDRESS" field="address" label="Monitor Address" relation="JavaMonitorAddress"/>
   </event>
 
   <event id="JavaMonitorWait" path="java/monitor_wait" label="Java Monitor Wait" description="Waiting on a Java monitor"
           has_thread="true" has_stacktrace="true" is_instant="false">
-    <value type="CLASS" field="klass" label="Monitor Class" description="Class of object waited on"/>
+    <value type="CLASS" field="monitorClass" label="Monitor Class" description="Class of object waited on"/>
     <value type="THREAD" field="notifier" label="Notifier Thread" description="Notifying Thread"/>
     <value type="MILLIS" field="timeout" label="Timeout" description="Maximum wait time"/>
     <value type="BOOLEAN" field="timedOut" label="Timed Out" description="Wait has been timed out"/>
-    <value type="ADDRESS" field="address" label="Monitor Address" description="Address of object waited on" relation="JAVA_MONITOR_ADDRESS"/>
+    <value type="ADDRESS" field="address" label="Monitor Address" description="Address of object waited on" relation="JavaMonitorAddress"/>
   </event>
 
   <event id="JavaMonitorInflate" path="java/monitor_inflate" label="Java Monitor Inflated"
          has_thread="true" has_stacktrace="true" is_instant="false">
-    <value type="CLASS" field="klass" label="Monitor Class"/>
-    <value type="ADDRESS" field="address" label="Monitor Address" relation="JAVA_MONITOR_ADDRESS"/>
-    <value type="INFLATECAUSE" field="cause" label="Cause" description="Cause of inflation"/>
+    <value type="CLASS" field="monitorClass" label="Monitor Class"/>
+    <value type="ADDRESS" field="address" label="Monitor Address" relation="JavaMonitorAddress"/>
+    <value type="INFLATECAUSE" field="cause" label="Monitor Inflation Cause" description="Cause of inflation"/>
   </event>
 
-  <event id="ReservedStackActivation" path="java/reserved_stack_activation" label="Reserved Stack Activation" description="Activation of Reserved Stack Area caused by stack overflow with ReservedStackAccess annotated method in call stack"
-          has_thread="true" has_stacktrace="true" is_instant="true">
+  <event id="ReservedStackActivation" path="vm/runtime/reserved_stack_activation" label="Reserved Stack Activation"
+         description="Activation of Reserved Stack Area caused by stack overflow with ReservedStackAccess annotated method in call stack"
+         has_thread="true" has_stacktrace="true" is_instant="true">
       <value type="METHOD" field="method" label="Java Method"/>
   </event>
 
   <event id="ClassLoad" path="vm/class/load" label="Class Load"
-          has_thread="true" has_stacktrace="true" is_instant="false">
+         has_thread="true" has_stacktrace="true" is_instant="false">
     <value type="CLASS" field="loadedClass" label="Loaded Class"/>
     <value type="CLASS" field="definingClassLoader" label="Defining Class Loader"/>
     <value type="CLASS" field="initiatingClassLoader" label="Initiating Class Loader"/>
   </event>
 
   <event id="ClassDefine" path="vm/class/define" label="Class Define"
-          has_thread="true" has_stacktrace="true" is_instant="true">
+         has_thread="true" has_stacktrace="true" is_instant="true">
     <value type="CLASS" field="definedClass" label="Defined Class"/>
     <value type="CLASS" field="definingClassLoader" label="Defining Class Loader"/>
   </event>
 
   <event id="ClassUnload" path="vm/class/unload" label="Class Unload"
-      has_thread="true" is_instant="true">
+         has_thread="true" is_instant="true">
     <value type="CLASS" field="unloadedClass" label="Unloaded Class"/>
     <value type="CLASS" field="definingClassLoader" label="Defining Class Loader"/>
   </event>
 
   <event id="IntFlagChanged" path="vm/flag/int_changed" label="Int Flag Changed"
-        is_instant="true">
-    <value type="UTF8" field="name" label="Name" />
-    <value type="INTEGER" field="old_value" label="Old Value" />
-    <value type="INTEGER" field="new_value" label="New Value" />
+         is_instant="true">
+    <value type="STRING" field="name" label="Name" />
+    <value type="INTEGER" field="oldValue" label="Old Value" />
+    <value type="INTEGER" field="newValue" label="New Value" />
     <value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
   </event>
 
   <event id="UnsignedIntFlagChanged" path="vm/flag/uint_changed" label="Unsigned Int Flag Changed"
-        is_instant="true">
-    <value type="UTF8" field="name" label="Name" />
-    <value type="UINT" field="old_value" label="Old Value" />
-    <value type="UINT" field="new_value" label="New Value" />
+         is_instant="true">
+    <value type="STRING" field="name" label="Name" />
+    <value type="UINT" field="oldValue" label="Old Value" />
+    <value type="UINT" field="newValue" label="New Value" />
     <value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
   </event>
 
   <event id="LongFlagChanged" path="vm/flag/long_changed" label="Long Flag Changed"
-        is_instant="true">
-    <value type="UTF8" field="name" label="Name" />
-    <value type="LONG" field="old_value" label="Old Value" />
-    <value type="LONG" field="new_value" label="New Value" />
+         is_instant="true">
+    <value type="STRING" field="name" label="Name" />
+    <value type="LONG" field="oldValue" label="Old Value" />
+    <value type="LONG" field="newValue" label="New Value" />
     <value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
   </event>
 
   <event id="UnsignedLongFlagChanged" path="vm/flag/ulong_changed" label="Unsigned Long Flag Changed"
-        is_instant="true">
-    <value type="UTF8" field="name" label="Name" />
-    <value type="ULONG" field="old_value" label="Old Value" />
-    <value type="ULONG" field="new_value" label="New Value" />
+         is_instant="true">
+    <value type="STRING" field="name" label="Name" />
+    <value type="ULONG" field="oldValue" label="Old Value" />
+    <value type="ULONG" field="newValue" label="New Value" />
     <value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
   </event>
 
   <event id="DoubleFlagChanged" path="vm/flag/double_changed" label="Double Flag Changed"
-       is_instant="true">
-    <value type="UTF8" field="name" label="Name" />
-    <value type="DOUBLE" field="old_value" label="Old Value" />
-    <value type="DOUBLE" field="new_value" label="New Value" />
+         is_instant="true">
+    <value type="STRING" field="name" label="Name" />
+    <value type="DOUBLE" field="oldValue" label="Old Value" />
+    <value type="DOUBLE" field="newValue" label="New Value" />
     <value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
   </event>
 
   <event id="BooleanFlagChanged" path="vm/flag/boolean_changed" label="Boolean Flag Changed"
-       is_instant="true">
-    <value type="UTF8" field="name" label="Name" />
-    <value type="BOOLEAN" field="old_value" label="Old Value" />
-    <value type="BOOLEAN" field="new_value" label="New Value" />
+         is_instant="true">
+    <value type="STRING" field="name" label="Name" />
+    <value type="BOOLEAN" field="oldValue" label="Old Value" />
+    <value type="BOOLEAN" field="newValue" label="New Value" />
     <value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
   </event>
 
   <event id="StringFlagChanged" path="vm/flag/string_changed" label="String Flag Changed"
-       is_instant="true">
-    <value type="UTF8" field="name" label="Name" />
-    <value type="UTF8" field="old_value" label="Old Value" />
-    <value type="UTF8" field="new_value" label="New Value" />
+         is_instant="true">
+    <value type="STRING" field="name" label="Name" />
+    <value type="STRING" field="oldValue" label="Old Value" />
+    <value type="STRING" field="newValue" label="New Value" />
     <value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
   </event>
 
@@ -200,7 +201,7 @@
   </struct>
 
   <event id="GCHeapSummary" path="vm/gc/heap/summary" label="Heap Summary" is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="GCWHEN" field="when" label="When" />
     <structvalue type="VirtualSpace" field="heapSpace" label="Heap Space"/>
     <value type="BYTES64" field="heapUsed" label="Heap Used" description="Bytes allocated by objects in the heap"/>
@@ -213,7 +214,7 @@
   </struct>
 
   <event id="MetaspaceSummary" path="vm/gc/heap/metaspace_summary" label="Metaspace Summary" is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="GCWHEN" field="when" label="When" />
     <value type="BYTES64" field="gcThreshold" label="GC Threshold" />
     <structvalue type="MetaspaceSizes" field="metaspace" label="Total"/>
@@ -244,7 +245,7 @@
   </event>
 
   <event id="MetaspaceChunkFreeListSummary" path="vm/gc/metaspace/chunk_free_list_summary" label="Metaspace Chunk Free List Summary" is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="GCWHEN" field="when" label="When" />
     <value type="METADATATYPE" field="metadataType" label="Metadata Type" />
     <value type="ULONG" field="specializedChunks" label="Specialized Chunks" />
@@ -258,7 +259,7 @@
   </event>
 
   <event id="PSHeapSummary" path="vm/gc/heap/ps_summary" label="Parallel Scavenge Heap Summary" is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="GCWHEN" field="when" label="When" />
 
     <structvalue type="VirtualSpace" field="oldSpace" label="Old Space"/>
@@ -271,7 +272,7 @@
   </event>
 
   <event id="G1HeapSummary" path="vm/gc/heap/g1_summary" label="G1 Heap Summary" is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="GCWHEN" field="when" label="When" />
 
     <value type="BYTES64" field="edenUsedSize" label="Eden Used Size" />
@@ -280,53 +281,53 @@
     <value type="UINT" field="numberOfRegions" label="Number of Regions" />
   </event>
 
-  <event id="GCGarbageCollection" path="vm/gc/collector/garbage_collection" label="Garbage Collection"
+  <event id="GarbageCollection" path="vm/gc/collector/garbage_collection" label="Garbage Collection"
          description="Garbage collection performed by the JVM">
-    <value type="UINT" field="gcId"  label="GC ID" relation="GC_ID" />
+    <value type="UINT" field="gcId"  label="GC Identifier" relation="GcId" />
     <value type="GCNAME" field="name" label="Name" description="The name of the Garbage Collector" />
     <value type="GCCAUSE" field="cause" label="Cause" description="The reason for triggering this Garbage Collection" />
     <value type="TICKSPAN" field="sumOfPauses" label="Sum of Pauses" description="Sum of all the times in which Java execution was paused during the garbage collection" />
     <value type="TICKSPAN" field="longestPause" label="Longest Pause" description="Longest individual pause during the garbage collection" />
   </event>
 
-  <event id="GCParallelOld" path="vm/gc/collector/parold_garbage_collection" label="Parallel Old Garbage Collection"
+  <event id="ParallelOldGarbageCollection" path="vm/gc/collector/parold_garbage_collection" label="Parallel Old Garbage Collection"
          description="Extra information specific to Parallel Old Garbage Collections">
-    <value type="UINT" field="gcId"  label="GC ID" relation="GC_ID" />
+    <value type="UINT" field="gcId"  label="GC Identifier" relation="GcId" />
     <value type="ADDRESS" field="densePrefix" label="Dense Prefix" description="The address of the dense prefix, used when compacting" />
   </event>
 
-  <event id="GCYoungGarbageCollection" path="vm/gc/collector/young_garbage_collection" label="Young Garbage Collection"
+  <event id="YoungGarbageCollection" path="vm/gc/collector/young_garbage_collection" label="Young Garbage Collection"
          description="Extra information specific to Young Garbage Collections">
-    <value type="UINT" field="gcId"  label="GC ID" relation="GC_ID" />
+    <value type="UINT" field="gcId"  label="GC Identifier" relation="GcId" />
     <value type="UINT" field="tenuringThreshold" label="Tenuring Threshold" />
   </event>
 
-  <event id="GCOldGarbageCollection" path="vm/gc/collector/old_garbage_collection" label="Old Garbage Collection"
+  <event id="OldGarbageCollection" path="vm/gc/collector/old_garbage_collection" label="Old Garbage Collection"
          description="Extra information specific to Old Garbage Collections">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
   </event>
 
-  <event id="GCG1GarbageCollection" path="vm/gc/collector/g1_garbage_collection" label="G1 Garbage Collection"
+  <event id="G1GarbageCollection" path="vm/gc/collector/g1_garbage_collection" label="G1 Garbage Collection"
          description="Extra information specific to G1 Garbage Collections">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="G1YCTYPE" field="type" label="Type" />
   </event>
 
-  <event id="GCG1MMU" path="vm/gc/detailed/g1_mmu_info" label="G1 MMU Information" is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
-    <value type="DOUBLE" field="timeSlice" label="Time slice used to calculate MMU"/>
-    <value type="DOUBLE" field="gcTime" label="Time spent on GC during last time slice"/>
-    <value type="DOUBLE" field="maxGcTime" label="Max time allowed to be spent on GC during last time slice"/>
+  <event id="G1MMU" path="vm/gc/detailed/g1_mmu_info" label="G1 MMU Information" is_instant="true">
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
+    <value type="DOUBLE" field="timeSlice" label="Time Slice" description="Time slice used to calculate MMU"/>
+    <value type="DOUBLE" field="gcTime" label="GC Time" description="Time spent on GC during last time slice"/>
+    <value type="DOUBLE" field="maxGcTime" label="Max GC Time" description="Max time allowed to be spent on GC during last time slice"/>
   </event>
 
-  <event id="EvacuationInfo" path="vm/gc/detailed/evacuation_info" label="Evacuation Information" is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+  <event id="EvacuationInformation" path="vm/gc/detailed/evacuation_info" label="Evacuation Information" is_instant="true">
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="UINT" field="cSetRegions" label="Collection Set Regions"/>
     <value type="BYTES64" field="cSetUsedBefore" label="Collection Set Before" description="Memory usage before GC in the collection set regions"/>
     <value type="BYTES64" field="cSetUsedAfter" label="Collection Set After" description="Memory usage after GC in the collection set regions"/>
     <value type="UINT" field="allocationRegions" label="Allocation Regions" description="Regions chosen as allocation regions during evacuation (includes survivors and old space regions)"/>
-    <value type="BYTES64" field="allocRegionsUsedBefore" label="Alloc Regions Before" description="Memory usage before GC in allocation regions"/>
-    <value type="BYTES64" field="allocRegionsUsedAfter" label="Alloc Regions After" description="Memory usage after GC in allocation regions"/>
+    <value type="BYTES64" field="allocationRegionsUsedBefore" label="Allocation Regions Before" description="Memory usage before GC in allocation regions"/>
+    <value type="BYTES64" field="allocationRegionsUsedAfter" label="Allocation Regions After" description="Memory usage after GC in allocation regions"/>
     <value type="BYTES64" field="bytesCopied" label="Bytes Copied"/>
     <value type="UINT" field="regionsFreed" label="Regions Freed"/>
   </event>
@@ -334,7 +335,7 @@
   <event id="GCReferenceStatistics" path="vm/gc/reference/statistics"
          label="GC Reference Statistics" is_instant="true"
          description="Total count of processed references during GC">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="REFERENCETYPE" field="type" label="Type" />
     <value type="ULONG" field="count" label="Total Count" />
   </event>
@@ -347,14 +348,14 @@
   </struct>
 
   <event id="ObjectCountAfterGC" path="vm/gc/detailed/object_count_after_gc" is_instant="true" label="Object Count after GC">
-    <value type="UINT" field="gcId"  label="GC ID" relation="GC_ID" />
-    <value type="CLASS" field="class" label="Class" />
+    <value type="UINT" field="gcId"  label="GC Identifier" relation="GcId" />
+    <value type="CLASS" field="objectClass" label="Object Class" />
     <value type="LONG" field="count" label="Count" />
     <value type="BYTES64" field="totalSize" label="Total Size" />
   </event>
 
-  <struct id="G1EvacStats">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+  <struct id="G1EvacuationStatistics">
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="BYTES64" field="allocated" label="Allocated" description="Total memory allocated by PLABs"/>
     <value type="BYTES64" field="wasted" label="Wasted" description="Total memory wasted within PLABs due to alignment or refill"/>
     <value type="BYTES64" field="used" label="Used" description="Total memory occupied by objects within PLABs"/>
@@ -366,48 +367,48 @@
     <value type="BYTES64" field="failureWaste" label="Wasted (failure)" description="Total memory left unused in regions where evacuation failed"/>
   </struct>
 
-  <event id="GCG1EvacuationYoungStatistics" path="vm/gc/detailed/g1_evac_young_stats" label="G1 Evacuation Statistics for Young" is_instant="true"
-         description="Memory related evacuation statistics during GC for the young generation">
-    <structvalue type="G1EvacStats" field="stats" label="Evacuation statistics"/>
+  <event id="G1EvacuationYoungStatistics" path="vm/gc/detailed/g1_evac_young_stats" label="G1 Evacuation Statistics for Young"
+         is_instant="true" description="Memory related evacuation statistics during GC for the young generation">
+    <structvalue type="G1EvacuationStatistics" field="statistics" label="Evacuation Statistics"/>
   </event>
 
-  <event id="GCG1EvacuationOldStatistics" path="vm/gc/detailed/g1_evac_old_stats" label="G1 Evacuation Memory Statistics for Old" is_instant="true"
-         description="Memory related evacuation statistics during GC for the old generation">
-    <structvalue type="G1EvacStats" field="stats" label="Evacuation statistics"/>
+  <event id="G1EvacuationOldStatistics" path="vm/gc/detailed/g1_evac_old_stats" label="G1 Evacuation Memory Statistics for Old"
+         is_instant="true" description="Memory related evacuation statistics during GC for the old generation">
+    <structvalue type="G1EvacuationStatistics" field="statistics" label="Evacuation Statistics"/>
   </event>
 
-  <event id="GCG1BasicIHOP" path="vm/gc/detailed/g1_basic_ihop_status" label="G1 Basic IHOP statistics" is_instant="true"
-         description="Basic statistics related to current IHOP calculation">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+  <event id="G1BasicIHOP" path="vm/gc/detailed/g1_basic_ihop_status" label="G1 Basic IHOP statistics"
+         is_instant="true" description="Basic statistics related to current IHOP calculation">
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="BYTES64" field="threshold" label="Current IHOP threshold" description="Current IHOP threshold in bytes"/>
     <value type="PERCENTAGE" field="thresholdPercentage" label="Current IHOP threshold in percent" description="Current IHOP threshold in percent of old gen"/>
-    <value type="BYTES64" field="targetOccupancy" label="Target occupancy" description="Target old gen occupancy to reach at the start of mixed GC in bytes"/>
-    <value type="BYTES64" field="currentOccupancy" label="Current occupancy" description="Current old gen occupancy in bytes"/>
-    <value type="BYTES64" field="lastAllocationSize" label="Last mutator allocation size" description="Mutator allocation during mutator operation since last GC in bytes"/>
-    <value type="DOUBLE" field="lastAllocationDuration" label="Last mutator operation duration" description="Time the mutator ran since last GC in seconds"/>
-    <value type="DOUBLE" field="lastAllocationRate" label="Last mutator allocation rate" description="Allocation rate of the mutator since last GC in bytes/second"/>
-    <value type="DOUBLE" field="lastMarkingLength" label="Last mutator time from initial mark to first mixed GC" description="Last time from the end of the last initial mark to the first mixed GC in seconds"/>
+    <value type="BYTES64" field="targetOccupancy" label="Target Occupancy" description="Target old gen occupancy to reach at the start of mixed GC in bytes"/>
+    <value type="BYTES64" field="currentOccupancy" label="Current Occupancy" description="Current old generation occupancy in bytes"/>
+    <value type="BYTES64" field="lastAllocationSize" label="Last Mutator Allocation" description="Mutator allocation during mutator operation since last GC in bytes"/>
+    <value type="DOUBLE" field="lastAllocationDuration" label="Last Mutator Operation" description="Time the mutator ran since last GC in seconds"/>
+    <value type="DOUBLE" field="lastAllocationRate" label="Last Mutator Allocation Rate" description="Allocation rate of the mutator since last GC in bytes/second"/>
+    <value type="DOUBLE" field="lastMarkingLength" label="Last Marking Length" description="Last time from the end of the last initial mark to the first mixed GC in seconds"/>
   </event>
 
-  <event id="GCG1AdaptiveIHOP" path="vm/gc/detailed/g1_adaptive_ihop_status" label="G1 Adaptive IHOP statistics" is_instant="true"
-         description="Statistics related to current adaptive IHOP calculation">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
-    <value type="BYTES64" field="threshold" label="Current IHOP threshold" description="Current IHOP threshold in bytes"/>
-    <value type="PERCENTAGE" field="thresholdPercentage" label="Current IHOP threshold in percent" description="Current IHOP threshold in percent of the internal target occupancy"/>
-    <value type="BYTES64" field="internalTargetOccupancy" label="Target occupancy" description="Internal target old gen occupancy to reach at the start of mixed GC in bytes"/>
-    <value type="BYTES64" field="currentOccupancy" label="Current occupancy" description="Current old gen occupancy in bytes"/>
-    <value type="BYTES64" field="additionalBufferSize" label="Additional buffer size" description="Additional buffer size in bytes"/>
-    <value type="DOUBLE" field="predictedAllocationRate" label="Predicted mutator allocation rate" description="Current predicted allocation rate for the mutator in bytes/second"/>
-    <value type="DOUBLE" field="predictedMarkingLength" label="Predicted time from initial mark to first mixed GC" description="Current predicted time from the end of the last initial mark to the first mixed GC in seconds"/>
-    <value type="BOOLEAN" field="predictionActive" label="Prediction active" description="Indicates whether the adaptive IHOP prediction is active"/>
+  <event id="G1AdaptiveIHOP" path="vm/gc/detailed/g1_adaptive_ihop_status" label="G1 Adaptive IHOP statistics"
+         is_instant="true" description="Statistics related to current adaptive IHOP calculation">
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
+    <value type="BYTES64" field="threshold" label="Threshold" description="Current IHOP threshold in bytes"/>
+    <value type="PERCENTAGE" field="thresholdPercentage" label="Threshold Percentage" description="Current IHOP threshold in percent of the internal target occupancy"/>
+    <value type="BYTES64" field="internalTargetOccupancy" label="Target Occupancy" description="Internal target old generation occupancy to reach at the start of mixed GC in bytes"/>
+    <value type="BYTES64" field="currentOccupancy" label="Current Occupancy" description="Current old generation occupancy in bytes"/>
+    <value type="BYTES64" field="additionalBufferSize" label="Additional Buffer" description="Additional buffer size in bytes"/>
+    <value type="DOUBLE" field="predictedAllocationRate" label="Predicted Allocation Rate" description="Current predicted allocation rate for the mutator in bytes/second"/>
+    <value type="DOUBLE" field="predictedMarkingLength" label="Predicted Marking Length" description="Current predicted time from the end of the last initial mark to the first mixed GC in seconds"/>
+    <value type="BOOLEAN" field="predictionActive" label="Prediction Active" description="Indicates whether the adaptive IHOP prediction is active"/>
   </event>
 
   <!-- Promotion events, Supported GCs are Parallel Scavange, G1 and CMS with Parallel New. -->
   <event id="PromoteObjectInNewPLAB" path="vm/gc/detailed/object_promotion_in_new_PLAB" label="Promotion in new PLAB"
-      description="Object survived scavenge and was copied to a new Promotion Local Allocation Buffer (PLAB). Supported GCs are Parallel Scavange, G1 and CMS with Parallel New. Due to promotion being done in parallel an object might be reported multiple times as the GC threads race to copy all objects." 
+         description="Object survived scavenge and was copied to a new Promotion Local Allocation Buffer (PLAB). Supported GCs are Parallel Scavange, G1 and CMS with Parallel New. Due to promotion being done in parallel an object might be reported multiple times as the GC threads race to copy all objects." 
          has_thread="true" has_stacktrace="false" is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID" description="ID of GC during which the object was promoted"/>
-    <value type="CLASS" field="class" label="Class" description="Class of promoted object"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId" description="Identifier signifying GC during which the object was promoted"/>
+    <value type="CLASS" field="objectClass" label="Object Class" description="Class of promoted object"/>
     <value type="BYTES64" field="objectSize" label="Object Size" description="Size of promoted object"/>
     <value type="UINT" field="tenuringAge" label="Object Tenuring Age" description="Tenuring age of a surviving object before being copied. The tenuring age of an object is a value between 0-15 and is incremented each scavange the object survives. Newly allocated objects have tenuring age 0."/>
     <value type="BOOLEAN" field="tenured" label="Tenured" description="True if object was promoted to Old space, otherwise the object was aged and copied to a Survivor space"/>
@@ -415,10 +416,10 @@
   </event>
   
   <event id="PromoteObjectOutsidePLAB" path="vm/gc/detailed/object_promotion_outside_PLAB" label="Promotion outside PLAB"
-      description="Object survived scavenge and was copied directly to the heap. Supported GCs are Parallel Scavange, G1 and CMS with Parallel New. Due to promotion being done in parallel an object might be reported multiple times as the GC threads race to copy all objects." 
+         description="Object survived scavenge and was copied directly to the heap. Supported GCs are Parallel Scavange, G1 and CMS with Parallel New. Due to promotion being done in parallel an object might be reported multiple times as the GC threads race to copy all objects." 
          has_thread="true" has_stacktrace="false" is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID" description="ID of GC during which the object was promoted"/>
-    <value type="CLASS" field="class" label="Class" description="Class of promoted object"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId" description="Identifier signifying GC during which the object was promoted"/>
+    <value type="CLASS" field="objectClass" label="Object Class" description="Class of promoted object"/>
     <value type="BYTES64" field="objectSize" label="Object Size" description="Size of promoted object"/>
     <value type="UINT" field="tenuringAge" label="Object Tenuring Age" description="Tenuring age of a surviving object before being copied. The tenuring age of an object is a value between 0-15 and is incremented each scavange the object survives. Newly allocated objects have tenuring age 0."/>
     <value type="BOOLEAN" field="tenured" label="Tenured" description="True if object was promoted to Old space, otherwise the object was aged and copied to a Survivor space"/>
@@ -426,81 +427,76 @@
 
   <event id="PromotionFailed" path="vm/gc/detailed/promotion_failed" label="Promotion Failed" is_instant="true"
          description="Promotion of an object failed">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
-    <structvalue type="CopyFailed" field="data" label="Data"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
+    <structvalue type="CopyFailed" field="promotionFailed" label="Promotion Failed Data"/>
     <value type="THREAD" field="thread" label="Running thread"/>
   </event>
 
   <event id="EvacuationFailed" path="vm/gc/detailed/evacuation_failed" label="Evacuation Failed" is_instant="true"
          description="Evacuation of an object failed">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
-    <structvalue type="CopyFailed" field="data" label="Data"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
+    <structvalue type="CopyFailed" field="evacuationFailed" label="Evacuation Failed Data"/>
   </event>
 
   <event id="ConcurrentModeFailure" path="vm/gc/detailed/concurrent_mode_failure" label="Concurrent Mode Failure"
          is_instant="true" description="Concurrent Mode failed">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
   </event>
 
   <event id="GCPhasePause" path="vm/gc/phases/pause" label="GC Phase Pause" has_thread="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
-    <value type="UTF8" field="name" label="Name" />
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
+    <value type="STRING" field="name" label="Name" />
   </event>
 
   <event id="GCPhasePauseLevel1" path="vm/gc/phases/pause_level_1" label="GC Phase Pause Level 1" has_thread="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
-    <value type="UTF8" field="name" label="Name" />
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
+    <value type="STRING" field="name" label="Name" />
   </event>
 
   <event id="GCPhasePauseLevel2" path="vm/gc/phases/pause_level_2" label="GC Phase Pause Level 2" has_thread="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
-    <value type="UTF8" field="name" label="Name" />
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
+    <value type="STRING" field="name" label="Name" />
   </event>
 
   <event id="GCPhasePauseLevel3" path="vm/gc/phases/pause_level_3" label="GC Phase Pause Level 3" has_thread="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
-    <value type="UTF8" field="name" label="Name" />
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
+    <value type="STRING" field="name" label="Name" />
   </event>
 
   <event id="GCPhaseConcurrent" path="vm/gc/phases/concurrent" label="GC Phase Concurrent" has_thread="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
-    <value type="UTF8" field="name" label="Name" />
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
+    <value type="STRING" field="name" label="Name" />
   </event>
 
   <event id="AllocationRequiringGC" path="vm/gc/detailed/allocation_requiring_gc" label="Allocation Requiring GC"
          has_thread="true" has_stacktrace="true"  is_instant="true">
-    <value type="UINT" field="gcId"  label="Pending GC ID" relation="GC_ID" />
+    <value type="UINT" field="gcId"  label="Pending GC Identifier" relation="GcId" />
     <value type="BYTES64" field="size" label="Allocation Size" />
   </event>
 
   <event id="TenuringDistribution" path="vm/gc/detailed/tenuring_distribution" label="Tenuring Distribution"
          is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="UINT" field="age" label="Age" />
     <value type="BYTES64" field="size" label="Size" />
   </event>
 
   <event id="G1HeapRegionTypeChange" path="vm/gc/detailed/g1_heap_region_type_change" label="G1 Heap Region Type Change"
-         description="Information about a G1 heap region type change." is_instant="true">
+         description="Information about a G1 heap region type change" is_instant="true">
     <value type="UINT" field="index" label="Index" />
-    <value type="G1HEAPREGIONTYPE" field="from" label="From Type" />
-    <value type="G1HEAPREGIONTYPE" field="to" label="To Type" />
+    <value type="G1HEAPREGIONTYPE" field="from" label="From" />
+    <value type="G1HEAPREGIONTYPE" field="to" label="To" />
     <value type="ADDRESS" field="start" label="Start" />
     <value type="BYTES64" field="used" label="Used" />
-    <value type="UINT" field="allocContext" label="Allocation Context" />
-  </event>
-
-  <event id="VMError" path="vm/runtime/vm_error" label="VM Error"
-         description="VM shutdown due to an error" has_stacktrace="true" has_thread="true">
-    <value type="BOOLEAN" field="out_of_java_memory" label="Java Out Of Memory"/>
+    <value type="UINT" field="allocationContext" label="Allocation Context" />
   </event>
 
   <!-- Compiler events -->
 
   <event id="Compilation" path="vm/compiler/compilation" label="Compilation"
-       has_thread="true" is_requestable="false" is_constant="false">
+         has_thread="true" is_requestable="false" is_constant="false">
     <value type="METHOD" field="method" label="Java Method"/>
-    <value type="UINT" field="compileID" label="Compilation ID" relation="COMP_ID"/>
+    <value type="UINT" field="compileId" label="Compilation Identifier" relation="CompileId"/>
     <value type="USHORT" field="compileLevel" label="Compilation Level"/>
     <value type="BOOLEAN" field="succeded" label="Succeeded"/>
     <value type="BOOLEAN" field="isOsr" label="On Stack Replacement"/>
@@ -509,39 +505,39 @@
   </event>
 
   <event id="CompilerPhase" path="vm/compiler/phase" label="Compiler Phase"
-          has_thread="true" is_requestable="false" is_constant="false">
+         has_thread="true" is_requestable="false" is_constant="false">
     <value type="COMPILERPHASETYPE" field="phase" label="Compile Phase"/>
-    <value type="UINT" field="compileID" label="Compilation ID" relation="COMP_ID"/>
+    <value type="UINT" field="compileId" label="Compilation Identifier" relation="CompileId"/>
     <value type="USHORT" field="phaseLevel" label="Phase Level"/>
   </event>
 
-  <event id="CompilerFailure" path="vm/compiler/failure" label="Compilation Failure"
-          has_thread="true" is_requestable="false" is_constant="false" is_instant="true">
-    <value type="UTF8" field="failure" label="Message"/>
-    <value type="UINT" field="compileID" label="Compilation ID" relation="COMP_ID"/>
+  <event id="CompilationFailure" path="vm/compiler/failure" label="Compilation Failure"
+         has_thread="true" is_requestable="false" is_constant="false" is_instant="true">
+    <value type="STRING" field="failureMessage" label="Failure Message"/>
+    <value type="UINT" field="compileId" label="Compilation Identifier" relation="CompileId"/>
   </event>
 
-  <struct id="CiMethod">
-    <value type="UTF8" field="class" label="Class name"/>
-    <value type="UTF8" field="name" label="Method name"/>
-    <value type="UTF8" field="signature" label="Method signature"/>
+  <struct id="CalleeMethod">
+    <value type="STRING" field="type" label="Class"/>
+    <value type="STRING" field="name" label="Method Name"/>
+    <value type="STRING" field="descriptor" label="Method Descriptor"/>
   </struct>
 
   <event id="CompilerInlining" path="vm/compiler/optimization/inlining" label="Method Inlining"
-       has_thread="true" is_instant="true">
-    <value type="UINT" field="compileID" label="Compilation ID" relation="COMP_ID"/>
+         has_thread="true" is_instant="true">
+    <value type="UINT" field="compileId" label="Compilation Identifier" relation="CompileId"/>
     <value type="METHOD" field="caller" label="Caller Method"/>
-    <structvalue type="CiMethod" field="callee" label="Callee Method"/>
+    <structvalue type="CalleeMethod" field="callee" label="Callee Method"/>
     <value type="BOOLEAN" field="succeeded" label="Succeeded"/>
-    <value type="UTF8" field="message" label="Message"/>
+    <value type="STRING" field="message" label="Message"/>
     <value type="INTEGER" field="bci" label="Byte Code Index"/>
   </event>
 
   <!-- Code sweeper events -->
 
   <event id="SweepCodeCache" path="vm/code_sweeper/sweep" label="Sweep Code Cache"
-     has_thread="true" is_requestable="false" is_constant="false">
-    <value type="INTEGER" field="sweepIndex" label="Sweep Index" relation="SWEEP_ID"/>
+         has_thread="true" is_requestable="false" is_constant="false">
+    <value type="INTEGER" field="sweepId" label="Sweep Identifier" relation="SweepId"/>
     <value type="UINT" field="sweptCount" label="Methods Swept"/>
     <value type="UINT" field="flushedCount" label="Methods Flushed"/>
     <value type="UINT" field="zombifiedCount" label="Methods Zombified"/>
@@ -550,7 +546,7 @@
   <!-- Code cache events -->
 
   <event id="CodeCacheFull" path="vm/code_cache/full" label="Code Cache Full"
-       has_thread="true" is_requestable="false" is_constant="false" is_instant="true">
+         has_thread="true" is_requestable="false" is_constant="false" is_instant="true">
     <value type="CODEBLOBTYPE" field="codeBlobType" label="Code Heap"/>
     <value type="ADDRESS" field="startAddress" label="Start Address"/>
     <value type="ADDRESS" field="commitedTopAddress" label="Commited Top"/>
@@ -564,14 +560,14 @@
 
   <event id="SafepointBegin" path="vm/runtime/safepoint/begin" label="Safepoint Begin"
          description="Safepointing begin" has_thread="true">
-    <value type="INTEGER" field="safepointId" label="Safepoint ID" relation="SAFEPOINT_ID"/>
+    <value type="INTEGER" field="safepointId" label="Safepoint Identifier" relation="SafepointId"/>
     <value type="INTEGER" field="totalThreadCount" label="Total Threads" description="The total number of threads at the start of safe point"/>
     <value type="INTEGER" field="jniCriticalThreadCount" label="JNI Critical Threads" description="The number of threads in JNI critical sections"/>
   </event>
 
-  <event id="SafepointStateSync" path="vm/runtime/safepoint/statesync" label="Safepoint State Sync"
+  <event id="SafepointStateSynchronization" path="vm/runtime/safepoint/statesync" label="Safepoint State Synchronization"
          description="Synchronize run state of threads" has_thread="true">
-    <value type="INTEGER" field="safepointId" label="Safepoint ID" relation="SAFEPOINT_ID"/>
+    <value type="INTEGER" field="safepointId" label="Safepoint Identifier" relation="SafepointId"/>
     <value type="INTEGER" field="initialThreadCount" label="Initial Threads" description="The number of threads running at the beginning of state check"/>
     <value type="INTEGER" field="runningThreadCount" label="Running Threads" description="The number of threads still running"/>
     <value type="INTEGER" field="iterations" label="Iterations" description="Number of state check iterations"/>
@@ -579,46 +575,46 @@
 
   <event id="SafepointWaitBlocked" path="vm/runtime/safepoint/waitblocked" label="Safepoint Wait Blocked"
          description="Safepointing begin waiting on running threads to block" has_thread="true">
-    <value type="INTEGER" field="safepointId" label="Safepoint ID" relation="SAFEPOINT_ID"/>
+    <value type="INTEGER" field="safepointId" label="Safepoint Identifier" relation="SafepointId"/>
     <value type="INTEGER" field="runningThreadCount" label="Running Threads" description="The number running of threads wait for safe point"/>
   </event>
 
   <event id="SafepointCleanup" path="vm/runtime/safepoint/cleanup" label="Safepoint Cleanup"
          description="Safepointing begin running cleanup tasks" has_thread="true">
-    <value type="INTEGER" field="safepointId" label="Safepoint ID" relation="SAFEPOINT_ID"/>
+    <value type="INTEGER" field="safepointId" label="Safepoint Identifier" relation="SafepointId"/>
   </event>
 
   <event id="SafepointCleanupTask" path="vm/runtime/safepoint/cleanuptask" label="Safepoint Cleanup Task"
          description="Safepointing begin running cleanup tasks" has_thread="true">
-    <value type="INTEGER" field="safepointId" label="Safepoint ID" relation="SAFEPOINT_ID"/>
-    <value type="UTF8" field="name" label="Task Name" description="The task name"/>
+    <value type="INTEGER" field="safepointId" label="Safepoint Identifier" relation="SafepointId"/>
+    <value type="STRING" field="name" label="Task Name" description="The task name"/>
   </event>
 
   <event id="SafepointEnd" path="vm/runtime/safepoint/end" label="Safepoint End"
          description="Safepointing end" has_thread="true">
-    <value type="INTEGER" field="safepointId" label="Safepoint ID" relation="SAFEPOINT_ID"/>
+    <value type="INTEGER" field="safepointId" label="Safepoint Identifier" relation="SafepointId"/>
   </event>
 
   <event id="ExecuteVMOperation" path="vm/runtime/execute_vm_operation" label="VM Operation"
-      description="Execution of a VM Operation" has_thread="true">
+         description="Execution of a VM Operation" has_thread="true">
     <value type="VMOPERATIONTYPE" field="operation" label="Operation" />
-    <value type="BOOLEAN" field="safepoint" label="At Safepoint" description="If the operation occured at a safepoint."/>
-    <value type="BOOLEAN" field="blocking" label="Caller Blocked" description="If the calling thread was blocked until the operation was complete."/>
-    <value type="THREAD" field="caller" label="Caller" transition="FROM" description="Thread requesting operation. If non-blocking, will be set to 0 indicating thread is unknown."/>
-    <value type="INTEGER" field="safepointId" label="Safepoint ID" description="The safepoint (if any) under which this operation was completed." relation="SAFEPOINT_ID"/>
+    <value type="BOOLEAN" field="safepoint" label="At Safepoint" description="If the operation occured at a safepoint"/>
+    <value type="BOOLEAN" field="blocking" label="Caller Blocked" description="If the calling thread was blocked until the operation was complete"/>
+    <value type="THREAD" field="caller" label="Caller" transition="FROM" description="Thread requesting operation. If non-blocking, will be set to 0 indicating thread is unknown"/>
+    <value type="INTEGER" field="safepointId" label="Safepoint Identifier" description="The safepoint (if any) under which this operation was completed" relation="SafepointId"/>
   </event>
 
   <!-- Allocation events -->
-  <event id="AllocObjectInNewTLAB" path="java/object_alloc_in_new_TLAB" label="Allocation in new TLAB"
-      description="Allocation in new Thread Local Allocation Buffer" has_thread="true" has_stacktrace="true" is_instant="true">
-    <value type="CLASS" field="class" label="Class" description="Class of allocated object"/>
+  <event id="ObjectAllocationInNewTLAB" path="java/object_alloc_in_new_TLAB" label="Allocation in new TLAB"
+         description="Allocation in new Thread Local Allocation Buffer" has_thread="true" has_stacktrace="true" is_instant="true">
+    <value type="CLASS" field="objectClass" label="Object Class" description="Class of allocated object"/>
     <value type="BYTES64" field="allocationSize" label="Allocation Size"/>
     <value type="BYTES64" field="tlabSize" label="TLAB Size"/>
   </event>
 
-  <event id="AllocObjectOutsideTLAB" path="java/object_alloc_outside_TLAB" label="Allocation outside TLAB"
-      description="Allocation outside Thread Local Allocation Buffers" has_thread="true" has_stacktrace="true" is_instant="true">
-    <value type="CLASS" field="class" label="Class" description="Class of allocated object"/>
+  <event id="ObjectAllocationOutsideTLAB" path="java/object_alloc_outside_TLAB" label="Allocation outside TLAB"
+         description="Allocation outside Thread Local Allocation Buffers" has_thread="true" has_stacktrace="true" is_instant="true">
+    <value type="CLASS" field="objectClass" label="Object Class" description="Class of allocated object"/>
     <value type="BYTES64" field="allocationSize" label="Allocation Size"/>
   </event>
 </events>
--- a/hotspot/src/share/vm/trace/tracerelationdecls.xml	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/trace/tracerelationdecls.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -27,9 +27,9 @@
 <!DOCTYPE relation_decls SYSTEM "trace.dtd">
 
 <relation_decls>
-  <relation_decl id="GC_ID" uri="vm/gc/id"/>
-  <relation_decl id="COMP_ID" uri="vm/compiler/id"/>
-  <relation_decl id="SWEEP_ID" uri="vm/code_sweeper/id"/>
-  <relation_decl id="JAVA_MONITOR_ADDRESS" uri="java/monitor/address"/>
-  <relation_decl id="SAFEPOINT_ID" uri="vm/runtime/safepoint/id"/>
+  <relation_decl id="GcId" uri="vm/gc/id"/>
+  <relation_decl id="CompileId" uri="vm/compiler/id"/>
+  <relation_decl id="SweepId" uri="vm/code_sweeper/id"/>
+  <relation_decl id="JavaMonitorAddress" uri="java/monitor/address"/>
+  <relation_decl id="SafepointId" uri="vm/runtime/safepoint/id"/>
 </relation_decls>
--- a/hotspot/src/share/vm/trace/tracetypes.xml	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/trace/tracetypes.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -43,7 +43,7 @@
 Example: (GcMode)
 
 <content_type id="GCMode" hr_name="GC mode" type="U1" jvm_type="GCMODE">
-  <value type="UTF8" field="desc" description="Description"/>
+  <value type="STRING" field="desc" description="Description"/>
 </content_type>
 
 This creates a content type CONTENT_TYPE_GCMODE
@@ -61,131 +61,131 @@
   <content_types>
     <content_type id="Thread" hr_name="Thread"
                   type="U8" builtin_type="THREAD">
-      <value type="UTF8" field="osName" label="OS Thread Name"/>
-      <value type="LONG" field="osThreadID" label="OS Thread ID"/>
-      <value type="UTF8" field="javaName" label="Java Lang Thread Name"/>
-      <value type="LONG" field="javaThreadID" label="Java Lang Thread ID"/>
+      <value type="STRING" field="osName" label="OS Thread Name"/>
+      <value type="LONG" field="osThreadId" label="OS Thread Id"/>
+      <value type="STRING" field="javaName" label="Java Thread Name"/>
+      <value type="LONG" field="javaThreadId" label="Java Thread Id"/>
       <value type="THREADGROUP" field="group" label="Java Thread Group"/>
     </content_type>
 
     <content_type id="ThreadGroup" hr_name="Thread group"
                   type="U8" jvm_type="THREADGROUP">
       <value type="THREADGROUP" field="parent" label="Parent"/>
-      <value type="UTF8" field="name" label="Name"/>
+      <value type="STRING" field="name" label="Name"/>
     </content_type>
 
     <content_type id="Class" hr_name="Java class"
                   type="U8" builtin_type="CLASS">
-      <value type="CLASS" field="loaderClass" label="ClassLoader"/>
+      <value type="CLASS" field="classLoaderType" label="Class Loader"/>
       <value type="SYMBOL" field="name" label="Name"/>
       <value type="PACKAGE" field="package" label="Package"/>
-      <value type="SHORT" field="modifiers" label="Access modifiers"/>
+      <value type="INTEGER" field="modifiers" label="Access Modifiers"/>
     </content_type>
 
     <content_type id="Method" hr_name="Java method"
                   type="U8" jvm_type="METHOD">
-      <value type="CLASS" field="class" label="Class"/>
+      <value type="CLASS" field="type" label="Type"/>
       <value type="SYMBOL" field="name" label="Name"/>
-      <value type="SYMBOL" field="signature" label="Signature"/>
-      <value type="SHORT" field="modifiers" label="Access modifiers"/>
+      <value type="SYMBOL" field="descriptor" label="Descriptor"/>
+      <value type="INTEGER" field="modifiers" label="Access Modifiers"/>
       <value type="BOOLEAN" field="hidden" label="Hidden"/>
     </content_type>
 
-    <content_type id="UTFConstant" hr_name="UTF constant"
+    <content_type id="Symbol" hr_name="Symbol"
                   type="U8" jvm_type="SYMBOL">
-      <value type="UTF8" field="utf8" label="UTF8 data"/>
+      <value type="STRING" field="string" label="String"/>
     </content_type>
 
     <content_type id="ThreadState" hr_name="Java Thread State"
                   type="U8" jvm_type="THREADSTATE">
-      <value type="UTF8" field="name" label="Name"/>
+      <value type="STRING" field="name" label="Name"/>
     </content_type>
 
     <content_type id="GCName" hr_name="GC Name"
                   type="U8" jvm_type="GCNAME">
-      <value type="UTF8" field="name" label="name" />
+      <value type="STRING" field="name" label="Name" />
     </content_type>
 
     <content_type id="GCCause" hr_name="GC Cause"
                   type="U8" jvm_type="GCCAUSE">
-      <value type="UTF8" field="cause" label="cause" />
+      <value type="STRING" field="cause" label="Cause" />
     </content_type>
 
     <content_type id="GCWhen" hr_name="GC When"
                   type="U8" jvm_type="GCWHEN">
-      <value type="UTF8" field="when" label="when" />
+      <value type="STRING" field="when" label="When" />
     </content_type>
 
     <content_type id="G1HeapRegionType" hr_name="G1 Heap Region Type"
                   type="U8" jvm_type="G1HEAPREGIONTYPE">
-      <value type="UTF8" field="type" label="type" />
+      <value type="STRING" field="type" label="Type" />
     </content_type>
     
     <content_type id="G1YCType" hr_name="G1 YC Type"
                   type="U8" jvm_type="G1YCTYPE">
-      <value type="UTF8" field="type" label="type" />
+      <value type="STRING" field="type" label="Type" />
     </content_type>
 
     <content_type id="GCThresholdUpdater" hr_name="GC Treshold Updater"
                   type="U8" jvm_type="GCTHRESHOLDUPDATER">
-      <value type="UTF8" field="updater" label="updater" />
+      <value type="STRING" field="updater" label="Updater" />
     </content_type>
 
     <content_type id="ReferenceType" hr_name="Reference Type"
                   type="U8" jvm_type="REFERENCETYPE">
-      <value type="UTF8" field="type" label="type" />
+      <value type="STRING" field="type" label="Type" />
     </content_type>
 
     <content_type id="MetadataType" hr_name="Metadata Type"
                   type="U8" jvm_type="METADATATYPE">
-      <value type="UTF8" field="type" label="type" />
+      <value type="STRING" field="type" label="Type" />
     </content_type>
 
     <content_type id="MetaspaceObjectType" hr_name="Metaspace Object Type"
                   type="U8" jvm_type="METASPACEOBJTYPE">
-      <value type="UTF8" field="type" label="type" />
+      <value type="STRING" field="type" label="Type" />
     </content_type>
 
-    <content_type id="NARROW_OOP_MODE" hr_name="Narrow Oop Mode"
+    <content_type id="NarrowOopMode" hr_name="Narrow oop Mode"
                   type="U8" jvm_type="NARROWOOPMODE">
-      <value type="UTF8" field="mode" label="mode" />
+      <value type="STRING" field="mode" label="Mode" />
     </content_type>
 
     <content_type id="VMOperationType" hr_name="VM Operation Type"
                   type="U8" jvm_type="VMOPERATIONTYPE">
-      <value type="UTF8" field="type" label="type" />
+      <value type="STRING" field="type" label="Type" />
     </content_type>
 
     <content_type id="CompilerPhaseType" hr_name="Compiler Phase Type"
                   type="U8" jvm_type="COMPILERPHASETYPE">
-      <value type="UTF8" field="phase" label="phase" />
+      <value type="STRING" field="phase" label="Phase" />
     </content_type>
 
     <content_type id="FlagValueOrigin" hr_name="Flag Value Origin"
                   type="U8" jvm_type="FLAGVALUEORIGIN">
-      <value type="UTF8" field="origin" label="origin" />
+      <value type="STRING" field="origin" label="Origin" />
     </content_type>
 
     <content_type id="CodeBlobType" hr_name="Code Blob Type"
                   type="U8" jvm_type="CODEBLOBTYPE">
-      <value type="UTF8" field="type" label="type" />
+      <value type="STRING" field="type" label="Type" />
     </content_type>
 
     <content_type id="InflateCause" hr_name="Inflation Cause"
                   type="U8" jvm_type="INFLATECAUSE">
-      <value type="UTF8" field="cause" label="cause" />
+      <value type="STRING" field="cause" label="Cause" />
     </content_type>
 
     <content_type id="Module" hr_name="Module"
-              type="U8" jvm_type="MODULE">
+                  type="U8" jvm_type="MODULE">
       <value type="SYMBOL" field="name" label="Name"/>
       <value type="SYMBOL" field="version" label="Version"/>
       <value type="SYMBOL" field="location" label="Location"/>
-      <value type="CLASS" field="classLoader" label="ClassLoader"/>
+      <value type="CLASS" field="classLoader" label="Class Loader"/>
     </content_type>
 
     <content_type id="Package" hr_name="Package"
-              type="U8" jvm_type="PACKAGE">
+                  type="U8" jvm_type="PACKAGE">
       <value type="SYMBOL" field="name" label="Name"/>
       <value type="MODULE" field="module" label="Module"/>
       <value type="BOOLEAN" field="exported" label="Exported"/>
@@ -288,8 +288,9 @@
     <primary_type symbol="PERCENTAGE" datatype="FLOAT" contenttype="PERCENTAGE"
                   type="float" sizeop="sizeof(float)"/>
 
-    <!-- UTF8-encoded string, max length Integer.MAX_VALUE -->
-    <primary_type symbol="UTF8" datatype="UTF8" contenttype="NONE"
+    <!-- STRING is a virtual type - depending on encoding
+         it will have polymorphic content -->
+    <primary_type symbol="STRING" datatype="STRING" contenttype="NONE"
                   type="const char*" sizeop="sizeof_utf(%)"/>
 
     <!-- Symbol* constant. Note that this may currently ONLY be used by
@@ -306,7 +307,7 @@
                   type="const ModuleEntry*" sizeop="sizeof(u8)"/>
 
     <primary_type symbol="PACKAGE" datatype="U8" contenttype="PACKAGE"
-              type="const PackageEntry*" sizeop="sizeof(u8)"/>
+                  type="const PackageEntry*" sizeop="sizeof(u8)"/>
 
     <!-- A Method *. The method is marked as "used" and will eventually be
          written into the recording constant pool. -->
@@ -325,8 +326,7 @@
     <!-- Threadgroup THIS TYPE MAY NOT BE USED IN NORMAL EVENTS (ATM). Only
           for thread constant pool // KK TODO: u8 should be ObjectP -->
     <primary_type symbol="THREADGROUP" datatype="U8" contenttype="THREADGROUP"
-                  type="u8"
-                  sizeop="sizeof(u8)"/>
+                  type="u8" sizeop="sizeof(u8)"/>
 
     <!-- FRAMETYPE enum -->
     <primary_type symbol="FRAMETYPE" datatype="U8" contenttype="FRAMETYPE"
@@ -361,39 +361,39 @@
                   type="u8" sizeop="sizeof(u8)" />
 
     <!-- REFERENCETYPE -->
-    <primary_type symbol="REFERENCETYPE" datatype="U8"
-                  contenttype="REFERENCETYPE" type="u8" sizeop="sizeof(u8)" />
+    <primary_type symbol="REFERENCETYPE" datatype="U8" contenttype="REFERENCETYPE"
+                  type="u8" sizeop="sizeof(u8)" />
 
     <!-- METADATATYPE -->
-    <primary_type symbol="METADATATYPE" datatype="U8"
-                  contenttype="METADATATYPE" type="u8" sizeop="sizeof(u8)" />
+    <primary_type symbol="METADATATYPE" datatype="U8" contenttype="METADATATYPE"
+                  type="u8" sizeop="sizeof(u8)" />
 
     <!-- METADATAOBJTYPE -->
-    <primary_type symbol="METASPACEOBJTYPE" datatype="U8"
-                  contenttype="METASPACEOBJTYPE" type="u8" sizeop="sizeof(u8)" />
+    <primary_type symbol="METASPACEOBJTYPE" datatype="U8" contenttype="METASPACEOBJTYPE"
+                  type="u8" sizeop="sizeof(u8)" />
 
     <!-- NARROWOOPMODE -->
-    <primary_type symbol="NARROWOOPMODE" datatype="U8"
-                  contenttype="NARROWOOPMODE" type="u8" sizeop="sizeof(u8)" />
+    <primary_type symbol="NARROWOOPMODE" datatype="U8" contenttype="NARROWOOPMODE"
+                  type="u8" sizeop="sizeof(u8)" />
 
     <!-- COMPILERPHASETYPE -->
-    <primary_type symbol="COMPILERPHASETYPE" datatype="U8"
-                  contenttype="COMPILERPHASETYPE" type="u8" sizeop="sizeof(u8)" />
+    <primary_type symbol="COMPILERPHASETYPE" datatype="U8" contenttype="COMPILERPHASETYPE"
+                  type="u8" sizeop="sizeof(u8)" />
 
     <!-- VMOPERATIONTYPE -->
     <primary_type symbol="VMOPERATIONTYPE" datatype="U8" contenttype="VMOPERATIONTYPE"
                   type="u8" sizeop="sizeof(u8)" />
                   
     <!-- FLAGVALUEORIGIN -->
-    <primary_type symbol="FLAGVALUEORIGIN" datatype="U8"
-                  contenttype="FLAGVALUEORIGIN" type="u8" sizeop="sizeof(u8)" />
+    <primary_type symbol="FLAGVALUEORIGIN" datatype="U8" contenttype="FLAGVALUEORIGIN"
+                  type="u8" sizeop="sizeof(u8)" />
                   
     <!-- CODEBLOBTYPE -->
-    <primary_type symbol="CODEBLOBTYPE" datatype="U8"
-                  contenttype="CODEBLOBTYPE" type="u8" sizeop="sizeof(u8)" />
+    <primary_type symbol="CODEBLOBTYPE" datatype="U8" contenttype="CODEBLOBTYPE"
+                  type="u8" sizeop="sizeof(u8)" />
 
     <!-- INFLATECAUSE -->
-    <primary_type symbol="INFLATECAUSE" datatype="U8"
-                  contenttype="INFLATECAUSE" type="u8" sizeop="sizeof(u8)" />
+    <primary_type symbol="INFLATECAUSE" datatype="U8" contenttype="INFLATECAUSE"
+                  type="u8" sizeop="sizeof(u8)" />
   </primary_types>
 </types>
--- a/hotspot/src/share/vm/utilities/accessFlags.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/utilities/accessFlags.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "utilities/accessFlags.hpp"
 
 void AccessFlags::atomic_set_bits(jint bits) {
--- a/hotspot/src/share/vm/utilities/bitMap.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/utilities/bitMap.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,7 @@
 #include "precompiled.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "utilities/bitMap.inline.hpp"
 #include "utilities/copy.hpp"
 #include "utilities/debug.hpp"
--- a/hotspot/src/share/vm/utilities/bitMap.inline.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/utilities/bitMap.inline.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,7 @@
 #ifndef SHARE_VM_UTILITIES_BITMAP_INLINE_HPP
 #define SHARE_VM_UTILITIES_BITMAP_INLINE_HPP
 
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "utilities/bitMap.hpp"
 
 inline void BitMap::set_bit(idx_t bit) {
--- a/hotspot/src/share/vm/utilities/debug.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/utilities/debug.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -38,7 +38,7 @@
 #include "oops/oop.inline.hpp"
 #include "prims/privilegedStack.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/frame.hpp"
 #include "runtime/java.hpp"
 #include "runtime/os.hpp"
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -327,11 +327,12 @@
 // and then additions like
 //       ... top() + size ...
 // are safe because we know that top() is at least size below end().
-inline size_t pointer_delta(const void* left,
-                            const void* right,
+inline size_t pointer_delta(const volatile void* left,
+                            const volatile void* right,
                             size_t element_size) {
   return (((uintptr_t) left) - ((uintptr_t) right)) / element_size;
 }
+
 // A version specialized for HeapWord*'s.
 inline size_t pointer_delta(const HeapWord* left, const HeapWord* right) {
   return pointer_delta(left, right, sizeof(HeapWord));
@@ -516,6 +517,10 @@
   return (void*)align_size_down((intptr_t)ptr, (intptr_t)alignment);
 }
 
+inline volatile void* align_ptr_down(volatile void* ptr, size_t alignment) {
+  return (volatile void*)align_size_down((intptr_t)ptr, (intptr_t)alignment);
+}
+
 // Align metaspace objects by rounding up to natural word boundary
 
 inline intptr_t align_metadata_size(intptr_t size) {
--- a/hotspot/src/share/vm/utilities/histogram.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/utilities/histogram.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "utilities/histogram.hpp"
 
 #ifdef ASSERT
--- a/hotspot/src/share/vm/utilities/macros.hpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/utilities/macros.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -486,4 +486,24 @@
 #define OS_CPU_HEADER(basename)        XSTR(OS_CPU_HEADER_STEM(basename).hpp)
 #define OS_CPU_HEADER_INLINE(basename) XSTR(OS_CPU_HEADER_STEM(basename).inline.hpp)
 
+// To use Atomic::inc(jshort* dest) and Atomic::dec(jshort* dest), the address must be specially
+// aligned, such that (*dest) occupies the upper 16 bits of an aligned 32-bit word. The best way to
+// achieve is to place your short value next to another short value, which doesn't need atomic ops.
+//
+// Example
+//  ATOMIC_SHORT_PAIR(
+//    volatile short _refcount,  // needs atomic operation
+//    unsigned short _length     // number of UTF8 characters in the symbol (does not need atomic op)
+//  );
+
+#ifdef VM_LITTLE_ENDIAN
+  #define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl)  \
+    non_atomic_decl;                                       \
+    atomic_decl
+#else
+  #define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl)  \
+    atomic_decl;                                           \
+    non_atomic_decl
+#endif
+
 #endif // SHARE_VM_UTILITIES_MACROS_HPP
--- a/hotspot/src/share/vm/utilities/vmError.cpp	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/src/share/vm/utilities/vmError.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -31,7 +31,7 @@
 #include "logging/logConfiguration.hpp"
 #include "prims/whitebox.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/init.hpp"
 #include "runtime/os.hpp"
--- a/hotspot/test/TEST.groups	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/TEST.groups	Fri Aug 26 14:47:52 2016 -0700
@@ -407,6 +407,11 @@
   runtime/SelectionResolution \
  -:hotspot_fast_runtime
 
+hotspot_runtime_minimalvm = \
+  runtime/MinimalVM \
+  runtime/ErrorHandling \
+  runtime/logging
+  
 #All tests that depends on nashorn extension.
 #
 needs_nashorn = \
--- a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java	Fri Aug 26 14:47:52 2016 -0700
@@ -36,11 +36,11 @@
 package compiler.intrinsics.unsafe;
 
 import jdk.internal.misc.Unsafe;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 
 public class TestUnsafeMismatchedArrayFieldAccess {
 
-    private static final Unsafe UNSAFE = Utils.getUnsafe();
+    private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
 
     static {
         try {
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -45,7 +45,7 @@
 
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
 import jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject;
@@ -114,7 +114,7 @@
         abstract HotSpotResolvedJavaMethod getResolvedJavaMethod();
     }
 
-    private static final Unsafe UNSAFE = Utils.getUnsafe();
+    private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
     private static final WhiteBox WB = WhiteBox.getWhiteBox();
     private static final Field METASPACE_METHOD_FIELD;
     private static final Class<?> TEST_CLASS = GetResolvedJavaMethodTest.class;
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -53,7 +53,7 @@
 
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
@@ -154,7 +154,7 @@
         abstract HotSpotResolvedObjectType getResolvedJavaType();
     }
 
-    private static final Unsafe UNSAFE = Utils.getUnsafe();
+    private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
     private static final WhiteBox WB = WhiteBox.getWhiteBox();
     private static final Class TEST_CLASS = GetResolvedJavaTypeTest.class;
     /* a compressed parameter for tested method is set to false because
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -53,7 +53,7 @@
 import jdk.internal.misc.Unsafe;
 import jdk.internal.org.objectweb.asm.Opcodes;
 import jdk.test.lib.Asserts;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
 import jdk.vm.ci.meta.ConstantPool;
@@ -69,7 +69,7 @@
  */
 public class ResolveFieldInPoolTest {
 
-    private static final Unsafe UNSAFE = Utils.getUnsafe();
+    private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
 
     public static void main(String[] args) throws Exception {
         Map<ConstantTypes, Validator> typeTests = new HashMap<>();
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -52,6 +52,7 @@
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
@@ -60,7 +61,7 @@
 import java.util.Set;
 
 public class ResolveMethodTest {
-    private static final Unsafe UNSAFE = Utils.getUnsafe();
+    private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
 
     public static void main(String args[]) {
         ResolveMethodTest test = new ResolveMethodTest();
--- a/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java	Fri Aug 26 14:47:52 2016 -0700
@@ -34,7 +34,7 @@
 package compiler.loopopts.superword;
 
 import jdk.internal.misc.Unsafe;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 
 public class TestVectorizationWithInvariant {
 
@@ -43,7 +43,7 @@
     private static final long CHAR_ARRAY_OFFSET;
 
     static {
-        unsafe = Utils.getUnsafe();
+        unsafe = UnsafeHelper.getUnsafe();
         BYTE_ARRAY_OFFSET = unsafe.arrayBaseOffset(byte[].class);
         CHAR_ARRAY_OFFSET = unsafe.arrayBaseOffset(char[].class);
     }
--- a/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java	Fri Aug 26 14:47:52 2016 -0700
@@ -28,6 +28,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
+ * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  * @run main/othervm -ea -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
--- a/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java	Fri Aug 26 14:47:52 2016 -0700
@@ -49,7 +49,7 @@
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.cli.predicate.AndPredicate;
 
@@ -125,7 +125,7 @@
     public static class Test implements CompilableTest {
         private static final int TOTAL_ITERATIONS = 10000;
         private static final int WARMUP_ITERATIONS = 1000;
-        private static final Unsafe UNSAFE = Utils.getUnsafe();
+        private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
         private final Object monitor = new Object();
         // Following field have to be static in order to avoid escape analysis.
         @SuppressWarnings("UnsuedDeclaration")
--- a/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java	Fri Aug 26 14:47:52 2016 -0700
@@ -51,7 +51,7 @@
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.cli.predicate.AndPredicate;
 
@@ -158,7 +158,7 @@
         private static int field = 0;
         private static final int ITERATIONS = 10000;
         private static final int RANGE_CHECK_AT = ITERATIONS / 2;
-        private static final Unsafe UNSAFE = Utils.getUnsafe();
+        private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
         private final Object monitor = new Object();
 
         @Override
--- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java	Fri Aug 26 14:47:52 2016 -0700
@@ -48,7 +48,7 @@
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.cli.predicate.AndPredicate;
 
@@ -133,7 +133,7 @@
     }
 
     public static class Test implements CompilableTest {
-        private static final Unsafe UNSAFE = Utils.getUnsafe();
+        private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
         private final Object monitor = new Object();
 
         @Override
--- a/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java	Fri Aug 26 14:47:52 2016 -0700
@@ -49,7 +49,7 @@
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.cli.predicate.AndPredicate;
 
@@ -142,7 +142,7 @@
         @SuppressWarnings("UnsuedDeclaration")
         private static int field = 0;
         private static final int TOTAL_ITERATIONS = 10000;
-        private static final Unsafe UNSAFE = Utils.getUnsafe();
+        private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
         private final Object monitor = new Object();
 
 
--- a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java	Fri Aug 26 14:47:52 2016 -0700
@@ -49,7 +49,7 @@
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.cli.predicate.AndPredicate;
 
@@ -113,7 +113,7 @@
 
     public static class Test implements CompilableTest {
         private static final long TOTAL_ITERATIONS = 10000L;
-        private static final Unsafe UNSAFE = Utils.getUnsafe();
+        private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
         private final Object monitor = new Object();
         // Following field have to be static in order to avoid escape analysis.
         @SuppressWarnings("UnsuedDeclaration")
--- a/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,7 @@
 package compiler.testlibrary.rtm;
 
 import jdk.internal.misc.Unsafe;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 
 /**
  * Current RTM locking implementation force transaction abort
@@ -35,7 +35,7 @@
     // Following field have to be static in order to avoid escape analysis.
     @SuppressWarnings("UnsuedDeclaration")
     private static int field = 0;
-    private static final Unsafe UNSAFE = Utils.getUnsafe();
+    private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
 
     public XAbortProvoker() {
         this(new Object());
--- a/hotspot/test/compiler/unsafe/UnsafeRaw.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/compiler/unsafe/UnsafeRaw.java	Fri Aug 26 14:47:52 2016 -0700
@@ -35,6 +35,7 @@
 
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 
 import java.util.Random;
 
@@ -81,7 +82,7 @@
   }
 
   public static void main(String[] args) throws Exception {
-    Unsafe unsafe = Utils.getUnsafe();
+    Unsafe unsafe = UnsafeHelper.getUnsafe();
     final int array_size = 128;
     final int element_size = 4;
     final int magic = 0x12345678;
--- a/hotspot/test/gc/arguments/TestAlignmentToUseLargePages.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/gc/arguments/TestAlignmentToUseLargePages.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,16 +29,16 @@
  * @key gc
  * @key regression
  * @requires vm.gc=="null"
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:-UseParallelOldGC -XX:+UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:-UseParallelOldGC -XX:-UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:-UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseSerialGC -XX:+UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseSerialGC -XX:-UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseConcMarkSweepGC -XX:+UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseConcMarkSweepGC -XX:-UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseG1GC -XX:+UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseG1GC -XX:-UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseParallelGC -XX:-UseParallelOldGC -XX:+UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseParallelGC -XX:-UseParallelOldGC -XX:-UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:-UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseSerialGC -XX:+UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseSerialGC -XX:-UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseConcMarkSweepGC -XX:+UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseConcMarkSweepGC -XX:-UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseG1GC -XX:+UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseG1GC -XX:-UseLargePages TestAlignmentToUseLargePages
  */
 
 public class TestAlignmentToUseLargePages {
--- a/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java	Fri Aug 26 14:47:52 2016 -0700
@@ -37,6 +37,7 @@
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 
 public class TestMaxMinHeapFreeRatioFlags {
@@ -133,7 +134,7 @@
      */
     public static class RatioVerifier {
 
-        private static final Unsafe unsafe = Utils.getUnsafe();
+        private static final Unsafe unsafe = UnsafeHelper.getUnsafe();
 
         // Size of byte array that will be allocated
         public static final int CHUNK_SIZE = 1024;
--- a/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java	Fri Aug 26 14:47:52 2016 -0700
@@ -46,6 +46,7 @@
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import sun.hotspot.WhiteBox;
 
 /* In order to test that TargetSurvivorRatio affects survivor space occupancy
@@ -248,7 +249,7 @@
     public static class TargetSurvivorRatioVerifier {
 
         static final WhiteBox wb = WhiteBox.getWhiteBox();
-        static final Unsafe unsafe = Utils.getUnsafe();
+        static final Unsafe unsafe = UnsafeHelper.getUnsafe();
 
         // Desired size of memory allocated at once
         public static final int CHUNK_SIZE = 1024;
--- a/hotspot/test/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java	Fri Aug 26 14:47:52 2016 -0700
@@ -43,12 +43,12 @@
 
 public class TestVerifyBeforeAndAfterGCFlags {
 
-    // VerifyBeforeGC:[Verifying threads heap tenured eden syms strs zone dict metaspace chunks hand C-heap code cache ]
+    // VerifyBeforeGC:[Verifying threads heap tenured eden syms strs zone dict metaspace chunks hand code cache ]
     public static final String VERIFY_BEFORE_GC_PATTERN = "Verifying Before GC";
     // VerifyBeforeGC: VerifyBeforeGC: VerifyBeforeGC:
     public static final String VERIFY_BEFORE_GC_CORRUPTED_PATTERN = "VerifyBeforeGC:(?!\\[Verifying[^]]+\\])";
 
-    // VerifyAfterGC:[Verifying threads heap tenured eden syms strs zone dict metaspace chunks hand C-heap code cache ]
+    // VerifyAfterGC:[Verifying threads heap tenured eden syms strs zone dict metaspace chunks hand code cache ]
     public static final String VERIFY_AFTER_GC_PATTERN = "Verifying After GC";
     // VerifyAfterGC: VerifyAfterGC: VerifyAfterGC:
     public static final String VERIFY_AFTER_GC_CORRUPTED_PATTERN = "VerifyAfterGC:(?!\\[Verifying[^]]+\\])";
--- a/hotspot/test/gc/cms/TestBubbleUpRef.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/gc/cms/TestBubbleUpRef.java	Fri Aug 26 14:47:52 2016 -0700
@@ -35,7 +35,7 @@
  *          stays nearly full.
  * @run main/othervm
  *  -XX:+UseConcMarkSweepGC -XX:-CMSYield -XX:-CMSPrecleanRefLists1
- *  -XX:CMSInitiatingOccupancyFraction=0 -Xmx8m TestBubbleUpRef 16000 50 10000
+ *  -XX:CMSInitiatingOccupancyFraction=0 -Xmx80m TestBubbleUpRef 16000 50 10000
  */
 
 /**
@@ -53,7 +53,7 @@
  * Do it again.
  *
  * Use the following VM options
- *     -Xmx8m -XX:-CMSYield [-XX:+UseConcMarkSweepGC] -XX:-CMSPrecleanRefLists1
+ *     -Xmx80m -XX:-CMSYield [-XX:+UseConcMarkSweepGC] -XX:-CMSPrecleanRefLists1
  *      -XX:CMSInitiatingOccupancyFraction=0
  *
  * Use parameter:
--- a/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java	Fri Aug 26 14:47:52 2016 -0700
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import java.lang.management.GarbageCollectorMXBean;
 import java.util.List;
 import java.util.ArrayList;
 
@@ -28,6 +29,8 @@
 import jdk.test.lib.InMemoryJavaCompiler;
 import jdk.test.lib.Platform;
 
+import sun.management.ManagementFactoryHelper;
+
 import static jdk.test.lib.Asserts.*;
 
 /* @test TestMetaspacePerfCounters
@@ -38,7 +41,7 @@
  *          space exists and works.
  * @modules java.base/jdk.internal.misc
  *          java.compiler
- *          java.management
+ *          java.management/sun.management
  *          jdk.jvmstat/sun.jvmstat.monitor
  * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedClassPointers -XX:+UsePerfData -XX:+UseSerialGC TestMetaspacePerfCounters
  * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedClassPointers -XX:+UsePerfData -XX:+UseParallelGC -XX:+UseParallelOldGC TestMetaspacePerfCounters
@@ -51,6 +54,7 @@
 public class TestMetaspacePerfCounters {
     public static Class fooClass = null;
     private static final String[] counterNames = {"minCapacity", "maxCapacity", "capacity", "used"};
+    private static final List<GarbageCollectorMXBean> gcBeans = ManagementFactoryHelper.getGarbageCollectorMXBeans();
 
     public static void main(String[] args) throws Exception {
         String metaspace = "sun.gc.metaspace";
@@ -68,10 +72,27 @@
     }
 
     private static void checkPerfCounters(String ns) throws Exception {
-        long minCapacity = getMinCapacity(ns);
-        long maxCapacity = getMaxCapacity(ns);
-        long capacity = getCapacity(ns);
-        long used = getUsed(ns);
+        long gcCountBefore;
+        long gcCountAfter;
+        long minCapacity;
+        long maxCapacity;
+        long capacity;
+        long used;
+
+        // The perf counter values are updated during GC and to be able to
+        // do the assertions below we need to ensure that the values are from
+        // the same GC cycle.
+        do {
+            gcCountBefore = currentGCCount();
+
+            minCapacity = getMinCapacity(ns);
+            maxCapacity = getMaxCapacity(ns);
+            capacity = getCapacity(ns);
+            used = getUsed(ns);
+
+            gcCountAfter = currentGCCount();
+            assertGTE(gcCountAfter, gcCountBefore);
+        } while(gcCountAfter > gcCountBefore);
 
         assertGTE(minCapacity, 0L);
         assertGTE(used, minCapacity);
@@ -130,4 +151,12 @@
     private static long getUsed(String ns) throws Exception {
         return PerfCounters.findByName(ns + ".used").longValue();
     }
+
+    private static long currentGCCount() {
+        long gcCount = 0;
+        for (GarbageCollectorMXBean bean : gcBeans) {
+            gcCount += bean.getCollectionCount();
+        }
+        return gcCount;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/logging/logTestFixture.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+#include "precompiled.hpp"
+#include "logTestFixture.hpp"
+#include "logTestUtils.inline.hpp"
+#include "logging/logConfiguration.hpp"
+#include "memory/resourceArea.hpp"
+#include "unittest.hpp"
+#include "utilities/ostream.hpp"
+
+LogTestFixture::LogTestFixture() {
+  // Set up TestLogFileName to include PID, testcase name and test name
+  int ret = jio_snprintf(_filename, sizeof(_filename), "testlog.pid%d.%s.%s.log",
+                         os::current_process_id(),
+                         ::testing::UnitTest::GetInstance()->current_test_info()->test_case_name(),
+                         ::testing::UnitTest::GetInstance()->current_test_info()->name());
+  EXPECT_GT(ret, 0) << "_filename buffer issue";
+  TestLogFileName = _filename;
+}
+
+LogTestFixture::~LogTestFixture() {
+  restore_default_log_config();
+  delete_file(TestLogFileName);
+}
+
+bool LogTestFixture::set_log_config(const char* output,
+                                    const char* what,
+                                    const char* decorators,
+                                    const char* options,
+                                    bool allow_failure) {
+  ResourceMark rm;
+  stringStream stream;
+  bool success = LogConfiguration::parse_log_arguments(output, what, decorators, options, &stream);
+  if (!allow_failure) {
+    const char* errmsg = stream.as_string();
+    EXPECT_STREQ("", errmsg) << "Unexpected error reported";
+    EXPECT_TRUE(success) << "Shouldn't cause errors";
+  }
+  return success;
+}
+
+void LogTestFixture::restore_default_log_config() {
+  LogConfiguration::disable_logging();
+  set_log_config("stdout", "all=warning");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/logging/logTestFixture.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+#include "unittest.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+// A fixture base class for tests that need to change the log configuration,
+// or use a log file. After each test, the fixture will automatically restore
+// the log configuration and remove the test file (if used).
+// Provides TestLogFileName which is unique for each test, and is automatically
+// deleted after the test completes.
+class LogTestFixture : public testing::Test {
+ private:
+  char _filename[2 * K];
+
+ protected:
+  const char* TestLogFileName;
+
+  LogTestFixture();
+  ~LogTestFixture();
+
+  static bool set_log_config(const char* output,
+                             const char* what,
+                             const char* decorators = "",
+                             const char* options = "",
+                             bool allow_failure = false);
+
+  static void restore_default_log_config();
+};
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/logging/logTestUtils.inline.hpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+#include "runtime/os.hpp"
+#include "unittest.hpp"
+
+#define LOG_TEST_STRING_LITERAL "a (hopefully) unique log message for testing"
+
+static inline bool string_contains_substring(const char* haystack, const char* needle) {
+  return strstr(haystack, needle) != NULL;
+}
+
+static inline bool file_exists(const char* filename) {
+  struct stat st;
+  return os::stat(filename, &st) == 0;
+}
+
+static inline void delete_file(const char* filename) {
+  if (!file_exists(filename)) {
+    return;
+  }
+  int ret = remove(filename);
+  EXPECT_TRUE(ret == 0 || errno == ENOENT) << "failed to remove file '" << filename << "': "
+      << os::strerror(errno) << " (" << errno << ")";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/logging/test_logConfiguration.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+#include "precompiled.hpp"
+#include "logTestFixture.hpp"
+#include "logTestUtils.inline.hpp"
+#include "logging/logConfiguration.hpp"
+#include "logging/logLevel.hpp"
+#include "logging/logOutput.hpp"
+#include "logging/logTag.hpp"
+#include "logging/logTagSet.hpp"
+#include "memory/resourceArea.hpp"
+#include "unittest.hpp"
+#include "utilities/ostream.hpp"
+
+class LogConfigurationTest : public LogTestFixture {
+ protected:
+  static char _all_decorators[256];
+
+ public:
+  static void SetUpTestCase();
+};
+
+char LogConfigurationTest::_all_decorators[256];
+
+// Prepare _all_decorators to contain the full list of decorators (comma separated)
+void LogConfigurationTest::SetUpTestCase() {
+  char *pos = _all_decorators;
+  for (size_t i = 0; i < LogDecorators::Count; i++) {
+    pos += jio_snprintf(pos, sizeof(_all_decorators) - (pos - _all_decorators), "%s%s",
+                        (i == 0 ? "" : ","),
+                        LogDecorators::name(static_cast<LogDecorators::Decorator>(i)));
+  }
+}
+
+// Check if the given text is included by LogConfiguration::describe()
+static bool is_described(const char* text) {
+  ResourceMark rm;
+  stringStream ss;
+  LogConfiguration::describe(&ss);
+  return string_contains_substring(ss.as_string(), text);
+}
+
+TEST_F(LogConfigurationTest, describe) {
+  ResourceMark rm;
+  stringStream ss;
+  LogConfiguration::describe(&ss);
+  const char* description = ss.as_string();
+
+  // Verify that stdout and stderr are listed by default
+  EXPECT_PRED2(string_contains_substring, description, LogOutput::Stdout->name());
+  EXPECT_PRED2(string_contains_substring, description, LogOutput::Stderr->name());
+
+  // Verify that each tag, level and decorator is listed
+  for (size_t i = 0; i < LogTag::Count; i++) {
+    EXPECT_PRED2(string_contains_substring, description, LogTag::name(static_cast<LogTagType>(i)));
+  }
+  for (size_t i = 0; i < LogLevel::Count; i++) {
+    EXPECT_PRED2(string_contains_substring, description, LogLevel::name(static_cast<LogLevelType>(i)));
+  }
+  for (size_t i = 0; i < LogDecorators::Count; i++) {
+    EXPECT_PRED2(string_contains_substring, description, LogDecorators::name(static_cast<LogDecorators::Decorator>(i)));
+  }
+
+  // Verify that the default configuration is printed
+  char expected_buf[256];
+  int ret = jio_snprintf(expected_buf, sizeof(expected_buf), "=%s", LogLevel::name(LogLevel::Default));
+  ASSERT_NE(-1, ret);
+  EXPECT_PRED2(string_contains_substring, description, expected_buf);
+  EXPECT_PRED2(string_contains_substring, description, "#1: stderr all=off");
+
+  // Verify default decorators are listed
+  LogDecorators default_decorators;
+  expected_buf[0] = '\0';
+  for (size_t i = 0; i < LogDecorators::Count; i++) {
+    LogDecorators::Decorator d = static_cast<LogDecorators::Decorator>(i);
+    if (default_decorators.is_decorator(d)) {
+      ASSERT_LT(strlen(expected_buf), sizeof(expected_buf));
+      ret = jio_snprintf(expected_buf + strlen(expected_buf),
+                         sizeof(expected_buf) - strlen(expected_buf),
+                         "%s%s",
+                         strlen(expected_buf) > 0 ? "," : "",
+                         LogDecorators::name(d));
+      ASSERT_NE(-1, ret);
+    }
+  }
+  EXPECT_PRED2(string_contains_substring, description, expected_buf);
+
+  // Add a new output and verify that it gets described after it has been added
+  const char* what = "all=trace";
+  EXPECT_FALSE(is_described(TestLogFileName)) << "Test output already exists!";
+  set_log_config(TestLogFileName, what);
+  EXPECT_TRUE(is_described(TestLogFileName));
+  EXPECT_TRUE(is_described("logging=trace"));
+}
+
+// Test updating an existing log output
+TEST_F(LogConfigurationTest, update_output) {
+  // Update stdout twice, first using it's name, and the second time its index #
+  const char* test_outputs[] = { "stdout", "#0" };
+  for (size_t i = 0; i < ARRAY_SIZE(test_outputs); i++) {
+    set_log_config(test_outputs[i], "all=info");
+
+    // Verify configuration using LogConfiguration::describe
+    EXPECT_TRUE(is_described("#0: stdout"));
+    EXPECT_TRUE(is_described("logging=info"));
+
+    // Verify by iterating over tagsets
+    LogOutput* o = LogOutput::Stdout;
+    for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
+      EXPECT_TRUE(ts->has_output(o));
+      EXPECT_TRUE(ts->is_level(LogLevel::Info));
+      EXPECT_FALSE(ts->is_level(LogLevel::Debug));
+    }
+
+    // Now change the level and verify the change propagated
+    set_log_config(test_outputs[i], "all=debug");
+    for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
+      EXPECT_TRUE(ts->has_output(o));
+      EXPECT_TRUE(ts->is_level(LogLevel::Debug));
+      EXPECT_FALSE(ts->is_level(LogLevel::Trace));
+    }
+  }
+}
+
+// Test adding a new output to the configuration
+TEST_F(LogConfigurationTest, add_new_output) {
+  const char* what = "all=trace";
+
+  ASSERT_FALSE(is_described(TestLogFileName));
+  set_log_config(TestLogFileName, what);
+
+  // Verify new output using LogConfiguration::describe
+  EXPECT_TRUE(is_described(TestLogFileName));
+  EXPECT_TRUE(is_described("logging=trace"));
+
+  // Also verify by iterating over tagsets, checking levels on tagsets
+  for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
+    EXPECT_TRUE(ts->is_level(LogLevel::Trace));
+  }
+}
+
+TEST_F(LogConfigurationTest, disable_logging) {
+  // Add TestLogFileName as an output
+  set_log_config(TestLogFileName, "logging=info");
+
+  LogConfiguration::disable_logging();
+
+  // Verify TestLogFileName was disabled
+  EXPECT_FALSE(is_described(TestLogFileName));
+
+  // Verify that no tagset has logging enabled
+  for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
+    EXPECT_FALSE(ts->has_output(LogOutput::Stdout));
+    EXPECT_FALSE(ts->has_output(LogOutput::Stderr));
+    EXPECT_FALSE(ts->is_level(LogLevel::Error));
+  }
+}
+
+// Test disabling a particular output
+TEST_F(LogConfigurationTest, disable_output) {
+  // Disable the default configuration for stdout
+  set_log_config("stdout", "all=off");
+
+  // Verify configuration using LogConfiguration::describe
+  EXPECT_TRUE(is_described("#0: stdout all=off"));
+
+  // Verify by iterating over tagsets
+  LogOutput* o = LogOutput::Stdout;
+  for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
+    EXPECT_FALSE(ts->has_output(o));
+    EXPECT_FALSE(ts->is_level(LogLevel::Error));
+  }
+
+  // Add a new file output
+  const char* what = "all=debug";
+  set_log_config(TestLogFileName, what);
+  EXPECT_TRUE(is_described(TestLogFileName));
+
+  // Now disable it, verifying it is removed completely
+  set_log_config(TestLogFileName, "all=off");
+  EXPECT_FALSE(is_described(TestLogFileName));
+  for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
+    EXPECT_FALSE(ts->is_level(LogLevel::Error));
+  }
+}
+
+// Test reconfiguration of the selected decorators for an output
+TEST_F(LogConfigurationTest, reconfigure_decorators) {
+  // Configure stderr with all decorators
+  set_log_config("stderr", "all=off", _all_decorators);
+  char buf[256];
+  int ret = jio_snprintf(buf, sizeof(buf), "#1: stderr all=off %s", _all_decorators);
+  ASSERT_NE(-1, ret);
+  EXPECT_TRUE(is_described(buf)) << "'" << buf << "' not described after reconfiguration";
+
+  // Now reconfigure logging on stderr with no decorators
+  set_log_config("stderr", "all=off", "none");
+  EXPECT_TRUE(is_described("#1: stderr all=off \n")) << "Expecting no decorators";
+}
+
+// Test that invalid options cause configuration errors
+TEST_F(LogConfigurationTest, invalid_configure_options) {
+  LogConfiguration::disable_logging();
+  const char* invalid_outputs[] = { "#2", "invalidtype=123", ":invalid/path}to*file?" };
+  for (size_t i = 0; i < ARRAY_SIZE(invalid_outputs); i++) {
+    EXPECT_FALSE(set_log_config(invalid_outputs[i], "", "", "", true))
+      << "Accepted invalid output '" << invalid_outputs[i] << "'";
+  }
+  EXPECT_FALSE(LogConfiguration::parse_command_line_arguments("all=invalid_level"));
+  EXPECT_FALSE(LogConfiguration::parse_command_line_arguments("what=invalid"));
+  EXPECT_FALSE(LogConfiguration::parse_command_line_arguments("all::invalid_decorator"));
+}
+
+// Test empty configuration options
+TEST_F(LogConfigurationTest, parse_empty_command_line_arguments) {
+  const char* empty_variations[] = { "", ":", "::", ":::", "::::" };
+  for (size_t i = 0; i < ARRAY_SIZE(empty_variations); i++) {
+    const char* cmdline = empty_variations[i];
+    bool ret = LogConfiguration::parse_command_line_arguments(cmdline);
+    EXPECT_TRUE(ret) << "Error parsing command line arguments '" << cmdline << "'";
+    for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
+      EXPECT_EQ(LogLevel::Unspecified, ts->level_for(LogOutput::Stdout));
+    }
+  }
+}
+
+// Test basic command line parsing & configuration
+TEST_F(LogConfigurationTest, parse_command_line_arguments) {
+  // Prepare a command line for logging*=debug on stderr with all decorators
+  int ret;
+  char buf[256];
+  ret = jio_snprintf(buf, sizeof(buf), "logging*=debug:stderr:%s", _all_decorators);
+  ASSERT_NE(-1, ret);
+
+  bool success = LogConfiguration::parse_command_line_arguments(buf);
+  EXPECT_TRUE(success) << "Error parsing valid command line arguments '" << buf << "'";
+  // Ensure the new configuration applied
+  EXPECT_TRUE(is_described("logging=debug"));
+  EXPECT_TRUE(is_described(_all_decorators));
+
+  // Test the configuration of file outputs as well
+  ret = jio_snprintf(buf, sizeof(buf), ":%s", TestLogFileName);
+  ASSERT_NE(-1, ret);
+  EXPECT_TRUE(LogConfiguration::parse_command_line_arguments(buf));
+}
+
+// Test split up log configuration arguments
+TEST_F(LogConfigurationTest, parse_log_arguments) {
+  ResourceMark rm;
+  stringStream ss;
+  // Verify that it's possible to configure each individual tag
+  for (size_t t = 1 /* Skip _NO_TAG */; t < LogTag::Count; t++) {
+    const LogTagType tag = static_cast<LogTagType>(t);
+    EXPECT_TRUE(LogConfiguration::parse_log_arguments("stdout", LogTag::name(tag), "", "", &ss));
+  }
+  // Same for each level
+  for (size_t l = 0; l < LogLevel::Count; l++) {
+    const LogLevelType level = static_cast<LogLevelType>(l);
+    char expected_buf[256];
+    int ret = jio_snprintf(expected_buf, sizeof(expected_buf), "all=%s", LogLevel::name(level));
+    ASSERT_NE(-1, ret);
+    EXPECT_TRUE(LogConfiguration::parse_log_arguments("stderr", expected_buf, "", "", &ss));
+  }
+  // And for each decorator
+  for (size_t d = 0; d < LogDecorators::Count; d++) {
+    const LogDecorators::Decorator decorator = static_cast<LogDecorators::Decorator>(d);
+    EXPECT_TRUE(LogConfiguration::parse_log_arguments("#0", "", LogDecorators::name(decorator), "", &ss));
+  }
+  EXPECT_STREQ("", ss.as_string()) << "Error reported while parsing: " << ss.as_string();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/logging/test_logDecorations.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+#include "precompiled.hpp"
+#include "logging/logDecorations.hpp"
+#include "logging/logTagSet.hpp"
+#include "runtime/os.hpp"
+#include "unittest.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+static const LogTagSet& tagset = LogTagSetMapping<LOG_TAGS(logging, safepoint)>::tagset();
+static const LogDecorators default_decorators;
+
+TEST(LogDecorations, level) {
+  for (uint l = LogLevel::First; l <= LogLevel::Last; l++) {
+    LogLevelType level = static_cast<LogLevelType>(l);
+    // Create a decorations object for the current level
+    LogDecorations decorations(level, tagset, default_decorators);
+    // Verify that the level decoration matches the specified level
+    EXPECT_STREQ(LogLevel::name(level), decorations.decoration(LogDecorators::level_decorator));
+
+    // Test changing level after object creation time
+    LogLevelType other_level;
+    if (l != LogLevel::Last) {
+      other_level = static_cast<LogLevelType>(l + 1);
+    } else {
+      other_level = static_cast<LogLevelType>(LogLevel::First);
+    }
+    decorations.set_level(other_level);
+    EXPECT_STREQ(LogLevel::name(other_level), decorations.decoration(LogDecorators::level_decorator))
+        << "Decoration reports incorrect value after changing the level";
+  }
+}
+
+TEST(LogDecorations, uptime) {
+  // Verify the format of the decoration
+  int a, b;
+  char decimal_point;
+  LogDecorations decorations(LogLevel::Info, tagset, default_decorators);
+  const char* uptime = decorations.decoration(LogDecorators::uptime_decorator);
+  int read = sscanf(uptime, "%d%c%ds", &a, &decimal_point, &b);
+  EXPECT_EQ(3, read) << "Invalid uptime decoration: " << uptime;
+  EXPECT_TRUE(decimal_point == '.' || decimal_point == ',') << "Invalid uptime decoration: " << uptime;
+
+  // Verify that uptime increases
+  double prev = 0;
+  for (int i = 0; i < 3; i++) {
+    os::naked_short_sleep(10);
+    LogDecorations d(LogLevel::Info, tagset, default_decorators);
+    double cur = strtod(d.decoration(LogDecorators::uptime_decorator), NULL);
+    ASSERT_LT(prev, cur);
+    prev = cur;
+  }
+}
+
+TEST(LogDecorations, tags) {
+  char expected_tags[1 * K];
+  tagset.label(expected_tags, sizeof(expected_tags));
+  // Verify that the expected tags are included in the tags decoration
+  LogDecorations decorations(LogLevel::Info, tagset, default_decorators);
+  EXPECT_STREQ(expected_tags, decorations.decoration(LogDecorators::tags_decorator));
+}
+
+// Test each variation of the different timestamp decorations (ms, ns, uptime ms, uptime ns)
+TEST(LogDecorations, timestamps) {
+  struct {
+    const LogDecorators::Decorator decorator;
+    const char* suffix;
+  } test_decorator[] = {
+    { LogDecorators::timemillis_decorator, "ms" },
+    { LogDecorators::uptimemillis_decorator, "ms" },
+    { LogDecorators::timenanos_decorator, "ns" },
+    { LogDecorators::uptimenanos_decorator, "ns" }
+  };
+
+  for (uint i = 0; i < ARRAY_SIZE(test_decorator); i++) {
+    LogDecorators::Decorator decorator = test_decorator[i].decorator;
+    LogDecorators decorator_selection;
+    ASSERT_TRUE(decorator_selection.parse(LogDecorators::name(decorator)));
+
+    // Create decorations with the decorator we want to test included
+    LogDecorations decorations(LogLevel::Info, tagset, decorator_selection);
+    const char* decoration = decorations.decoration(decorator);
+
+    // Verify format of timestamp
+    const char* suffix;
+    for (suffix = decoration; isdigit(*suffix); suffix++) {
+      // Skip over digits
+    }
+    EXPECT_STREQ(test_decorator[i].suffix, suffix);
+
+    // Verify timestamp values
+    julong prev = 0;
+    for (int i = 0; i < 3; i++) {
+      os::naked_short_sleep(5);
+      LogDecorations d(LogLevel::Info, tagset, decorator_selection);
+      julong val = strtoull(d.decoration(decorator), NULL, 10);
+      ASSERT_LT(prev, val);
+      prev = val;
+    }
+  }
+}
+
+// Test the time decoration
+TEST(LogDecorations, iso8601_time) {
+  LogDecorators decorator_selection;
+  ASSERT_TRUE(decorator_selection.parse("time"));
+  LogDecorations decorations(LogLevel::Info, tagset, decorator_selection);
+
+  const char *timestr = decorations.decoration(LogDecorators::time_decorator);
+  time_t expected_ts = time(NULL);
+
+  // Verify format
+  int y, M, d, h, m;
+  double s;
+  int read = sscanf(timestr, "%d-%d-%dT%d:%d:%lfZ", &y, &M, &d, &h, &m, &s);
+  ASSERT_EQ(6, read);
+
+  // Verify reported time & date
+  struct tm reported_time = {0};
+  reported_time.tm_year = y - 1900;
+  reported_time.tm_mon = M - 1;
+  reported_time.tm_mday = d;
+  reported_time.tm_hour = h;
+  reported_time.tm_min = m;
+  reported_time.tm_sec = s;
+  reported_time.tm_isdst = daylight;
+  time_t reported_ts = mktime(&reported_time);
+  expected_ts = mktime(localtime(&expected_ts));
+  time_t diff = reported_ts - expected_ts;
+  if (diff < 0) {
+    diff = -diff;
+  }
+  // Allow up to 10 seconds in difference
+  ASSERT_LE(diff, 10) << "Reported time: " << reported_ts << " (" << timestr << ")"
+      << ", expected time: " << expected_ts;
+}
+
+// Test the pid and tid decorations
+TEST(LogDecorations, identifiers) {
+  LogDecorators decorator_selection;
+  ASSERT_TRUE(decorator_selection.parse("pid,tid"));
+  LogDecorations decorations(LogLevel::Info, tagset, decorator_selection);
+
+  struct {
+      intx expected;
+      LogDecorators::Decorator decorator;
+  } ids[] = {
+      { os::current_process_id(), LogDecorators::pid_decorator },
+      { os::current_thread_id(), LogDecorators::tid_decorator },
+  };
+
+  for (uint i = 0; i < ARRAY_SIZE(ids); i++) {
+    const char* reported = decorations.decoration(ids[i].decorator);
+
+    // Verify format
+    const char* str;
+    for (str = reported; isdigit(*str); str++) {
+      // Skip over digits
+    }
+    EXPECT_EQ('\0', *str) << "Should only contain digits";
+
+    // Verify value
+    EXPECT_EQ(ids[i].expected, strtol(reported, NULL, 10));
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/logging/test_logDecorators.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+#include "precompiled.hpp"
+#include "logging/logDecorators.hpp"
+#include "unittest.hpp"
+
+static LogDecorators::Decorator decorator_array[] = {
+#define DECORATOR(name, abbr) LogDecorators::name##_decorator,
+    DECORATOR_LIST
+#undef DECORATOR
+};
+
+static const char* decorator_name_array[] = {
+#define DECORATOR(name, abbr) #name,
+    DECORATOR_LIST
+#undef DECORATOR
+};
+
+static const char* decorator_abbr_array[] = {
+#define DECORATOR(name, abbr) #abbr,
+    DECORATOR_LIST
+#undef DECORATOR
+};
+
+// Assert that the given decorators object has the default decorators (uptime, level, tags)
+// If exclusive = true, also assert that no other decorators are selected
+static void assert_default_decorators(LogDecorators* decorators, bool exclusive = true) {
+  for (int i = 0; i < LogDecorators::Count; i++) {
+    LogDecorators::Decorator decorator = decorator_array[i];
+    if (decorator == LogDecorators::uptime_decorator ||
+        decorator == LogDecorators::level_decorator ||
+        decorator == LogDecorators::tags_decorator) {
+      EXPECT_TRUE(decorators->is_decorator(decorator));
+    } else if (exclusive) {
+      EXPECT_FALSE(decorators->is_decorator(decorator));
+    }
+  }
+}
+
+TEST(LogDecorators, defaults) {
+  LogDecorators decorators;
+  assert_default_decorators(&decorators);
+}
+
+// Test converting between name and decorator (string and enum)
+TEST(LogDecorators, from_and_to_name) {
+  EXPECT_EQ(LogDecorators::Invalid, LogDecorators::from_string("unknown"));
+  EXPECT_EQ(LogDecorators::Invalid, LogDecorators::from_string(""));
+
+  for (int i = 0; i < LogDecorators::Count; i++) {
+    LogDecorators::Decorator decorator = decorator_array[i];
+
+    const char* name = LogDecorators::name(decorator);
+    EXPECT_STREQ(decorator_name_array[i], name);
+
+    LogDecorators::Decorator decorator2 = LogDecorators::from_string(name);
+    EXPECT_EQ(decorator, decorator2);
+
+    // Test case insensitivity
+    char* name_cpy = strdup(name);
+    name_cpy[0] = toupper(name_cpy[0]);
+    decorator2 = LogDecorators::from_string(name_cpy);
+    free(name_cpy);
+    EXPECT_EQ(decorator, decorator2);
+  }
+}
+
+// Test decorator abbreviations
+TEST(LogDecorators, from_and_to_abbr) {
+  for (int i = 0; i < LogDecorators::Count; i++) {
+    LogDecorators::Decorator decorator = decorator_array[i];
+
+    const char* abbr = LogDecorators::abbreviation(decorator);
+    EXPECT_STREQ(decorator_abbr_array[i], abbr);
+
+    LogDecorators::Decorator decorator2 = LogDecorators::from_string(abbr);
+    ASSERT_EQ(decorator, decorator2);
+
+    // Test case insensitivity
+    char* abbr_cpy = strdup(abbr);
+    abbr_cpy[0] = toupper(abbr_cpy[0]);
+    decorator2 = LogDecorators::from_string(abbr_cpy);
+    free(abbr_cpy);
+    EXPECT_EQ(decorator, decorator2);
+  }
+}
+
+TEST(LogDecorators, parse_default) {
+  LogDecorators decorators;
+  decorators.parse(""); // Empty string means we should use the default decorators
+  assert_default_decorators(&decorators);
+}
+
+// Test that "none" gives no decorators at all
+TEST(LogDecorators, parse_none) {
+  LogDecorators decorators;
+  decorators.parse("none");
+  for (int i = 0; i < LogDecorators::Count; i++) {
+    EXPECT_FALSE(decorators.is_decorator(decorator_array[i]));
+  }
+}
+
+// Test a few invalid decorator selections
+TEST(LogDecorators, parse_invalid) {
+  LogDecorators decorators;
+  EXPECT_FALSE(decorators.parse("invalid"));
+  EXPECT_FALSE(decorators.parse(",invalid"));
+  EXPECT_FALSE(decorators.parse(",invalid,"));
+  assert_default_decorators(&decorators);
+}
+
+// Assert that the given decorator has all decorators between first and last
+static void assert_decorations_between(const LogDecorators* decorator, size_t first, size_t last) {
+  for (size_t i = 0; i < ARRAY_SIZE(decorator_array); i++) {
+    if (i >= first && i <= last) {
+      EXPECT_TRUE(decorator->is_decorator(decorator_array[i]));
+    } else {
+      EXPECT_FALSE(decorator->is_decorator(decorator_array[i]));
+    }
+  }
+}
+
+TEST(LogDecorators, parse) {
+  LogDecorators decorators;
+
+  // Verify a bunch of different decorator selections
+  char decstr[1 * K];
+  decstr[0] = '\0';
+  size_t written = 0;
+  for (size_t i = 0; i < ARRAY_SIZE(decorator_array); i++) {
+    for (size_t j = i; j < ARRAY_SIZE(decorator_array); j++) {
+      for (size_t k = i; k <= j; k++) {
+        ASSERT_LT(written, sizeof(decstr)) << "decstr overflow";
+        int ret = jio_snprintf(decstr + written, sizeof(decstr) - written, "%s%s",
+                               written == 0 ? "" : ",",
+                               ((k + j) % 2 == 0) ? decorator_name_array[k] : decorator_abbr_array[k]);
+        ASSERT_NE(-1, ret);
+        written += ret;
+      }
+      EXPECT_TRUE(decorators.parse(decstr)) << "Valid decorator selection did not parse: " << decstr;
+      assert_decorations_between(&decorators, i, j);
+      written = 0;
+      decstr[0] = '\0';
+    }
+  }
+}
+
+TEST(LogDecorators, combine_with) {
+  LogDecorators dec1;
+  LogDecorators dec2;
+
+  // Select first and third decorator for dec1
+  char input[64];
+  sprintf(input, "%s,%s", decorator_name_array[0], decorator_name_array[2]);
+  dec1.parse(input);
+  EXPECT_TRUE(dec1.is_decorator(decorator_array[0]));
+  EXPECT_TRUE(dec1.is_decorator(decorator_array[2]));
+
+  // Select the default decorators for dec2
+  EXPECT_FALSE(dec2.is_decorator(decorator_array[0]));
+  EXPECT_FALSE(dec2.is_decorator(decorator_array[2]));
+  assert_default_decorators(&dec2);
+
+  // Combine and verify that the combination includes first, third and default decorators
+  dec2.combine_with(dec1);
+  EXPECT_TRUE(dec2.is_decorator(decorator_array[0]));
+  EXPECT_TRUE(dec2.is_decorator(decorator_array[2]));
+  assert_default_decorators(&dec2, false);
+}
+
+TEST(LogDecorators, clear) {
+  // Start with default decorators and then clear it
+  LogDecorators dec;
+  EXPECT_FALSE(dec.is_empty());
+
+  dec.clear();
+  EXPECT_TRUE(dec.is_empty());
+  for (size_t i = 0; i < LogDecorators::Count; i++) {
+    EXPECT_FALSE(dec.is_decorator(decorator_array[i]));
+  }
+}
+
+// Test the decorator constant None
+TEST(LogDecorators, none) {
+  LogDecorators dec = LogDecorators::None;
+  for (size_t i = 0; i < LogDecorators::Count; i++) {
+    EXPECT_FALSE(dec.is_decorator(decorator_array[i]));
+  }
+}
+
+TEST(LogDecorators, is_empty) {
+  LogDecorators def, none = LogDecorators::None;
+  EXPECT_FALSE(def.is_empty());
+  EXPECT_TRUE(none.is_empty());
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/logging/test_logFileOutput.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+#include "precompiled.hpp"
+#include "logging/logFileOutput.hpp"
+#include "memory/resourceArea.hpp"
+#include "runtime/os.hpp"
+#include "unittest.hpp"
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/ostream.hpp"
+
+static const char* name = "testlog.pid%p.%t.log";
+
+// Test parsing a bunch of valid file output options
+TEST(LogFileOutput, parse_valid) {
+  const char* valid_options[] = {
+    "", "filecount=10", "filesize=512",
+    "filecount=11,filesize=256",
+    "filesize=256,filecount=11",
+    "filesize=0", "filecount=1",
+    "filesize=1m", "filesize=1M",
+    "filesize=1k", "filesize=1G"
+  };
+
+  // Override LogOutput's vm_start time to get predictable file name
+  LogFileOutput::set_file_name_parameters(0);
+  char expected_filename[1 * K];
+  int ret = jio_snprintf(expected_filename, sizeof(expected_filename),
+                         "testlog.pid%d.1970-01-01_01-00-00.log",
+                         os::current_process_id());
+  ASSERT_GT(ret, 0) << "Buffer too small";
+
+  for (size_t i = 0; i < ARRAY_SIZE(valid_options); i++) {
+    ResourceMark rm;
+    stringStream ss;
+    {
+      LogFileOutput fo(name);
+      EXPECT_STREQ(name, fo.name());
+      EXPECT_TRUE(fo.initialize(valid_options[i], &ss))
+        << "Did not accept valid option(s) '" << valid_options[i] << "': " << ss.as_string();
+    }
+    remove(expected_filename);
+  }
+}
+
+// Test parsing a bunch of invalid file output options
+TEST(LogFileOutput, parse_invalid) {
+  const char* invalid_options[] = {
+    "invalidopt", "filecount=",
+    "filesize=,filecount=10",
+    "fileco=10", "ilesize=512",
+    "filecount=11,,filesize=256",
+    ",filesize=256,filecount=11",
+    "filesize=256,filecount=11,",
+    "filesize=-1", "filecount=0.1",
+    "filecount=-2", "filecount=2.0",
+    "filecount= 2", "filesize=2 ",
+    "filecount=ab", "filesize=0xz",
+    "filecount=1MB", "filesize=99bytes",
+    "filesize=9999999999999999999999999"
+    "filecount=9999999999999999999999999"
+  };
+
+  for (size_t i = 0; i < ARRAY_SIZE(invalid_options); i++) {
+    ResourceMark rm;
+    stringStream ss;
+    LogFileOutput fo(name);
+    EXPECT_FALSE(fo.initialize(invalid_options[i], &ss))
+      << "Accepted invalid option(s) '" << invalid_options[i] << "': " << ss.as_string();
+  }
+}
+
+// Test for overflows with filesize
+TEST(LogFileOutput, filesize_overflow) {
+  char buf[256];
+  int ret = jio_snprintf(buf, sizeof(buf), "filesize=" SIZE_FORMAT "K", SIZE_MAX);
+  ASSERT_GT(ret, 0) << "Buffer too small";
+
+  ResourceMark rm;
+  stringStream ss;
+  LogFileOutput fo(name);
+  EXPECT_FALSE(fo.initialize(buf, &ss)) << "Accepted filesize that overflows";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/logging/test_logLevel.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+#include "precompiled.hpp"
+#include "logging/logLevel.hpp"
+#include "unittest.hpp"
+
+TEST(LogLevel, from_string) {
+  LogLevelType level;
+
+  // Verify each name defined in the LOG_LEVEL_LIST
+#define LOG_LEVEL(lname, lstring) \
+  level = LogLevel::from_string(#lstring); \
+  EXPECT_EQ(level, LogLevel::lname);
+  LOG_LEVEL_LIST
+#undef LOG_LEVEL
+
+  // Verify a few invalid level strings
+  EXPECT_EQ(LogLevel::Invalid, LogLevel::from_string("bad level"));
+  EXPECT_EQ(LogLevel::Invalid, LogLevel::from_string("debugger"));
+  EXPECT_EQ(LogLevel::Invalid, LogLevel::from_string("inf"));
+  EXPECT_EQ(LogLevel::Invalid, LogLevel::from_string("info "));
+  EXPECT_EQ(LogLevel::Invalid, LogLevel::from_string("  info"));
+  EXPECT_EQ(LogLevel::Invalid, LogLevel::from_string("=info"));
+  EXPECT_EQ(LogLevel::Invalid, LogLevel::from_string("infodebugwarning"));
+}
+
+TEST(LogLevel, name) {
+  // Use names from macro as reference
+#define LOG_LEVEL(lname, lstring) \
+  EXPECT_STREQ(LogLevel::name(LogLevel::lname), #lstring);
+  LOG_LEVEL_LIST
+#undef LOG_LEVEL
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/logging/test_logOutputList.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,255 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+#include "precompiled.hpp"
+#include "logging/logLevel.hpp"
+#include "logging/logOutput.hpp"
+#include "logging/logOutputList.hpp"
+#include "runtime/os.hpp"
+#include "unittest.hpp"
+
+// Count the outputs in the given list, starting from the specified level
+static size_t output_count(LogOutputList* list, LogLevelType from = LogLevel::Error)  {
+  size_t count = 0;
+  for (LogOutputList::Iterator it = list->iterator(from); it != list->end(); it++) {
+    count++;
+  }
+  return count;
+}
+
+// Get the level for an output in the given list
+static LogLevelType find_output_level(LogOutputList* list, LogOutput* o) {
+  for (size_t levelnum = 1; levelnum < LogLevel::Count; levelnum++) {
+    LogLevelType level = static_cast<LogLevelType>(levelnum);
+    for (LogOutputList::Iterator it = list->iterator(level); it != list->end(); it++) {
+      if (*it == o) {
+        return level;
+      }
+    }
+  }
+  return LogLevel::Off;
+}
+
+// Create a dummy output pointer with the specified id.
+// This dummy pointer should not be used for anything
+// but pointer comparisons with other dummies.
+static LogOutput* dummy_output(size_t id) {
+  return reinterpret_cast<LogOutput*>(id + 1);
+}
+
+// Randomly update and verify some outputs some number of times
+TEST(LogOutputList, set_output_level_update) {
+  const size_t TestOutputCount = 10;
+  const size_t TestIterations = 10000;
+  LogOutputList list;
+  size_t outputs_on_level[LogLevel::Count];
+  LogLevelType expected_level_for_output[TestOutputCount];
+
+  os::init_random(0x4711);
+  for (size_t i = 0; i < LogLevel::Count; i++) {
+    outputs_on_level[i] = 0;
+  }
+  outputs_on_level[LogLevel::Off] = TestOutputCount;
+  for (size_t i = 0; i < TestOutputCount; i++) {
+    expected_level_for_output[i] = LogLevel::Off;
+  }
+
+  for (size_t iteration = 0; iteration < TestIterations; iteration++) {
+    size_t output_idx = os::random() % TestOutputCount;
+    size_t levelnum = os::random() % LogLevel::Count;
+    LogLevelType level = static_cast<LogLevelType>(levelnum);
+
+    // Update the expectations
+    outputs_on_level[expected_level_for_output[output_idx]]--;
+    outputs_on_level[levelnum]++;
+    expected_level_for_output[output_idx] = level;
+
+    // Update the actual list
+    list.set_output_level(dummy_output(output_idx), level);
+
+    // Verify expected levels
+    for (size_t i = 0; i < TestOutputCount; i++) {
+      ASSERT_EQ(expected_level_for_output[i], find_output_level(&list, dummy_output(i)));
+    }
+    // Verify output counts
+    size_t expected_count = 0;
+    for (size_t i = 1; i < LogLevel::Count; i++) {
+      expected_count += outputs_on_level[i];
+      ASSERT_EQ(expected_count, output_count(&list, static_cast<LogLevelType>(i)));
+    }
+    ASSERT_EQ(TestOutputCount, expected_count + outputs_on_level[LogLevel::Off]);
+  }
+}
+
+// Test removing outputs from a LogOutputList
+TEST(LogOutputList, set_output_level_remove) {
+  LogOutputList list;
+
+  // Add three dummy outputs per loglevel
+  for (size_t i = 1; i < LogLevel::Count; i++) {
+    list.set_output_level(dummy_output(i), static_cast<LogLevelType>(i));
+    list.set_output_level(dummy_output(i*10), static_cast<LogLevelType>(i));
+    list.set_output_level(dummy_output(i*100), static_cast<LogLevelType>(i));
+  }
+
+  // Verify that they have been added successfully
+  // (Count - 1 since we don't count LogLevel::Off)
+  EXPECT_EQ(3u * (LogLevel::Count - 1), output_count(&list));
+  // Now remove the second output from each loglevel
+  for (size_t i = 1; i < LogLevel::Count; i++) {
+    list.set_output_level(dummy_output(i*10), LogLevel::Off);
+  }
+  // Make sure they have been successfully removed
+  EXPECT_EQ(2u * (LogLevel::Count - 1), output_count(&list));
+
+  // Now remove the remaining outputs
+  for (size_t i = 1; i < LogLevel::Count; i++) {
+    list.set_output_level(dummy_output(i), LogLevel::Off);
+    list.set_output_level(dummy_output(i*100), LogLevel::Off);
+  }
+  EXPECT_EQ(0u, output_count(&list));
+}
+
+// Test adding to a LogOutputList
+TEST(LogOutputList, set_output_level_add) {
+  LogOutputList list;
+
+  // First add 5 outputs to Info level
+  for (size_t i = 10; i < 15; i++) {
+    list.set_output_level(dummy_output(i), LogLevel::Info);
+  }
+
+  // Verify that they have been added successfully
+  size_t count = 0;
+  for (LogOutputList::Iterator it = list.iterator(); it != list.end(); it++) {
+    ASSERT_EQ(dummy_output(10 + count++), *it);
+  }
+  ASSERT_EQ(5u, count);
+
+  // Now add more outputs, but on all different levels
+  for (size_t i = 5; i < 10; i++) {
+    list.set_output_level(dummy_output(i), LogLevel::Warning);
+  }
+  for (size_t i = 0; i < 5; i++) {
+    list.set_output_level(dummy_output(i), LogLevel::Error);
+  }
+  for (size_t i = 15; i < 20; i++) {
+    list.set_output_level(dummy_output(i), LogLevel::Debug);
+  }
+  for (size_t i = 20; i < 25; i++) {
+    list.set_output_level(dummy_output(i), LogLevel::Trace);
+  }
+
+  // Verify that that all outputs have been added, and that the order is Error, Warning, Info, Debug, Trace
+  count = 0;
+  for (LogOutputList::Iterator it = list.iterator(); it != list.end(); it++) {
+    ASSERT_EQ(dummy_output(count++), *it);
+  }
+  ASSERT_EQ(25u, count);
+}
+
+// Test is_level() on lists with a single output on different levels
+TEST(LogOutputList, is_level_single_output) {
+  for (size_t i = LogLevel::First; i < LogLevel::Count; i++) {
+    LogLevelType level = static_cast<LogLevelType>(i);
+    LogOutputList list;
+    list.set_output_level(LogOutput::Stdout, level);
+    for (size_t j = LogLevel::First; j < LogLevel::Count; j++) {
+      LogLevelType other = static_cast<LogLevelType>(j);
+      // Verify that levels finer than the current level for stdout are reported as disabled,
+      // and levels equal to or included in the current level are reported as enabled
+      if (other >= level) {
+        EXPECT_TRUE(list.is_level(other))
+          << LogLevel::name(other) << " >= " << LogLevel::name(level) << " but is_level() returns false";
+      } else {
+        EXPECT_FALSE(list.is_level(other))
+          << LogLevel::name(other) << " < " << LogLevel::name(level) << " but is_level() returns true";
+      }
+    }
+  }
+}
+
+// Test is_level() with an empty list
+TEST(LogOutputList, is_level_empty) {
+  LogOutputList emptylist;
+  for (size_t i = LogLevel::First; i < LogLevel::Count; i++) {
+    LogLevelType other = static_cast<LogLevelType>(i);
+    EXPECT_FALSE(emptylist.is_level(other)) << "is_level() returns true even though the list is empty";
+  }
+}
+
+// Test is_level() on lists with two outputs on different levels
+TEST(LogOutputList, is_level_multiple_outputs) {
+  for (size_t i = LogLevel::First; i < LogLevel::Count - 1; i++) {
+      LogOutput* dummy1 = LogOutput::Stdout;
+      LogOutput* dummy2 = LogOutput::Stderr;
+      LogLevelType first = static_cast<LogLevelType>(i);
+      LogLevelType second = static_cast<LogLevelType>(i + 1);
+      LogOutputList list;
+      list.set_output_level(dummy1, first);
+      list.set_output_level(dummy2, second);
+      for (size_t j = LogLevel::First; j < LogLevel::Count; j++) {
+        LogLevelType other = static_cast<LogLevelType>(j);
+        // The first output's level will be the finest, expect it's level to be reported by the list
+        if (other >= first) {
+          EXPECT_TRUE(list.is_level(other))
+            << LogLevel::name(other) << " >= " << LogLevel::name(first) << " but is_level() returns false";
+        } else {
+          EXPECT_FALSE(list.is_level(other))
+            << LogLevel::name(other) << " < " << LogLevel::name(first) << " but is_level() returns true";
+        }
+      }
+    }
+}
+
+TEST(LogOutputList, level_for) {
+  LogOutputList list;
+
+  // Ask the empty list about stdout, stderr
+  EXPECT_EQ(LogLevel::Off, list.level_for(LogOutput::Stdout));
+  EXPECT_EQ(LogLevel::Off, list.level_for(LogOutput::Stderr));
+
+  // Ask for level in a list with two outputs on different levels
+  list.set_output_level(LogOutput::Stdout, LogLevel::Info);
+  list.set_output_level(LogOutput::Stderr, LogLevel::Trace);
+  EXPECT_EQ(LogLevel::Info, list.level_for(LogOutput::Stdout));
+  EXPECT_EQ(LogLevel::Trace, list.level_for(LogOutput::Stderr));
+
+  // Remove and ask again
+  list.set_output_level(LogOutput::Stdout, LogLevel::Off);
+  EXPECT_EQ(LogLevel::Off, list.level_for(LogOutput::Stdout));
+  EXPECT_EQ(LogLevel::Trace, list.level_for(LogOutput::Stderr));
+
+  // Ask about an unknown output
+  LogOutput* dummy = dummy_output(4711);
+  EXPECT_EQ(LogLevel::Off, list.level_for(dummy));
+
+  for (size_t i = LogLevel::First; i <= LogLevel::Last; i++) {
+    LogLevelType level = static_cast<LogLevelType>(i);
+    list.set_output_level(dummy, level);
+    EXPECT_EQ(level, list.level_for(dummy));
+  }
+
+  // Make sure the stderr level is still the same
+  EXPECT_EQ(LogLevel::Trace, list.level_for(LogOutput::Stderr));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/logging/test_logTag.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+#include "precompiled.hpp"
+#include "logging/logTag.hpp"
+#include "unittest.hpp"
+
+TEST(LogTag, from_string) {
+  // Verify for all tags defined in LOG_TAG_LIST
+#define LOG_TAG(tag) \
+  EXPECT_EQ(PREFIX_LOG_TAG(tag), LogTag::from_string(#tag));
+  LOG_TAG_LIST
+#undef LOG_TAG
+
+  // Verify a couple of invalid strings parsing as invalid tags
+  const char* invalid_tag[] = {
+    "bad tag", ".^@", "**", "*", "gcc", "+gc", "gc+", "gc+safepoint",
+    "gc+safepoint=warning", "warning", "=info", "gcsafepointlogging",
+    "gc+safepointlogging", "gclogging", "+", " gc", "logging ", ","
+  };
+  for (size_t i = 0; i < sizeof(invalid_tag) / sizeof(*invalid_tag); i++) {
+    EXPECT_EQ(LogTag::__NO_TAG, LogTag::from_string(invalid_tag[i]))
+        << "'" << invalid_tag[i] << "' did not parse as an invalid tag";
+  }
+}
+
+TEST(LogTag, name) {
+  // Verify for each tag from the macro
+#define LOG_TAG(tag) \
+  EXPECT_STREQ(#tag, LogTag::name(PREFIX_LOG_TAG(tag)));
+  LOG_TAG_LIST
+#undef LOG_TAG
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/logging/test_logTagLevelExpression.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+#include "precompiled.hpp"
+#include "logging/logLevel.hpp"
+#include "logging/logTagLevelExpression.hpp"
+#include "logging/logTagSet.hpp"
+#include "unittest.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+TEST(LogTagLevelExpression, parse) {
+  char buf[256];
+  const char* invalid_substr[] = {
+    "=", "+", " ", "+=", "+=*", "*+", " +", "**", "++", ".", ",", ",," ",+",
+    " *", "all+", "all*", "+all", "+all=Warning", "==Info", "=InfoWarning",
+    "BadTag+", "logging++", "logging*+", ",=", "gc+gc+gc+gc+gc+gc"
+  };
+  const char* valid_expression[] = {
+    "all", "gc", "gc,logging", "gc+logging", "logging+gc", "logging+gc,gc", "logging+gc*", "gc=trace",
+    "gc=trace,logging=info", "logging+gc=trace", "logging+gc=trace,gc+logging=warning,logging",
+    "gc,all=info", "logging*", "logging*=info", "gc+logging*=error", "logging*,gc=info"
+  };
+
+  // Verify valid expressions parse without problems
+  for (size_t i = 0; i < ARRAY_SIZE(valid_expression); i++) {
+    LogTagLevelExpression expr;
+    EXPECT_TRUE(expr.parse(valid_expression[i])) << "Valid expression '" << valid_expression[i] << "' did not parse";
+  }
+
+  // Verify we can use 'all' with each available level
+  for (uint level = LogLevel::First; level <= LogLevel::Last; level++) {
+    char buf[32];
+    int ret = jio_snprintf(buf, sizeof(buf), "all=%s", LogLevel::name(static_cast<LogLevelType>(level)));
+    ASSERT_NE(ret, -1);
+
+    LogTagLevelExpression expr;
+    EXPECT_TRUE(expr.parse(buf));
+  }
+
+  // Verify invalid expressions do not parse
+  for (size_t i = 0; i < ARRAY_SIZE(valid_expression); i++) {
+    for (size_t j = 0; j < ARRAY_SIZE(invalid_substr); j++) {
+      // Prefix with invalid substr
+      LogTagLevelExpression expr;
+      jio_snprintf(buf, sizeof(buf), "%s%s", invalid_substr[j], valid_expression[i]);
+      EXPECT_FALSE(expr.parse(buf)) << "'" << buf << "'" << " considered legal";
+
+      // Suffix with invalid substr
+      LogTagLevelExpression expr1;
+      jio_snprintf(buf, sizeof(buf), "%s%s", valid_expression[i], invalid_substr[j]);
+      EXPECT_FALSE(expr1.parse(buf)) << "'" << buf << "'" << " considered legal";
+
+      // Use only the invalid substr
+      LogTagLevelExpression expr2;
+      EXPECT_FALSE(expr2.parse(invalid_substr[j])) << "'" << invalid_substr[j] << "'" << " considered legal";
+    }
+
+    // Suffix/prefix with some unique invalid prefixes/suffixes
+    LogTagLevelExpression expr;
+    jio_snprintf(buf, sizeof(buf), "*%s", valid_expression[i]);
+    EXPECT_FALSE(expr.parse(buf)) << "'" << buf << "'" << " considered legal";
+
+    LogTagLevelExpression expr1;
+    jio_snprintf(buf, sizeof(buf), "logging*%s", valid_expression[i]);
+    EXPECT_FALSE(expr1.parse(buf)) << "'" << buf << "'" << " considered legal";
+  }
+}
+
+// Test the level_for() function for an empty expression
+TEST(LogTagLevelExpression, level_for_empty) {
+  LogTagLevelExpression emptyexpr;
+  ASSERT_TRUE(emptyexpr.parse(""));
+  // All tagsets should be unspecified since the expression doesn't involve any tagset
+  for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
+    EXPECT_EQ(LogLevel::Unspecified, emptyexpr.level_for(*ts));
+  }
+}
+
+// Test level_for() with "all" without any specified level
+TEST(LogTagLevelExpression, level_for_all) {
+  LogTagLevelExpression allexpr;
+  ASSERT_TRUE(allexpr.parse("all"));
+  // Level will be unspecified since no level was given
+  for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
+    EXPECT_EQ(LogLevel::Unspecified, allexpr.level_for(*ts));
+  }
+}
+
+// Test level_for() with "all=debug"
+TEST(LogTagLevelExpression, level_for_all_debug) {
+  LogTagLevelExpression alldebugexpr;
+  ASSERT_TRUE(alldebugexpr.parse("all=debug"));
+  // All tagsets should report debug level
+  for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
+    EXPECT_EQ(LogLevel::Debug, alldebugexpr.level_for(*ts));
+  }
+}
+
+// Test level_for() with "all=off"
+TEST(LogTagLevelExpression, level_for_all_off) {
+  LogTagLevelExpression alloffexpr;
+  ASSERT_TRUE(alloffexpr.parse("all=off"));
+  for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
+    EXPECT_EQ(LogLevel::Off, alloffexpr.level_for(*ts));
+  }
+}
+
+// Test level_for() with an expression that has overlap (last subexpression should be used)
+TEST(LogTagLevelExpression, level_for_overlap) {
+  LogTagLevelExpression overlapexpr;
+  // The all=warning will be overridden with gc=info and/or logging+safepoint*=trace
+  ASSERT_TRUE(overlapexpr.parse("all=warning,gc=info,logging+safepoint*=trace"));
+  for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
+    if (ts->contains(PREFIX_LOG_TAG(gc)) && ts->ntags() == 1) {
+      EXPECT_EQ(LogLevel::Info, overlapexpr.level_for(*ts));
+    } else if (ts->contains(PREFIX_LOG_TAG(logging)) && ts->contains(PREFIX_LOG_TAG(safepoint))) {
+      EXPECT_EQ(LogLevel::Trace, overlapexpr.level_for(*ts));
+    } else {
+      EXPECT_EQ(LogLevel::Warning, overlapexpr.level_for(*ts));
+    }
+  }
+  EXPECT_EQ(LogLevel::Warning, overlapexpr.level_for(LogTagSetMapping<LOG_TAGS(class)>::tagset()));
+  EXPECT_EQ(LogLevel::Info, overlapexpr.level_for(LogTagSetMapping<LOG_TAGS(gc)>::tagset()));
+  EXPECT_EQ(LogLevel::Trace, overlapexpr.level_for(LogTagSetMapping<LOG_TAGS(logging, safepoint)>::tagset()));
+  EXPECT_EQ(LogLevel::Trace,
+            overlapexpr.level_for(LogTagSetMapping<LOG_TAGS(logging, gc, class, safepoint, heap)>::tagset()));
+}
+
+// Test level_for() with an expression containing two independent subexpressions
+TEST(LogTagLevelExpression, level_for_disjoint) {
+  LogTagLevelExpression reducedexpr;
+  ASSERT_TRUE(reducedexpr.parse("gc+logging=trace,class*=error"));
+  EXPECT_EQ(LogLevel::Error, reducedexpr.level_for(LogTagSetMapping<LOG_TAGS(class)>::tagset()));
+  EXPECT_EQ(LogLevel::Error, reducedexpr.level_for(LogTagSetMapping<LOG_TAGS(safepoint, class)>::tagset()));
+  EXPECT_EQ(LogLevel::NotMentioned, reducedexpr.level_for(LogTagSetMapping<LOG_TAGS(safepoint)>::tagset()));
+  EXPECT_EQ(LogLevel::NotMentioned, reducedexpr.level_for(LogTagSetMapping<LOG_TAGS(logging)>::tagset()));
+  EXPECT_EQ(LogLevel::NotMentioned, reducedexpr.level_for(LogTagSetMapping<LOG_TAGS(gc)>::tagset()));
+  EXPECT_EQ(LogLevel::Trace, reducedexpr.level_for(LogTagSetMapping<LOG_TAGS(logging, gc)>::tagset()));
+}
+
+// Test level_for() with an expression that is completely overridden in the last part of the expression
+TEST(LogTagLevelExpression, level_for_override) {
+  LogTagLevelExpression overrideexpr;
+  // No matter what, everything should be set to error level because of the last part
+  ASSERT_TRUE(overrideexpr.parse("logging,gc*=trace,all=error"));
+  EXPECT_EQ(LogLevel::Error, overrideexpr.level_for(LogTagSetMapping<LOG_TAGS(class)>::tagset()));
+  EXPECT_EQ(LogLevel::Error, overrideexpr.level_for(LogTagSetMapping<LOG_TAGS(logging)>::tagset()));
+  EXPECT_EQ(LogLevel::Error, overrideexpr.level_for(LogTagSetMapping<LOG_TAGS(gc)>::tagset()));
+  EXPECT_EQ(LogLevel::Error, overrideexpr.level_for(LogTagSetMapping<LOG_TAGS(logging, gc)>::tagset()));
+}
+
+// Test level_for() with a mixed expression with a bit of everything
+TEST(LogTagLevelExpression, level_for_mixed) {
+  LogTagLevelExpression mixedexpr;
+  ASSERT_TRUE(mixedexpr.parse("all=warning,gc*=debug,gc=trace,safepoint*=off"));
+  EXPECT_EQ(LogLevel::Warning, mixedexpr.level_for(LogTagSetMapping<LOG_TAGS(logging)>::tagset()));
+  EXPECT_EQ(LogLevel::Warning, mixedexpr.level_for(LogTagSetMapping<LOG_TAGS(logging, class)>::tagset()));
+  EXPECT_EQ(LogLevel::Debug, mixedexpr.level_for(LogTagSetMapping<LOG_TAGS(gc, class)>::tagset()));
+  EXPECT_EQ(LogLevel::Off, mixedexpr.level_for(LogTagSetMapping<LOG_TAGS(gc, safepoint, logging)>::tagset()));
+  EXPECT_EQ(LogLevel::Off, mixedexpr.level_for(LogTagSetMapping<LOG_TAGS(safepoint)>::tagset()));
+  EXPECT_EQ(LogLevel::Debug, mixedexpr.level_for(LogTagSetMapping<LOG_TAGS(logging, gc)>::tagset()));
+  EXPECT_EQ(LogLevel::Trace, mixedexpr.level_for(LogTagSetMapping<LOG_TAGS(gc)>::tagset()));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/logging/test_logTagSet.cpp	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * ac_heapanied 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 "logging/logLevel.hpp"
+#include "logging/logOutput.hpp"
+#include "logging/logTag.hpp"
+#include "logging/logTagSet.hpp"
+#include "unittest.hpp"
+
+// Test the default level for each tagset
+TEST(LogTagSet, defaults) {
+  for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
+    char buf[256];
+    ts->label(buf, sizeof(buf));
+    SCOPED_TRACE(buf);
+    EXPECT_TRUE(ts->is_level(LogLevel::Error));
+    EXPECT_TRUE(ts->is_level(LogLevel::Warning));
+    EXPECT_FALSE(ts->is_level(LogLevel::Info));
+    EXPECT_TRUE(ts->has_output(LogOutput::Stdout));
+    EXPECT_FALSE(ts->has_output(LogOutput::Stderr));
+  }
+}
+
+TEST(LogTagSet, has_output) {
+  LogTagSet& ts = LogTagSetMapping<LOG_TAGS(logging)>::tagset();
+  ts.set_output_level(LogOutput::Stderr, LogLevel::Trace);
+  EXPECT_TRUE(ts.has_output(LogOutput::Stderr));
+  EXPECT_FALSE(ts.has_output(NULL));
+  ts.set_output_level(LogOutput::Stderr, LogLevel::Off);
+  EXPECT_FALSE(ts.has_output(LogOutput::Stderr));
+}
+
+TEST(LogTagSet, ntags) {
+  const LogTagSet& ts = LogTagSetMapping<LOG_TAGS(logging)>::tagset();
+  EXPECT_EQ(1u, ts.ntags());
+  const LogTagSet& ts2 = LogTagSetMapping<LOG_TAGS(logging, gc, class, safepoint, heap)>::tagset();
+  EXPECT_EQ(5u, ts2.ntags());
+}
+
+TEST(LogTagSet, is_level) {
+  LogTagSet& ts = LogTagSetMapping<LOG_TAGS(logging)>::tagset();
+  // Set info level on stdout and verify that is_level() reports correctly
+  ts.set_output_level(LogOutput::Stdout, LogLevel::Info);
+  EXPECT_TRUE(ts.is_level(LogLevel::Error));
+  EXPECT_TRUE(ts.is_level(LogLevel::Warning));
+  EXPECT_TRUE(ts.is_level(LogLevel::Info));
+  EXPECT_FALSE(ts.is_level(LogLevel::Debug));
+  EXPECT_FALSE(ts.is_level(LogLevel::Trace));
+  ts.set_output_level(LogOutput::Stdout, LogLevel::Default);
+  EXPECT_TRUE(ts.is_level(LogLevel::Default));
+}
+
+TEST(LogTagSet, level_for) {
+  LogOutput* output = LogOutput::Stdout;
+  LogTagSet& ts = LogTagSetMapping<LOG_TAGS(logging)>::tagset();
+  for (uint i = 0; i < LogLevel::Count; i++) {
+    LogLevelType level = static_cast<LogLevelType>(i);
+    // Set the level and verify that level_for() reports it back
+    ts.set_output_level(output, level);
+    EXPECT_EQ(level, ts.level_for(output));
+  }
+  ts.set_output_level(output, LogLevel::Default);
+}
+
+TEST(LogTagSet, contains) {
+  // Verify that contains works as intended for a few predetermined tagsets
+  const LogTagSet& ts = LogTagSetMapping<LOG_TAGS(logging)>::tagset();
+  EXPECT_TRUE(ts.contains(PREFIX_LOG_TAG(logging)));
+  EXPECT_FALSE(ts.contains(PREFIX_LOG_TAG(gc)));
+  EXPECT_FALSE(ts.contains(PREFIX_LOG_TAG(class)));
+
+  const LogTagSet& ts2 = LogTagSetMapping<LOG_TAGS(logging, gc)>::tagset();
+  EXPECT_TRUE(ts2.contains(PREFIX_LOG_TAG(logging)));
+  EXPECT_TRUE(ts2.contains(PREFIX_LOG_TAG(gc)));
+  EXPECT_FALSE(ts2.contains(PREFIX_LOG_TAG(class)));
+
+  const LogTagSet& ts3 = LogTagSetMapping<LOG_TAGS(logging, gc, class)>::tagset();
+  EXPECT_TRUE(ts3.contains(PREFIX_LOG_TAG(logging)));
+  EXPECT_TRUE(ts3.contains(PREFIX_LOG_TAG(gc)));
+  EXPECT_TRUE(ts3.contains(PREFIX_LOG_TAG(class)));
+  EXPECT_FALSE(ts3.contains(PREFIX_LOG_TAG(safepoint)));
+
+  const LogTagSet& ts4 = LogTagSetMapping<LOG_TAGS(logging, gc, class, safepoint, heap)>::tagset();
+  EXPECT_TRUE(ts4.contains(PREFIX_LOG_TAG(logging)));
+  EXPECT_TRUE(ts4.contains(PREFIX_LOG_TAG(gc)));
+  EXPECT_TRUE(ts4.contains(PREFIX_LOG_TAG(class)));
+  EXPECT_TRUE(ts4.contains(PREFIX_LOG_TAG(safepoint)));
+  EXPECT_TRUE(ts4.contains(PREFIX_LOG_TAG(heap)));
+}
+
+TEST(LogTagSet, label) {
+  char buf[256];
+  const LogTagSet& ts = LogTagSetMapping<LOG_TAGS(logging, safepoint)>::tagset();
+  ASSERT_NE(-1, ts.label(buf, sizeof(buf)));
+  EXPECT_STREQ("logging,safepoint", buf);
+  // Verify using a custom separator
+  ASSERT_NE(-1, ts.label(buf, sizeof(buf), "++"));
+  EXPECT_STREQ("logging++safepoint", buf);
+
+  // Verify with three tags
+  const LogTagSet& ts1 = LogTagSetMapping<LOG_TAGS(logging, safepoint, jni)>::tagset();
+  ASSERT_NE(-1, ts1.label(buf, sizeof(buf)));
+  EXPECT_STREQ("logging,safepoint,jni", buf);
+
+  // Verify with a single tag
+  const LogTagSet& ts2 = LogTagSetMapping<LOG_TAGS(logging)>::tagset();
+  ASSERT_NE(-1, ts2.label(buf, sizeof(buf)));
+  EXPECT_STREQ("logging", buf);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/ClassFile/BadHelloWorld.jcod	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file fuzzes the class name #15 to have a leading 'L' and ending ';'.
+ */
+
+class BadHelloWorld {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [31] { // Constant Pool
+    ; // first element is empty
+    Utf8 "BadHelloWorld"; // #1     at 0x0A
+    class #1; // #2     at 0x1A
+    Utf8 "java/lang/Object"; // #3     at 0x1D
+    class #3; // #4     at 0x30
+    Utf8 "<init>"; // #5     at 0x33
+    Utf8 "()V"; // #6     at 0x3C
+    NameAndType #5 #6; // #7     at 0x42
+    Method #4 #7; // #8     at 0x47
+    Utf8 "toString"; // #9     at 0x4C
+    Utf8 "()Ljava/lang/String;"; // #10     at 0x57
+    Utf8 "Hello, world!"; // #11     at 0x6E
+    String #11; // #12     at 0x7E
+    Utf8 "main"; // #13     at 0x81
+    Utf8 "([Ljava/lang/String;)V"; // #14     at 0x88
+    Utf8 "LBadHelloWorld;"; // #15     at 0xA1
+    class #15; // #16     at 0xB3
+    Method #16 #7; // #17     at 0xB6
+    Utf8 "java/lang/System"; // #18     at 0xBB
+    class #18; // #19     at 0xCE
+    Utf8 "out"; // #20     at 0xD1
+    Utf8 "Ljava/io/PrintStream;"; // #21     at 0xD7
+    NameAndType #20 #21; // #22     at 0xEF
+    Field #19 #22; // #23     at 0xF4
+    Utf8 "java/io/PrintStream"; // #24     at 0xF9
+    class #24; // #25     at 0x010F
+    Utf8 "println"; // #26     at 0x0112
+    Utf8 "(Ljava/lang/Object;)V"; // #27     at 0x011C
+    NameAndType #26 #27; // #28     at 0x0134
+    Method #25 #28; // #29     at 0x0139
+    Utf8 "Code"; // #30     at 0x013E
+  } // Constant Pool
+
+  0x0021; // access
+  #2;// this_cpx
+  #4;// super_cpx
+
+  [0] { // Interfaces
+  } // Interfaces
+
+  [0] { // fields
+  } // fields
+
+  [3] { // methods
+    { // Member at 0x0151
+      0x0001; // access
+      #5; // name_cpx
+      #6; // sig_cpx
+      [1] { // Attributes
+        Attr(#30, 17) { // Code at 0x0159
+          1; // max_stack
+          1; // max_locals
+          Bytes[5]{
+            0x2AB70008B1;
+          };
+          [0] { // Traps
+          } // end Traps
+          [0] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member at 0x0170
+      0x0001; // access
+      #9; // name_cpx
+      #10; // sig_cpx
+      [1] { // Attributes
+        Attr(#30, 15) { // Code at 0x0178
+          1; // max_stack
+          1; // max_locals
+          Bytes[3]{
+            0x120CB0;
+          };
+          [0] { // Traps
+          } // end Traps
+          [0] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member at 0x018D
+      0x0089; // access
+      #13; // name_cpx
+      #14; // sig_cpx
+      [1] { // Attributes
+        Attr(#30, 28) { // Code at 0x0195
+          2; // max_stack
+          2; // max_locals
+          Bytes[16]{
+            0xBB001059B700114C;
+            0xB200172BB6001DB1;
+          };
+          [0] { // Traps
+          } // end Traps
+          [0] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [0] { // Attributes
+  } // Attributes
+} // end class BadHelloWorld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/ClassFile/FormatCheckingTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8148854
+ * @summary Ensure class name loaded by app class loader is format checked by default
+ * @library /test/lib
+ * @compile BadHelloWorld.jcod
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @run main FormatCheckingTest
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+public class FormatCheckingTest {
+    public static void main(String args[]) throws Throwable {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("BadHelloWorld");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("java.lang.ClassFormatError: Illegal class name");
+        output.shouldHaveExitValue(1);
+    }
+}
--- a/hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java	Fri Aug 26 14:47:52 2016 -0700
@@ -34,13 +34,13 @@
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.Platform;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 
 public class CreateCoredumpOnCrash {
     private static class Crasher {
         public static void main(String[] args) {
-            Utils.getUnsafe().putInt(0L, 0);
+            UnsafeHelper.getUnsafe().putInt(0L, 0);
         }
     }
 
--- a/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -35,14 +35,14 @@
 
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 
 import jdk.internal.misc.Unsafe;
 
 public class ProblematicFrameTest {
     private static class Crasher {
         public static void main(String[] args) {
-            Utils.getUnsafe().getInt(0);
+            UnsafeHelper.getUnsafe().getInt(0);
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/MinimalVM/CDS.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @requires vm.flavor == "minimal"
+ * @modules java.base/jdk.internal.misc
+ * @library /test/lib
+ * @run driver CDS
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+public class CDS {
+
+    public static void main(String args[]) throws Exception {
+        ProcessBuilder pb;
+
+        pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Xshare:dump");
+        new OutputAnalyzer(pb.start())
+                .shouldContain("Shared spaces are not supported in this VM")
+                .shouldHaveExitValue(1);
+
+        pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Xshare:on");
+        new OutputAnalyzer(pb.start())
+                .shouldContain("Shared spaces are not supported in this VM")
+                .shouldHaveExitValue(1);
+
+        pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Xshare:auto", "-version");
+        new OutputAnalyzer(pb.start())
+                .shouldContain("Shared spaces are not supported in this VM")
+                .shouldHaveExitValue(0);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/MinimalVM/CheckJNI.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @requires vm.flavor == "minimal"
+ * @modules java.base/jdk.internal.misc
+ * @library /test/lib
+ * @run driver CheckJNI
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+public class CheckJNI {
+
+    public static void main(String args[]) throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Xcheck:jni", "-version");
+        new OutputAnalyzer(pb.start())
+                .shouldContain("Minimal VM warning: JNI CHECKING is not supported in this VM")
+                .shouldHaveExitValue(0);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/MinimalVM/Instrumentation.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library /test/lib
+ * @requires vm.flavor == "minimal"
+ * @modules java.base/jdk.internal.misc
+ *          java.instrument
+ * @run driver Instrumentation
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+public class Instrumentation {
+
+    public static void main(String[] args) throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+                "-minimal", "-javaagent:redefineagent.jar", "-version");
+        new OutputAnalyzer(pb.start())
+                .shouldContain("Instrumentation agents are not supported in this VM")
+                .shouldHaveExitValue(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/MinimalVM/JMX.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @requires vm.flavor == "minimal"
+ * @library /test/lib
+ * @run main/othervm JMX
+ */
+
+import jdk.test.lib.JDKToolFinder;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+public class JMX {
+
+    public static void main(String args[]) throws Exception {
+        ProcessBuilder pb;
+
+        pb = ProcessTools.createJavaProcessBuilder("-minimal", "-XX:+ManagementServer", "-version");
+        new OutputAnalyzer(pb.start())
+                .shouldContain("ManagementServer is not supported in this VM.")
+                .shouldHaveExitValue(1);
+
+        pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Dcom.sun.management ", "-version");
+        new OutputAnalyzer(pb.start())
+                .shouldContain("-Dcom.sun.management is not supported in this VM.")
+                .shouldHaveExitValue(1);
+
+        pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), Long.toString(ProcessTools.getProcessId()), "VM.print_threads"});
+        new OutputAnalyzer(pb.start())
+                .shouldContain("Could not find any processes matching ")
+                .shouldHaveExitValue(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/MinimalVM/JVMTI.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @requires vm.flavor == "minimal"
+ * @modules java.base/jdk.internal.misc
+ * @library /test/lib
+ * @run driver JVMTI
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+public class JVMTI {
+
+    public static void main(String args[]) throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+                "-minimal",
+                "-agentlib:jdwp=server=y,transport=dt_socket,address=5000,suspend=n",
+                "-version");
+        new OutputAnalyzer(pb.start())
+                .shouldContain("Debugging agents are not supported in this VM")
+                .shouldHaveExitValue(1);
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/MinimalVM/NMT.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @requires vm.flavor == "minimal"
+ * @modules java.base/jdk.internal.misc
+ * @library /test/lib
+ * @run driver NMT
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+public class NMT {
+
+    public static void main(String args[]) throws Exception {
+        ProcessBuilder pb;
+
+        pb = ProcessTools.createJavaProcessBuilder("-minimal", "-XX:NativeMemoryTracking=detail", "-version");
+        new OutputAnalyzer(pb.start())
+                .shouldContain("Native Memory Tracking is not supported in this VM")
+                .shouldHaveExitValue(1);
+
+        pb = ProcessTools.createJavaProcessBuilder("-minimal", "-XX:NativeMemoryTracking=summary", "-version");
+        new OutputAnalyzer(pb.start())
+                .shouldContain("Native Memory Tracking is not supported in this VM")
+                .shouldHaveExitValue(1);
+
+        pb = ProcessTools.createJavaProcessBuilder("-minimal", "-XX:NativeMemoryTracking=off", "-version");
+        new OutputAnalyzer(pb.start())
+                .shouldContain("Native Memory Tracking is not supported in this VM")
+                .shouldHaveExitValue(1);
+
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/MinimalVM/Xprof.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @requires vm.flavor == "minimal"
+ * @modules java.base/jdk.internal.misc
+ * @library /test/lib
+ * @run driver Xprof
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+public class Xprof {
+
+    public static void main(String args[]) throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Xprof", "-version");
+        new OutputAnalyzer(pb.start())
+                .shouldContain("Flat profiling is not supported in this VM.")
+                .shouldHaveExitValue(1);
+
+    }
+}
--- a/hotspot/test/runtime/RedefineObject/TestRedefineObject.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/RedefineObject/TestRedefineObject.java	Fri Aug 26 14:47:52 2016 -0700
@@ -42,7 +42,7 @@
  * @build Agent
  * @run main ClassFileInstaller Agent
  * @run main TestRedefineObject
- * @run main/othervm -javaagent:agent.jar -XX:TraceRedefineClasses=5 Agent
+ * @run main/othervm -javaagent:agent.jar -Xlog:redefine+class+load=debug,redefine+class+timer=info Agent
  */
 public class TestRedefineObject {
     public static void main(String[] args) throws Exception  {
--- a/hotspot/test/runtime/RedefineTests/RedefineRunningMethods.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/RedefineTests/RedefineRunningMethods.java	Fri Aug 26 14:47:52 2016 -0700
@@ -31,7 +31,7 @@
  *          java.instrument
  *          jdk.jartool/sun.tools.jar
  * @run main RedefineClassHelper
- * @run main/othervm -javaagent:redefineagent.jar -XX:TraceRedefineClasses=0x600 RedefineRunningMethods
+ * @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+iklass+add=trace,redefine+class+iklass+purge=trace RedefineRunningMethods
  */
 public class RedefineRunningMethods {
 
--- a/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithResolutionErrors.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithResolutionErrors.java	Fri Aug 26 14:47:52 2016 -0700
@@ -31,7 +31,7 @@
  *          java.instrument
  *          jdk.jartool/sun.tools.jar
  * @run main RedefineClassHelper
- * @run main/othervm -javaagent:redefineagent.jar -XX:TraceRedefineClasses=0x600 RedefineRunningMethodsWithResolutionErrors
+ * @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+iklass+add=trace,redefine+class+iklass+purge=trace RedefineRunningMethodsWithResolutionErrors
  */
 
 import jdk.internal.org.objectweb.asm.ClassWriter;
--- a/hotspot/test/runtime/Unsafe/AllocateInstance.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/AllocateInstance.java	Fri Aug 26 14:47:52 2016 -0700
@@ -30,12 +30,12 @@
  * @run main AllocateInstance
  */
 
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import static jdk.test.lib.Asserts.*;
 
 public class AllocateInstance {
-    static final Unsafe UNSAFE = Utils.getUnsafe();
+    static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
 
     class TestClass {
         public boolean calledConstructor = false;
--- a/hotspot/test/runtime/Unsafe/AllocateMemory.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/AllocateMemory.java	Fri Aug 26 14:47:52 2016 -0700
@@ -31,13 +31,13 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:MallocMaxTestWords=100m AllocateMemory
  */
 
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import static jdk.test.lib.Asserts.*;
 
 public class AllocateMemory {
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
 
         // Allocate a byte, write to the location and read back the value
         long address = unsafe.allocateMemory(1);
--- a/hotspot/test/runtime/Unsafe/CopyMemory.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/CopyMemory.java	Fri Aug 26 14:47:52 2016 -0700
@@ -30,14 +30,14 @@
  * @run main CopyMemory
  */
 
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import static jdk.test.lib.Asserts.*;
 
 public class CopyMemory {
     final static int LENGTH = 8;
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
         long src = unsafe.allocateMemory(LENGTH);
         long dst = unsafe.allocateMemory(LENGTH);
         assertNotEquals(src, 0L);
--- a/hotspot/test/runtime/Unsafe/DefineClass.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/DefineClass.java	Fri Aug 26 14:47:52 2016 -0700
@@ -34,13 +34,13 @@
 import java.security.ProtectionDomain;
 import java.io.InputStream;
 import jdk.test.lib.InMemoryJavaCompiler;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import static jdk.test.lib.Asserts.*;
 
 public class DefineClass {
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
         TestClassLoader classloader = new TestClassLoader();
         ProtectionDomain pd = new ProtectionDomain(null, null);
 
--- a/hotspot/test/runtime/Unsafe/FieldOffset.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/FieldOffset.java	Fri Aug 26 14:47:52 2016 -0700
@@ -31,14 +31,14 @@
  */
 
 import java.lang.reflect.Field;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import java.lang.reflect.*;
 import static jdk.test.lib.Asserts.*;
 
 public class FieldOffset {
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
         Field[] fields = Test.class.getDeclaredFields();
 
         for (int i = 0; i < fields.length; i++) {
--- a/hotspot/test/runtime/Unsafe/GetField.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/GetField.java	Fri Aug 26 14:47:52 2016 -0700
@@ -30,14 +30,14 @@
  * @run main GetField
  */
 
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import java.lang.reflect.*;
 import static jdk.test.lib.Asserts.*;
 
 public class GetField {
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
         // Unsafe.INVALID_FIELD_OFFSET is a static final int field,
         // make sure getField returns the correct field
         Field field = Unsafe.class.getField("INVALID_FIELD_OFFSET");
--- a/hotspot/test/runtime/Unsafe/GetPutAddress.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutAddress.java	Fri Aug 26 14:47:52 2016 -0700
@@ -31,13 +31,13 @@
  */
 
 import jdk.test.lib.Platform;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import static jdk.test.lib.Asserts.*;
 
 public class GetPutAddress {
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
         int addressSize = unsafe.addressSize();
         // Ensure the size returned from Unsafe.addressSize is correct
         assertEquals(unsafe.addressSize(), Platform.is32bit() ? 4 : 8);
--- a/hotspot/test/runtime/Unsafe/GetPutBoolean.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutBoolean.java	Fri Aug 26 14:47:52 2016 -0700
@@ -31,13 +31,13 @@
  */
 
 import java.lang.reflect.Field;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import static jdk.test.lib.Asserts.*;
 
 public class GetPutBoolean {
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
         Test t = new Test();
         Field field = Test.class.getField("b1");
 
--- a/hotspot/test/runtime/Unsafe/GetPutByte.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutByte.java	Fri Aug 26 14:47:52 2016 -0700
@@ -31,13 +31,13 @@
  */
 
 import java.lang.reflect.Field;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import static jdk.test.lib.Asserts.*;
 
 public class GetPutByte {
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
         Test t = new Test();
         Field field = Test.class.getField("b");
 
--- a/hotspot/test/runtime/Unsafe/GetPutChar.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutChar.java	Fri Aug 26 14:47:52 2016 -0700
@@ -31,13 +31,13 @@
  */
 
 import java.lang.reflect.Field;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import static jdk.test.lib.Asserts.*;
 
 public class GetPutChar {
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
         Test t = new Test();
         Field field = Test.class.getField("c");
 
--- a/hotspot/test/runtime/Unsafe/GetPutDouble.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutDouble.java	Fri Aug 26 14:47:52 2016 -0700
@@ -31,13 +31,13 @@
  */
 
 import java.lang.reflect.Field;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import static jdk.test.lib.Asserts.*;
 
 public class GetPutDouble {
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
         Test t = new Test();
         Field field = Test.class.getField("d");
 
--- a/hotspot/test/runtime/Unsafe/GetPutFloat.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutFloat.java	Fri Aug 26 14:47:52 2016 -0700
@@ -31,13 +31,13 @@
  */
 
 import java.lang.reflect.Field;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import static jdk.test.lib.Asserts.*;
 
 public class GetPutFloat {
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
         Test t = new Test();
         Field field = Test.class.getField("f");
 
--- a/hotspot/test/runtime/Unsafe/GetPutInt.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutInt.java	Fri Aug 26 14:47:52 2016 -0700
@@ -30,13 +30,13 @@
  */
 
 import java.lang.reflect.Field;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import static jdk.test.lib.Asserts.*;
 
 public class GetPutInt {
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
         Test t = new Test();
         Field field = Test.class.getField("i");
 
--- a/hotspot/test/runtime/Unsafe/GetPutLong.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutLong.java	Fri Aug 26 14:47:52 2016 -0700
@@ -31,13 +31,13 @@
  */
 
 import java.lang.reflect.Field;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import static jdk.test.lib.Asserts.*;
 
 public class GetPutLong {
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
         Test t = new Test();
         Field field = Test.class.getField("l");
 
--- a/hotspot/test/runtime/Unsafe/GetPutObject.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutObject.java	Fri Aug 26 14:47:52 2016 -0700
@@ -31,13 +31,13 @@
  */
 
 import java.lang.reflect.Field;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import static jdk.test.lib.Asserts.*;
 
 public class GetPutObject {
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
         Test t = new Test();
         Object o = new Object();
         Field field = Test.class.getField("o");
--- a/hotspot/test/runtime/Unsafe/GetPutShort.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutShort.java	Fri Aug 26 14:47:52 2016 -0700
@@ -31,13 +31,13 @@
  */
 
 import java.lang.reflect.Field;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import static jdk.test.lib.Asserts.*;
 
 public class GetPutShort {
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
         Test t = new Test();
         Field field = Test.class.getField("s");
 
--- a/hotspot/test/runtime/Unsafe/GetUncompressedObject.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/GetUncompressedObject.java	Fri Aug 26 14:47:52 2016 -0700
@@ -30,13 +30,13 @@
 
 import static jdk.test.lib.Asserts.*;
 
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 
 public class GetUncompressedObject {
 
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
 
         // Allocate some memory and fill it with non-zero values.
         final int size = 32;
--- a/hotspot/test/runtime/Unsafe/NestedUnsafe.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/NestedUnsafe.java	Fri Aug 26 14:47:52 2016 -0700
@@ -35,7 +35,7 @@
 import java.io.InputStream;
 import java.lang.*;
 import jdk.test.lib.InMemoryJavaCompiler;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import static jdk.test.lib.Asserts.*;
 
@@ -50,7 +50,7 @@
         " } } ");
 
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
 
         Class klass = unsafe.defineAnonymousClass(NestedUnsafe.class, klassbuf, new Object[0]);
         unsafe.ensureClassInitialized(klass);
--- a/hotspot/test/runtime/Unsafe/PageSize.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/PageSize.java	Fri Aug 26 14:47:52 2016 -0700
@@ -31,13 +31,13 @@
  */
 
 import java.lang.reflect.Field;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import static jdk.test.lib.Asserts.*;
 
 public class PageSize {
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
         int pageSize = unsafe.pageSize();
 
         for (int n = 1; n != 0; n <<= 1) {
--- a/hotspot/test/runtime/Unsafe/RangeCheck.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/RangeCheck.java	Fri Aug 26 14:47:52 2016 -0700
@@ -33,7 +33,7 @@
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.Platform;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 
 import jdk.internal.misc.Unsafe;
 
@@ -60,7 +60,7 @@
 
     public static class DummyClassWithMainRangeCheck {
         public static void main(String args[]) throws Exception {
-            Unsafe unsafe = Utils.getUnsafe();
+            Unsafe unsafe = UnsafeHelper.getUnsafe();
             unsafe.getObject(new DummyClassWithMainRangeCheck(), Short.MAX_VALUE);
         }
     }
--- a/hotspot/test/runtime/Unsafe/Reallocate.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/Reallocate.java	Fri Aug 26 14:47:52 2016 -0700
@@ -31,13 +31,13 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:MallocMaxTestWords=100m Reallocate
  */
 
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import static jdk.test.lib.Asserts.*;
 
 public class Reallocate {
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
 
         long address = unsafe.allocateMemory(1);
         assertNotEquals(address, 0L);
--- a/hotspot/test/runtime/Unsafe/SetMemory.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/SetMemory.java	Fri Aug 26 14:47:52 2016 -0700
@@ -30,13 +30,13 @@
  * @run main SetMemory
  */
 
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import static jdk.test.lib.Asserts.*;
 
 public class SetMemory {
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
         long address = unsafe.allocateMemory(1);
         assertNotEquals(address, 0L);
         unsafe.setMemory(address, 1, (byte)17);
--- a/hotspot/test/runtime/Unsafe/ThrowException.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/runtime/Unsafe/ThrowException.java	Fri Aug 26 14:47:52 2016 -0700
@@ -30,13 +30,13 @@
  * @run main ThrowException
  */
 
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 import static jdk.test.lib.Asserts.*;
 
 public class ThrowException {
     public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
+        Unsafe unsafe = UnsafeHelper.getUnsafe();
         try {
             unsafe.throwException(new TestException());
         } catch (Throwable t) {
--- a/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import jdk.test.lib.JDKToolLauncher;
-import jdk.test.lib.process.OutputBuffer;
-import jdk.test.lib.Platform;
-import jdk.test.lib.process.ProcessTools;
-
-import java.io.File;
-
-/*
- * @test
- * @bug 8028623
- * @summary Test hashing of extended characters in Serviceability Agent.
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.compiler
- *          java.management
- *          jdk.jvmstat/sun.jvmstat.monitor
- * @compile -encoding utf8 Test8028623.java
- * @run main/othervm -XX:+UsePerfData Test8028623
- */
-public class Test8028623 {
-
-  public static int \u00CB = 1;
-  public static String dumpFile = "heap.bin";
-
-  public static void main (String[] args) {
-
-    System.out.println(\u00CB);
-
-    try {
-        if (!Platform.shouldSAAttach()) {
-            System.out.println("SA attach not expected to work - test skipped.");
-            return;
-        }
-        long pid = ProcessTools.getProcessId();
-        JDKToolLauncher jmap = JDKToolLauncher.create("jhsdb")
-                                              .addToolArg("jmap")
-                                              .addToolArg("--binaryheap")
-                                              .addToolArg("--pid")
-                                              .addToolArg(Long.toString(pid));
-        ProcessBuilder pb = new ProcessBuilder(jmap.getCommand());
-        OutputBuffer output = ProcessTools.getOutput(pb);
-        Process p = pb.start();
-        int e = p.waitFor();
-        System.out.println("stdout:");
-        System.out.println(output.getStdout());
-        System.out.println("stderr:");
-        System.out.println(output.getStderr());
-
-        if (e != 0) {
-            throw new RuntimeException("jmap returns: " + e);
-        }
-        if (! new File(dumpFile).exists()) {
-            throw new RuntimeException("dump file NOT created: '" + dumpFile + "'");
-        }
-    } catch (Throwable t) {
-        t.printStackTrace();
-        throw new RuntimeException("Test failed with: " + t);
-    }
-  }
-}
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java	Fri Aug 26 14:47:52 2016 -0700
@@ -39,7 +39,7 @@
  * Concrete subclasses should implement method {@link #process()}.
  */
 public abstract class PathHandler {
-    private static final Unsafe UNSAFE = jdk.test.lib.Utils.getUnsafe();
+    private static final Unsafe UNSAFE = jdk.test.lib.unsafe.UnsafeHelper.getUnsafe();
     private static final AtomicLong CLASS_COUNT = new AtomicLong(0L);
     private static volatile boolean CLASSES_LIMIT_REACHED = false;
     private static final Pattern JAR_IN_DIR_PATTERN
--- a/jaxp/.hgtags	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/.hgtags	Fri Aug 26 14:47:52 2016 -0700
@@ -375,3 +375,4 @@
 e66cdc2de6b02443911d386fc9217b0d824d0686 jdk-9+130
 874082a9b565a7092a40bfa934a6e3e3c3455a60 jdk-9+131
 907445d85e680ea410fe2c83c0ec64b5508e4f3e jdk-9+132
+9490ba2e5e41685c858a0ca2a6ec87611eb011c6 jdk-9+133
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,15 +1,15 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -170,6 +170,14 @@
         "Invalid URI ''{0}''."},
 
         /*
+         * Note to translators:  This message is displayed when the URI
+         * mentioned in the substitution text is not well-formed syntactically.
+         */
+        {ErrorMsg.CATALOG_EXCEPTION,
+        "JAXP08090001: The CatalogResolver is enabled with the catalog \"{0}\", "
+              + "but a CatalogException is returned."},
+
+        /*
          * Note to translators:  The file or URI named in the substitution text
          * exists but could not be opened.
          */
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,15 +1,15 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,9 +17,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*
- * $Id: ErrorMsg.java,v 1.2.4.1 2005/09/15 10:18:01 pvedula Exp $
- */
 
 package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
 
@@ -60,6 +57,7 @@
     public static final String ARGUMENT_CONVERSION_ERR = "ARGUMENT_CONVERSION_ERR";
     public static final String FILE_NOT_FOUND_ERR = "FILE_NOT_FOUND_ERR";
     public static final String INVALID_URI_ERR = "INVALID_URI_ERR";
+    public static final String CATALOG_EXCEPTION = "CATALOG_EXCEPTION";
     public static final String FILE_ACCESS_ERR = "FILE_ACCESS_ERR";
     public static final String MISSING_ROOT_ERR = "MISSING_ROOT_ERR";
     public static final String NAMESPACE_UNDEF_ERR = "NAMESPACE_UNDEF_ERR";
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java	Fri Aug 26 14:47:52 2016 -0700
@@ -51,10 +51,11 @@
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogException;
 import javax.xml.catalog.CatalogFeatures;
 import javax.xml.catalog.CatalogFeatures.Feature;
 import javax.xml.catalog.CatalogManager;
-import javax.xml.catalog.CatalogUriResolver;
+import javax.xml.catalog.CatalogResolver;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 import javax.xml.transform.ErrorListener;
@@ -241,7 +242,7 @@
     // type checking
     private Map<String, Class> _xsltcExtensionFunctions;
 
-    CatalogUriResolver _catalogUriResolver;
+    CatalogResolver _catalogUriResolver;
     CatalogFeatures _catalogFeatures;
     CatalogFeatures.Builder cfBuilder = CatalogFeatures.builder();
     // Catalog features
@@ -634,7 +635,7 @@
         }
 
         // Inefficient, but array is small
-        for (int i = 0; i < features.length; i++) {
+        for (int i =0; i < features.length; i++) {
             if (name.equals(features[i])) {
                 return true;
             }
@@ -923,7 +924,7 @@
             String transletClassName = getTransletBaseName(source);
 
             if (_packageName != null)
-                transletClassName = _packageName + "." + transletClassName;
+               transletClassName = _packageName + "." + transletClassName;
 
             if (_jarFileName != null)
                 bytecodes = getBytecodesFromJar(source, transletClassName);
@@ -1327,7 +1328,7 @@
             if (source == null && _catalogFiles != null &&
                     _xmlFeatures.getFeature(JdkXmlFeatures.XmlFeature.USE_CATALOG)) {
                 if (_catalogUriResolver == null) {
-                    _catalogUriResolver = CatalogManager.catalogUriResolver(_catalogFeatures);
+                    _catalogUriResolver = CatalogManager.catalogResolver(_catalogFeatures);
                 }
                 source = _catalogUriResolver.resolve(href, context);
             }
@@ -1340,6 +1341,10 @@
             final ErrorMsg msg = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, href + "\n" + e.getMessage(), this);
             xsltc.getParser().reportError(Constants.FATAL, msg);
         }
+        catch (CatalogException e) {
+            final ErrorMsg msg = new ErrorMsg(ErrorMsg.CATALOG_EXCEPTION, href + "\n" + e.getMessage(), this);
+            xsltc.getParser().reportError(Constants.FATAL, msg);
+        }
 
         return null;
     }
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java	Fri Aug 26 14:47:52 2016 -0700
@@ -60,9 +60,10 @@
 import java.util.Properties;
 import java.util.StringTokenizer;
 import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogException;
 import javax.xml.catalog.CatalogFeatures;
 import javax.xml.catalog.CatalogManager;
-import javax.xml.catalog.CatalogUriResolver;
+import javax.xml.catalog.CatalogResolver;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -224,7 +225,7 @@
 
     // Catalog features
     CatalogFeatures _catalogFeatures;
-    CatalogUriResolver _catalogUriResolver;
+    CatalogResolver _catalogUriResolver;
 
     // Catalog is enabled by default
     boolean _useCatalog = true;
@@ -1337,7 +1338,7 @@
             if (resolvedSource == null && _useCatalog &&
                     _catalogFeatures.get(CatalogFeatures.Feature.FILES) != null)  {
                 if (_catalogUriResolver == null) {
-                    _catalogUriResolver = CatalogManager.catalogUriResolver(_catalogFeatures);
+                    _catalogUriResolver = CatalogManager.catalogResolver(_catalogFeatures);
                 }
                 resolvedSource = _catalogUriResolver.resolve(href, baseURI);
             }
@@ -1350,7 +1351,7 @@
 
             return getDOM(resolvedSource);
         }
-        catch (TransformerException e) {
+        catch (TransformerException | CatalogException e) {
             if (_errorListener != null)
                 postErrorToListener("File not found: " + e.getMessage());
             return(null);
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Fri Aug 26 14:47:52 2016 -0700
@@ -511,7 +511,8 @@
                     //fDocumentHandler.endElement(getElementQName(),null);
                     break;
                 default :
-                    throw new InternalError("processing event: " + event);
+                    // Errors should have already been handled by the Scanner
+                    return false;
 
             }
             //System.out.println("here in before calling next");
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Fri Aug 26 14:47:52 2016 -0700
@@ -20,8 +20,6 @@
 
 package com.sun.org.apache.xerces.internal.impl ;
 
-import com.sun.org.apache.xerces.internal.impl.Constants;
-import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler;
 import com.sun.org.apache.xerces.internal.impl.io.ASCIIReader;
 import com.sun.org.apache.xerces.internal.impl.io.UCSReader;
 import com.sun.org.apache.xerces.internal.impl.io.UTF8Reader;
@@ -42,7 +40,6 @@
 import com.sun.xml.internal.stream.StaxXMLInputSource;
 import com.sun.xml.internal.stream.XMLEntityStorage;
 import java.io.*;
-import java.lang.reflect.Method;
 import java.net.HttpURLConnection;
 import java.net.URISyntaxException;
 import java.net.URL;
@@ -59,7 +56,6 @@
 import javax.xml.catalog.CatalogFeatures.Feature;
 import javax.xml.catalog.CatalogManager;
 import javax.xml.catalog.CatalogResolver;
-import javax.xml.catalog.CatalogUriResolver;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.transform.Source;
 import jdk.xml.internal.JdkXmlUtils;
@@ -420,7 +416,6 @@
     private boolean fUseCatalog = true;
     CatalogFeatures fCatalogFeatures;
     CatalogResolver fCatalogResolver;
-    CatalogUriResolver fCatalogUriResolver;
 
     private String fCatalogFile;
     private String fDefer;
@@ -1044,12 +1039,18 @@
             }
             fCatalogFile = fCatalogFeatures.get(Feature.FILES);
             if (fUseCatalog && fCatalogFile != null) {
-                if (fCatalogResolver == null) {
-                    fCatalogResolver = CatalogManager.catalogResolver(fCatalogFeatures);
-                }
-                InputSource is = fCatalogResolver.resolveEntity(publicId, literalSystemId);
-                if (is != null && !is.isEmpty()) {
-                    staxInputSource = new StaxXMLInputSource(new XMLInputSource(is, true), true);
+                try {
+                    if (fCatalogResolver == null) {
+                        fCatalogResolver = CatalogManager.catalogResolver(fCatalogFeatures);
+                    }
+                    InputSource is = fCatalogResolver.resolveEntity(publicId, literalSystemId);
+                    if (is != null && !is.isEmpty()) {
+                        staxInputSource = new StaxXMLInputSource(new XMLInputSource(is, true), true);
+                    }
+                } catch (CatalogException e) {
+                    fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,"CatalogException",
+                    new Object[]{SecuritySupport.sanitizePath(fCatalogFile)},
+                    XMLErrorReporter.SEVERITY_FATAL_ERROR, e );
                 }
             }
         }
@@ -1140,7 +1141,7 @@
             if (fUseCatalog && fCatalogFile != null) {
                 /*
                  since the method can be called from various processors, both
-                 CatalogResolver and CatalogUriResolver are used to attempt to find
+                 EntityResolver and URIResolver are used to attempt to find
                  a match
                 */
                 InputSource is = null;
@@ -1153,13 +1154,20 @@
                         is = fCatalogResolver.resolveEntity(pid, literalSystemId);
                     }
                 } catch (CatalogException e) {}
+
                 if (is != null && !is.isEmpty()) {
                     xmlInputSource = new XMLInputSource(is, true);
                 } else if (literalSystemId != null) {
-                    if (fCatalogUriResolver == null) {
-                        fCatalogUriResolver = CatalogManager.catalogUriResolver(fCatalogFeatures);
+                    if (fCatalogResolver == null) {
+                        fCatalogResolver = CatalogManager.catalogResolver(fCatalogFeatures);
                     }
-                    Source source = fCatalogUriResolver.resolve(literalSystemId, baseSystemId);
+
+                    Source source = null;
+                    try {
+                        source = fCatalogResolver.resolve(literalSystemId, baseSystemId);
+                    } catch (CatalogException e) {
+                        throw new XNIException(e);
+                    }
                     if (source != null && !source.isEmpty()) {
                         xmlInputSource = new XMLInputSource(publicId, source.getSystemId(), baseSystemId, true);
                     }
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties	Fri Aug 26 14:47:52 2016 -0700
@@ -303,3 +303,5 @@
         MaxElementDepthLimit=JAXP00010006: The element \"{0}\" has a depth of \"{1}\" that exceeds the limit \"{2}\" set by \"{3}\".
         EntityReplacementLimit=JAXP00010007: The total number of nodes in entity references is \"{0}\" that is over the limit \"{1}\" set by \"{2}\".
 
+# Catalog 09
+        CatalogException=JAXP00090001: The CatalogResolver is enabled with the catalog \"{0}\", but a CatalogException is returned.
\ No newline at end of file
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/EntityResolverWrapper.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/EntityResolverWrapper.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,13 +1,13 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 2001, 2002,2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
@@ -28,6 +28,7 @@
 import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
+import javax.xml.catalog.CatalogException;
 
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
@@ -132,6 +133,10 @@
                 }
                 throw new XNIException(ex);
             }
+
+            catch (CatalogException e) {
+                throw new XNIException(e);
+            }
         }
 
         // unable to resolve entity
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -75,7 +75,6 @@
 import javax.xml.catalog.CatalogFeatures;
 import javax.xml.catalog.CatalogManager;
 import javax.xml.catalog.CatalogResolver;
-import javax.xml.catalog.CatalogUriResolver;
 import javax.xml.transform.Source;
 import jdk.xml.internal.JdkXmlUtils;
 import org.xml.sax.InputSource;
@@ -371,7 +370,6 @@
     private boolean fUseCatalog = true;
     CatalogFeatures fCatalogFeatures;
     CatalogResolver fCatalogResolver;
-    CatalogUriResolver fCatalogUriResolver;
 
     private String fCatalogFile;
     private String fDefer;
@@ -1638,10 +1636,10 @@
                         */
                         Source source = null;
                         try {
-                            if (fCatalogUriResolver == null) {
-                                fCatalogUriResolver = CatalogManager.catalogUriResolver(fCatalogFeatures);
+                            if (fCatalogResolver == null) {
+                                fCatalogResolver = CatalogManager.catalogResolver(fCatalogFeatures);
                             }
-                            source = fCatalogUriResolver.resolve(href, fCurrentBaseURI.getExpandedSystemId());
+                            source = fCatalogResolver.resolve(href, fCurrentBaseURI.getExpandedSystemId());
                         } catch (CatalogException e) {}
 
                         if (source != null && !source.isEmpty()) {
@@ -1669,7 +1667,7 @@
                         includedSource.getBaseSystemId(), accept, acceptLanguage);
                 }
             }
-            catch (IOException e) {
+            catch (IOException | CatalogException e) {
                 reportResourceError(
                     "XMLResourceError",
                     new Object[] { href, e.getMessage()});
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/StaxEntityResolverWrapper.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/StaxEntityResolverWrapper.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
 import com.sun.org.apache.xerces.internal.xni.XNIException;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
+import javax.xml.catalog.CatalogException;
 
 /**
  *
@@ -58,11 +59,11 @@
     public StaxXMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
     throws XNIException, java.io.IOException {
         Object object = null ;
-        try{
+        try {
             object = fStaxResolver.resolveEntity(resourceIdentifier.getPublicId(), resourceIdentifier.getLiteralSystemId(),
             resourceIdentifier.getBaseSystemId(), null);
             return getStaxInputSource(object) ;
-        }catch(XMLStreamException streamException){
+        } catch(XMLStreamException | CatalogException streamException){
             throw new XNIException(streamException) ;
         }
     }
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/Catalog.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/Catalog.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,9 +42,9 @@
  * <p>
  * A catalog can be used in two situations:
  * <ul>
- * <li>Locate the replacement text for an external entity;
+ * <li>Locate the external resources with a public or system identifier;
  * </li>
- * <li>Locate an alternate URI reference for a resource.
+ * <li>Locate an alternate URI reference with an URI.
  * </li>
  * </ul>
  * <p>
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogManager.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogManager.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,17 +77,6 @@
     }
 
     /**
-     * Creates an instance of a {@code CatalogUriResolver} using the specified catalog.
-     *
-     * @param catalog the catalog instance
-     * @return an instance of a {@code CatalogResolver}
-     */
-    public static CatalogUriResolver catalogUriResolver(Catalog catalog) {
-        if (catalog == null) CatalogMessages.reportNPEOnNull("catalog", null);
-        return new CatalogUriResolverImpl(catalog);
-    }
-
-    /**
      * Creates an instance of a {@code CatalogResolver} using the specified feature
      * settings and path to one or more catalog files.
      * <p>
@@ -115,33 +104,4 @@
         Catalog catalog = catalog(features, paths);
         return new CatalogResolverImpl(catalog);
     }
-
-    /**
-     * Creates an instance of a {@code CatalogUriResolver} using the specified
-     * feature settings and path to one or more catalog files.
-     * <p>
-     * If {@code paths} is empty, system property {@code javax.xml.catalog.files}
-     * will be read to locate the initial list of catalog files.
-     * <p>
-     * If more than one catalog files are specified through the paths argument or
-     * {@code javax.xml.catalog.files} property, the first entry is considered
-     * the main catalog, while others are treated as alternative catalogs after
-     * those referenced by the {@code nextCatalog} elements in the main catalog.
-     * <p>
-     * As specified in
-     * <a href="https://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html#s.res.fail">
-     * XML Catalogs, OASIS Standard V1.1</a>, invalid path entries will be ignored.
-     * No error will be reported. In case all entries are invalid, the resolver
-     * will return as no mapping is found.
-     *
-     * @param features the catalog features
-     * @param paths the path(s) to one or more catalogs
-     *
-     * @return an instance of a {@code CatalogUriResolver}
-     * @throws CatalogException If an error occurs while parsing the catalog
-     */
-    public static CatalogUriResolver catalogUriResolver(CatalogFeatures features, String... paths) {
-        Catalog catalog = catalog(features, paths);
-        return new CatalogUriResolverImpl(catalog);
-    }
 }
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogResolver.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogResolver.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,32 +24,90 @@
  */
 package javax.xml.catalog;
 
+import java.io.InputStream;
+import javax.xml.stream.XMLResolver;
+import javax.xml.transform.Source;
+import javax.xml.transform.URIResolver;
+import org.w3c.dom.ls.LSInput;
+import org.w3c.dom.ls.LSResourceResolver;
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
 
 /**
- * A SAX EntityResolver that uses catalogs to resolve references.
+ * A Catalog Resolver that implements SAX {@link org.xml.sax.EntityResolver},
+ * StAX {@link javax.xml.stream.XMLResolver},
+ * DOM LS {@link org.w3c.dom.ls.LSResourceResolver} used by Schema Validation, and
+ * Transform {@link javax.xml.transform.URIResolver}, and resolves
+ * external references using catalogs.
+ * <p>
+ * The <a href="https://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html">
+ * Catalog Standard</a> distinguished {@code external identifiers} from {@code uri entries}
+ * as being used to solely identify DTDs, while {@code uri entries} for
+ * other resources such as stylesheets and schema. The Java APIs, such as
+ * {@link javax.xml.stream.XMLResolver} and {@link org.w3c.dom.ls.LSResourceResolver}
+ * however, make no such distinction.
+ * In consistent with the existing Java API, this CatalogResolver recognizes a
+ * system identifier as an URI and will search both {@code system} and {@code uri}
+ * entries in a catalog in order to find a matching entry.
+ * <p>
+ * The search is started in the current catalog. If a match is found,
+ * no further attempt will be made. Only if there is no match in the current
+ * catalog, will alternate catalogs including delegate and next catalogs be considered.
+ * <p>
+ * <h3>Search Order</h3>
+ * The resolver will first search the system-type of entries with the specified
+ * {@code systemId}. The system entries include {@code system},
+ * {@code rewriteSystem} and {@code systemSuffix} entries.
+ * <p>
+ * If no match is found, {@code public} entries may be searched in accordance with
+ * the {@code prefer} attribute.
+ * <p>
+ * <b>The {@code prefer} attribute</b>: if the {@code prefer} is public,
+ * and there is no match found through the system entries, {@code public} entries
+ * will be considered. If it is not specified, the {@code prefer} is public
+ * by default (Note that by the OASIS standard, system entries will always
+ * be considered before public entries. Prefer public means that public entries
+ * will be matched when both system and public identifiers are specified.
+ * In general therefore, prefer public is recommended.)
+ * <p>
+ * If no match is found with the {@code systemId} and {@code public} identifier,
+ * the resolver will continue searching {@code uri} entries
+ * with the specified {@code systemId} or {@code href}. The {@code uri} entries
+ * include {@code uri}, {@code rewriteURI}, and {@code uriSuffix} entries.
+ *
+ * <p>
+ * <h3>Error Handling</h3>
+ * The interfaces that the CatalogResolver extend specified checked exceptions, including:
+ * <ul>
+ * <li>
+ * {@link org.xml.sax.SAXException} and {@link java.io.IOException} by
+ * {@link org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String)}
+ * </li>
+ * <li>
+ * {@link javax.xml.stream.XMLStreamException} by
+ * {@link javax.xml.stream.XMLResolver#resolveEntity(java.lang.String, java.lang.String, java.lang.String, java.lang.String)}
+ * </li>
+ * <li>
+ * {@link javax.xml.transform.TransformerException} by
+ * {@link javax.xml.transform.URIResolver#resolve(java.lang.String, java.lang.String)}
+ * </li>
+ * </ul>
+ * <p>
+ * The CatalogResolver however, will throw {@link javax.xml.catalog.CatalogException}
+ * only when {@code javax.xml.catalog.resolve} is specified as {@code strict}.
+ * For applications that expect to handle the checked Exceptions, it may be
+ * necessary to use a custom resolver to wrap the CatalogResolver or implement it
+ * with a {@link javax.xml.catalog.Catalog} object.
  *
  * @since 9
  */
-public interface CatalogResolver extends EntityResolver {
+public interface CatalogResolver extends EntityResolver, XMLResolver,
+        URIResolver, LSResourceResolver {
 
     /**
-     * The method searches through the catalog entries in the main and
-     * alternative catalogs to attempt to find a match with the specified publicId
-     * or systemId.
-     * <p>
-     * For resolving external entities, system entries will be matched before
-     * the public entries.
-     * <p>
-     * <b>The {@code prefer} attribute</b>: if the {@code prefer} is public,
-     * and there is no match found through the system entries, public entries
-     * will be considered. If it is not specified, the {@code prefer} is public
-     * by default (Note that by the OASIS standard, system entries will always
-     * be considered first when the external system identifier is specified.
-     * Prefer public means that public entries will be matched when both system
-     * and public identifiers are specified. In general therefore, prefer
-     * public is recommended.)
+     * Implements {@link org.xml.sax.EntityResolver}. The method searches through
+     * the catalog entries in the main and alternative catalogs to attempt to find
+     * a match with the specified {@code publicId} or systemId.
      *
      * @param publicId the public identifier of the external entity being
      * referenced, or null if none was supplied
@@ -59,15 +117,123 @@
      * requires a system identifier on all external entities, so this value is
      * always specified.
      *
-     * @return a {@link org.xml.sax.InputSource} object if a mapping is found. If no mapping is
-     * found, returns a {@link org.xml.sax.InputSource} object containing an empty
-     * {@link java.io.Reader} if the {@code javax.xml.catalog.resolve} property
-     * is set to {@code ignore}; returns null if the
+     * @return a {@link org.xml.sax.InputSource} object if a mapping is found.
+     * If no mapping is found, returns a {@link org.xml.sax.InputSource} object
+     * containing an empty {@link java.io.Reader} if the
+     * {@code javax.xml.catalog.resolve} property is set to {@code ignore};
+     * returns null if the
+     * {@code javax.xml.catalog.resolve} property is set to {@code continue}.
+     *
+     * @throws CatalogException if no mapping is found and
+     * {@code javax.xml.catalog.resolve} is specified as {@code strict}
+     */
+    @Override
+    public InputSource resolveEntity(String publicId, String systemId);
+
+
+    /**
+     * Implements URIResolver. The method searches through the catalog entries
+     * in the main and alternative catalogs to attempt to find a match
+     * with the specified {@code href} attribute. The {@code href} attribute will
+     * be used literally, with no attempt to be made absolute to the {@code base}.
+     * <p>
+     * If the value is an URN, the {@code href} attribute is recognized as a
+     * {@code publicId}, and used to search {@code public} entries.
+     * If the value is an URI, it is taken as a {@code systemId}, and used to
+     * search both {@code system} and {@code uri} entries.
+     *
+     *
+     * @param href the href attribute that specifies the URI of a style sheet,
+     * which may be relative or absolute
+     * @param base The base URI against which the href attribute will be made
+     * absolute if the absolute URI is required
+     *
+     * @return a {@link javax.xml.transform.Source} object if a mapping is found.
+     * If no mapping is found, returns an empty {@link javax.xml.transform.Source}
+     * object if the {@code javax.xml.catalog.resolve} property is set to
+     * {@code ignore};
+     * returns a {@link javax.xml.transform.Source} object with the original URI
+     * (href, or href resolved with base if base is not null) if the
      * {@code javax.xml.catalog.resolve} property is set to {@code continue}.
      *
      * @throws CatalogException if no mapping is found and
-     * {@code javax.xml.catalog.resolve} is specified as strict
+     * {@code javax.xml.catalog.resolve} is specified as {@code strict}
+     */
+    @Override
+    public Source resolve(String href, String base);
+
+    /**
+     * Implements {@link javax.xml.stream.XMLResolver}. For the purpose of resolving
+     * {@code publicId} and {@code systemId}, this method is equivalent to
+     * {@link #resolveEntity(java.lang.String, java.lang.String) }.
+     * <p>
+     * The {@code systemId} will be used literally, with no attempt to be made
+     * absolute to the {@code baseUri}. The {@code baseUri} and {@code namespace}
+     * are not used in the search for a match in a catalog. However, a relative
+     * {@code systemId} in an xml source may have been made absolute by the parser
+     * with the {@code baseURI}, thus making it unable to find a {@code system} entry.
+     * In such a case, a {@code systemSuffix} entry is recommended over a
+     * {@code system} entry.
+     *
+     * @param publicId the public identifier of the external entity being
+     * referenced, or null if none was supplied
+     *
+     * @param systemId the system identifier of the external entity being
+     * referenced. A system identifier is required on all external entities. XML
+     * requires a system identifier on all external entities, so this value is
+     * always specified.
+     * @param baseUri  the absolute base URI, not used by the CatalogResolver
+     * @param namespace the namespace of the entity to resolve, not used by the
+     * CatalogResolver.
+     *
+     * @return an {@link java.io.InputStream} object if a mapping is found; null
+     * if no mapping is found and the {@code javax.xml.catalog.resolve} property
+     * is set to {@code continue} or {@code ignore}. Note that for XMLResolver,
+     * it is not possible to ignore a reference, {@code ignore} is therefore
+     * treated the same as {@code continue}.
+     *
+     * @throws CatalogException if no mapping is found and
+     * {@code javax.xml.catalog.resolve} is specified as {@code strict}
      */
     @Override
-    public InputSource resolveEntity(String publicId, String systemId);
+    public InputStream resolveEntity(String publicId, String systemId,
+            String baseUri, String namespace);
+
+    /**
+     * Implements {@link org.w3c.dom.ls.LSResourceResolver}. For the purpose of
+     * resolving {@code publicId} and {@code systemId}, this method is equivalent
+     * to {@link #resolveEntity(java.lang.String, java.lang.String) }.
+     * <p>
+     * The {@code systemId} will be used literally, with no attempt to be made
+     * absolute to the {@code baseUri}. The {@code baseUri}, {@code namespaceUri}
+     * and {@code type} are not used in the search for a match in a catalog.
+     * However, a relative {@code systemId} in a source may have been made absolute
+     * by the parser with the {@code baseURI}, thus making it unable to find a
+     * {@code system} entry. In such a case, a {@code systemSuffix} entry is
+     * recommended over a {@code system} entry.
+     *
+     * @param type  the type of the resource being resolved,
+     * not used by the CatalogResolver
+     * @param namespaceUri  the namespace of the resource being resolved,
+     * not used by the CatalogResolver
+     * @param publicId  the public identifier of the external entity being
+     *   referenced, or {@code null} if no public identifier was
+     *   supplied or if the resource is not an entity.
+     * @param systemId  the system identifier, an URI reference of the
+     *   external resource being referenced
+     * @param baseUri  the absolute base URI, not used by the CatalogResolver
+     *
+     * @return a {@link org.w3c.dom.ls.LSInput} object if a mapping is found; null
+     * if no mapping is found and the {@code javax.xml.catalog.resolve} property
+     * is set to {@code continue} or {@code ignore}. Note that for
+     * {@link org.w3c.dom.ls.LSResourceResolver}, it is not possible to ignore a
+     * reference, {@code ignore} is therefore treated the same as {@code continue}.
+     *
+     * @throws CatalogException if no mapping is found and
+     * {@code javax.xml.catalog.resolve} is specified as {@code strict}
+     */
+    @Override
+    public LSInput resolveResource(String type, String namespaceUri,
+            String publicId, String systemId, String baseUri);
+
 }
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogResolverImpl.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogResolverImpl.java	Fri Aug 26 14:47:52 2016 -0700
@@ -24,15 +24,27 @@
  */
 package javax.xml.catalog;
 
+import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
 import java.io.StringReader;
-import java.util.Iterator;
+import java.net.URL;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Source;
+import javax.xml.transform.sax.SAXSource;
+import org.w3c.dom.ls.LSInput;
 import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
 
 /**
- * A SAX EntityResolver/JAXP URIResolver that uses catalogs.
+ * Implements CatalogResolver.
  *
  * <p>
- * This class implements both a SAX EntityResolver and a JAXP URIResolver.
+ * This class implements a SAX EntityResolver, StAX XMLResolver,
+ * Schema Validation LSResourceResolver and Transform URIResolver.
  *
  *
  * @since 9
@@ -49,9 +61,14 @@
         this.catalog = catalog;
     }
 
+    /*
+       Implements the EntityResolver interface
+    */
     @Override
     public InputSource resolveEntity(String publicId, String systemId) {
+        //8150187: NPE expected if the system identifier is null for CatalogResolver
         CatalogMessages.reportNPEOnNull("systemId", systemId);
+
         //Normalize publicId and systemId
         systemId = Normalizer.normalizeURI(Util.getNotNullOrEmpty(systemId));
         publicId = Normalizer.normalizePublicId(Normalizer.decodeURN(Util.getNotNullOrEmpty(publicId)));
@@ -87,4 +104,242 @@
         return null;
     }
 
+    /*
+        Implements the URIResolver interface
+    */
+    CatalogResolverImpl entityResolver;
+
+    @Override
+    public Source resolve(String href, String base) {
+        CatalogMessages.reportNPEOnNull("href", href);
+
+        href = Util.getNotNullOrEmpty(href);
+        base = Util.getNotNullOrEmpty(base);
+
+        String result = null;
+        CatalogImpl c = (CatalogImpl)catalog;
+        String uri = Normalizer.normalizeURI(href);
+        //check whether uri is an urn
+        if (uri != null && uri.startsWith(Util.URN)) {
+            String publicId = Normalizer.decodeURN(uri);
+            if (publicId != null) {
+                result = Util.resolve(c, publicId, null);
+            }
+        }
+
+        //if no match with a public id, continue search for an URI
+        if (result == null) {
+            //remove fragment if any.
+            int hashPos = uri.indexOf("#");
+            if (hashPos >= 0) {
+                uri = uri.substring(0, hashPos);
+            }
+
+            //search the current catalog
+            result = Util.resolve(c, null, uri);
+        }
+
+        //Report error or return the URI as is when no match is found
+        if (result == null) {
+            GroupEntry.ResolveType resolveType = c.getResolve();
+            switch (resolveType) {
+                case IGNORE:
+                    return new SAXSource(new InputSource(new StringReader("")));
+                case STRICT:
+                    CatalogMessages.reportError(CatalogMessages.ERR_NO_URI_MATCH,
+                            new Object[]{href, base});
+            }
+            try {
+                URL url = null;
+
+                if (base == null) {
+                    url = new URL(uri);
+                    result = url.toString();
+                } else {
+                    URL baseURL = new URL(base);
+                    url = (href.length() == 0 ? baseURL : new URL(baseURL, uri));
+                    result = url.toString();
+                }
+            } catch (java.net.MalformedURLException mue) {
+                    CatalogMessages.reportError(CatalogMessages.ERR_CREATING_URI,
+                            new Object[]{href, base});
+            }
+        }
+
+        SAXSource source = new SAXSource();
+        source.setInputSource(new InputSource(result));
+        setEntityResolver(source);
+        return source;
+    }
+
+    /**
+     * Establish an entityResolver for newly resolved URIs.
+     * <p>
+     * This is called from the URIResolver to set an EntityResolver on the SAX
+     * parser to be used for new XML documents that are encountered as a result
+     * of the document() function, xsl:import, or xsl:include. This is done
+     * because the XSLT processor calls out to the SAXParserFactory itself to
+     * create a new SAXParser to parse the new document. The new parser does not
+     * automatically inherit the EntityResolver of the original (although
+     * arguably it should). Quote from JAXP specification on Class
+     * SAXTransformerFactory:
+     * <p>
+     * {@code If an application wants to set the ErrorHandler or EntityResolver
+     * for an XMLReader used during a transformation, it should use a URIResolver
+     * to return the SAXSource which provides (with getXMLReader) a reference to
+     * the XMLReader}
+     *
+     */
+    private void setEntityResolver(SAXSource source) {
+        XMLReader reader = source.getXMLReader();
+        if (reader == null) {
+            SAXParserFactory spFactory = new SAXParserFactoryImpl();
+            spFactory.setNamespaceAware(true);
+            try {
+                reader = spFactory.newSAXParser().getXMLReader();
+            } catch (ParserConfigurationException | SAXException ex) {
+                CatalogMessages.reportRunTimeError(CatalogMessages.ERR_PARSER_CONF, ex);
+            }
+        }
+        if (entityResolver != null) {
+            entityResolver = new CatalogResolverImpl(catalog);
+        }
+        reader.setEntityResolver(entityResolver);
+        source.setXMLReader(reader);
+    }
+
+    @Override
+    public InputStream resolveEntity(String publicId, String systemId, String baseUri, String namespace) {
+        InputSource is = resolveEntity(publicId, systemId);
+
+        if (is != null && !is.isEmpty()) {
+
+            try {
+                return new URL(is.getSystemId()).openStream();
+            } catch (IOException ex) {
+                //considered as no mapping.
+            }
+
+        }
+
+        GroupEntry.ResolveType resolveType = ((CatalogImpl) catalog).getResolve();
+        switch (resolveType) {
+            case IGNORE:
+                return null;
+            case STRICT:
+                CatalogMessages.reportError(CatalogMessages.ERR_NO_MATCH,
+                        new Object[]{publicId, systemId});
+        }
+
+        //no action, allow the parser to continue
+        return null;
+    }
+
+    @Override
+    public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) {
+        InputSource is = resolveEntity(publicId, systemId);
+
+        if (is != null && !is.isEmpty()) {
+            return new LSInputImpl(is.getSystemId());
+        }
+
+        GroupEntry.ResolveType resolveType = ((CatalogImpl) catalog).getResolve();
+        switch (resolveType) {
+            case IGNORE:
+                return null;
+            case STRICT:
+                CatalogMessages.reportError(CatalogMessages.ERR_NO_MATCH,
+                        new Object[]{publicId, systemId});
+        }
+
+        //no action, allow the parser to continue
+        return null;
+    }
+
+    /**
+     * Implements LSInput. All that we need is the systemId since the Catalog
+     * has already resolved it.
+     */
+    class LSInputImpl implements LSInput {
+
+        private String systemId;
+
+        public LSInputImpl(String systemId) {
+            this.systemId = systemId;
+        }
+
+        @Override
+        public Reader getCharacterStream() {
+            return null;
+        }
+
+        @Override
+        public void setCharacterStream(Reader characterStream) {
+        }
+
+        @Override
+        public InputStream getByteStream() {
+            return null;
+        }
+
+        @Override
+        public void setByteStream(InputStream byteStream) {
+        }
+
+        @Override
+        public String getStringData() {
+            return null;
+        }
+
+        @Override
+        public void setStringData(String stringData) {
+        }
+
+        @Override
+        public String getSystemId() {
+            return systemId;
+        }
+
+        @Override
+        public void setSystemId(String systemId) {
+            this.systemId = systemId;
+        }
+
+        @Override
+        public String getPublicId() {
+            return null;
+        }
+
+        @Override
+        public void setPublicId(String publicId) {
+        }
+
+        @Override
+        public String getBaseURI() {
+            return null;
+        }
+
+        @Override
+        public void setBaseURI(String baseURI) {
+        }
+
+        @Override
+        public String getEncoding() {
+            return null;
+        }
+
+        @Override
+        public void setEncoding(String encoding) {
+        }
+
+        @Override
+        public boolean getCertifiedText() {
+            return false;
+        }
+
+        @Override
+        public void setCertifiedText(boolean certifiedText) {
+        }
+    }
+
 }
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogUriResolver.java	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package javax.xml.catalog;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.URIResolver;
-
-/**
- * A JAXP URIResolver that uses catalogs to resolve references.
- *
- * @since 9
- */
-public interface CatalogUriResolver extends URIResolver {
-
-    /**
-     * The method searches through the catalog entries in the main and
-     * alternative catalogs to attempt to find a match with the specified URI.
-     *
-     * @param href an href attribute, which may be relative or absolute
-     * @param base The base URI against which the href attribute will be made
-     * absolute if the absolute URI is required
-     *
-     * @return a {@link javax.xml.transform.Source} object if a mapping is found.
-     * If no mapping is found, returns an empty {@link javax.xml.transform.Source}
-     * object if the {@code javax.xml.catalog.resolve} property is set to
-     * {@code ignore};
-     * returns a {@link javax.xml.transform.Source} object with the original URI
-     * (href, or href resolved with base if base is not null) if the
-     * {@code javax.xml.catalog.resolve} property is set to {@code continue}.
-     *
-     * @throws CatalogException if no mapping is found and
-     * {@code javax.xml.catalog.resolve} is specified as strict
-     */
-    @Override
-    public Source resolve(String href, String base);
-}
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogUriResolverImpl.java	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 javax.xml.catalog;
-
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
-import java.io.StringReader;
-import java.net.URL;
-import java.util.Iterator;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParserFactory;
-import javax.xml.transform.Source;
-import javax.xml.transform.sax.SAXSource;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-
-/**
- * A SAX EntityResolver/JAXP URIResolver that uses catalogs.
- * <p>
- * This class implements both a SAX EntityResolver and a JAXP URIResolver.
- *
- *
- * @since 9
- */
-final class CatalogUriResolverImpl implements CatalogUriResolver {
-
-    Catalog catalog;
-    CatalogResolverImpl entityResolver;
-
-    /**
-     * Construct an instance of the CatalogResolver from a Catalog.
-     *
-     * @param catalog A Catalog.
-     */
-    public CatalogUriResolverImpl(Catalog catalog) {
-        this.catalog = catalog;
-    }
-
-    @Override
-    public Source resolve(String href, String base) {
-        href = Util.getNotNullOrEmpty(href);
-        base = Util.getNotNullOrEmpty(base);
-
-        if (href == null) return null;
-
-        String result = null;
-        CatalogImpl c = (CatalogImpl)catalog;
-        String uri = Normalizer.normalizeURI(href);
-        //check whether uri is an urn
-        if (uri != null && uri.startsWith(Util.URN)) {
-            String publicId = Normalizer.decodeURN(uri);
-            if (publicId != null) {
-                result = Util.resolve(c, publicId, null);
-            }
-        }
-
-        //if no match with a public id, continue search for an URI
-        if (result == null) {
-            //remove fragment if any.
-            int hashPos = uri.indexOf("#");
-            if (hashPos >= 0) {
-                uri = uri.substring(0, hashPos);
-            }
-
-            //search the current catalog
-            result = resolve(c, uri);
-        }
-
-        //Report error or return the URI as is when no match is found
-        if (result == null) {
-            GroupEntry.ResolveType resolveType = c.getResolve();
-            switch (resolveType) {
-                case IGNORE:
-                    return new SAXSource(new InputSource(new StringReader("")));
-                case STRICT:
-                    CatalogMessages.reportError(CatalogMessages.ERR_NO_URI_MATCH,
-                            new Object[]{href, base});
-            }
-            try {
-                URL url = null;
-
-                if (base == null) {
-                    url = new URL(uri);
-                    result = url.toString();
-                } else {
-                    URL baseURL = new URL(base);
-                    url = (href.length() == 0 ? baseURL : new URL(baseURL, uri));
-                    result = url.toString();
-                }
-            } catch (java.net.MalformedURLException mue) {
-                    CatalogMessages.reportError(CatalogMessages.ERR_CREATING_URI,
-                            new Object[]{href, base});
-            }
-        }
-
-        SAXSource source = new SAXSource();
-        source.setInputSource(new InputSource(result));
-        setEntityResolver(source);
-        return source;
-    }
-
-    /**
-     * Resolves the publicId or systemId to one specified in the catalog.
-     * @param catalog the catalog
-     * @param href an href attribute, which may be relative or absolute
-     * @return the resolved systemId if a match is found, null otherwise
-     */
-    String resolve(CatalogImpl catalog, String href) {
-        String result = null;
-
-        //search the current catalog
-        catalog.reset();
-        if (href != null) {
-            result = catalog.matchURI(href);
-        }
-
-        //mark the catalog as having been searched before trying alternatives
-        catalog.markAsSearched();
-
-        //search alternative catalogs
-        if (result == null) {
-            Iterator<Catalog> iter = catalog.catalogs().iterator();
-            while (iter.hasNext()) {
-                result = resolve((CatalogImpl)iter.next(), href);
-                if (result != null) {
-                    break;
-                }
-            }
-        }
-
-        return result;
-    }
-
-    /**
-     * Establish an entityResolver for newly resolved URIs.
-     * <p>
-     * This is called from the URIResolver to set an EntityResolver on the SAX
-     * parser to be used for new XML documents that are encountered as a result
-     * of the document() function, xsl:import, or xsl:include. This is done
-     * because the XSLT processor calls out to the SAXParserFactory itself to
-     * create a new SAXParser to parse the new document. The new parser does not
-     * automatically inherit the EntityResolver of the original (although
-     * arguably it should). Quote from JAXP specification on Class
-     * SAXTransformerFactory:
-     * <p>
-     * {@code If an application wants to set the ErrorHandler or EntityResolver
-     * for an XMLReader used during a transformation, it should use a URIResolver
-     * to return the SAXSource which provides (with getXMLReader) a reference to
-     * the XMLReader}
-     *
-     */
-    private void setEntityResolver(SAXSource source) {
-        XMLReader reader = source.getXMLReader();
-        if (reader == null) {
-            SAXParserFactory spFactory = new SAXParserFactoryImpl();
-            spFactory.setNamespaceAware(true);
-            try {
-                reader = spFactory.newSAXParser().getXMLReader();
-            } catch (ParserConfigurationException | SAXException ex) {
-                CatalogMessages.reportRunTimeError(CatalogMessages.ERR_PARSER_CONF, ex);
-            }
-        }
-        if (entityResolver != null) {
-            entityResolver = new CatalogResolverImpl(catalog);
-        }
-        reader.setEntityResolver(entityResolver);
-        source.setXMLReader(reader);
-    }
-}
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/Util.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/Util.java	Fri Aug 26 14:47:52 2016 -0700
@@ -55,6 +55,9 @@
      * prefer "public": attempts to resolve with a system entry;
      *                  attempts to resolve with a public entry if no matching
      *                  system entry is found.
+     *
+     * If no match is found, continue searching uri entries
+     *
      * @param catalog the catalog
      * @param publicId the publicId
      * @param systemId the systemId
@@ -77,6 +80,10 @@
             resolvedSystemId = catalog.matchPublic(publicId);
         }
 
+        if (resolvedSystemId == null && systemId != null) {
+            resolvedSystemId = catalog.matchURI(systemId);
+        }
+
         //mark the catalog as having been searched before trying alternatives
         catalog.markAsSearched();
 
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -64,4 +64,3 @@
                 { "catalogReferCircle-left.xml" } };
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -69,4 +69,3 @@
                 { Feature.RESOLVE, CatalogTestUtils.RESOLVE_STRICT } };
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -86,4 +86,3 @@
         return (int) method.invoke(catalog);
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -100,4 +100,3 @@
         return catalogResolver("delegatePublic.xml");
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -100,4 +100,3 @@
         return catalogResolver("delegateSystem.xml");
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateUriTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateUriTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -27,8 +27,8 @@
 import static catalog.ResolutionChecker.checkUriResolution;
 import static catalog.ResolutionChecker.expectExceptionOnUri;
 
+import javax.xml.catalog.CatalogResolver;
 import javax.xml.catalog.CatalogException;
-import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Listeners;
@@ -95,8 +95,7 @@
                         CatalogException.class } };
     }
 
-    private CatalogUriResolver createResolver() {
+    private CatalogResolver createResolver() {
         return catalogUriResolver("delegateUri.xml");
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/GroupTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/GroupTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -131,4 +131,3 @@
         return catalogResolver(CATALOG_GROUP);
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -33,7 +33,6 @@
 
 import javax.xml.catalog.CatalogException;
 import javax.xml.catalog.CatalogResolver;
-import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Listeners;
@@ -56,6 +55,7 @@
     private static final String CATALOG_DUMMY = "dummy.xml";
 
     private static final String ID_ALICE = "http://remote/dtd/alice/docAlice.dtd";
+    private static final String ID_ALICE_URI = "http://remote/dtd/uri/alice/docAlice.dtd";
     private static final String ID_DUMMY = "http://remote/dtd/doc.dtd";
 
     @Test(dataProvider = "entityResolver")
@@ -79,8 +79,8 @@
     }
 
     @Test(dataProvider = "uriResolver")
-    public void testMatchOnUriResolver(CatalogUriResolver resolver) {
-        checkUriResolution(resolver, ID_ALICE,
+    public void testMatchOnUriResolver(CatalogResolver resolver) {
+        checkUriResolution(resolver, ID_ALICE_URI,
                 "http://local/dtd/docAliceURI.dtd");
     }
 
@@ -121,4 +121,3 @@
                 { new String[] { CATALOG_LOADCATALOGFILES } } };
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/NextCatalogTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/NextCatalogTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -30,7 +30,6 @@
 import static catalog.ResolutionChecker.checkUriResolution;
 
 import javax.xml.catalog.CatalogResolver;
-import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Listeners;
@@ -154,9 +153,8 @@
                 CATALOG_NEXTCATALOGRIGHT);
     }
 
-    private CatalogUriResolver createUriResolver() {
+    private CatalogResolver createUriResolver() {
         return catalogUriResolver(CATALOG_NEXTCATALOGLEFT,
                 CATALOG_NEXTCATALOGRIGHT);
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/NormalizationTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/NormalizationTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -30,7 +30,6 @@
 import static catalog.ResolutionChecker.checkUriResolution;
 
 import javax.xml.catalog.CatalogResolver;
-import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Listeners;
@@ -111,8 +110,7 @@
         return catalogResolver(CATALOG_NORMALIZATION);
     }
 
-    private CatalogUriResolver createUriResolver() {
+    private CatalogResolver createUriResolver() {
         return catalogUriResolver(CATALOG_NORMALIZATION);
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -81,4 +81,3 @@
                 "preferFeature.xml");
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/PreferTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/PreferTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -92,4 +92,3 @@
         return catalogResolver("prefer.xml");
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -70,4 +70,3 @@
         return catalogResolver("publicFamily.xml");
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/PublicTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/PublicTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -92,4 +92,3 @@
         return catalogResolver(CATALOG_PUBLIC);
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -38,7 +38,6 @@
 import javax.xml.catalog.CatalogFeatures;
 import javax.xml.catalog.CatalogFeatures.Feature;
 import javax.xml.catalog.CatalogResolver;
-import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
@@ -93,7 +92,7 @@
      */
     @Test
     public void testContinueResolutionOnUriResolver() {
-        CatalogUriResolver resolver = createUriResolver(RESOLVE_CONTINUE);
+        CatalogResolver resolver = createUriResolver(RESOLVE_CONTINUE);
         resolver.resolve("http://remote/dtd/bob/docBobDummy.dtd", null);
         checkUriResolution(resolver, "http://remote/dtd/bob/docBob.dtd",
                 "http://local/base/dtd/docBobURI.dtd");
@@ -123,7 +122,7 @@
         return catalogResolver(createFeature(resolve), CATALOG_SYSTEM);
     }
 
-    private CatalogUriResolver createUriResolver(String resolve) {
+    private CatalogResolver createUriResolver(String resolve) {
         return catalogUriResolver(createFeature(resolve), CATALOG_URI);
     }
 
@@ -131,4 +130,3 @@
         return builder().with(Feature.RESOLVE, resolve).build();
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -95,4 +95,3 @@
         return catalogResolver("rewriteSystem.xml");
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteUriTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteUriTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -24,11 +24,11 @@
 package catalog;
 
 import static catalog.CatalogTestUtils.catalogUriResolver;
-import static catalog.ResolutionChecker.checkNoMatch;
+import static catalog.ResolutionChecker.checkNoUriMatch;
 import static catalog.ResolutionChecker.checkUriResolution;
 
+import javax.xml.catalog.CatalogResolver;
 import javax.xml.catalog.CatalogException;
-import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Listeners;
@@ -88,11 +88,10 @@
      */
     @Test(expectedExceptions = CatalogException.class)
     public void testNoMatch() {
-        checkNoMatch(createResolver());
+        checkNoUriMatch(createResolver());
     }
 
-    private CatalogUriResolver createResolver() {
+    private CatalogResolver createResolver() {
         return catalogUriResolver("rewriteUri.xml");
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -36,7 +36,6 @@
 
 import javax.xml.catalog.CatalogFeatures;
 import javax.xml.catalog.CatalogResolver;
-import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
@@ -68,7 +67,7 @@
     }
 
     /*
-     * CatalogUriResolver specifies catalog via feature javax.xml.catalog.files.
+     * CatalogResolver specifies catalog via feature javax.xml.catalog.files.
      */
     @Test
     public void specifyCatalogOnUriResolver() {
@@ -102,7 +101,7 @@
         checkSysIdResolution(resolver, ID_SYS, matchedUri);
     }
 
-    private void checkResolutionOnUriResolver(CatalogUriResolver resolver,
+    private void checkResolutionOnUriResolver(CatalogResolver resolver,
             String matchedUri) {
         checkUriResolution(resolver, ID_URI, matchedUri);
     }
@@ -111,4 +110,3 @@
         return builder().with(FILES, getCatalogPath(catalogName)).build();
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -84,4 +84,3 @@
         return catalogResolver("systemFamily.xml");
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -95,4 +95,3 @@
         return catalogResolver("systemSuffix.xml");
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/SystemTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/SystemTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -92,4 +92,3 @@
         return catalogResolver(CATALOG_SYSTEM);
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/UriFamilyTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/UriFamilyTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -24,11 +24,11 @@
 package catalog;
 
 import static catalog.CatalogTestUtils.catalogUriResolver;
-import static catalog.ResolutionChecker.checkNoMatch;
+import static catalog.ResolutionChecker.checkNoUriMatch;
 import static catalog.ResolutionChecker.checkUriResolution;
 
+import javax.xml.catalog.CatalogResolver;
 import javax.xml.catalog.CatalogException;
-import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Listeners;
@@ -58,7 +58,7 @@
         return new Object[][] {
                 // The matched URI of the specified URI reference is defined in
                 // a uri entry.
-                { "http://remote/dtd/alice/docAlice.dtd",
+                { "http://remote/dtd/uri/alice/docAlice.dtd",
                         "http://local/base/dtd/docAliceURI.dtd" },
 
                 // The matched URI of the specified URI reference is defined in
@@ -77,11 +77,10 @@
      */
     @Test(expectedExceptions = CatalogException.class)
     public void testNoMatch() {
-        checkNoMatch(createResolver());
+        checkNoUriMatch(createResolver());
     }
 
-    private CatalogUriResolver createResolver() {
+    private CatalogResolver createResolver() {
         return catalogUriResolver("uriFamily.xml");
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/UriSuffixTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/UriSuffixTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -24,11 +24,11 @@
 package catalog;
 
 import static catalog.CatalogTestUtils.catalogUriResolver;
-import static catalog.ResolutionChecker.checkNoMatch;
+import static catalog.ResolutionChecker.checkNoUriMatch;
 import static catalog.ResolutionChecker.checkUriResolution;
 
+import javax.xml.catalog.CatalogResolver;
 import javax.xml.catalog.CatalogException;
-import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Listeners;
@@ -88,11 +88,10 @@
      */
     @Test(expectedExceptions = CatalogException.class)
     public void testNoMatch() {
-        checkNoMatch(createResolver());
+        checkNoUriMatch(createResolver());
     }
 
-    private CatalogUriResolver createResolver() {
+    private CatalogResolver createResolver() {
         return catalogUriResolver("uriSuffix.xml");
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/UriTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/UriTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -26,12 +26,12 @@
 import static catalog.CatalogTestUtils.CATALOG_URI;
 import static catalog.CatalogTestUtils.RESOLVE_CONTINUE;
 import static catalog.CatalogTestUtils.catalogUriResolver;
-import static catalog.ResolutionChecker.checkNoMatch;
+import static catalog.ResolutionChecker.checkNoUriMatch;
 import static catalog.ResolutionChecker.checkUriResolution;
 
+import javax.xml.catalog.CatalogResolver;
 import javax.xml.catalog.CatalogException;
 import javax.xml.catalog.CatalogFeatures;
-import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Listeners;
@@ -58,7 +58,7 @@
         return new Object[][] {
                 // The matched URI of the specified URI reference is defined in
                 // a uri entry. The match is an absolute path.
-                { "http://remote/dtd/alice/docAlice.dtd",
+                { "http://remote/dtd/uri/alice/docAlice.dtd",
                         "http://local/dtd/docAliceURI.dtd" },
 
                 // The matched URI of the specified URI reference is defined in
@@ -76,7 +76,7 @@
     }
 
     /*
-     * Specify base location via method CatalogUriResolver.resolve(href, base).
+     * Specify base location via method CatalogResolver.resolve(href, base).
      */
     @Test
     public void testSpecifyBaseByAPI() {
@@ -84,7 +84,7 @@
                 "http://remote/dtd/carl/docCarl.dtd",
                 "http://local/carlBase/dtd/docCarlURI.dtd");
 
-        CatalogUriResolver continueResolver = catalogUriResolver(
+        CatalogResolver continueResolver = catalogUriResolver(
                 CatalogFeatures.builder().with(CatalogFeatures.Feature.RESOLVE,
                         RESOLVE_CONTINUE).build(), CATALOG_URI);
         checkUriResolution(continueResolver, "docCarl.dtd",
@@ -97,11 +97,10 @@
      */
     @Test(expectedExceptions = CatalogException.class)
     public void testNoMatch() {
-        checkNoMatch(createResolver());
+        checkNoUriMatch(createResolver());
     }
 
-    private CatalogUriResolver createResolver() {
+    private CatalogResolver createResolver() {
         return catalogUriResolver(CATALOG_URI);
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -67,4 +67,3 @@
         return catalogResolver("urnUnwrapping.xml");
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -98,8 +98,7 @@
                 "http://remote/dtd/alice/docAlice.dtd",
                 "http://local/dtd/docAliceSys.dtd");
         checkUriResolution(catalogUriResolver(catalogName, CATALOG_URI),
-                "http://remote/dtd/alice/docAlice.dtd",
+                "http://remote/dtd/uri/alice/docAlice.dtd",
                 "http://local/dtd/docAliceURI.dtd");
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/deferFeature.xml	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/deferFeature.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -2,7 +2,7 @@
 
 <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
     <system systemId="http://remote/dtd/alice/docAlice.dtd" uri="http://local/dtd/docAliceSys.dtd" />
-    <uri name="http://remote/dtd/alice/docAlice.dtd" uri="http://local/dtd/docAliceURI.dtd" />
+    <uri name="http://remote/dtd/uri/alice/docAlice.dtd" uri="http://local/dtd/docAliceURI.dtd" />
 
     <delegateSystem systemIdStartString="http://remote/dtd/alice/" catalog="delegateSystem-alice.xml" />
     <delegatePublic publicIdStartString="-//REMOTE//DTD ALICE DOCALICE" catalog="delegatePublic-alice.xml" />
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/uri.xml	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/uri.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
-    <uri name="http://remote/dtd/alice/docAlice.dtd" uri="http://local/dtd/docAliceURI.dtd" />
+    <uri name="http://remote/dtd/uri/alice/docAlice.dtd" uri="http://local/dtd/docAliceURI.dtd" />
 
     <uri name="http://remote/dtd/bob/docBob.dtd" uri="docBobURI.dtd" />
 
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/uriFamily.xml	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/uriFamily.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -4,7 +4,7 @@
     <delegateURI uriStartString="http://remote/dtd/alice/" catalog="delegateURI-alice.xml" />
     <uriSuffix uriSuffix="docAlice.dtd" uri="docAliceUS.dtd" />
     <rewriteURI uriStartString="http://remote/dtd/alice/" rewritePrefix="http://local/base/ru/" />
-    <uri name="http://remote/dtd/alice/docAlice.dtd" uri="docAliceURI.dtd" />
+    <uri name="http://remote/dtd/uri/alice/docAlice.dtd" uri="docAliceURI.dtd" />
 
     <delegateURI uriStartString="http://remote/dtd/bob/" catalog="delegateURI-bob.xml" />
     <uriSuffix uriSuffix="docBob.dtd" uri="docBobUS.dtd" />
--- a/jaxp/test/javax/xml/jaxp/isolatedjdk/catalog/PropertiesTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/isolatedjdk/catalog/PropertiesTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,6 @@
 import java.util.Map;
 
 import javax.xml.catalog.CatalogResolver;
-import javax.xml.catalog.CatalogUriResolver;
 
 /*
  * This case tests if the properties FILES, DEFER, PREFER, RESOLVE in
@@ -96,7 +95,7 @@
     }
 
     private static void testPropertiesOnUriResolver() {
-        CatalogUriResolver uriResolver = catalogUriResolver((String[]) null);
+        CatalogResolver uriResolver = catalogUriResolver((String[]) null);
         uriResolver.resolve("http://remote/uri/dtd/docDummy.dtd", null);
         "http://local/base/dtd/docURI.dtd".equals(uriResolver.resolve(
                 "http://remote/dtd/doc.dtd", null).getSystemId());
--- a/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,6 @@
 import javax.xml.catalog.CatalogFeatures;
 import javax.xml.catalog.CatalogManager;
 import javax.xml.catalog.CatalogResolver;
-import javax.xml.catalog.CatalogUriResolver;
 
 import jaxp.library.JAXPTestUtilities;
 
@@ -101,18 +100,18 @@
     /*
      * Creates catalogUriResolver with a set of catalogs.
      */
-    static CatalogUriResolver catalogUriResolver(String... catalogName) {
+    static CatalogResolver catalogUriResolver(String... catalogName) {
         return catalogUriResolver(CatalogFeatures.defaults(), catalogName);
     }
 
     /*
      * Creates catalogUriResolver with a feature and a set of catalogs.
      */
-    static CatalogUriResolver catalogUriResolver(
+    static CatalogResolver catalogUriResolver(
             CatalogFeatures features, String... catalogName) {
         return (catalogName == null) ?
-                CatalogManager.catalogUriResolver(features) :
-                CatalogManager.catalogUriResolver(features, getCatalogPaths(catalogName));
+                CatalogManager.catalogResolver(features) :
+                CatalogManager.catalogResolver(features, getCatalogPaths(catalogName));
     }
 
     // Gets the paths of the specified catalogs.
--- a/jaxp/test/javax/xml/jaxp/libs/catalog/ResolutionChecker.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/libs/catalog/ResolutionChecker.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,6 @@
 package catalog;
 
 import javax.xml.catalog.CatalogResolver;
-import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.Assert;
 
@@ -65,7 +64,7 @@
      * Checks the resolution result for specified URI references
      * with the specified base location.
      */
-    static void checkUriResolution(CatalogUriResolver resolver,
+    static void checkUriResolution(CatalogResolver resolver,
             String href, String base, String matchedUri) {
         Assert.assertEquals(resolver.resolve(href, base).getSystemId(),
                 matchedUri);
@@ -74,7 +73,7 @@
     /*
      * Checks the resolution result for specified URI references.
      */
-    static void checkUriResolution(CatalogUriResolver resolver,
+    static void checkUriResolution(CatalogResolver resolver,
             String href, String matchedUri) {
         checkUriResolution(resolver, href, null, matchedUri);
     }
@@ -92,9 +91,9 @@
 
     /*
      * With strict resolution, if no match is found,
-     * CatalogUriResolver should throw CatalogException.
+     * CatalogResolver should throw CatalogException.
      */
-    static void checkNoMatch(CatalogUriResolver resolver) {
+    static void checkNoUriMatch(CatalogResolver resolver) {
         resolver.resolve("http://uri/noMatch/docNoMatch.dtd", getNotSpecified(null));
     }
 
@@ -139,7 +138,7 @@
      * URI reference with a specified base location.
      */
     static <T extends Throwable> void expectExceptionOnUri(
-            CatalogUriResolver resolver, String href, String base,
+            CatalogResolver resolver, String href, String base,
             Class<T> expectedExceptionClass) {
         expectThrows(expectedExceptionClass, () -> {
             resolver.resolve(href, base);
@@ -151,7 +150,7 @@
      * URI reference without any specified base location.
      */
     static <T extends Throwable> void expectExceptionOnUri(
-            CatalogUriResolver resolver, String href,
+            CatalogResolver resolver, String href,
             Class<T> expectedExceptionClass) {
         expectExceptionOnUri(resolver, href, null, expectedExceptionClass);
     }
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport.java	Fri Aug 26 14:47:52 2016 -0700
@@ -327,4 +327,3 @@
         };
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport.xml	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -11,32 +11,32 @@
     <!-- public publicId="datatypes" uri="datatypes.dtd"/-->
 
     <!-- XInclude -->
-    <uri name="XI_simple.xml" uri="XI_simple4Catalog.xml"/>
-    <uri name="XI_utf8.xml" uri="XI_utf8.xml"/>
-    <uri name="XI_utf8Catalog.xml" uri="XI_utf8Catalog.xml"/>
-    <uri name="XI_test2.xml" uri="XI_test2.xml"/>
+    <system systemId="XI_simple.xml" uri="XI_simple4Catalog.xml"/>
+    <system systemId="XI_utf8.xml" uri="XI_utf8.xml"/>
+    <system systemId="XI_utf8Catalog.xml" uri="XI_utf8Catalog.xml"/>
+    <system systemId="XI_test2.xml" uri="XI_test2.xml"/>
     <system systemId="XI_red.dtd" uri="XI_red.dtd"/>
 
     <!-- xsd import can be mapped using the namespace or systemId -->
     <!--public publicId="http://www.w3.org/XML/1998/namespace" uri="xml.xsd"/-->
     <!--uri name="http://www.w3.org/XML/1998/namespace" uri="xml.xsd"/-->
-    <uri name="http://www.w3.org/2001/pathto/xml.xsd" uri="xml.xsd"/>
+    <system systemId="http://www.w3.org/2001/pathto/xml.xsd" uri="xml.xsd"/>
     
     <!-- schema include -->
-    <uri name="pathto/XSDInclude_person.xsd" uri="XSDInclude_person.xsd"/>
-    <uri name="pathto/XSDInclude_product.xsd" uri="XSDInclude_product.xsd"/>
+    <system systemId="pathto/XSDInclude_person.xsd" uri="XSDInclude_person.xsd"/>
+    <system systemId="pathto/XSDInclude_product.xsd" uri="XSDInclude_product.xsd"/>
     
     <!-- for relative path, use Suffix -->    
     <systemSuffix systemIdSuffix="pathto/val_test.xsd" uri="val_test.xsd"/>
     
     <!-- XSL import and include -->
-    <uri name="pathto/XSLImport_html.xsl" uri="XSLImport_html.xsl"/>
-    <uri name="pathto/XSLInclude_header.xsl" uri="XSLInclude_header.xsl"/>
-    <uri name="pathto/XSLInclude_footer.xsl" uri="XSLInclude_footer.xsl"/>
+    <system systemId="pathto/XSLImport_html.xsl" uri="XSLImport_html.xsl"/>
+    <system systemId="pathto/XSLInclude_header.xsl" uri="XSLInclude_header.xsl"/>
+    <system systemId="pathto/XSLInclude_footer.xsl" uri="XSLInclude_footer.xsl"/>
     <!-- and DTDs -->
     <system systemId="http://openjdk.java.net/xml/catalog/dtd/XSLDTD.dtd" uri="XSLDTD.dtd"/>
     <system systemId="http://openjdk.java.net/xml/catalog/dtd/include.dtd" uri="include.dtd"/>
     
     <!-- XSLT document function -->
-    <uri name="pathto/DocFunc2.xml" uri="DocFuncCatalog.xml"/>
+    <system systemId="pathto/DocFunc2.xml" uri="DocFuncCatalog.xml"/>
 </catalog>
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport1.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport1.java	Fri Aug 26 14:47:52 2016 -0700
@@ -268,4 +268,3 @@
     }
 
 }
-
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport2.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport2.java	Fri Aug 26 14:47:52 2016 -0700
@@ -270,4 +270,3 @@
         };
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport3.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport3.java	Fri Aug 26 14:47:52 2016 -0700
@@ -280,4 +280,3 @@
         };
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport4.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport4.java	Fri Aug 26 14:47:52 2016 -0700
@@ -269,4 +269,3 @@
         };
     }
 }
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport5.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,250 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package catalog;
+
+import java.io.File;
+import java.io.StringReader;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stax.StAXSource;
+import javax.xml.transform.stream.StreamSource;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+import org.w3c.dom.ls.LSResourceResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/*
+ * @test
+ * @bug 8158084 8163232
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport5
+ * @run testng/othervm catalog.CatalogSupport5
+ * @summary extends CatalogSupport tests, verifies that when errors occur,
+ * relevant checked Exceptions are returned.
+ */
+/**
+ * The CatalogResolver will throw CatalogException when there is no match and
+ * the resolve property is strict. The Exception should be caught with the existing
+ * mechanisms so that the checked Exception corresponding to the process can be
+ * returned.
+ *
+ * @author huizhe.wang@oracle.com
+ */
+@Listeners({jaxp.library.FilePolicy.class, jaxp.library.NetAccessPolicy.class})
+public class CatalogSupport5 extends CatalogSupportBase {
+
+    /*
+     * Initializing fields
+     */
+    @BeforeClass
+    public void setUpClass() throws Exception {
+        setUp();
+    }
+
+
+    /*
+       Verifies the Catalog support on SAXParser.
+    */
+    @Test(dataProvider = "data_SAXC", expectedExceptions = SAXException.class)
+    public void testSAXC(boolean setUseCatalog, boolean useCatalog, String catalog, String
+            xml, MyHandler handler, String expected) throws Exception {
+        testSAX(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on XMLReader.
+    */
+    @Test(dataProvider = "data_SAXC", expectedExceptions = SAXException.class)
+    public void testXMLReaderC(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        testXMLReader(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on XInclude.
+    */
+    @Test(dataProvider = "data_XIC", expectedExceptions = SAXException.class)
+    public void testXIncludeC(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        testXInclude(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on DOM parser.
+    */
+    @Test(dataProvider = "data_DOMC", expectedExceptions = SAXException.class)
+    public void testDOMC(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        testDOM(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on resolving DTD, xsd import and include in
+    Schema files.
+    */
+    @Test(dataProvider = "data_SchemaC", expectedExceptions = SAXException.class)
+    public void testValidationC(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xsd, LSResourceResolver resolver)
+            throws Exception {
+        testValidation(setUseCatalog, useCatalog, catalog, xsd, resolver) ;
+    }
+
+    @Test(dataProvider = "data_ValidatorC", expectedExceptions = SAXException.class)
+    public void testValidatorC(boolean setUseCatalog1, boolean setUseCatalog2, boolean useCatalog,
+            Source source, LSResourceResolver resolver1, LSResourceResolver resolver2,
+            String catalog1, String catalog2)
+            throws Exception {
+        testValidator(setUseCatalog1, setUseCatalog2, useCatalog, source,
+                resolver1, resolver2, catalog1, catalog2);
+    }
+
+    /*
+       Verifies the Catalog support on resolving DTD, xsl import and include in
+    XSL files.
+    */
+    @Test(dataProvider = "data_XSLC", expectedExceptions = TransformerException.class)
+    public void testXSLImportC(boolean setUseCatalog, boolean useCatalog, String catalog,
+            SAXSource xsl, StreamSource xml, URIResolver resolver, String expected) throws Exception {
+
+        testXSLImport(setUseCatalog, useCatalog, catalog, xsl, xml, resolver, expected);
+    }
+
+    /*
+       @bug 8158084 8162442
+       Verifies the Catalog support on resolving DTD, xsl import and include in
+    XSL files.
+    */
+    @Test(dataProvider = "data_XSLC", expectedExceptions = TransformerException.class)
+    public void testXSLImportWTemplatesC(boolean setUseCatalog, boolean useCatalog, String catalog,
+            SAXSource xsl, StreamSource xml, URIResolver resolver, String expected) throws Exception {
+        testXSLImportWTemplates(setUseCatalog, useCatalog, catalog, xsl, xml, resolver, expected);
+    }
+
+    /*
+       DataProvider: for testing the SAX parser
+       Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
+     */
+    @DataProvider(name = "data_SAXC")
+    public Object[][] getDataSAXC() {
+        return new Object[][]{
+            {false, true, xml_bogus_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog}
+
+        };
+    }
+
+    /*
+       DataProvider: for testing XInclude
+       Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
+     */
+    @DataProvider(name = "data_XIC")
+    public Object[][] getDataXIC() {
+        return new Object[][]{
+            {false, true, xml_bogus_catalog, xml_xInclude, new MyHandler(elementInXISimple), contentInUIutf8Catalog},
+        };
+    }
+
+    /*
+       DataProvider: for testing DOM parser
+       Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
+     */
+    @DataProvider(name = "data_DOMC")
+    public Object[][] getDataDOMC() {
+        return new Object[][]{
+            {false, true, xml_bogus_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog}
+        };
+    }
+
+    /*
+       DataProvider: for testing Schema validation
+       Data: set use_catalog, use_catalog, catalog file, xsd file, a LSResourceResolver
+     */
+    @DataProvider(name = "data_SchemaC")
+    public Object[][] getDataSchemaC() {
+
+        return new Object[][]{
+            // for resolving DTD in xsd
+            {false, true, xml_bogus_catalog, xsd_xmlSchema, null},
+            // for resolving xsd import
+            {false, true, xml_bogus_catalog, xsd_xmlSchema_import, null},
+            // for resolving xsd include
+            {false, true, xml_bogus_catalog, xsd_include_company, null}
+        };
+    }
+
+    /*
+       DataProvider: for testing Schema Validator
+       Data: setUseCatalog1, setUseCatalog2, useCatalog, source, resolver1, resolver2,
+             catalog1, catalog2
+     */
+    @DataProvider(name = "data_ValidatorC")
+    public Object[][] getDataValidator() {
+        DOMSource ds = getDOMSource(xml_val_test, xml_val_test_id, true, true, xml_catalog);
+
+        SAXSource ss = new SAXSource(new InputSource(xml_val_test));
+        ss.setSystemId(xml_val_test_id);
+
+        StAXSource stax = getStaxSource(xml_val_test, xml_val_test_id);
+        StAXSource stax1 = getStaxSource(xml_val_test, xml_val_test_id);
+
+        StreamSource source = new StreamSource(new File(xml_val_test));
+
+        return new Object[][]{
+            // use catalog
+            {false, false, true, ds, null, null, xml_bogus_catalog, null},
+            {false, false, true, ds, null, null, null, xml_bogus_catalog},
+            {false, false, true, ss, null, null, xml_bogus_catalog, null},
+            {false, false, true, ss, null, null, null, xml_bogus_catalog},
+            {false, false, true, stax, null, null, xml_bogus_catalog, null},
+            {false, false, true, stax1, null, null, null, xml_bogus_catalog},
+            {false, false, true, source, null, null, xml_bogus_catalog, null},
+            {false, false, true, source, null, null, null, xml_bogus_catalog},
+        };
+    }
+
+    /*
+       DataProvider: for testing XSL import and include
+       Data: set use_catalog, use_catalog, catalog file, xsl file, xml file, a URIResolver, expected
+     */
+    @DataProvider(name = "data_XSLC")
+    public Object[][] getDataXSLC() {
+        SAXSource xslSourceDTD = new SAXSource(new InputSource(new StringReader(xsl_includeDTD)));
+        StreamSource xmlSourceDTD = new StreamSource(new StringReader(xml_xslDTD));
+
+        SAXSource xslDocSource = new SAXSource(new InputSource(new File(xsl_doc).toURI().toASCIIString()));
+        StreamSource xmlDocSource = new StreamSource(new File(xml_doc));
+        return new Object[][]{
+            // for resolving DTD, import and include in xsl
+            {false, true, xml_bogus_catalog, xslSourceDTD, xmlSourceDTD, null, ""},
+            // for resolving reference by the document function
+            {false, true, xml_bogus_catalog, xslDocSource, xmlDocSource, null, "Resolved by a catalog"},
+        };
+    }
+}
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupportBase.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupportBase.java	Fri Aug 26 14:47:52 2016 -0700
@@ -35,9 +35,9 @@
 import java.io.StringReader;
 import java.io.StringWriter;
 import java.io.UnsupportedEncodingException;
-
 import javax.xml.XMLConstants;
 import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogResolver;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -61,7 +61,6 @@
 import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
 import javax.xml.validation.Validator;
-
 import org.testng.Assert;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
@@ -677,6 +676,29 @@
 
     }
 
+
+    /**
+     * Extends MyHandler and overrides resolveEntity with a CatalogResolver
+     */
+    class MyCatalogHandler extends MyHandler {
+        CatalogResolver cr;
+
+        public MyCatalogHandler(CatalogResolver cr, String elementName) {
+            super(elementName);
+            this.cr = cr;
+        }
+
+        @Override
+        public InputSource resolveEntity(String publicId, String systemId) {
+            return cr.resolveEntity(publicId, systemId);
+        }
+        @Override
+        public InputSource resolveEntity(String name, String publicId,
+                String baseURI, String systemId) {
+            return cr.resolveEntity(publicId, systemId);
+        }
+    }
+
     /**
      * Extends MyHandler and overrides resolveEntity
      */
@@ -935,4 +957,3 @@
         }
     }
 }
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport_uri.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+    <!-- DTDs and external entities -->
+    <uri name="http://openjdk.java.net/xml/catalog/dtd/system.dtd" uri="system.dtd"/>
+    
+    <!-- XMLSchema refers to XMLSchema.dtd -->
+    <public publicId="-//W3C//DTD XMLSCHEMA 200102//EN" uri="XMLSchema.dtd"/>
+    <!-- XMLSchema.dtd refers to datatypes.dtd -->
+    <uriSuffix uriSuffix="datatypes.dtd" uri="datatypes.dtd"/>
+    <!-- XMLSchema.dtd refers to datatypes.dtd, can use public entry as well -->
+    <!-- public publicId="datatypes" uri="datatypes.dtd"/-->
+
+    <!-- XInclude -->
+    <uri name="XI_simple.xml" uri="XI_simple4Catalog.xml"/>
+    <uri name="XI_utf8.xml" uri="XI_utf8.xml"/>
+    <uri name="XI_utf8Catalog.xml" uri="XI_utf8Catalog.xml"/>
+    <uri name="XI_test2.xml" uri="XI_test2.xml"/>
+    <uri name="XI_red.dtd" uri="XI_red.dtd"/>
+
+    <!-- xsd import can be mapped using the namespace or systemId -->
+    <!--public publicId="http://www.w3.org/XML/1998/namespace" uri="xml.xsd"/-->
+    <!--uri name="http://www.w3.org/XML/1998/namespace" uri="xml.xsd"/-->
+    <uri name="http://www.w3.org/2001/pathto/xml.xsd" uri="xml.xsd"/>
+    
+    <!-- schema include -->
+    <uri name="pathto/XSDInclude_person.xsd" uri="XSDInclude_person.xsd"/>
+    <uri name="pathto/XSDInclude_product.xsd" uri="XSDInclude_product.xsd"/>
+    
+    <!-- for relative path, use Suffix -->    
+    <uriSuffix uriSuffix="pathto/val_test.xsd" uri="val_test.xsd"/>
+    
+    <!-- XSL import and include -->
+    <uri name="pathto/XSLImport_html.xsl" uri="XSLImport_html.xsl"/>
+    <uri name="pathto/XSLInclude_header.xsl" uri="XSLInclude_header.xsl"/>
+    <uri name="pathto/XSLInclude_footer.xsl" uri="XSLInclude_footer.xsl"/>
+    <!-- and DTDs -->
+    <uri name="http://openjdk.java.net/xml/catalog/dtd/XSLDTD.dtd" uri="XSLDTD.dtd"/>
+    <uri name="http://openjdk.java.net/xml/catalog/dtd/include.dtd" uri="include.dtd"/>
+    
+    <!-- XSLT document function -->
+    <uri name="pathto/DocFunc2.xml" uri="DocFuncCatalog.xml"/>
+</catalog>
+
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -26,23 +26,37 @@
 import static jaxp.library.JAXPTestUtilities.getSystemProperty;
 import static jaxp.library.JAXPTestUtilities.setSystemProperty;
 
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.FilePermission;
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
 import java.nio.file.Paths;
 import java.util.PropertyPermission;
-
+import javax.xml.XMLConstants;
 import javax.xml.catalog.Catalog;
 import javax.xml.catalog.CatalogException;
 import javax.xml.catalog.CatalogFeatures;
 import javax.xml.catalog.CatalogFeatures.Feature;
 import javax.xml.catalog.CatalogManager;
 import javax.xml.catalog.CatalogResolver;
-import javax.xml.catalog.CatalogUriResolver;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
 import javax.xml.transform.Source;
-
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
 import jaxp.library.JAXPTestUtilities;
 
 import org.testng.Assert;
@@ -59,29 +73,235 @@
 
 /*
  * @test
- * @bug 8081248 8144966 8146606 8146237 8151154 8150969 8151162 8152527 8154220
+ * @bug 8081248 8144966 8146606 8146237 8151154 8150969 8151162 8152527 8154220 8163232
  * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
  * @run testng/othervm -DrunSecMngr=true catalog.CatalogTest
  * @run testng/othervm catalog.CatalogTest
  * @summary Tests basic Catalog functions.
  */
 @Listeners({jaxp.library.FilePolicy.class})
-public class CatalogTest {
+public class CatalogTest extends CatalogSupportBase {
     static final String KEY_FILES = "javax.xml.catalog.files";
 
-    public String filepath;
 
     /*
      * Initializing fields
      */
     @BeforeClass
     public void setUpClass() throws Exception {
-        String file1 = getClass().getResource("first_cat.xml").getFile();
-        if (getSystemProperty("os.name").contains("Windows")) {
-            filepath = file1.substring(1, file1.lastIndexOf("/") + 1);
-        } else {
-            filepath = file1.substring(0, file1.lastIndexOf("/") + 1);
+        super.setUp();
+    }
+
+
+    /*
+     * @bug 8163232
+     * Verifies that the CatalogResolver supports the following XML Resolvers:
+          javax.xml.stream.XMLResolver
+          javax.xml.transform.URIResolver
+          org.w3c.dom.ls.LSResourceResolver
+          org.xml.sax.EntityResolver
+     *
+     * Plus, system and uri entries can equally be used.
+     */
+
+    /*
+     * Verifies the support for org.xml.sax.EntityResolver.
+     * Expected: the parser returns the expected string.
+    */
+    @Test(dataProvider = "supportXMLResolver")
+    public void supportEntityResolver(String catalogFile, String xml, String expected) throws Exception {
+        String xmlSource = getClass().getResource(xml).getFile();
+
+        CatalogResolver cr = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalogFile);
+        MyCatalogHandler handler = new MyCatalogHandler(cr, elementInSystem);
+        SAXParser parser = getSAXParser(false, true, null);
+        parser.parse(xmlSource, handler);
+
+        Assert.assertEquals(handler.getResult().trim(), expected);
+    }
+
+    /*
+     * Verifies the support for javax.xml.stream.XMLResolver.
+     * Expected: the parser returns the expected string.
+    */
+    @Test(dataProvider = "supportXMLResolver")
+    public void supportXMLResolver(String catalogFile, String xml, String expected) throws Exception {
+        String xmlSource = getClass().getResource(xml).getFile();
+
+        CatalogResolver cr = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalogFile);
+
+        XMLInputFactory xifactory = XMLInputFactory.newInstance();
+        xifactory.setProperty(XMLInputFactory.IS_COALESCING, true);
+        xifactory.setProperty(XMLInputFactory.RESOLVER, cr);
+        File file = new File(xmlSource);
+        String systemId = file.toURI().toString();
+        InputStream entityxml = new FileInputStream(file);
+        XMLStreamReader streamReader = xifactory.createXMLStreamReader(systemId, entityxml);
+        String result = null;
+        while (streamReader.hasNext()) {
+            int eventType = streamReader.next();
+            if (eventType == XMLStreamConstants.START_ELEMENT) {
+                eventType = streamReader.next();
+                if (eventType == XMLStreamConstants.CHARACTERS) {
+                    result = streamReader.getText();
+                }
+            }
         }
+        System.out.println(": expected [" + expected + "] <> actual [" + result.trim() + "]");
+
+        Assert.assertEquals(result.trim(), expected);
+    }
+
+    /*
+     * Verifies the support for org.w3c.dom.ls.LSResourceResolver by ShemaFactory.
+     * Success: parsing goes through with no error
+     * Fail: throws Exception if references are not resolved (by the CatalogResolver)
+    */
+    @Test(dataProvider = "supportLSResourceResolver")
+    public void supportLSResourceResolver(String catalogFile, Source schemaSource) throws SAXException {
+
+        CatalogResolver cr = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalogFile);
+
+        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        factory.setResourceResolver(cr);
+        Schema schema = factory.newSchema(schemaSource);
+
+    }
+
+    /*
+     * Verifies the support for org.w3c.dom.ls.LSResourceResolver by Validator.
+     * Success: parsing goes through with no error
+     * Fail: throws Exception if references are not resolved (by the CatalogResolver)
+    */
+    @Test(dataProvider = "supportLSResourceResolver1")
+    public void supportLSResourceResolver1(String catalogFile, Source source) throws Exception {
+
+        CatalogResolver cr = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalogFile);
+
+        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        Validator validator = factory.newSchema().newValidator();
+        validator.setResourceResolver(cr);
+        validator.validate(source);
+    }
+
+    /*
+     * Verifies the support for javax.xml.transform.URIResolver.
+     * Success: parsing goes through with no error
+     * Fail: throws Exception if references are not resolved (by the CatalogResolver)
+    */
+    @Test(dataProvider = "supportURIResolver")
+    public void supportURIResolver(String catalogFile, Source xsl, Source xml, String expected) throws Exception {
+
+        CatalogResolver cr = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalogFile);
+
+            TransformerFactory factory = TransformerFactory.newInstance();
+            factory.setURIResolver(cr);
+            Transformer transformer = factory.newTransformer(xsl);
+            StringWriter out = new StringWriter();
+            transformer.transform(xml, new StreamResult(out));
+            if (expected != null) {
+                Assert.assertTrue(out.toString().contains(expected), "supportURIResolver");
+            }
+    }
+
+    /*
+       DataProvider: used to verify the support of XML Resolvers.
+        Data columns:
+        catalog filepath, xml source file, expected result
+     */
+    @DataProvider(name = "supportXMLResolver")
+    public Object[][] supportXMLResolver() {
+        String catalogFile = getClass().getResource("catalog.xml").getFile();
+        String catalogFileUri = getClass().getResource("catalog_uri.xml").getFile();
+
+        return new Object[][]{
+            {catalogFile, "system.xml", "Test system entry"},
+            {catalogFile, "rewritesystem.xml", "Test rewritesystem entry"},
+            {catalogFile, "rewritesystem1.xml", "Test rewritesystem entry"},
+            {catalogFile, "systemsuffix.xml", "Test systemsuffix entry"},
+            {catalogFile, "delegatesystem.xml", "Test delegatesystem entry"},
+            {catalogFile, "public.xml", "Test public entry"},
+            {catalogFile, "delegatepublic.xml", "Test delegatepublic entry"},
+            // using uri entries
+            {catalogFileUri, "system.xml", "Test system entry"},
+            {catalogFileUri, "rewritesystem.xml", "Test rewritesystem entry"},
+            {catalogFileUri, "rewritesystem1.xml", "Test rewritesystem entry"},
+            {catalogFileUri, "systemsuffix.xml", "Test systemsuffix entry"},
+            {catalogFileUri, "delegateuri.xml", "Test delegateuri entry"},
+            {catalogFileUri, "public.xml", "Test public entry"},
+         };
+    }
+
+    /*
+       DataProvider: used to verify the support of LSResourceResolver by SchemaFactory.
+        Data columns:
+        catalog filepath, schema source file
+     */
+    @DataProvider(name = "supportLSResourceResolver")
+    public Object[][] supportLSResourceResolver() {
+        String catalogFile = getClass().getResource("CatalogSupport.xml").getFile();
+        String catalogFileUri = getClass().getResource("CatalogSupport_uri.xml").getFile();
+
+        /*
+         * XMLSchema.xsd has a reference to XMLSchema.dtd which in turn refers to
+         * datatypes.dtd
+        */
+        return new Object[][]{
+            {catalogFile, new StreamSource(new StringReader(xsd_xmlSchema))},
+            {catalogFile, new StreamSource(new StringReader(xsd_xmlSchema_import))},
+            {catalogFile, new StreamSource(new StringReader(xsd_include_company))},
+            {catalogFileUri, new StreamSource(new StringReader(xsd_xmlSchema))},
+            {catalogFileUri, new StreamSource(new StringReader(xsd_xmlSchema_import))},
+            {catalogFileUri, new StreamSource(new StringReader(xsd_include_company))},
+         };
+    }
+
+    /*
+       DataProvider: used to verify the support of LSResourceResolver by Validator.
+        Data columns:
+        catalog filepath, source file
+     */
+    @DataProvider(name = "supportLSResourceResolver1")
+    public Object[][] supportLSResourceResolver1() {
+        String catalogFile = getClass().getResource("CatalogSupport.xml").getFile();
+        String catalogFileUri = getClass().getResource("CatalogSupport_uri.xml").getFile();
+
+        /*
+         * val_test.xml has a reference to system.dtd and val_test.xsd
+        */
+        SAXSource ss = new SAXSource(new InputSource(xml_val_test));
+        ss.setSystemId(xml_val_test_id);
+
+        return new Object[][]{
+            {catalogFile, ss},
+            {catalogFileUri, ss},
+         };
+    }
+
+
+    /*
+       DataProvider: used to verify the support of LSResourceResolver by Validator.
+        Data columns:
+        catalog filepath, xsl source, xml source file
+     */
+    @DataProvider(name = "supportURIResolver")
+    public Object[][] supportURIResolver() {
+        String catalogFile = getClass().getResource("CatalogSupport.xml").getFile();
+        String catalogFileUri = getClass().getResource("CatalogSupport_uri.xml").getFile();
+        SAXSource xslSource = new SAXSource(new InputSource(new File(xsl_doc).toURI().toASCIIString()));
+
+        /*
+         * val_test.xml has a reference to system.dtd and val_test.xsd
+        */
+        SAXSource ss = new SAXSource(new InputSource(xml_val_test));
+        ss.setSystemId(xml_val_test_id);
+
+        return new Object[][]{
+            {catalogFile, new SAXSource(new InputSource(new File(xsl_doc).toURI().toASCIIString())),
+                new StreamSource(new File(xml_doc)), "Resolved by a catalog"},
+            {catalogFileUri, new SAXSource(new InputSource(new StringReader(xsl_include))),
+                new StreamSource(new StringReader(xml_xsl)), null},
+         };
     }
 
     /*
@@ -110,7 +330,7 @@
     @Test(dataProvider = "resolveUri")
     public void testMatch1(String cFile, String href, String expectedFile, String expectedUri, String msg) {
         String catalogFile = getClass().getResource(cFile).getFile();
-        CatalogUriResolver cur = CatalogManager.catalogUriResolver(CatalogFeatures.defaults(), catalogFile);
+        CatalogResolver cur = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalogFile);
         Source source = cur.resolve(href, null);
         Assert.assertNotNull(source, "Source returned is null");
         Assert.assertEquals(expectedUri, source.getSystemId(), msg);
@@ -275,7 +495,7 @@
 
         try {
 
-            CatalogUriResolver resolver = CatalogManager.catalogUriResolver(CatalogFeatures.defaults(), catalog);
+            CatalogResolver resolver = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalog);
             String actualSystemId = resolver.resolve("http://remote.com/import/import.xsl", null).getSystemId();
             Assert.assertTrue(!actualSystemId.contains("//"), "result contains duplicate slashes");
         } catch (Exception e) {
@@ -383,7 +603,7 @@
 
 
     /*
-        DataProvider: used to verify CatalogUriResolver's resolve function.
+        DataProvider: used to verify CatalogResolver's resolve function.
         Data columns:
         catalog, uri or publicId, expectedFile, expectedUri, msg
 
@@ -571,4 +791,3 @@
         }
     }
 }
-
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/catalog.xml	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/catalog.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -26,4 +26,4 @@
         <system systemId="http://remote/dtd/alice/docAlice.dtd" uri="http://local/dtd/docAliceSys.dtd" />
     </group> 
 
-</catalog>
\ No newline at end of file
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/catalog_uri.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<catalog
+  xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+
+    <!-- using uri entries -->
+    <uri name="http://openjdk.java.net/xml/catalog/dtd/system.dtd" uri="system.dtd"/>
+    <rewriteURI uriStartString="http://openjdk.java.net/" 
+                   rewritePrefix="files" />
+    
+    <rewriteURI uriStartString="http://openjdk.java.net/xml/catalog/dtd/" 
+                   rewritePrefix="files" />
+
+    <uriSuffix uriSuffix="systemsuffix.dtd" uri="systemsuffix.dtd"/>
+    
+    <delegateURI uriStartString="http://java.com/xml/catalog/dtd/" catalog="files/delegatecatalog_uri.xml"/>
+
+
+    <uri name="-//OPENJDK//XML CATALOG DTD//1.0" uri="public.dtd"/>
+
+    
+    <delegateURI uriStartString="-//JAVASE//XML CATALOG DTD//DELEGATEPULIC" catalog="files/delegatecatalog_uri.xml"/>
+    
+</catalog>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/delegateuri.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<!DOCTYPE  catalogtest  PUBLIC  "-//JAVASE//XML CATALOG DTD//DELEGATEURI"  
+     "http://java.com/xml/catalog/dtd/delegateuri.dtd">
+
+<catalogtest>Test &delegateuri; entry</catalogtest>
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/files/delegatecatalog.xml	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/files/delegatecatalog.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -22,4 +22,4 @@
     
     <system systemId="http://java.com/xml/catalog/dtd/delegatesystem.dtd" uri="delegatesystem.dtd"/>
     
-</catalog>
\ No newline at end of file
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/files/delegatecatalog_uri.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<catalog
+  xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+
+    <uri name="http://java.com/xml/catalog/dtd/delegateuri.dtd" uri="delegateuri.dtd"/>
+    
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/files/delegateuri.dtd	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,2 @@
+
+<!ENTITY delegateuri "delegateuri">
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/system.xml	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/system.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<!DOCTYPE  catalogtest  PUBLIC  "-//OPENJDK//XML CATALOG DTD//1.0"  
+<!DOCTYPE  catalogtest  PUBLIC  "-//OPENJDK//XML CATALOG DTD SYSTEM//1.0"  
      "http://openjdk.java.net/xml/catalog/dtd/system.dtd">
      
-<catalogtest>Test &system; entry</catalogtest>
\ No newline at end of file
+<catalogtest>Test &system; entry</catalogtest>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/HandleError.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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 parsers;
+
+import java.io.StringReader;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8157797
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.HandleError
+ * @run testng/othervm parsers.HandleError
+ * @summary Tests that the parser handles errors properly.
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class HandleError {
+
+    /*
+     * Verifies that the parser returns with no unexpected "java.lang.InternalError"
+     * when continue-after-fatal-error is requested.
+    */
+    @Test
+    public void test() throws Exception {
+        String invalidXml = "<a>";
+        SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
+        saxParserFactory.setFeature("http://apache.org/xml/features/continue-after-fatal-error", true);
+        SAXParser parser = saxParserFactory.newSAXParser();
+        parser.parse(new InputSource(new StringReader(invalidXml)), new DefaultHandler() {
+            @Override
+            public void fatalError(SAXParseException e) throws SAXException {
+                System.err.printf("%s%n", e.getMessage());
+            }
+        });
+    }
+
+
+    /*
+     * Verifies that the parser throws SAXParseException when parsing error is
+     * encountered when:
+     * continue-after-fatal-error is not set, the default it false
+     * continue-after-fatal-error is explicitly set to false
+    */
+    @Test(dataProvider = "setFeature", expectedExceptions = SAXParseException.class)
+    public void test1(boolean setFeature, boolean value) throws Exception {
+        String invalidXml = "<a>";
+        SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
+        if (setFeature) {
+            saxParserFactory.setFeature("http://apache.org/xml/features/continue-after-fatal-error", value);
+        }
+        SAXParser parser = saxParserFactory.newSAXParser();
+        parser.parse(new InputSource(new StringReader(invalidXml)), new DefaultHandler());
+    }
+
+    /*
+       DataProvider: used to set feature "continue-after-fatal-error"
+        Data columns:
+        flag to indicate the feature is to be set, the value of the feature
+     */
+    @DataProvider(name = "setFeature")
+    public Object[][] getFeatureSetting() {
+
+        return new Object[][]{
+            {false, false},
+            {true, false},
+         };
+    }
+}
--- a/jaxws/.hgtags	Thu Aug 25 02:10:03 2016 -0700
+++ b/jaxws/.hgtags	Fri Aug 26 14:47:52 2016 -0700
@@ -378,3 +378,4 @@
 39c6293131d91aec7f2f5120395e070a937b8858 jdk-9+130
 783e7e2c587f2c7e1b9998a46d90ec196ab2a195 jdk-9+131
 9fff2477a4cadf2a9618a76f1f4fe0f20bb5ff3b jdk-9+132
+05e99eefda2b58d1ed176e411302d9d6b35dca16 jdk-9+133
--- a/jdk/.hgtags	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/.hgtags	Fri Aug 26 14:47:52 2016 -0700
@@ -375,3 +375,4 @@
 6c827500e34587061af97ad6fef0e859280255c5 jdk-9+130
 8c57f4c293bbc5609928308a6d91ba765760b5f9 jdk-9+131
 d5c70818cd8a82e76632c8c815bdb4f75f53aeaf jdk-9+132
+3cdae27c90b5e41afe75eab904fda19fac076330 jdk-9+133
--- a/jdk/make/data/cryptopolicy/limited/default_local.policy	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-// Some countries have import limits on crypto strength. This policy file
-// is worldwide importable.
-
-grant {
-    permission javax.crypto.CryptoPermission "DES", 64;
-    permission javax.crypto.CryptoPermission "DESede", *;
-    permission javax.crypto.CryptoPermission "RC2", 128, 
-                                     "javax.crypto.spec.RC2ParameterSpec", 128;
-    permission javax.crypto.CryptoPermission "RC4", 128;
-    permission javax.crypto.CryptoPermission "RC5", 128, 
-          "javax.crypto.spec.RC5ParameterSpec", *, 12, *;
-    permission javax.crypto.CryptoPermission "RSA", *;
-    permission javax.crypto.CryptoPermission *, 128;
-};
--- a/jdk/make/data/cryptopolicy/limited/exempt_local.policy	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-// Some countries have import limits on crypto strength. So this file
-// will be useful.
-
-grant {
-    // There is no restriction to any algorithms if KeyRecovery is enforced.
-    permission javax.crypto.CryptoPermission *, "KeyRecovery"; 
-
-    // There is no restriction to any algorithms if KeyEscrow is enforced.
-    permission javax.crypto.CryptoPermission *, "KeyEscrow"; 
-
-    // There is no restriction to any algorithms if KeyWeakening is enforced. 
-    permission javax.crypto.CryptoPermission *, "KeyWeakening";
-};
--- a/jdk/make/data/cryptopolicy/unlimited/default_US_export.policy	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-// Manufacturing policy file.
-grant {
-    // There is no restriction to any algorithms.
-    permission javax.crypto.CryptoAllPermission; 
-};
--- a/jdk/make/data/cryptopolicy/unlimited/default_local.policy	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-// Country-specific policy file for countries with no limits on crypto strength.
-grant {
-    // There is no restriction to any algorithms.
-    permission javax.crypto.CryptoAllPermission; 
-};
--- a/jdk/make/gendata/Gendata-java.base.gmk	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/make/gendata/Gendata-java.base.gmk	Fri Aug 26 14:47:52 2016 -0700
@@ -34,7 +34,7 @@
 
 include GendataBlacklistedCerts.gmk
 
-include GendataPolicyJars.gmk
+include GendataCryptoPolicy.gmk
 
 ################################################################################
 
@@ -64,13 +64,19 @@
 GENDATA_JAVA_SECURITY_SRC := $(JDK_TOPDIR)/src/java.base/share/conf/security/java.security
 GENDATA_JAVA_SECURITY := $(SUPPORT_OUTPUTDIR)/modules_conf/java.base/security/java.security
 
+ifeq ($(UNLIMITED_CRYPTO), true)
+    CRYPTO.POLICY := unlimited
+else
+    CRYPTO.POLICY := limited
+endif
+
 # RESTRICTED_PKGS_SRC is optionally set in custom extension for this makefile
 
 $(GENDATA_JAVA_SECURITY): $(BUILD_TOOLS) $(GENDATA_JAVA_SECURITY_SRC) $(RESTRICTED_PKGS_SRC)
 	$(call LogInfo, Generating java.security)
 	$(call MakeDir, $(@D))
 	$(TOOL_MAKEJAVASECURITY) $(GENDATA_JAVA_SECURITY_SRC) $@ $(OPENJDK_TARGET_OS) \
-	    $(OPENJDK_TARGET_CPU_ARCH) $(RESTRICTED_PKGS_SRC)
+	    $(OPENJDK_TARGET_CPU_ARCH) $(CRYPTO.POLICY) $(RESTRICTED_PKGS_SRC)
 
 TARGETS += $(GENDATA_JAVA_SECURITY)
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/gendata/GendataCryptoPolicy.gmk	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,72 @@
+#
+# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# 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.
+#
+
+#
+# In pre-JDK9 releases, Oracle JDK has had a separately downloadable set
+# of policy files which has been a nightmare for deployment.
+#
+# We now create 2 complete initial sets of policy files and package into 
+# 2 different directories.  The crypto.policy Security property will select
+# the active policy.
+#
+# It will be up to the user/deployer to make an informed choice
+# as to whether they are legally entitled to use the unlimited policy
+# file in their environment.  The $(UNLIMITED_CRYPTO) make variable
+# determines the default directory/policy.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+
+
+################################################################################
+POLICY_DIR := $(SUPPORT_OUTPUTDIR)/modules_conf/java.base/security/policy
+LIMITED_POLICY_DIR := $(POLICY_DIR)/limited
+UNLIMITED_POLICY_DIR := $(POLICY_DIR)/unlimited
+
+POLICY_SRC_DIR := $(JDK_TOPDIR)/src/java.base/share/conf/security/policy
+LIMITED_POLICY_SRC_DIR := $(POLICY_SRC_DIR)/limited
+UNLIMITED_POLICY_SRC_DIR := $(POLICY_SRC_DIR)/unlimited
+
+$(POLICY_DIR)/README.txt: $(POLICY_SRC_DIR)/README.txt
+	$(install-file)
+
+$(LIMITED_POLICY_DIR)/%: $(LIMITED_POLICY_SRC_DIR)/%
+	$(install-file)
+
+$(UNLIMITED_POLICY_DIR)/%: $(UNLIMITED_POLICY_SRC_DIR)/%
+	$(install-file)
+
+TARGETS += \
+    $(POLICY_DIR)/README.txt \
+    $(LIMITED_POLICY_DIR)/default_US_export.policy \
+    $(LIMITED_POLICY_DIR)/default_local.policy \
+    $(LIMITED_POLICY_DIR)/exempt_local.policy \
+    $(UNLIMITED_POLICY_DIR)/default_US_export.policy \
+    $(UNLIMITED_POLICY_DIR)/default_local.policy \
+
+################################################################################
--- a/jdk/make/gendata/GendataPolicyJars.gmk	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-#
-# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-include JarArchive.gmk
-
-
-################################################################################
-
-US_EXPORT_POLICY_JAR_DST := \
-    $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/security/US_export_policy.jar
-
-US_EXPORT_POLICY_JAR_LIMITED := \
-    $(SUPPORT_OUTPUTDIR)/jce/policy/limited/US_export_policy.jar
-US_EXPORT_POLICY_JAR_UNLIMITED := \
-    $(SUPPORT_OUTPUTDIR)/jce/policy/unlimited/US_export_policy.jar
-
-#
-# TODO fix so that SetupJarArchive does not write files into SRCS
-# then we don't need this extra copying
-#
-# NOTE: We currently do not place restrictions on our limited export
-# policy. This was not a typo. This means we are shipping the same file
-# for both limited and unlimited US_export_policy.jar.  Only the local
-# policy file currently has restrictions.
-#
-US_EXPORT_POLICY_JAR_SRC_DIR := \
-    $(JDK_TOPDIR)/make/data/cryptopolicy/unlimited
-US_EXPORT_POLICY_JAR_TMP := \
-    $(SUPPORT_OUTPUTDIR)/jce/policy/unlimited/US_export_policy_jar.tmp
-
-$(US_EXPORT_POLICY_JAR_TMP)/%: $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
-	$(install-file)
-
-US_EXPORT_POLICY_JAR_DEPS := \
-    $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
-
-$(eval $(call SetupJarArchive, BUILD_US_EXPORT_POLICY_JAR, \
-    DEPENDENCIES := $(US_EXPORT_POLICY_JAR_DEPS), \
-    SRCS := $(US_EXPORT_POLICY_JAR_TMP), \
-    SUFFIXES := .policy, \
-    JAR := $(US_EXPORT_POLICY_JAR_UNLIMITED), \
-    EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
-    SKIP_METAINF := true, \
-))
-
-$(US_EXPORT_POLICY_JAR_LIMITED): \
-    $(US_EXPORT_POLICY_JAR_UNLIMITED)
-	$(call LogInfo, Copying unlimited $(patsubst $(OUTPUT_ROOT)/%,%,$@))
-	$(install-file)
-
-TARGETS += $(US_EXPORT_POLICY_JAR_LIMITED) $(US_EXPORT_POLICY_JAR_UNLIMITED)
-
-ifeq ($(UNLIMITED_CRYPTO), true)
-  $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_UNLIMITED)
-	$(install-file)
-else
-  $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_LIMITED)
-	$(install-file)
-endif
-
-POLICY_JARS += $(US_EXPORT_POLICY_JAR_DST)
-
-################################################################################
-
-LOCAL_POLICY_JAR_DST := \
-    $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/security/local_policy.jar
-
-LOCAL_POLICY_JAR_LIMITED := \
-    $(SUPPORT_OUTPUTDIR)/jce/policy/limited/local_policy.jar
-LOCAL_POLICY_JAR_UNLIMITED := \
-    $(SUPPORT_OUTPUTDIR)/jce/policy/unlimited/local_policy.jar
-
-#
-# TODO fix so that SetupJarArchive does not write files into SRCS
-# then we don't need this extra copying
-#
-LOCAL_POLICY_JAR_LIMITED_TMP := \
-    $(SUPPORT_OUTPUTDIR)/jce/policy/limited/local_policy_jar.tmp
-LOCAL_POLICY_JAR_UNLIMITED_TMP := \
-    $(SUPPORT_OUTPUTDIR)/jce/policy/unlimited/local_policy_jar.tmp
-
-$(LOCAL_POLICY_JAR_LIMITED_TMP)/%: \
-    $(JDK_TOPDIR)/make/data/cryptopolicy/limited/%
-	$(install-file)
-
-$(LOCAL_POLICY_JAR_UNLIMITED_TMP)/%: \
-    $(JDK_TOPDIR)/make/data/cryptopolicy/unlimited/%
-	$(install-file)
-
-$(eval $(call SetupJarArchive, BUILD_LOCAL_POLICY_JAR_LIMITED, \
-    DEPENDENCIES := $(LOCAL_POLICY_JAR_LIMITED_TMP)/exempt_local.policy \
-        $(LOCAL_POLICY_JAR_LIMITED_TMP)/default_local.policy, \
-    SRCS := $(LOCAL_POLICY_JAR_LIMITED_TMP), \
-    SUFFIXES := .policy, \
-    JAR := $(LOCAL_POLICY_JAR_LIMITED), \
-    EXTRA_MANIFEST_ATTR := Crypto-Strength: limited, \
-    SKIP_METAINF := true, \
-))
-
-$(eval $(call SetupJarArchive, BUILD_LOCAL_POLICY_JAR_UNLIMITED, \
-    DEPENDENCIES := $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/default_local.policy, \
-    SRCS := $(LOCAL_POLICY_JAR_UNLIMITED_TMP), \
-    SUFFIXES := .policy, \
-    JAR := $(LOCAL_POLICY_JAR_UNLIMITED), \
-    EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
-    SKIP_METAINF := true, \
-))
-
-TARGETS += $(LOCAL_POLICY_JAR_LIMITED) $(LOCAL_POLICY_JAR_UNLIMITED)
-
-ifeq ($(UNLIMITED_CRYPTO), true)
-  $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_UNLIMITED)
-	$(install-file)
-else
-  $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_LIMITED)
-	$(install-file)
-endif
-
-POLICY_JARS += $(LOCAL_POLICY_JAR_DST)
-TARGETS += $(POLICY_JARS)
-
-################################################################################
-
-$(eval $(call IncludeCustomExtension, jdk, gendata/GendataPolicyJars.gmk))
--- a/jdk/make/launcher/Launcher-jdk.jdeps.gmk	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/make/launcher/Launcher-jdk.jdeps.gmk	Fri Aug 26 14:47:52 2016 -0700
@@ -36,3 +36,9 @@
     CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
         -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
 ))
+
+$(eval $(call SetupBuildLauncher, jdeprscan, \
+    MAIN_CLASS := com.sun.tools.jdeprscan.Main, \
+    CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
+        -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
+))
--- a/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -38,8 +38,6 @@
     CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2PKCS11_SRC)) \
         $(LIBJAVA_HEADER_FLAGS) \
         -I$(SUPPORT_OUTPUTDIR)/headers/jdk.crypto.pkcs11, \
-    DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
-    DISABLED_WARNINGS_microsoft := 4013 4267, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2pkcs11/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/jdk/make/src/classes/build/tools/makejavasecurity/MakeJavaSecurity.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/make/src/classes/build/tools/makejavasecurity/MakeJavaSecurity.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,8 @@
  *
  * 1. Adds additional packages to the package.access and
  *    package.definition security properties.
- * 2. Filter out platform-unrelated parts
+ * 2. Filter out platform-unrelated parts.
+ * 3. Set the JCE jurisdiction policy directory.
  *
  * In order to easily maintain platform-related entries, every item
  * (including the last line) in package.access and package.definition
@@ -50,12 +51,13 @@
 
     public static void main(String[] args) throws Exception {
 
-        if (args.length < 4) {
+        if (args.length < 5) {
             System.err.println("Usage: java MakeJavaSecurity " +
                                "[input java.security file name] " +
                                "[output java.security file name] " +
                                "[openjdk target os] " +
                                "[openjdk target cpu architecture]" +
+                               "[JCE jurisdiction policy directory]" +
                                "[more restricted packages file name?]");
 
                     System.exit(1);
@@ -63,8 +65,8 @@
 
         // more restricted packages
         List<String> extraLines;
-        if (args.length == 5) {
-            extraLines = Files.readAllLines(Paths.get(args[4]));
+        if (args.length == 6) {
+            extraLines = Files.readAllLines(Paths.get(args[5]));
         } else {
             extraLines = Collections.emptyList();
         }
@@ -135,6 +137,16 @@
             }
         }
 
+        // Set the JCE policy value
+        for (int i = 0; i < lines.size(); i++) {
+            String line = lines.get(i);
+            int index = line.indexOf("crypto.policydir-tbd");
+            if (index >= 0) {
+                String prefix = line.substring(0, index);
+                lines.set(i, prefix + args[4]);
+            }
+        }
+
         // Clean up the last line of PKG_ACC and PKG_DEF blocks.
         // Not really necessary since a blank line follows.
         boolean inBlock = false;
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/CipherCore.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/CipherCore.java	Fri Aug 26 14:47:52 2016 -0700
@@ -986,8 +986,9 @@
             if (padding != null) {
                 int padStart = padding.unpad(outWithPadding, 0, outLen);
                 if (padStart < 0) {
-                    throw new BadPaddingException("Given final block not "
-                                                  + "properly padded");
+                    throw new BadPaddingException("Given final block not " +
+                    "properly padded. Such issues can arise if a bad key " +
+                    "is used during decryption.");
                 }
                 outLen = padStart;
             }
--- a/jdk/src/java.base/share/classes/java/lang/Class.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java	Fri Aug 26 14:47:52 2016 -0700
@@ -331,12 +331,6 @@
      * Note that this method does not check whether the requested class
      * is accessible to its caller.
      *
-     * <p> If the {@code loader} is {@code null}, and a security
-     * manager is present, and the caller's class loader is not null, then this
-     * method calls the security manager's {@code checkPermission} method
-     * with a {@code RuntimePermission("getClassLoader")} permission to
-     * ensure it's ok to access the bootstrap class loader.
-     *
      * @param name       fully qualified name of the desired class
      * @param initialize if {@code true} the class will be initialized.
      *                   See Section 12.4 of <em>The Java Language Specification</em>.
@@ -348,6 +342,11 @@
      *            by this method fails
      * @exception ClassNotFoundException if the class cannot be located by
      *            the specified class loader
+     * @exception SecurityException
+     *            if a security manager is present, and the {@code loader} is
+     *            {@code null}, and the caller's class loader is not
+     *            {@code null}, and the caller does not have the
+     *            {@link RuntimePermission}{@code ("getClassLoader")}
      *
      * @see       java.lang.Class#forName(String)
      * @see       java.lang.ClassLoader
@@ -782,22 +781,17 @@
      * null in such implementations if this class was loaded by the bootstrap
      * class loader.
      *
-     * <p> If a security manager is present, and the caller's class loader is
-     * not null and the caller's class loader is not the same as or an ancestor of
-     * the class loader for the class whose class loader is requested, then
-     * this method calls the security manager's {@code checkPermission}
-     * method with a {@code RuntimePermission("getClassLoader")}
-     * permission to ensure it's ok to access the class loader for the class.
-     *
      * <p>If this object
      * represents a primitive type or void, null is returned.
      *
      * @return  the class loader that loaded the class or interface
      *          represented by this object.
-     * @throws SecurityException
-     *    if a security manager exists and its
-     *    {@code checkPermission} method denies
-     *    access to the class loader for the class.
+     * @throws  SecurityException
+     *          if a security manager is present, and the caller's class loader
+     *          is not {@code null} and is not the same as or an ancestor of the
+     *          class loader for the class whose class loader is requested,
+     *          and the caller does not have the
+     *          {@link RuntimePermission}{@code ("getClassLoader")}
      * @see java.lang.ClassLoader
      * @see SecurityManager#checkPermission
      * @see java.lang.RuntimePermission
--- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1537,22 +1537,13 @@
      * will return <tt>null</tt> in such implementations if this class loader's
      * parent is the bootstrap class loader.
      *
-     * <p> If a security manager is present, and the invoker's class loader is
-     * not <tt>null</tt> and is not an ancestor of this class loader, then this
-     * method invokes the security manager's {@link
-     * SecurityManager#checkPermission(java.security.Permission)
-     * <tt>checkPermission</tt>} method with a {@link
-     * RuntimePermission#RuntimePermission(String)
-     * <tt>RuntimePermission("getClassLoader")</tt>} permission to verify
-     * access to the parent class loader is permitted.  If not, a
-     * <tt>SecurityException</tt> will be thrown.  </p>
-     *
      * @return  The parent <tt>ClassLoader</tt>
      *
      * @throws  SecurityException
-     *          If a security manager exists and its <tt>checkPermission</tt>
-     *          method doesn't allow access to this class loader's parent class
-     *          loader.
+     *          If a security manager is present, and the caller's class loader
+     *          is not {@code null} and is not an ancestor of this class loader,
+     *          and the caller does not have the
+     *          {@link RuntimePermission}{@code ("getClassLoader")}
      *
      * @since  1.2
      */
@@ -1590,12 +1581,11 @@
      * @return  The platform {@code ClassLoader}.
      *
      * @throws  SecurityException
-     *          If a security manager exists and the caller's class loader is
-     *          not {@code null} and the caller's class loader is not the same
+     *          If a security manager is present, and the caller's class loader is
+     *          not {@code null}, and the caller's class loader is not the same
      *          as or an ancestor of the platform class loader,
-     *          and the {@link SecurityManager#checkPermission(java.security.Permission)
-     *          checkPermission} method denies {@code RuntimePermission("getClassLoader")}
-     *          to access the platform class loader.
+     *          and the caller does not have the
+     *          {@link RuntimePermission}{@code ("getClassLoader")}
      *
      * @since 9
      */
@@ -1636,17 +1626,6 @@
      * If circular initialization of the system class loader is detected then
      * an unspecified error or exception is thrown.
      *
-     * <p> If a security manager is present, and the invoker's class loader is
-     * not <tt>null</tt> and the invoker's class loader is not the same as or
-     * an ancestor of the system class loader, then this method invokes the
-     * security manager's {@link
-     * SecurityManager#checkPermission(java.security.Permission)
-     * <tt>checkPermission</tt>} method with a {@link
-     * RuntimePermission#RuntimePermission(String)
-     * <tt>RuntimePermission("getClassLoader")</tt>} permission to verify
-     * access to the system class loader.  If not, a
-     * <tt>SecurityException</tt> will be thrown.  </p>
-     *
      * @implNote The system property to override the system class loader is not
      * examined until the VM is almost fully initialized. Code that executes
      * this method during startup should take care not to cache the return
@@ -1656,8 +1635,10 @@
      *          <tt>null</tt> if none
      *
      * @throws  SecurityException
-     *          If a security manager exists and its <tt>checkPermission</tt>
-     *          method doesn't allow access to the system class loader.
+     *          If a security manager is present, and the caller's class loader
+     *          is not {@code null} and is not the same as or an ancestor of the
+     *          system class loader, and the caller does not have the
+     *          {@link RuntimePermission}{@code ("getClassLoader")}
      *
      * @throws  IllegalStateException
      *          If invoked recursively during the construction of the class
--- a/jdk/src/java.base/share/classes/java/lang/Math.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/Math.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1370,8 +1370,13 @@
      * result is positive zero.
      * <li>If the argument is infinite, the result is positive infinity.
      * <li>If the argument is NaN, the result is NaN.</ul>
-     * In other words, the result is the same as the value of the expression:
-     * <p>{@code Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))}
+     *
+     * @apiNote As implied by the above, one valid implementation of
+     * this method is given by the expression below which computes a
+     * {@code float} with the same exponent and significand as the
+     * argument but with a guaranteed zero sign bit indicating a
+     * positive value:<br>
+     * {@code Float.intBitsToFloat(0x7fffffff & Float.floatToRawIntBits(a))}
      *
      * @param   a   the argument whose absolute value is to be determined
      * @return  the absolute value of the argument.
@@ -1389,8 +1394,13 @@
      * is positive zero.
      * <li>If the argument is infinite, the result is positive infinity.
      * <li>If the argument is NaN, the result is NaN.</ul>
-     * In other words, the result is the same as the value of the expression:
-     * <p>{@code Double.longBitsToDouble((Double.doubleToLongBits(a)<<1)>>>1)}
+     *
+     * @apiNote As implied by the above, one valid implementation of
+     * this method is given by the expression below which computes a
+     * {@code double} with the same exponent and significand as the
+     * argument but with a guaranteed zero sign bit indicating a
+     * positive value:<br>
+     * {@code Double.longBitsToDouble((Double.doubleToRawLongBits(a)<<1)>>>1)}
      *
      * @param   a   the argument whose absolute value is to be determined
      * @return  the absolute value of the argument.
--- a/jdk/src/java.base/share/classes/java/lang/StrictMath.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/StrictMath.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1070,8 +1070,13 @@
      * result is positive zero.
      * <li>If the argument is infinite, the result is positive infinity.
      * <li>If the argument is NaN, the result is NaN.</ul>
-     * In other words, the result is the same as the value of the expression:
-     * <p>{@code Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))}
+     *
+     * @apiNote As implied by the above, one valid implementation of
+     * this method is given by the expression below which computes a
+     * {@code float} with the same exponent and significand as the
+     * argument but with a guaranteed zero sign bit indicating a
+     * positive value: <br>
+     * {@code Float.intBitsToFloat(0x7fffffff & Float.floatToRawIntBits(a))}
      *
      * @param   a   the argument whose absolute value is to be determined
      * @return  the absolute value of the argument.
@@ -1089,8 +1094,13 @@
      * is positive zero.
      * <li>If the argument is infinite, the result is positive infinity.
      * <li>If the argument is NaN, the result is NaN.</ul>
-     * In other words, the result is the same as the value of the expression:
-     * <p>{@code Double.longBitsToDouble((Double.doubleToLongBits(a)<<1)>>>1)}
+     *
+     * @apiNote As implied by the above, one valid implementation of
+     * this method is given by the expression below which computes a
+     * {@code double} with the same exponent and significand as the
+     * argument but with a guaranteed zero sign bit indicating a
+     * positive value: <br>
+     * {@code Double.longBitsToDouble((Double.doubleToRawLongBits(a)<<1)>>>1)}
      *
      * @param   a   the argument whose absolute value is to be determined
      * @return  the absolute value of the argument.
--- a/jdk/src/java.base/share/classes/java/lang/Thread.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/Thread.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1507,28 +1507,25 @@
     }
 
     /**
-     * Returns the context ClassLoader for this Thread. The context
-     * ClassLoader is provided by the creator of the thread for use
+     * Returns the context {@code ClassLoader} for this thread. The context
+     * {@code ClassLoader} is provided by the creator of the thread for use
      * by code running in this thread when loading classes and resources.
      * If not {@linkplain #setContextClassLoader set}, the default is the
-     * ClassLoader context of the parent Thread. The context ClassLoader of the
+     * {@code ClassLoader} context of the parent thread. The context
+     * {@code ClassLoader} of the
      * primordial thread is typically set to the class loader used to load the
      * application.
      *
-     * <p>If a security manager is present, and the invoker's class loader is not
-     * {@code null} and is not the same as or an ancestor of the context class
-     * loader, then this method invokes the security manager's {@link
-     * SecurityManager#checkPermission(java.security.Permission) checkPermission}
-     * method with a {@link RuntimePermission RuntimePermission}{@code
-     * ("getClassLoader")} permission to verify that retrieval of the context
-     * class loader is permitted.
      *
-     * @return  the context ClassLoader for this Thread, or {@code null}
+     * @return  the context {@code ClassLoader} for this thread, or {@code null}
      *          indicating the system class loader (or, failing that, the
      *          bootstrap class loader)
      *
      * @throws  SecurityException
-     *          if the current thread cannot get the context ClassLoader
+     *          if a security manager is present, and the caller's class loader
+     *          is not {@code null} and is not the same as or an ancestor of the
+     *          context class loader, and the caller does not have the
+     *          {@link RuntimePermission}{@code ("getClassLoader")}
      *
      * @since 1.2
      */
--- a/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java	Fri Aug 26 14:47:52 2016 -0700
@@ -497,6 +497,10 @@
                         String shortTypes = LambdaForm.shortenSignature(types);
                         String className = SPECIES_CLASS_PREFIX + shortTypes;
                         Class<?> c = BootLoader.loadClassOrNull(className);
+                        if (TRACE_RESOLVE) {
+                            System.out.println("[BMH_RESOLVE] " + shortTypes +
+                                    (c != null ? " (success)" : " (fail)") );
+                        }
                         if (c != null) {
                             return c.asSubclass(BoundMethodHandle.class);
                         } else {
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java	Fri Aug 26 14:47:52 2016 -0700
@@ -492,7 +492,7 @@
     }
 
     // Caching machinery for field accessors:
-    private static final byte
+    static final byte
             AF_GETFIELD        = 0,
             AF_PUTFIELD        = 1,
             AF_GETSTATIC       = 2,
@@ -502,7 +502,7 @@
             AF_LIMIT           = 6;
     // Enumerate the different field kinds using Wrapper,
     // with an extra case added for checked references.
-    private static final int
+    static final int
             FT_LAST_WRAPPER    = Wrapper.COUNT-1,
             FT_UNCHECKED_REF   = Wrapper.OBJECT.ordinal(),
             FT_CHECKED_REF     = FT_LAST_WRAPPER+1,
@@ -515,7 +515,7 @@
     @Stable
     private static final LambdaForm[] ACCESSOR_FORMS
             = new LambdaForm[afIndex(AF_LIMIT, false, 0)];
-    private static int ftypeKind(Class<?> ftype) {
+    static int ftypeKind(Class<?> ftype) {
         if (ftype.isPrimitive())
             return Wrapper.forPrimitiveType(ftype).ordinal();
         else if (VerifyType.isNullReferenceConversion(Object.class, ftype))
@@ -566,7 +566,64 @@
 
     private static final Wrapper[] ALL_WRAPPERS = Wrapper.values();
 
-    private static LambdaForm makePreparedFieldLambdaForm(byte formOp, boolean isVolatile, int ftypeKind) {
+    private static Kind getFieldKind(boolean isGetter, boolean isVolatile, Wrapper wrapper) {
+        if (isGetter) {
+            if (isVolatile) {
+                switch (wrapper) {
+                    case BOOLEAN: return GET_BOOLEAN_VOLATILE;
+                    case BYTE:    return GET_BYTE_VOLATILE;
+                    case SHORT:   return GET_SHORT_VOLATILE;
+                    case CHAR:    return GET_CHAR_VOLATILE;
+                    case INT:     return GET_INT_VOLATILE;
+                    case LONG:    return GET_LONG_VOLATILE;
+                    case FLOAT:   return GET_FLOAT_VOLATILE;
+                    case DOUBLE:  return GET_DOUBLE_VOLATILE;
+                    case OBJECT:  return GET_OBJECT_VOLATILE;
+                }
+            } else {
+                switch (wrapper) {
+                    case BOOLEAN: return GET_BOOLEAN;
+                    case BYTE:    return GET_BYTE;
+                    case SHORT:   return GET_SHORT;
+                    case CHAR:    return GET_CHAR;
+                    case INT:     return GET_INT;
+                    case LONG:    return GET_LONG;
+                    case FLOAT:   return GET_FLOAT;
+                    case DOUBLE:  return GET_DOUBLE;
+                    case OBJECT:  return GET_OBJECT;
+                }
+            }
+        } else {
+            if (isVolatile) {
+                switch (wrapper) {
+                    case BOOLEAN: return PUT_BOOLEAN_VOLATILE;
+                    case BYTE:    return PUT_BYTE_VOLATILE;
+                    case SHORT:   return PUT_SHORT_VOLATILE;
+                    case CHAR:    return PUT_CHAR_VOLATILE;
+                    case INT:     return PUT_INT_VOLATILE;
+                    case LONG:    return PUT_LONG_VOLATILE;
+                    case FLOAT:   return PUT_FLOAT_VOLATILE;
+                    case DOUBLE:  return PUT_DOUBLE_VOLATILE;
+                    case OBJECT:  return PUT_OBJECT_VOLATILE;
+                }
+            } else {
+                switch (wrapper) {
+                    case BOOLEAN: return PUT_BOOLEAN;
+                    case BYTE:    return PUT_BYTE;
+                    case SHORT:   return PUT_SHORT;
+                    case CHAR:    return PUT_CHAR;
+                    case INT:     return PUT_INT;
+                    case LONG:    return PUT_LONG;
+                    case FLOAT:   return PUT_FLOAT;
+                    case DOUBLE:  return PUT_DOUBLE;
+                    case OBJECT:  return PUT_OBJECT;
+                }
+            }
+        }
+        throw new AssertionError("Invalid arguments");
+    }
+
+    static LambdaForm makePreparedFieldLambdaForm(byte formOp, boolean isVolatile, int ftypeKind) {
         boolean isGetter  = (formOp & 1) == (AF_GETFIELD & 1);
         boolean isStatic  = (formOp >= AF_GETSTATIC);
         boolean needsInit = (formOp >= AF_GETSTATIC_INIT);
@@ -576,24 +633,14 @@
         assert(ftypeKind(needsCast ? String.class : ft) == ftypeKind);
 
         // getObject, putIntVolatile, etc.
-        StringBuilder nameBuilder = new StringBuilder();
-        if (isGetter) {
-            nameBuilder.append("get");
-        } else {
-            nameBuilder.append("put");
-        }
-        nameBuilder.append(fw.primitiveSimpleName());
-        nameBuilder.setCharAt(3, Character.toUpperCase(nameBuilder.charAt(3)));
-        if (isVolatile) {
-            nameBuilder.append("Volatile");
-        }
+        Kind kind = getFieldKind(isGetter, isVolatile, fw);
 
         MethodType linkerType;
         if (isGetter)
             linkerType = MethodType.methodType(ft, Object.class, long.class);
         else
             linkerType = MethodType.methodType(void.class, Object.class, long.class, ft);
-        MemberName linker = new MemberName(Unsafe.class, nameBuilder.toString(), linkerType, REF_invokeVirtual);
+        MemberName linker = new MemberName(Unsafe.class, kind.methodName, linkerType, REF_invokeVirtual);
         try {
             linker = IMPL_NAMES.resolveOrFail(REF_invokeVirtual, linker, null, NoSuchMethodException.class);
         } catch (ReflectiveOperationException ex) {
@@ -620,6 +667,7 @@
         final int F_HOLDER  = (isStatic ? nameCursor++ : -1);  // static base if any
         final int F_OFFSET  = nameCursor++;  // Either static offset or field offset.
         final int OBJ_CHECK = (OBJ_BASE >= 0 ? nameCursor++ : -1);
+        final int U_HOLDER  = nameCursor++;  // UNSAFE holder
         final int INIT_BAR  = (needsInit ? nameCursor++ : -1);
         final int PRE_CAST  = (needsCast && !isGetter ? nameCursor++ : -1);
         final int LINKER_CALL = nameCursor++;
@@ -632,7 +680,7 @@
             names[PRE_CAST] = new Name(NF_checkCast, names[DMH_THIS], names[SET_VALUE]);
         Object[] outArgs = new Object[1 + linkerType.parameterCount()];
         assert(outArgs.length == (isGetter ? 3 : 4));
-        outArgs[0] = UNSAFE;
+        outArgs[0] = names[U_HOLDER] = new Name(NF_UNSAFE);
         if (isStatic) {
             outArgs[1] = names[F_HOLDER]  = new Name(NF_staticBase, names[DMH_THIS]);
             outArgs[2] = names[F_OFFSET]  = new Name(NF_staticOffset, names[DMH_THIS]);
@@ -650,6 +698,7 @@
         for (Name n : names)  assert(n != null);
         // add some detail to the lambdaForm debugname,
         // significant only for debugging
+        StringBuilder nameBuilder = new StringBuilder(kind.methodName);
         if (isStatic) {
             nameBuilder.append("Static");
         } else {
@@ -657,7 +706,12 @@
         }
         if (needsCast)  nameBuilder.append("Cast");
         if (needsInit)  nameBuilder.append("Init");
-        return new LambdaForm(nameBuilder.toString(), ARG_LIMIT, names, RESULT);
+        if (needsCast || needsInit) {
+            // can't use the pre-generated form when casting and/or initializing
+            return new LambdaForm(nameBuilder.toString(), ARG_LIMIT, names, RESULT);
+        } else {
+            return new LambdaForm(nameBuilder.toString(), ARG_LIMIT, names, RESULT, kind);
+        }
     }
 
     /**
@@ -674,7 +728,8 @@
             NF_staticOffset,
             NF_checkCast,
             NF_allocateInstance,
-            NF_constructorMethod;
+            NF_constructorMethod,
+            NF_UNSAFE;
     static {
         try {
             NamedFunction nfs[] = {
@@ -697,7 +752,9 @@
                     NF_allocateInstance = new NamedFunction(DirectMethodHandle.class
                             .getDeclaredMethod("allocateInstance", Object.class)),
                     NF_constructorMethod = new NamedFunction(DirectMethodHandle.class
-                            .getDeclaredMethod("constructorMethod", Object.class))
+                            .getDeclaredMethod("constructorMethod", Object.class)),
+                    NF_UNSAFE = new NamedFunction(new MemberName(MethodHandleStatics.class
+                            .getDeclaredField("UNSAFE")))
             };
             // Each nf must be statically invocable or we get tied up in our bootstraps.
             assert(InvokerBytecodeGenerator.isStaticallyInvocable(nfs));
--- a/jdk/src/java.base/share/classes/java/lang/invoke/GenerateJLIClassesHelper.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/GenerateJLIClassesHelper.java	Fri Aug 26 14:47:52 2016 -0700
@@ -28,9 +28,11 @@
 import java.util.Map;
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import jdk.internal.org.objectweb.asm.Opcodes;
-
 import java.util.ArrayList;
 import java.util.HashSet;
+import sun.invoke.util.Wrapper;
+
+import static java.lang.invoke.MethodHandleNatives.Constants.*;
 
 /**
  * Helper class to assist the GenerateJLIClassesPlugin to get access to
@@ -66,14 +68,38 @@
 
     static byte[] generateDirectMethodHandleHolderClassBytes(String className,
             MethodType[] methodTypes, int[] types) {
-        LambdaForm[] forms = new LambdaForm[methodTypes.length];
-        String[] names = new String[methodTypes.length];
-        for (int i = 0; i < forms.length; i++) {
-            forms[i] = DirectMethodHandle.makePreparedLambdaForm(methodTypes[i],
-                                                                 types[i]);
-            names[i] = forms[i].kind.defaultLambdaName;
+        ArrayList<LambdaForm> forms = new ArrayList<>();
+        ArrayList<String> names = new ArrayList<>();
+        for (int i = 0; i < methodTypes.length; i++) {
+            LambdaForm form = DirectMethodHandle
+                    .makePreparedLambdaForm(methodTypes[i], types[i]);
+            forms.add(form);
+            names.add(form.kind.defaultLambdaName);
         }
-        return generateCodeBytesForLFs(className, names, forms);
+        for (Wrapper wrapper : Wrapper.values()) {
+            if (wrapper == Wrapper.VOID) {
+                continue;
+            }
+            for (byte b = DirectMethodHandle.AF_GETFIELD; b < DirectMethodHandle.AF_LIMIT; b++) {
+                int ftype = DirectMethodHandle.ftypeKind(wrapper.primitiveType());
+                LambdaForm form = DirectMethodHandle
+                        .makePreparedFieldLambdaForm(b, /*isVolatile*/false, ftype);
+                if (form.kind != LambdaForm.Kind.GENERIC) {
+                    forms.add(form);
+                    names.add(form.kind.defaultLambdaName);
+                }
+                // volatile
+                form = DirectMethodHandle
+                        .makePreparedFieldLambdaForm(b, /*isVolatile*/true, ftype);
+                if (form.kind != LambdaForm.Kind.GENERIC) {
+                    forms.add(form);
+                    names.add(form.kind.defaultLambdaName);
+                }
+            }
+        }
+        return generateCodeBytesForLFs(className,
+                names.toArray(new String[0]),
+                forms.toArray(new LambdaForm[0]));
     }
 
     static byte[] generateDelegatingMethodHandleHolderClassBytes(String className,
@@ -107,6 +133,34 @@
                 forms.toArray(new LambdaForm[0]));
     }
 
+    static byte[] generateInvokersHolderClassBytes(String className,
+            MethodType[] methodTypes) {
+
+        HashSet<MethodType> dedupSet = new HashSet<>();
+        ArrayList<LambdaForm> forms = new ArrayList<>();
+        ArrayList<String> names = new ArrayList<>();
+        int[] types = {
+            MethodTypeForm.LF_EX_LINKER,
+            MethodTypeForm.LF_EX_INVOKER,
+            MethodTypeForm.LF_GEN_LINKER,
+            MethodTypeForm.LF_GEN_INVOKER
+        };
+        for (int i = 0; i < methodTypes.length; i++) {
+            // generate methods representing invokers of the specified type
+            if (dedupSet.add(methodTypes[i])) {
+                for (int type : types) {
+                    LambdaForm invokerForm = Invokers.invokeHandleForm(methodTypes[i],
+                            /*customized*/false, type);
+                    forms.add(invokerForm);
+                    names.add(invokerForm.kind.defaultLambdaName);
+                }
+            }
+        }
+        return generateCodeBytesForLFs(className,
+                names.toArray(new String[0]),
+                forms.toArray(new LambdaForm[0]));
+    }
+
     /*
      * Generate customized code for a set of LambdaForms of specified types into
      * a class with a specified name.
@@ -166,4 +220,5 @@
                          BoundMethodHandle.Factory.generateConcreteBMHClassBytes(
                                  shortTypes, types, className));
     }
+
 }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Fri Aug 26 14:47:52 2016 -0700
@@ -607,7 +607,10 @@
     private static MemberName resolveFrom(String name, MethodType type, Class<?> holder) {
         MemberName member = new MemberName(holder, name, type, REF_invokeStatic);
         MemberName resolvedMember = MemberName.getFactory().resolveOrNull(REF_invokeStatic, member, holder);
-
+        if (TRACE_RESOLVE) {
+            System.out.println("[LF_RESOLVE] " + holder.getName() + " " + name + " " +
+                    shortenSignature(basicTypeSignature(type)) + (resolvedMember != null ? " (success)" : " (fail)") );
+        }
         return resolvedMember;
     }
 
@@ -629,6 +632,28 @@
                 name = name + "_" + form.returnType().basicTypeChar();
                 return resolveFrom(name, invokerType, LambdaForm.Holder.class);
             }
+            case EXACT_INVOKER:             // fall-through
+            case EXACT_LINKER:              // fall-through
+            case GENERIC_INVOKER:           // fall-through
+            case GENERIC_LINKER:            return resolveFrom(name, invokerType.basicType(), Invokers.Holder.class);
+            case GET_OBJECT:                // fall-through
+            case GET_BOOLEAN:               // fall-through
+            case GET_BYTE:                  // fall-through
+            case GET_CHAR:                  // fall-through
+            case GET_SHORT:                 // fall-through
+            case GET_INT:                   // fall-through
+            case GET_LONG:                  // fall-through
+            case GET_FLOAT:                 // fall-through
+            case GET_DOUBLE:                // fall-through
+            case PUT_OBJECT:                // fall-through
+            case PUT_BOOLEAN:               // fall-through
+            case PUT_BYTE:                  // fall-through
+            case PUT_CHAR:                  // fall-through
+            case PUT_SHORT:                 // fall-through
+            case PUT_INT:                   // fall-through
+            case PUT_LONG:                  // fall-through
+            case PUT_FLOAT:                 // fall-through
+            case PUT_DOUBLE:                // fall-through
             case DIRECT_INVOKE_INTERFACE:   // fall-through
             case DIRECT_INVOKE_SPECIAL:     // fall-through
             case DIRECT_INVOKE_STATIC:      // fall-through
--- a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java	Fri Aug 26 14:47:52 2016 -0700
@@ -36,6 +36,7 @@
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
 import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
 import static java.lang.invoke.LambdaForm.*;
+import static java.lang.invoke.LambdaForm.Kind.*;
 
 /**
  * Construction and caching of often-used invokers.
@@ -254,7 +255,7 @@
      * @param which bit-encoded 0x01 whether it is a CP adapter ("linker") or MHs.invoker value ("invoker");
      *                          0x02 whether it is for invokeExact or generic invoke
      */
-    private static LambdaForm invokeHandleForm(MethodType mtype, boolean customized, int which) {
+    static LambdaForm invokeHandleForm(MethodType mtype, boolean customized, int which) {
         boolean isCached;
         if (!customized) {
             mtype = mtype.basicType();  // normalize Z to I, String to Object, etc.
@@ -263,12 +264,12 @@
             isCached = false;  // maybe cache if mtype == mtype.basicType()
         }
         boolean isLinker, isGeneric;
-        String debugName;
+        Kind kind;
         switch (which) {
-        case MethodTypeForm.LF_EX_LINKER:   isLinker = true;  isGeneric = false; debugName = "invokeExact_MT"; break;
-        case MethodTypeForm.LF_EX_INVOKER:  isLinker = false; isGeneric = false; debugName = "exactInvoker"; break;
-        case MethodTypeForm.LF_GEN_LINKER:  isLinker = true;  isGeneric = true;  debugName = "invoke_MT"; break;
-        case MethodTypeForm.LF_GEN_INVOKER: isLinker = false; isGeneric = true;  debugName = "invoker"; break;
+        case MethodTypeForm.LF_EX_LINKER:   isLinker = true;  isGeneric = false; kind = EXACT_LINKER; break;
+        case MethodTypeForm.LF_EX_INVOKER:  isLinker = false; isGeneric = false; kind = EXACT_INVOKER; break;
+        case MethodTypeForm.LF_GEN_LINKER:  isLinker = true;  isGeneric = true;  kind = GENERIC_LINKER; break;
+        case MethodTypeForm.LF_GEN_INVOKER: isLinker = false; isGeneric = true;  kind = GENERIC_INVOKER; break;
         default: throw new InternalError();
         }
         LambdaForm lform;
@@ -323,7 +324,11 @@
             names[CHECK_CUSTOM] = new Name(NF_checkCustomized, outArgs[0]);
         }
         names[LINKER_CALL] = new Name(outCallType, outArgs);
-        lform = new LambdaForm(debugName, INARG_LIMIT, names);
+        if (customized) {
+            lform = new LambdaForm(kind.defaultLambdaName, INARG_LIMIT, names);
+        } else {
+            lform = new LambdaForm(kind.defaultLambdaName, INARG_LIMIT, names, kind);
+        }
         if (isLinker)
             lform.compileToBytecode();  // JVM needs a real methodOop
         if (isCached)
@@ -614,4 +619,15 @@
             }
         }
     }
+
+    static {
+        // The Holder class will contain pre-generated Invokers resolved
+        // speculatively using MemberName.getFactory().resolveOrNull. However, that
+        // doesn't initialize the class, which subtly breaks inlining etc. By forcing
+        // initialization of the Holder class we avoid these issues.
+        UNSAFE.ensureClassInitialized(Holder.class);
+    }
+
+    /* Placeholder class for Invokers generated ahead of time */
+    final class Holder {}
 }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Fri Aug 26 14:47:52 2016 -0700
@@ -275,12 +275,52 @@
         BOUND_REINVOKER("BMH.reinvoke"),
         REINVOKER("MH.reinvoke"),
         DELEGATE("MH.delegate"),
+        EXACT_LINKER("MH.invokeExact_MT"),
+        EXACT_INVOKER("MH.exactInvoker"),
+        GENERIC_LINKER("MH.invoke_MT"),
+        GENERIC_INVOKER("MH.invoker"),
         DIRECT_INVOKE_VIRTUAL("DMH.invokeVirtual"),
         DIRECT_INVOKE_SPECIAL("DMH.invokeSpecial"),
         DIRECT_INVOKE_STATIC("DMH.invokeStatic"),
         DIRECT_NEW_INVOKE_SPECIAL("DMH.newInvokeSpecial"),
         DIRECT_INVOKE_INTERFACE("DMH.invokeInterface"),
-        DIRECT_INVOKE_STATIC_INIT("DMH.invokeStaticInit");
+        DIRECT_INVOKE_STATIC_INIT("DMH.invokeStaticInit"),
+        GET_OBJECT("getObject"),
+        PUT_OBJECT("putObject"),
+        GET_OBJECT_VOLATILE("getObjectVolatile"),
+        PUT_OBJECT_VOLATILE("putObjectVolatile"),
+        GET_INT("getInt"),
+        PUT_INT("putInt"),
+        GET_INT_VOLATILE("getIntVolatile"),
+        PUT_INT_VOLATILE("putIntVolatile"),
+        GET_BOOLEAN("getBoolean"),
+        PUT_BOOLEAN("putBoolean"),
+        GET_BOOLEAN_VOLATILE("getBooleanVolatile"),
+        PUT_BOOLEAN_VOLATILE("putBooleanVolatile"),
+        GET_BYTE("getByte"),
+        PUT_BYTE("putByte"),
+        GET_BYTE_VOLATILE("getByteVolatile"),
+        PUT_BYTE_VOLATILE("putByteVolatile"),
+        GET_CHAR("getChar"),
+        PUT_CHAR("putChar"),
+        GET_CHAR_VOLATILE("getCharVolatile"),
+        PUT_CHAR_VOLATILE("putCharVolatile"),
+        GET_SHORT("getShort"),
+        PUT_SHORT("putShort"),
+        GET_SHORT_VOLATILE("getShortVolatile"),
+        PUT_SHORT_VOLATILE("putShortVolatile"),
+        GET_LONG("getLong"),
+        PUT_LONG("putLong"),
+        GET_LONG_VOLATILE("getLongVolatile"),
+        PUT_LONG_VOLATILE("putLongVolatile"),
+        GET_FLOAT("getFloat"),
+        PUT_FLOAT("putFloat"),
+        GET_FLOAT_VOLATILE("getFloatVolatile"),
+        PUT_FLOAT_VOLATILE("putFloatVolatile"),
+        GET_DOUBLE("getDouble"),
+        PUT_DOUBLE("putDouble"),
+        GET_DOUBLE_VOLATILE("getDoubleVolatile"),
+        PUT_DOUBLE_VOLATILE("putDoubleVolatile");
 
         final String defaultLambdaName;
         final String methodName;
@@ -330,6 +370,10 @@
         this(debugName, arity, names, LAST_RESULT, /*forceInline=*/true, /*customized=*/null, Kind.GENERIC);
     }
     LambdaForm(String debugName,
+               int arity, Name[] names, Kind kind) {
+        this(debugName, arity, names, LAST_RESULT, /*forceInline=*/true, /*customized=*/null, kind);
+    }
+    LambdaForm(String debugName,
                int arity, Name[] names, boolean forceInline) {
         this(debugName, arity, names, LAST_RESULT, forceInline, /*customized=*/null, Kind.GENERIC);
     }
@@ -817,54 +861,6 @@
         }
     }
 
-    private static void computeInitialPreparedForms() {
-        // Find all predefined invokers and associate them with canonical empty lambda forms.
-        for (MemberName m : MemberName.getFactory().getMethods(LambdaForm.class, false, null, null, null)) {
-            if (!m.isStatic() || !m.isPackage())  continue;
-            MethodType mt = m.getMethodType();
-            if (mt.parameterCount() > 0 &&
-                mt.parameterType(0) == MethodHandle.class &&
-                m.getName().startsWith("interpret_")) {
-                String sig = null;
-                assert((sig = basicTypeSignature(mt)) != null &&
-                        m.getName().equals("interpret" + sig.substring(sig.indexOf('_'))));
-                LambdaForm form = new LambdaForm(mt);
-                form.vmentry = m;
-                form = mt.form().setCachedLambdaForm(MethodTypeForm.LF_INTERPRET, form);
-            }
-        }
-    }
-
-    // Set this false to disable use of the interpret_L methods defined in this file.
-    private static final boolean USE_PREDEFINED_INTERPRET_METHODS = true;
-
-    // The following are predefined exact invokers.  The system must build
-    // a separate invoker for each distinct signature.
-    static Object interpret_L(MethodHandle mh) throws Throwable {
-        Object[] av = {mh};
-        String sig = null;
-        assert(argumentTypesMatch(sig = "L_L", av));
-        Object res = mh.form.interpretWithArguments(av);
-        assert(returnTypesMatch(sig, av, res));
-        return res;
-    }
-    static Object interpret_L(MethodHandle mh, Object x1) throws Throwable {
-        Object[] av = {mh, x1};
-        String sig = null;
-        assert(argumentTypesMatch(sig = "LL_L", av));
-        Object res = mh.form.interpretWithArguments(av);
-        assert(returnTypesMatch(sig, av, res));
-        return res;
-    }
-    static Object interpret_L(MethodHandle mh, Object x1, Object x2) throws Throwable {
-        Object[] av = {mh, x1, x2};
-        String sig = null;
-        assert(argumentTypesMatch(sig = "LLL_L", av));
-        Object res = mh.form.interpretWithArguments(av);
-        assert(returnTypesMatch(sig, av, res));
-        return res;
-    }
-
     // The next few routines are called only from assert expressions
     // They verify that the built-in invokers process the correct raw data types.
     private static boolean argumentTypesMatch(String sig, Object[] av) {
@@ -1151,113 +1147,6 @@
             return super.hashCode();
         }
 
-        // Put the predefined NamedFunction invokers into the table.
-        static void initializeInvokers() {
-            for (MemberName m : MemberName.getFactory().getMethods(NamedFunction.class, false, null, null, null)) {
-                if (!m.isStatic() || !m.isPackage())  continue;
-                MethodType type = m.getMethodType();
-                if (type.equals(INVOKER_METHOD_TYPE) &&
-                    m.getName().startsWith("invoke_")) {
-                    String sig = m.getName().substring("invoke_".length());
-                    int arity = LambdaForm.signatureArity(sig);
-                    MethodType srcType = MethodType.genericMethodType(arity);
-                    if (LambdaForm.signatureReturn(sig) == V_TYPE)
-                        srcType = srcType.changeReturnType(void.class);
-                    MethodTypeForm typeForm = srcType.form();
-                    typeForm.setCachedMethodHandle(MethodTypeForm.MH_NF_INV, DirectMethodHandle.make(m));
-                }
-            }
-        }
-
-        // The following are predefined NamedFunction invokers.  The system must build
-        // a separate invoker for each distinct signature.
-        /** void return type invokers. */
-        @Hidden
-        static Object invoke__V(MethodHandle mh, Object[] a) throws Throwable {
-            assert(arityCheck(0, void.class, mh, a));
-            mh.invokeBasic();
-            return null;
-        }
-        @Hidden
-        static Object invoke_L_V(MethodHandle mh, Object[] a) throws Throwable {
-            assert(arityCheck(1, void.class, mh, a));
-            mh.invokeBasic(a[0]);
-            return null;
-        }
-        @Hidden
-        static Object invoke_LL_V(MethodHandle mh, Object[] a) throws Throwable {
-            assert(arityCheck(2, void.class, mh, a));
-            mh.invokeBasic(a[0], a[1]);
-            return null;
-        }
-        @Hidden
-        static Object invoke_LLL_V(MethodHandle mh, Object[] a) throws Throwable {
-            assert(arityCheck(3, void.class, mh, a));
-            mh.invokeBasic(a[0], a[1], a[2]);
-            return null;
-        }
-        @Hidden
-        static Object invoke_LLLL_V(MethodHandle mh, Object[] a) throws Throwable {
-            assert(arityCheck(4, void.class, mh, a));
-            mh.invokeBasic(a[0], a[1], a[2], a[3]);
-            return null;
-        }
-        @Hidden
-        static Object invoke_LLLLL_V(MethodHandle mh, Object[] a) throws Throwable {
-            assert(arityCheck(5, void.class, mh, a));
-            mh.invokeBasic(a[0], a[1], a[2], a[3], a[4]);
-            return null;
-        }
-        /** Object return type invokers. */
-        @Hidden
-        static Object invoke__L(MethodHandle mh, Object[] a) throws Throwable {
-            assert(arityCheck(0, mh, a));
-            return mh.invokeBasic();
-        }
-        @Hidden
-        static Object invoke_L_L(MethodHandle mh, Object[] a) throws Throwable {
-            assert(arityCheck(1, mh, a));
-            return mh.invokeBasic(a[0]);
-        }
-        @Hidden
-        static Object invoke_LL_L(MethodHandle mh, Object[] a) throws Throwable {
-            assert(arityCheck(2, mh, a));
-            return mh.invokeBasic(a[0], a[1]);
-        }
-        @Hidden
-        static Object invoke_LLL_L(MethodHandle mh, Object[] a) throws Throwable {
-            assert(arityCheck(3, mh, a));
-            return mh.invokeBasic(a[0], a[1], a[2]);
-        }
-        @Hidden
-        static Object invoke_LLLL_L(MethodHandle mh, Object[] a) throws Throwable {
-            assert(arityCheck(4, mh, a));
-            return mh.invokeBasic(a[0], a[1], a[2], a[3]);
-        }
-        @Hidden
-        static Object invoke_LLLLL_L(MethodHandle mh, Object[] a) throws Throwable {
-            assert(arityCheck(5, mh, a));
-            return mh.invokeBasic(a[0], a[1], a[2], a[3], a[4]);
-        }
-        private static boolean arityCheck(int arity, MethodHandle mh, Object[] a) {
-            return arityCheck(arity, Object.class, mh, a);
-        }
-        private static boolean arityCheck(int arity, Class<?> rtype, MethodHandle mh, Object[] a) {
-            assert(a.length == arity)
-                    : Arrays.asList(a.length, arity);
-            assert(mh.type().basicType() == MethodType.genericMethodType(arity).changeReturnType(rtype))
-                    : Arrays.asList(mh, rtype, arity);
-            MemberName member = mh.internalMemberName();
-            if (isInvokeBasic(member)) {
-                assert(arity > 0);
-                assert(a[0] instanceof MethodHandle);
-                MethodHandle mh2 = (MethodHandle) a[0];
-                assert(mh2.type().basicType() == MethodType.genericMethodType(arity-1).changeReturnType(rtype))
-                        : Arrays.asList(member, mh2, rtype, arity);
-            }
-            return true;
-        }
-
         static final MethodType INVOKER_METHOD_TYPE =
             MethodType.methodType(Object.class, MethodHandle.class, Object[].class);
 
@@ -1920,12 +1809,7 @@
             DEBUG_NAME_COUNTERS = null;
     }
 
-    // Put this last, so that previous static inits can run before.
     static {
-        if (USE_PREDEFINED_INTERPRET_METHODS)
-            computeInitialPreparedForms();
-        NamedFunction.initializeInvokers();
-
         // The Holder class will contain pre-generated forms resolved
         // using MemberName.getFactory(). However, that doesn't initialize the
         // class, which subtly breaks inlining etc. By forcing
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1745,6 +1745,13 @@
                 return GenerateJLIClassesHelper
                         .generateBasicFormsClassBytes(className);
             }
+
+            @Override
+            public byte[] generateInvokersHolderClassBytes(final String className,
+                    MethodType[] methodTypes) {
+                return GenerateJLIClassesHelper
+                        .generateInvokersHolderClassBytes(className, methodTypes);
+            }
         });
     }
 
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java	Fri Aug 26 14:47:52 2016 -0700
@@ -46,6 +46,7 @@
     static final boolean DUMP_CLASS_FILES;
     static final boolean TRACE_INTERPRETER;
     static final boolean TRACE_METHOD_LINKAGE;
+    static final boolean TRACE_RESOLVE;
     static final int COMPILE_THRESHOLD;
     static final boolean LOG_LF_COMPILATION_FAILURE;
     static final int DONT_INLINE_THRESHOLD;
@@ -65,6 +66,8 @@
                 props.getProperty("java.lang.invoke.MethodHandle.TRACE_INTERPRETER"));
         TRACE_METHOD_LINKAGE = Boolean.parseBoolean(
                 props.getProperty("java.lang.invoke.MethodHandle.TRACE_METHOD_LINKAGE"));
+        TRACE_RESOLVE = Boolean.parseBoolean(
+                props.getProperty("java.lang.invoke.MethodHandle.TRACE_RESOLVE"));
         COMPILE_THRESHOLD = Integer.parseInt(
                 props.getProperty("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", "0"));
         LOG_LF_COMPILATION_FAILURE = Boolean.parseBoolean(
--- a/jdk/src/java.base/share/classes/java/net/HttpCookie.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/net/HttpCookie.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -233,7 +233,7 @@
         // if not specify max-age, this cookie should be
         // discarded when user agent is to be closed, but
         // it is not expired.
-        if (maxAge == MAX_AGE_UNSPECIFIED) return false;
+        if (maxAge < 0) return false;
 
         long deltaSecond = (System.currentTimeMillis() - whenCreated) / 1000;
         if (deltaSecond > maxAge)
@@ -952,7 +952,8 @@
                                    String attrName,
                                    String attrValue) {
                     if (cookie.getMaxAge() == MAX_AGE_UNSPECIFIED) {
-                        cookie.setMaxAge(cookie.expiryDate2DeltaSeconds(attrValue));
+                        long delta = cookie.expiryDate2DeltaSeconds(attrValue);
+                        cookie.setMaxAge(delta > 0 ? delta : 0);
                     }
                 }
             });
--- a/jdk/src/java.base/share/classes/java/time/Duration.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/time/Duration.java	Fri Aug 26 14:47:52 2016 -0700
@@ -150,10 +150,12 @@
     /**
      * The pattern for parsing.
      */
-    private static final Pattern PATTERN =
+    private static class Lazy {
+        static final Pattern PATTERN =
             Pattern.compile("([-+]?)P(?:([-+]?[0-9]+)D)?" +
                     "(T(?:([-+]?[0-9]+)H)?(?:([-+]?[0-9]+)M)?(?:([-+]?[0-9]+)(?:[.,]([0-9]{0,9}))?S)?)?",
                     Pattern.CASE_INSENSITIVE);
+    }
 
     /**
      * The number of seconds in the duration.
@@ -387,7 +389,7 @@
      */
     public static Duration parse(CharSequence text) {
         Objects.requireNonNull(text, "text");
-        Matcher matcher = PATTERN.matcher(text);
+        Matcher matcher = Lazy.PATTERN.matcher(text);
         if (matcher.matches()) {
             // check for letter T but no time sections
             if (!charMatch(text, matcher.start(3), matcher.end(3), 'T')) {
--- a/jdk/src/java.base/share/classes/java/time/ZoneOffset.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/time/ZoneOffset.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -375,15 +375,15 @@
         } else if ((minutes > 0 && seconds < 0) || (minutes < 0 && seconds > 0)) {
             throw new DateTimeException("Zone offset minutes and seconds must have the same sign");
         }
-        if (Math.abs(minutes) > 59) {
-            throw new DateTimeException("Zone offset minutes not in valid range: abs(value) " +
-                    Math.abs(minutes) + " is not in the range 0 to 59");
+        if (minutes < -59 || minutes > 59) {
+            throw new DateTimeException("Zone offset minutes not in valid range: value " +
+                    minutes + " is not in the range -59 to 59");
         }
-        if (Math.abs(seconds) > 59) {
-            throw new DateTimeException("Zone offset seconds not in valid range: abs(value) " +
-                    Math.abs(seconds) + " is not in the range 0 to 59");
+        if (seconds < -59 || seconds > 59) {
+            throw new DateTimeException("Zone offset seconds not in valid range: value " +
+                    seconds + " is not in the range -59 to 59");
         }
-        if (Math.abs(hours) == 18 && (Math.abs(minutes) > 0 || Math.abs(seconds) > 0)) {
+        if (Math.abs(hours) == 18 && (minutes | seconds) != 0) {
             throw new DateTimeException("Zone offset not in valid range: -18:00 to +18:00");
         }
     }
@@ -411,7 +411,7 @@
      * @throws DateTimeException if the offset is not in the required range
      */
     public static ZoneOffset ofTotalSeconds(int totalSeconds) {
-        if (Math.abs(totalSeconds) > MAX_SECONDS) {
+        if (totalSeconds < -MAX_SECONDS || totalSeconds > MAX_SECONDS) {
             throw new DateTimeException("Zone offset not in valid range: -18:00 to +18:00");
         }
         if (totalSeconds % (15 * SECONDS_PER_MINUTE) == 0) {
@@ -696,11 +696,12 @@
      * The comparison is "consistent with equals", as defined by {@link Comparable}.
      *
      * @param other  the other date to compare to, not null
-     * @return the comparator value, negative if less, postive if greater
+     * @return the comparator value, negative if less, positive if greater
      * @throws NullPointerException if {@code other} is null
      */
     @Override
     public int compareTo(ZoneOffset other) {
+        // abs(totalSeconds) <= MAX_SECONDS, so no overflow can happen here
         return other.totalSeconds - totalSeconds;
     }
 
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java	Fri Aug 26 14:47:52 2016 -0700
@@ -4566,7 +4566,10 @@
             boolean modified = false;
             // Use (c instanceof Set) as a hint that lookup in c is as
             // efficient as this view
-            if (c instanceof Set<?> && c.size() > map.table.length) {
+            Node<K,V>[] t;
+            if ((t = map.table) == null) {
+                return false;
+            } else if (c instanceof Set<?> && c.size() > t.length) {
                 for (Iterator<?> it = iterator(); it.hasNext(); ) {
                     if (c.contains(it.next())) {
                         it.remove();
--- a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java	Fri Aug 26 14:47:52 2016 -0700
@@ -353,7 +353,7 @@
         if (isMultiRelease) {
             return true;
         }
-        if (MULTI_RELEASE_ENABLED && versionMajor != BASE_VERSION_MAJOR) {
+        if (MULTI_RELEASE_ENABLED) {
             try {
                 checkForSpecialAttributes();
             } catch (IOException io) {
@@ -644,7 +644,7 @@
             return signers == null ? null : signers.clone();
         }
         JarFileEntry realEntry() {
-            if (isMultiRelease()) {
+            if (isMultiRelease() && versionMajor != BASE_VERSION_MAJOR) {
                 String entryName = super.getName();
                 return entryName.equals(this.name) ? this : new JarFileEntry(entryName, this);
             }
@@ -960,7 +960,7 @@
                 hasClassPathAttribute = match(CLASSPATH_CHARS, b,
                         CLASSPATH_LASTOCC) != -1;
                 // is this a multi-release jar file
-                if (MULTI_RELEASE_ENABLED && versionMajor != BASE_VERSION_MAJOR) {
+                if (MULTI_RELEASE_ENABLED) {
                     int i = match(MULTIRELEASE_CHARS, b, MULTIRELEASE_LASTOCC);
                     if (i != -1) {
                         i += MULTIRELEASE_CHARS.length;
--- a/jdk/src/java.base/share/classes/javax/crypto/JceSecurity.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/javax/crypto/JceSecurity.java	Fri Aug 26 14:47:52 2016 -0700
@@ -29,6 +29,7 @@
 import java.util.jar.*;
 import java.io.*;
 import java.net.URL;
+import java.nio.file.*;
 import java.security.*;
 
 import java.security.Provider.Service;
@@ -206,7 +207,7 @@
 
     static {
         try {
-            NULL_URL = new URL("http://null.sun.com/");
+            NULL_URL = new URL("http://null.oracle.com/");
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
@@ -243,83 +244,94 @@
         }
     }
 
+    // This is called from within an doPrivileged block.
     private static void setupJurisdictionPolicies() throws Exception {
-        String javaHomeDir = System.getProperty("java.home");
-        String sep = File.separator;
-        String pathToPolicyJar = javaHomeDir + sep + "lib" + sep +
-            "security" + sep;
+
+        // Sanity check the crypto.policy Security property.  Single
+        // directory entry, no pseudo-directories (".", "..", leading/trailing
+        // path separators). normalize()/getParent() will help later.
+        String cryptoPolicyProperty = Security.getProperty("crypto.policy");
+        Path cpPath = Paths.get(cryptoPolicyProperty);
+
+        if ((cryptoPolicyProperty == null) ||
+                (cpPath.getNameCount() != 1) ||
+                (cpPath.compareTo(cpPath.getFileName()) != 0)) {
+            throw new SecurityException(
+                "Invalid policy directory name format: " +
+                cryptoPolicyProperty);
+        }
 
-        File exportJar = new File(pathToPolicyJar, "US_export_policy.jar");
-        File importJar = new File(pathToPolicyJar, "local_policy.jar");
+        // Prepend java.home to get the full path.  normalize() in
+        // case an extra "." or ".." snuck in somehow.
+        String javaHomeProperty = System.getProperty("java.home");
+        Path javaHomePolicyPath = Paths.get(javaHomeProperty, "conf",
+                "security", "policy").normalize();
+        Path cryptoPolicyPath = Paths.get(javaHomeProperty, "conf", "security",
+                "policy", cryptoPolicyProperty).normalize();
 
-        if (!exportJar.exists() || !importJar.exists()) {
-            throw new SecurityException
-                                ("Cannot locate policy or framework files!");
+        if (cryptoPolicyPath.getParent().compareTo(javaHomePolicyPath) != 0) {
+            throw new SecurityException(
+                "Invalid cryptographic jurisdiction policy directory path: " +
+                cryptoPolicyProperty);
+        }
+
+        if (!Files.isDirectory(cryptoPolicyPath)
+                || !Files.isReadable(cryptoPolicyPath)) {
+            throw new SecurityException(
+                "Can't read cryptographic policy directory: " +
+                cryptoPolicyProperty);
         }
 
-        // Read jurisdiction policies.
-        CryptoPermissions defaultExport = new CryptoPermissions();
-        CryptoPermissions exemptExport = new CryptoPermissions();
-        loadPolicies(exportJar, defaultExport, exemptExport);
-
-        CryptoPermissions defaultImport = new CryptoPermissions();
-        CryptoPermissions exemptImport = new CryptoPermissions();
-        loadPolicies(importJar, defaultImport, exemptImport);
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(
+                cryptoPolicyPath, "{default,exempt}_*.policy")) {
+            for (Path entry : stream) {
+                try (InputStream is = new BufferedInputStream(
+                        Files.newInputStream(entry))) {
+                    String filename = entry.getFileName().toString();
 
-        // Merge the export and import policies for default applications.
-        if (defaultExport.isEmpty() || defaultImport.isEmpty()) {
-            throw new SecurityException("Missing mandatory jurisdiction " +
-                                        "policy files");
-        }
-        defaultPolicy = defaultExport.getMinimum(defaultImport);
-
-        // Merge the export and import policies for exempt applications.
-        if (exemptExport.isEmpty())  {
-            exemptPolicy = exemptImport.isEmpty() ? null : exemptImport;
-        } else {
-            exemptPolicy = exemptExport.getMinimum(exemptImport);
-        }
-    }
+                    CryptoPermissions tmpPerms = new CryptoPermissions();
+                    tmpPerms.load(is);
 
-    /**
-     * Load the policies from the specified file. Also checks that the
-     * policies are correctly signed.
-     */
-    private static void loadPolicies(File jarPathName,
-                                     CryptoPermissions defaultPolicy,
-                                     CryptoPermissions exemptPolicy)
-        throws Exception {
-
-        JarFile jf = new JarFile(jarPathName);
-
-        Enumeration<JarEntry> entries = jf.entries();
-        while (entries.hasMoreElements()) {
-            JarEntry je = entries.nextElement();
-            InputStream is = null;
-            try {
-                if (je.getName().startsWith("default_")) {
-                    is = jf.getInputStream(je);
-                    defaultPolicy.load(is);
-                } else if (je.getName().startsWith("exempt_")) {
-                    is = jf.getInputStream(je);
-                    exemptPolicy.load(is);
-                } else {
-                    continue;
-                }
-            } finally {
-                if (is != null) {
-                    is.close();
+                    if (filename.startsWith("default_")) {
+                        // Did we find a default perms?
+                        defaultPolicy = ((defaultPolicy == null) ? tmpPerms :
+                                defaultPolicy.getMinimum(tmpPerms));
+                    } else if (filename.startsWith("exempt_")) {
+                        // Did we find a exempt perms?
+                        exemptPolicy = ((exemptPolicy == null) ? tmpPerms :
+                                exemptPolicy.getMinimum(tmpPerms));
+                    } else {
+                        // This should never happen.  newDirectoryStream
+                        // should only throw return "{default,exempt}_*.policy"
+                        throw new SecurityException(
+                            "Unexpected jurisdiction policy files in : " +
+                            cryptoPolicyProperty);
+                    }
+                } catch (Exception e) {
+                    throw new SecurityException(
+                        "Couldn't parse jurisdiction policy files in: " +
+                        cryptoPolicyProperty);
                 }
             }
+        } catch (DirectoryIteratorException ex) {
+            // I/O error encountered during the iteration,
+            // the cause is an IOException
+            throw new SecurityException(
+                "Couldn't iterate through the jurisdiction policy files: " +
+                cryptoPolicyProperty);
+        }
 
-            // Enforce the signer restraint, i.e. signer of JCE framework
-            // jar should also be the signer of the two jurisdiction policy
-            // jar files.
-            ProviderVerifier.verifyPolicySigned(je.getCertificates());
+        // Must have a default policy
+        if ((defaultPolicy == null) || defaultPolicy.isEmpty()) {
+            throw new SecurityException(
+                "Missing mandatory jurisdiction policy files: " +
+                cryptoPolicyProperty);
         }
-        // Close and nullify the JarFile reference to help GC.
-        jf.close();
-        jf = null;
+
+        // If there was an empty exempt policy file, ignore it.
+        if ((exemptPolicy != null) && exemptPolicy.isEmpty()) {
+            exemptPolicy = null;
+        }
     }
 
     static CryptoPermissions getDefaultPolicy() {
--- a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtDirectoryStream.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtDirectoryStream.java	Fri Aug 26 14:47:52 2016 -0700
@@ -47,8 +47,8 @@
 
     private final JrtPath dir;
     private final DirectoryStream.Filter<? super Path> filter;
-    private volatile boolean isClosed;
-    private volatile Iterator<Path> itr;
+    private boolean isClosed;
+    private Iterator<Path> itr;
 
     JrtDirectoryStream(JrtPath dir,
             DirectoryStream.Filter<? super java.nio.file.Path> filter)
@@ -73,24 +73,22 @@
             throw new IllegalStateException(e);
         }
         return new Iterator<Path>() {
-            private Path next;
             @Override
-            public synchronized boolean hasNext() {
-                if (isClosed)
-                    return false;
-                return itr.hasNext();
+            public boolean hasNext() {
+                synchronized (JrtDirectoryStream.this) {
+                    if (isClosed)
+                        return false;
+                    return itr.hasNext();
+                }
             }
 
             @Override
-            public synchronized Path next() {
-                if (isClosed)
-                    throw new NoSuchElementException();
-                return itr.next();
-            }
-
-            @Override
-            public void remove() {
-                throw new UnsupportedOperationException();
+            public Path next() {
+                synchronized (JrtDirectoryStream.this) {
+                    if (isClosed)
+                        throw new NoSuchElementException();
+                    return itr.next();
+                }
             }
         };
     }
--- a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java	Fri Aug 26 14:47:52 2016 -0700
@@ -119,9 +119,7 @@
 
     @Override
     public Iterable<Path> getRootDirectories() {
-        ArrayList<Path> dirs = new ArrayList<>();
-        dirs.add(getRootPath());
-        return dirs;
+        return Collections.singleton(getRootPath());
     }
 
     @Override
@@ -159,9 +157,7 @@
 
     @Override
     public final Iterable<FileStore> getFileStores() {
-        ArrayList<FileStore> list = new ArrayList<>(1);
-        list.add(getFileStore(getRootPath()));
-        return list;
+        return Collections.singleton(getFileStore(getRootPath()));
     }
 
     private static final Set<String> supportedFileAttributeViews
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangInvokeAccess.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangInvokeAccess.java	Fri Aug 26 14:47:52 2016 -0700
@@ -46,7 +46,7 @@
     boolean isNative(Object mname);
 
     /**
-     * Returns a {@code byte[]} containing the bytecode for a class implementing
+     * Returns a {@code byte[]} representation of a class implementing
      * DirectMethodHandle of each pairwise combination of {@code MethodType} and
      * an {@code int} representing method type.  Used by
      * GenerateJLIClassesPlugin to generate such a class during the jlink phase.
@@ -55,7 +55,7 @@
             MethodType[] methodTypes, int[] types);
 
     /**
-     * Returns a {@code byte[]} containing the bytecode for a class implementing
+     * Returns a {@code byte[]} representation of a class implementing
      * DelegatingMethodHandles of each {@code MethodType} kind in the
      * {@code methodTypes} argument.  Used by GenerateJLIClassesPlugin to
      * generate such a class during the jlink phase.
@@ -64,7 +64,7 @@
             MethodType[] methodTypes);
 
     /**
-     * Returns a {@code byte[]} containing the bytecode for a BoundMethodHandle
+     * Returns a {@code byte[]} representation of {@code BoundMethodHandle}
      * species class implementing the signature defined by {@code types}. Used
      * by GenerateBMHClassesPlugin to enable generation of such classes during
      * the jlink phase. Should do some added validation since this string may be
@@ -74,8 +74,15 @@
             final String types);
 
     /**
-     * Returns a {@code byte[]} containing the bytecode for a class implementing
+     * Returns a {@code byte[]} representation of a class implementing
      * the zero and identity forms of all {@code LambdaForm.BasicType}s.
      */
     byte[] generateBasicFormsClassBytes(final String className);
+
+    /**
+     * Returns a {@code byte[]} representation of a class implementing
+     * the invoker forms for the set of supplied {@code methodTypes}.
+     */
+    byte[] generateInvokersHolderClassBytes(String className,
+            MethodType[] methodTypes);
 }
--- a/jdk/src/java.base/share/classes/sun/security/rsa/RSAPadding.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/rsa/RSAPadding.java	Fri Aug 26 14:47:52 2016 -0700
@@ -253,7 +253,8 @@
     public byte[] pad(byte[] data) throws BadPaddingException {
         if (data.length > maxDataSize) {
             throw new BadPaddingException("Data must be shorter than "
-                + (maxDataSize + 1) + " bytes");
+                + (maxDataSize + 1) + " bytes but received "
+                + data.length + " bytes.");
         }
         switch (type) {
         case PAD_NONE:
@@ -281,7 +282,9 @@
      */
     public byte[] unpad(byte[] padded) throws BadPaddingException {
         if (padded.length != paddedSize) {
-            throw new BadPaddingException("Decryption error");
+            throw new BadPaddingException("Decryption error." +
+                "The padded array length (" + padded.length +
+                ") is not the specified padded size (" + paddedSize + ")");
         }
         switch (type) {
         case PAD_NONE:
--- a/jdk/src/java.base/share/classes/sun/security/ssl/CipherBox.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/CipherBox.java	Fri Aug 26 14:47:52 2016 -0700
@@ -493,7 +493,9 @@
 
                 if (protocolVersion.useTLS11PlusSpec()) {
                     if (newLen < blockSize) {
-                        throw new BadPaddingException("invalid explicit IV");
+                        throw new BadPaddingException("The length after " +
+                        "padding removal (" + newLen + ") should be larger " +
+                        "than <" + blockSize + "> since explicit IV used");
                     }
                 }
             }
@@ -504,7 +506,6 @@
         }
     }
 
-
     /*
      * Decrypts a block of data, returning the size of the
      * resulting block if padding was required.  position and limit
@@ -575,7 +576,9 @@
                 // check the explicit IV of TLS v1.1 or later
                 if (protocolVersion.useTLS11PlusSpec()) {
                     if (newLen < blockSize) {
-                        throw new BadPaddingException("invalid explicit IV");
+                        throw new BadPaddingException("The length after " +
+                        "padding removal (" + newLen + ") should be larger " +
+                        "than <" + blockSize + "> since explicit IV used");
                     }
 
                     // reset the position to the end of the decrypted data
@@ -756,7 +759,9 @@
             // so accept that as well
             // v3 does not require any particular value for the other bytes
             if (padLen > blockSize) {
-                throw new BadPaddingException("Invalid SSLv3 padding");
+                throw new BadPaddingException("Padding length (" +
+                padLen + ") of SSLv3 message should not be bigger " +
+                "than the block size (" + blockSize + ")");
             }
         }
         return newLen;
@@ -802,7 +807,9 @@
             // so accept that as well
             // v3 does not require any particular value for the other bytes
             if (padLen > blockSize) {
-                throw new BadPaddingException("Invalid SSLv3 padding");
+                throw new BadPaddingException("Padding length (" +
+                padLen + ") of SSLv3 message should not be bigger " +
+                "than the block size (" + blockSize + ")");
             }
         }
 
@@ -925,7 +932,10 @@
             case AEAD_CIPHER:
                 if (bb.remaining() < (recordIvSize + tagSize)) {
                     throw new BadPaddingException(
-                                        "invalid AEAD cipher fragment");
+                        "Insufficient buffer remaining for AEAD cipher " +
+                        "fragment (" + bb.remaining() + "). Needs to be " +
+                        "more than or equal to IV size (" + recordIvSize +
+                         ") + tag size (" + tagSize + ")");
                 }
 
                 // initialize the AEAD cipher for the unique IV
--- a/jdk/src/java.base/share/classes/sun/util/calendar/ZoneInfo.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/util/calendar/ZoneInfo.java	Fri Aug 26 14:47:52 2016 -0700
@@ -27,15 +27,8 @@
 
 import java.io.IOException;
 import java.io.ObjectInputStream;
-import java.lang.ref.SoftReference;
-import java.security.AccessController;
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Date;
-import java.util.List;
-import java.util.Locale;
 import java.util.Map;
-import java.util.Set;
 import java.util.SimpleTimeZone;
 import java.util.TimeZone;
 
@@ -80,8 +73,6 @@
     private static final long ABBR_MASK = 0xf00L;
     private static final int TRANSITION_NSHIFT = 12;
 
-    private static final CalendarSystem gcal = CalendarSystem.getGregorianCalendar();
-
     /**
      * The raw GMT offset in milliseconds between this zone and GMT.
      * Negative offsets are to the west of Greenwich.  To obtain local
@@ -379,6 +370,7 @@
             throw new IllegalArgumentException();
         }
 
+        Gregorian gcal = CalendarSystem.getGregorianCalendar();
         CalendarDate date = gcal.newCalendarDate(null);
         date.setDate(year, month + 1, day);
         if (gcal.validate(date) == false) {
--- a/jdk/src/java.base/share/conf/security/java.security	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/conf/security/java.security	Fri Aug 26 14:47:52 2016 -0700
@@ -490,7 +490,7 @@
 # property is set then those two properties are ignored.
 #
 # Example,
-#   ocsp.responderCertSubjectName="CN=OCSP Responder, O=XYZ Corp"
+#   ocsp.responderCertSubjectName=CN=OCSP Responder, O=XYZ Corp
 
 #
 # Issuer name of the OCSP responder's certificate
@@ -505,7 +505,7 @@
 # property is ignored.
 #
 # Example,
-#   ocsp.responderCertIssuerName="CN=Enterprise CA, O=XYZ Corp"
+#   ocsp.responderCertIssuerName=CN=Enterprise CA, O=XYZ Corp
 
 #
 # Serial number of the OCSP responder's certificate
@@ -803,3 +803,94 @@
 #       E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED \
 #       EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE65381 \
 #       FFFFFFFF FFFFFFFF, 2}
+
+# Cryptographic Jurisdiction Policy defaults
+# 
+# Due to the import control restrictions of some countries, the default
+# JCE policy files allow for strong but "limited" cryptographic key
+# lengths to be used.  If your country's cryptographic regulations allow,
+# the "unlimited" strength policy files can be used instead, which contain
+# no restrictions on cryptographic strengths.
+# 
+# If your country has restrictions that don't fit either "limited" or
+# "unlimited", an appropriate set of policy files should be created and
+# configured before using this distribution.  The jurisdiction policy file
+# configuration must reflect the cryptographic restrictions appropriate
+# for your country.
+# 
+# YOU ARE ADVISED TO CONSULT YOUR EXPORT/IMPORT CONTROL COUNSEL OR ATTORNEY
+# TO DETERMINE THE EXACT REQUIREMENTS.
+# 
+# The policy files are flat text files organized into subdirectories of
+# <java-home>/conf/security/policy.  Each directory contains a complete
+# set of policy files.
+#
+# The "crypto.policy" Security property controls the directory selection,
+# and thus the effective cryptographic policy.
+# 
+# The default set of directories is:  
+# 
+#     limited | unlimited 
+# 
+# however other directories can be created and configured.
+# 
+# Within a directory, the effective policy is the combined minimum
+# permissions of the grant statements in the file(s) with the filename
+# pattern "default_*.policy".  At least one grant is required.  For
+# example:
+#
+#     limited   =  Export (all) + Import (limited)  =  Limited
+#     unlimited =  Export (all) + Import (all)      =  Unlimited
+#
+# The effective exemption policy is the combined minimum permissions
+# of the grant statements in the file(s) with the filename pattern
+# "exempt_*.policy".  Exemption grants are optional.
+#
+#     limited   =  grants exemption permissions, by which the
+#                  effective policy can be circumvented. 
+#                  e.g.  KeyRecovery/Escrow/Weakening.
+# 
+# Please see the JCA documentation for additional information on these
+# files and formats.
+crypto.policy=crypto.policydir-tbd
+
+#
+# The policy for the XML Signature secure validation mode. The mode is
+# enabled by setting the property "org.jcp.xml.dsig.secureValidation" to
+# true with the javax.xml.crypto.XMLCryptoContext.setProperty() method,
+# or by running the code with a SecurityManager.
+#
+#   Policy:
+#       Constraint {"," Constraint }
+#   Constraint:
+#       AlgConstraint | MaxTransformsConstraint | MaxReferencesConstraint |
+#       ReferenceUriSchemeConstraint | OtherConstraint
+#   AlgConstraint
+#       "disallowAlg" Uri
+#   MaxTransformsConstraint:
+#       "maxTransforms" Integer
+#   MaxReferencesConstraint:
+#       "maxReferences" Integer
+#   ReferenceUriSchemeConstraint:
+#       "disallowReferenceUriSchemes" String { String }
+#   OtherConstraint:
+#       "noDuplicateIds" | "noRetrievalMethodLoops"
+#
+# For AlgConstraint, Uri is the algorithm URI String that is not allowed.
+# See the XML Signature Recommendation for more information on algorithm
+# URI Identifiers. If the MaxTransformsConstraint or MaxReferencesConstraint is
+# specified more than once, only the last entry is enforced.
+#
+# Note: This property is currently used by the JDK Reference implementation. It
+# is not guaranteed to be examined and used by other implementations.
+#
+jdk.xml.dsig.secureValidationPolicy=\
+    disallowAlg http://www.w3.org/TR/1999/REC-xslt-19991116,\
+    disallowAlg http://www.w3.org/2001/04/xmldsig-more#rsa-md5,\
+    disallowAlg http://www.w3.org/2001/04/xmldsig-more#hmac-md5,\
+    disallowAlg http://www.w3.org/2001/04/xmldsig-more#md5,\
+    maxTransforms 5,\
+    maxReferences 30,\
+    disallowReferenceUriSchemes file http https,\
+    noDuplicateIds,\
+    noRetrievalMethodLoops
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/conf/security/policy/README.txt	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,35 @@
+
+            Java(TM) Cryptography Extension Policy Files
+    for the Java(TM) Platform, Standard Edition Runtime Environment
+
+                               README
+------------------------------------------------------------------------
+
+
+The JCE architecture allows flexible cryptographic strength to be
+configured via the jurisdiction policy files contained within these
+directories.
+
+Due to import control restrictions of some countries, the default
+JCE policy files bundled in this Java Runtime Environment allow
+for strong but "limited" cryptographic strengths.  For convenience,
+this build also contains the "unlimited strength" policy files which
+contain no restrictions on cryptographic strengths, but they must be
+specifically activated by updating the "crypto.policy" Security property
+(e.g. <java-home>/conf/security/java.security) to point to the appropriate
+directory.
+
+Each subdirectory contains a complete policy configuration, and additional
+subdirectories can be added/removed to reflect local regulations.
+
+JCE for Java SE has been through the U.S. export review process.  The JCE
+framework, along with the various JCE providers that come standard with it
+(SunJCE, SunEC, SunPKCS11, SunMSCAPI, etc), is exportable from the
+United States.
+
+You are advised to consult your export/import control counsel or attorney
+to determine the exact requirements of your location, and what policy
+settings should be used.
+
+Please see The Java(TM) Cryptography Architecture (JCA) Reference
+Guide and the java.security file for more information.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/conf/security/policy/limited/default_US_export.policy	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,6 @@
+// Default US Export policy file.
+
+grant {
+    // There is no restriction to any algorithms.
+    permission javax.crypto.CryptoAllPermission; 
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/conf/security/policy/limited/default_local.policy	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,14 @@
+// Some countries have import limits on crypto strength. This policy file
+// is worldwide importable.
+
+grant {
+    permission javax.crypto.CryptoPermission "DES", 64;
+    permission javax.crypto.CryptoPermission "DESede", *;
+    permission javax.crypto.CryptoPermission "RC2", 128, 
+                                     "javax.crypto.spec.RC2ParameterSpec", 128;
+    permission javax.crypto.CryptoPermission "RC4", 128;
+    permission javax.crypto.CryptoPermission "RC5", 128, 
+          "javax.crypto.spec.RC5ParameterSpec", *, 12, *;
+    permission javax.crypto.CryptoPermission "RSA", *;
+    permission javax.crypto.CryptoPermission *, 128;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/conf/security/policy/limited/exempt_local.policy	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,13 @@
+// Some countries have import limits on crypto strength, but may allow for
+// these exemptions if the exemption mechanism is used.
+
+grant {
+    // There is no restriction to any algorithms if KeyRecovery is enforced.
+    permission javax.crypto.CryptoPermission *, "KeyRecovery"; 
+
+    // There is no restriction to any algorithms if KeyEscrow is enforced.
+    permission javax.crypto.CryptoPermission *, "KeyEscrow"; 
+
+    // There is no restriction to any algorithms if KeyWeakening is enforced. 
+    permission javax.crypto.CryptoPermission *, "KeyWeakening";
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/conf/security/policy/unlimited/default_US_export.policy	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,6 @@
+// Default US Export policy file.
+
+grant {
+    // There is no restriction to any algorithms.
+    permission javax.crypto.CryptoAllPermission; 
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/conf/security/policy/unlimited/default_local.policy	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,6 @@
+// Country-specific policy file for countries with no limits on crypto strength.
+
+grant {
+    // There is no restriction to any algorithms.
+    permission javax.crypto.CryptoAllPermission; 
+};
--- a/jdk/src/java.base/share/lib/security/default.policy	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/share/lib/security/default.policy	Fri Aug 26 14:47:52 2016 -0700
@@ -72,6 +72,8 @@
                    "removeProviderProperty.XMLDSig";
     permission java.security.SecurityPermission
                    "com.sun.org.apache.xml.internal.security.register";
+    permission java.security.SecurityPermission
+                   "getProperty.jdk.xml.dsig.secureValidationPolicy";
 };
 
 grant codeBase "jrt:/java.xml.ws" {
--- a/jdk/src/java.base/unix/classes/sun/nio/fs/UnixPath.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/unix/classes/sun/nio/fs/UnixPath.java	Fri Aug 26 14:47:52 2016 -0700
@@ -252,6 +252,21 @@
         return new UnixPath(getFileSystem(), new byte[0]);
     }
 
+
+    // return true if this path has "." or ".."
+    private boolean hasDotOrDotDot() {
+        int n = getNameCount();
+        for (int i=0; i<n; i++) {
+            byte[] bytes = getName(i).path;
+            if ((bytes.length == 1 && bytes[0] == '.'))
+                return true;
+            if ((bytes.length == 2 && bytes[0] == '.') && bytes[1] == '.') {
+                return true;
+            }
+        }
+        return false;
+    }
+
     @Override
     public UnixFileSystem getFileSystem() {
         return fs;
@@ -405,80 +420,94 @@
 
     @Override
     public UnixPath relativize(Path obj) {
-        UnixPath other = toUnixPath(obj);
-        if (other.equals(this))
+        UnixPath child = toUnixPath(obj);
+        if (child.equals(this))
             return emptyPath();
 
         // can only relativize paths of the same type
-        if (this.isAbsolute() != other.isAbsolute())
+        if (this.isAbsolute() != child.isAbsolute())
             throw new IllegalArgumentException("'other' is different type of Path");
 
         // this path is the empty path
         if (this.isEmpty())
-            return other;
+            return child;
 
-        int bn = this.getNameCount();
-        int cn = other.getNameCount();
+        UnixPath base = this;
+        if (base.hasDotOrDotDot() || child.hasDotOrDotDot()) {
+            base = base.normalize();
+            child = child.normalize();
+        }
+
+        int baseCount = base.getNameCount();
+        int childCount = child.getNameCount();
 
         // skip matching names
-        int n = (bn > cn) ? cn : bn;
+        int n = Math.min(baseCount, childCount);
         int i = 0;
         while (i < n) {
-            if (!this.getName(i).equals(other.getName(i)))
+            if (!base.getName(i).equals(child.getName(i)))
                 break;
             i++;
         }
 
-        int dotdots = bn - i;
-        if (i < cn) {
-            // remaining name components in other
-            UnixPath remainder = other.subpath(i, cn);
-            if (dotdots == 0)
-                return remainder;
+        // remaining elements in child
+        UnixPath childRemaining;
+        boolean isChildEmpty;
+        if (i == childCount) {
+            childRemaining = emptyPath();
+            isChildEmpty = true;
+        } else {
+            childRemaining = child.subpath(i, childCount);
+            isChildEmpty = childRemaining.isEmpty();
+        }
+
+        // matched all of base
+        if (i == baseCount) {
+            return childRemaining;
+        }
 
-            // other is the empty path
-            boolean isOtherEmpty = other.isEmpty();
+        // the remainder of base cannot contain ".."
+        UnixPath baseRemaining = base.subpath(i, baseCount);
+        if (baseRemaining.hasDotOrDotDot()) {
+            throw new IllegalArgumentException("Unable to compute relative "
+                    + " path from " + this + " to " + obj);
+        }
+        if (baseRemaining.isEmpty())
+            return childRemaining;
+
+        // number of ".." needed
+        int dotdots = baseRemaining.getNameCount();
+        if (dotdots == 0) {
+            return childRemaining;
+        }
 
-            // result is a  "../" for each remaining name in base
-            // followed by the remaining names in other. If the remainder is
-            // the empty path then we don't add the final trailing slash.
-            int len = dotdots*3 + remainder.path.length;
-            if (isOtherEmpty) {
-                assert remainder.isEmpty();
-                len--;
+        // result is a  "../" for each remaining name in base followed by the
+        // remaining names in child. If the remainder is the empty path
+        // then we don't add the final trailing slash.
+        int len = dotdots*3 + childRemaining.path.length;
+        if (isChildEmpty) {
+            assert childRemaining.isEmpty();
+            len--;
+        }
+        byte[] result = new byte[len];
+        int pos = 0;
+        while (dotdots > 0) {
+            result[pos++] = (byte)'.';
+            result[pos++] = (byte)'.';
+            if (isChildEmpty) {
+                if (dotdots > 1) result[pos++] = (byte)'/';
+            } else {
+                result[pos++] = (byte)'/';
             }
-            byte[] result = new byte[len];
-            int pos = 0;
-            while (dotdots > 0) {
-                result[pos++] = (byte)'.';
-                result[pos++] = (byte)'.';
-                if (isOtherEmpty) {
-                    if (dotdots > 1) result[pos++] = (byte)'/';
-                } else {
-                    result[pos++] = (byte)'/';
-                }
-                dotdots--;
-            }
-            System.arraycopy(remainder.path, 0, result, pos, remainder.path.length);
-            return new UnixPath(getFileSystem(), result);
-        } else {
-            // no remaining names in other so result is simply a sequence of ".."
-            byte[] result = new byte[dotdots*3 - 1];
-            int pos = 0;
-            while (dotdots > 0) {
-                result[pos++] = (byte)'.';
-                result[pos++] = (byte)'.';
-                // no tailing slash at the end
-                if (dotdots > 1)
-                    result[pos++] = (byte)'/';
-                dotdots--;
-            }
-            return new UnixPath(getFileSystem(), result);
+            dotdots--;
         }
+        System.arraycopy(childRemaining.path,0, result, pos,
+                             childRemaining.path.length);
+        return new UnixPath(getFileSystem(), result);
     }
 
     @Override
-    public Path normalize() {
+    public UnixPath normalize() {
         final int count = getNameCount();
         if (count == 0 || isEmpty())
             return this;
--- a/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsPath.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsPath.java	Fri Aug 26 14:47:52 2016 -0700
@@ -375,57 +375,108 @@
         return (WindowsPath)path;
     }
 
+    // return true if this path has "." or ".."
+    private boolean hasDotOrDotDot() {
+        int n = getNameCount();
+        for (int i=0; i<n; i++) {
+            String name = elementAsString(i);
+            if (name.length() == 1 && name.charAt(0) == '.')
+                return true;
+            if (name.length() == 2
+                    && name.charAt(0) == '.' && name.charAt(1) == '.')
+                return true;
+        }
+        return false;
+    }
+
     @Override
     public WindowsPath relativize(Path obj) {
-        WindowsPath other = toWindowsPath(obj);
-        if (this.equals(other))
+        WindowsPath child = toWindowsPath(obj);
+        if (this.equals(child))
             return emptyPath();
 
         // can only relativize paths of the same type
-        if (this.type != other.type)
+        if (this.type != child.type)
             throw new IllegalArgumentException("'other' is different type of Path");
 
         // can only relativize paths if root component matches
-        if (!this.root.equalsIgnoreCase(other.root))
+        if (!this.root.equalsIgnoreCase(child.root))
             throw new IllegalArgumentException("'other' has different root");
 
         // this path is the empty path
         if (this.isEmpty())
-            return other;
+            return child;
+
 
-        int bn = this.getNameCount();
-        int cn = other.getNameCount();
+        WindowsPath base = this;
+        if (base.hasDotOrDotDot() || child.hasDotOrDotDot()) {
+            base = base.normalize();
+            child = child.normalize();
+        }
+
+        int baseCount = base.getNameCount();
+        int childCount = child.getNameCount();
 
         // skip matching names
-        int n = (bn > cn) ? cn : bn;
+        int n = Math.min(baseCount, childCount);
         int i = 0;
         while (i < n) {
-            if (!this.getName(i).equals(other.getName(i)))
+            if (!base.getName(i).equals(child.getName(i)))
                 break;
             i++;
         }
 
-        // append ..\ for remaining names in the base
+        // remaining elements in child
+        WindowsPath childRemaining;
+        boolean isChildEmpty;
+        if (i == childCount) {
+            childRemaining = emptyPath();
+            isChildEmpty = true;
+        } else {
+            childRemaining = child.subpath(i, childCount);
+            isChildEmpty = childRemaining.isEmpty();
+        }
+
+        // matched all of base
+        if (i == baseCount) {
+            return childRemaining;
+        }
+
+        // the remainder of base cannot contain ".."
+        WindowsPath baseRemaining = base.subpath(i, baseCount);
+        if (baseRemaining.hasDotOrDotDot()) {
+            throw new IllegalArgumentException("Unable to compute relative "
+                    + " path from " + this + " to " + obj);
+        }
+        if (baseRemaining.isEmpty())
+            return childRemaining;
+
+        // number of ".." needed
+        int dotdots = baseRemaining.getNameCount();
+        if (dotdots == 0) {
+            return childRemaining;
+        }
+
         StringBuilder result = new StringBuilder();
-        for (int j=i; j<bn; j++) {
+        for (int j=0; j<dotdots; j++) {
             result.append("..\\");
         }
 
         // append remaining names in child
-        if (!other.isEmpty()) {
-            for (int j=i; j<cn; j++) {
-                result.append(other.getName(j).toString());
+        if (!isChildEmpty) {
+            for (int j=0; j<childRemaining.getNameCount(); j++) {
+                result.append(childRemaining.getName(j).toString());
                 result.append("\\");
             }
         }
 
-        // drop trailing slash in result
+        // drop trailing slash
         result.setLength(result.length()-1);
         return createFromNormalizedPath(getFileSystem(), result.toString());
     }
 
     @Override
-    public Path normalize() {
+    public WindowsPath normalize() {
         final int count = getNameCount();
         if (count == 0 || isEmpty())
             return this;
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KdcComm.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KdcComm.java	Fri Aug 26 14:47:52 2016 -0700
@@ -390,35 +390,27 @@
 
             for (int i=1; i <= retries; i++) {
                 String proto = useTCP?"TCP":"UDP";
-                try (NetClient kdcClient = NetClient.getInstance(
-                        proto, kdc, port, timeout)) {
-                    if (DEBUG) {
-                        System.out.println(">>> KDCCommunication: kdc=" + kdc
+                if (DEBUG) {
+                    System.out.println(">>> KDCCommunication: kdc=" + kdc
                             + " " + proto + ":"
                             +  port +  ", timeout="
                             + timeout
                             + ",Attempt =" + i
                             + ", #bytes=" + obuf.length);
+                }
+                try (NetClient kdcClient = NetClient.getInstance(
+                        proto, kdc, port, timeout)) {
+                    kdcClient.send(obuf);
+                    ibuf = kdcClient.receive();
+                    break;
+                } catch (SocketTimeoutException se) {
+                    if (DEBUG) {
+                        System.out.println ("SocketTimeOutException with " +
+                                "attempt: " + i);
                     }
-                    try {
-                        /*
-                        * Send the data to the kdc.
-                        */
-                        kdcClient.send(obuf);
-                        /*
-                        * And get a response.
-                        */
-                        ibuf = kdcClient.receive();
-                        break;
-                    } catch (SocketTimeoutException se) {
-                        if (DEBUG) {
-                            System.out.println ("SocketTimeOutException with " +
-                                                "attempt: " + i);
-                        }
-                        if (i == retries) {
-                            ibuf = null;
-                            throw se;
-                        }
+                    if (i == retries) {
+                        ibuf = null;
+                        throw se;
                     }
                 }
             }
--- a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/BaseRowSet.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/BaseRowSet.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3204,7 +3204,6 @@
     * this method is called on a closed <code>CallableStatement</code>
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
-    * @since 1.4
     */
    public void setNull(String parameterName, int sqlType) throws SQLException {
         throw new SQLFeatureNotSupportedException("Feature not supported");
@@ -3240,7 +3239,6 @@
     * this method is called on a closed <code>CallableStatement</code>
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
-    * @since 1.4
     */
    public void setNull (String parameterName, int sqlType, String typeName)
        throws SQLException{
@@ -3259,7 +3257,6 @@
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
     * @see #getParams
-    * @since 1.4
     */
    public void setBoolean(String parameterName, boolean x) throws SQLException{
         throw new SQLFeatureNotSupportedException("Feature not supported");
@@ -3277,7 +3274,6 @@
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
     * @see #getParams
-    * @since 1.4
     */
    public void setByte(String parameterName, byte x) throws SQLException{
         throw new SQLFeatureNotSupportedException("Feature not supported");
@@ -3295,7 +3291,6 @@
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
     * @see #getParams
-    * @since 1.4
     */
    public void setShort(String parameterName, short x) throws SQLException{
         throw new SQLFeatureNotSupportedException("Feature not supported");
@@ -3313,7 +3308,6 @@
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
     * @see #getParams
-    * @since 1.4
     */
    public void setInt(String parameterName, int x) throws SQLException{
         throw new SQLFeatureNotSupportedException("Feature not supported");
@@ -3332,7 +3326,6 @@
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
     * @see #getParams
-    * @since 1.4
     */
    public void setLong(String parameterName, long x) throws SQLException{
         throw new SQLFeatureNotSupportedException("Feature not supported");
@@ -3350,7 +3343,6 @@
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
     * @see #getParams
-    * @since 1.4
     */
    public void setFloat(String parameterName, float x) throws SQLException{
         throw new SQLFeatureNotSupportedException("Feature not supported");
@@ -3368,7 +3360,6 @@
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
     * @see #getParams
-    * @since 1.4
     */
    public void setDouble(String parameterName, double x) throws SQLException{
         throw new SQLFeatureNotSupportedException("Feature not supported");
@@ -3387,7 +3378,6 @@
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
     * @see #getParams
-    * @since 1.4
     */
    public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException{
         throw new SQLFeatureNotSupportedException("Feature not supported");
@@ -3408,7 +3398,6 @@
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
     * @see #getParams
-    * @since 1.4
     */
    public void setString(String parameterName, String x) throws SQLException{
         throw new SQLFeatureNotSupportedException("Feature not supported");
@@ -3428,7 +3417,6 @@
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
     * @see #getParams
-    * @since 1.4
     */
    public void setBytes(String parameterName, byte x[]) throws SQLException{
         throw new SQLFeatureNotSupportedException("Feature not supported");
@@ -3447,7 +3435,6 @@
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
     * @see #getParams
-    * @since 1.4
     */
    public void setTimestamp(String parameterName, java.sql.Timestamp x)
        throws SQLException{
@@ -3474,7 +3461,6 @@
     * this method is called on a closed <code>CallableStatement</code>
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
-    * @since 1.4
     */
    public void setAsciiStream(String parameterName, java.io.InputStream x, int length)
        throws SQLException{
@@ -3500,7 +3486,6 @@
     * this method is called on a closed <code>CallableStatement</code>
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
-    * @since 1.4
     */
    public void setBinaryStream(String parameterName, java.io.InputStream x,
                         int length) throws SQLException{
@@ -3528,7 +3513,6 @@
     * this method is called on a closed <code>CallableStatement</code>
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
-    * @since 1.4
     */
    public void setCharacterStream(String parameterName,
                            java.io.Reader reader,
@@ -3684,7 +3668,6 @@
     * this data type
     * @see Types
     * @see #getParams
-    * @since 1.4
     */
    public void setObject(String parameterName, Object x, int targetSqlType, int scale)
        throws SQLException{
@@ -3710,7 +3693,6 @@
     * or  <code>STRUCT</code> data type and the JDBC driver does not support
     * this data type
     * @see #getParams
-    * @since 1.4
     */
    public void setObject(String parameterName, Object x, int targetSqlType)
        throws SQLException{
@@ -3751,7 +3733,6 @@
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
    * this method
    * @see #getParams
-   * @since 1.4
    */
   public void setObject(String parameterName, Object x) throws SQLException{
         throw new SQLFeatureNotSupportedException("Feature not supported");
@@ -4024,7 +4005,6 @@
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
     * @see #getParams
-    * @since 1.4
     */
    public void setDate(String parameterName, java.sql.Date x)
            throws SQLException {
@@ -4050,7 +4030,6 @@
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
     * @see #getParams
-    * @since 1.4
     */
    public void setDate(String parameterName, java.sql.Date x, Calendar cal)
            throws SQLException {
@@ -4069,7 +4048,6 @@
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
     * @see #getParams
-    * @since 1.4
     */
    public void setTime(String parameterName, java.sql.Time x)
            throws SQLException {
@@ -4095,7 +4073,6 @@
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
     * @see #getParams
-    * @since 1.4
     */
    public void setTime(String parameterName, java.sql.Time x, Calendar cal)
            throws SQLException {
@@ -4121,7 +4098,6 @@
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
     * this method
     * @see #getParams
-    * @since 1.4
     */
    public void setTimestamp(String parameterName, java.sql.Timestamp x, Calendar cal)
            throws SQLException {
@@ -4459,7 +4435,6 @@
     * @exception SQLException if a database access error occurs or
     * this method is called on a closed <code>PreparedStatement</code>
     * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
-    * @since 1.4
     */
    public void setURL(int parameterIndex, java.net.URL x) throws SQLException {
        throw new SQLFeatureNotSupportedException("Feature not supported");
--- a/jdk/src/java.sql/share/classes/javax/sql/CommonDataSource.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.sql/share/classes/javax/sql/CommonDataSource.java	Fri Aug 26 14:47:52 2016 -0700
@@ -57,7 +57,6 @@
      *        logging is disabled
      * @exception java.sql.SQLException if a database access error occurs
      * @see #setLogWriter
-     * @since 1.4
      */
     java.io.PrintWriter getLogWriter() throws SQLException;
 
@@ -79,7 +78,6 @@
      * @param out the new log writer; to disable logging, set to null
      * @exception SQLException if a database access error occurs
      * @see #getLogWriter
-     * @since 1.4
      */
     void setLogWriter(java.io.PrintWriter out) throws SQLException;
 
@@ -94,7 +92,6 @@
      * @param seconds the data source login time limit
      * @exception SQLException if a database access error occurs.
      * @see #getLoginTimeout
-     * @since 1.4
      */
     void setLoginTimeout(int seconds) throws SQLException;
 
@@ -109,7 +106,6 @@
      * @return the data source login time limit
      * @exception SQLException if a database access error occurs.
      * @see #setLoginTimeout
-     * @since 1.4
      */
     int getLoginTimeout() throws SQLException;
 
--- a/jdk/src/java.sql/share/classes/javax/sql/ConnectionPoolDataSource.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.sql/share/classes/javax/sql/ConnectionPoolDataSource.java	Fri Aug 26 14:47:52 2016 -0700
@@ -72,6 +72,34 @@
   PooledConnection getPooledConnection(String user, String password)
     throws SQLException;
 
+  /**
+   * {@inheritDoc}
+   * @since 1.4
+   */
+  @Override
+  java.io.PrintWriter getLogWriter() throws SQLException;
+
+  /**
+   * {@inheritDoc}
+   * @since 1.4
+   */
+  @Override
+  void setLogWriter(java.io.PrintWriter out) throws SQLException;
+
+  /**
+   * {@inheritDoc}
+   * @since 1.4
+   */
+  @Override
+  void setLoginTimeout(int seconds) throws SQLException;
+
+  /**
+   * {@inheritDoc}
+   * @since 1.4
+   */
+  @Override
+  int getLoginTimeout() throws SQLException;
+
   //------------------------- JDBC 4.3 -----------------------------------
 
   /**
--- a/jdk/src/java.sql/share/classes/javax/sql/DataSource.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.sql/share/classes/javax/sql/DataSource.java	Fri Aug 26 14:47:52 2016 -0700
@@ -109,6 +109,34 @@
   Connection getConnection(String username, String password)
     throws SQLException;
 
+  /**
+   * {@inheritDoc}
+   * @since 1.4
+   */
+  @Override
+  java.io.PrintWriter getLogWriter() throws SQLException;
+
+  /**
+   * {@inheritDoc}
+   * @since 1.4
+   */
+  @Override
+  void setLogWriter(java.io.PrintWriter out) throws SQLException;
+
+  /**
+   * {@inheritDoc}
+   * @since 1.4
+   */
+  @Override
+  void setLoginTimeout(int seconds) throws SQLException;
+
+  /**
+   * {@inheritDoc}
+   * @since 1.4
+   */
+  @Override
+  int getLoginTimeout() throws SQLException;
+
   // JDBC 4.3
 
   /**
--- a/jdk/src/java.sql/share/classes/javax/sql/XADataSource.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.sql/share/classes/javax/sql/XADataSource.java	Fri Aug 26 14:47:52 2016 -0700
@@ -81,7 +81,35 @@
   XAConnection getXAConnection(String user, String password)
     throws SQLException;
 
-  // JDBC 4.3
+  /**
+   * {@inheritDoc}
+   * @since 1.4
+   */
+  @Override
+  java.io.PrintWriter getLogWriter() throws SQLException;
+
+  /**
+   * {@inheritDoc}
+   * @since 1.4
+   */
+  @Override
+  void setLogWriter(java.io.PrintWriter out) throws SQLException;
+
+  /**
+   * {@inheritDoc}
+   * @since 1.4
+   */
+  @Override
+  void setLoginTimeout(int seconds) throws SQLException;
+
+  /**
+   * {@inheritDoc}
+   * @since 1.4
+   */
+  @Override
+  int getLoginTimeout() throws SQLException;
+
+   // JDBC 4.3
 
   /**
    * Creates a new {@code XAConnectionBuilder} instance
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/IntegrityHmac.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/IntegrityHmac.java	Fri Aug 26 14:47:52 2016 -0700
@@ -150,7 +150,7 @@
             this.macAlgorithm.init(secretKey);
         } catch (InvalidKeyException ex) {
             // reinstantiate Mac object to work around bug in JDK
-            // see: http://bugs.sun.com/view_bug.do?bug_id=4953555
+            // see: http://bugs.java.com/view_bug.do?bug_id=4953555
             Mac mac = this.macAlgorithm;
             try {
                 this.macAlgorithm = Mac.getInstance(macAlgorithm.getAlgorithm());
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureBaseRSA.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureBaseRSA.java	Fri Aug 26 14:47:52 2016 -0700
@@ -112,7 +112,7 @@
             this.signatureAlgorithm.initVerify((PublicKey) publicKey);
         } catch (InvalidKeyException ex) {
             // reinstantiate Signature object to work around bug in JDK
-            // see: http://bugs.sun.com/view_bug.do?bug_id=4953555
+            // see: http://bugs.java.com/view_bug.do?bug_id=4953555
             Signature sig = this.signatureAlgorithm;
             try {
                 this.signatureAlgorithm = Signature.getInstance(signatureAlgorithm.getAlgorithm());
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureDSA.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureDSA.java	Fri Aug 26 14:47:52 2016 -0700
@@ -139,7 +139,7 @@
             this.signatureAlgorithm.initVerify((PublicKey) publicKey);
         } catch (InvalidKeyException ex) {
             // reinstantiate Signature object to work around bug in JDK
-            // see: http://bugs.sun.com/view_bug.do?bug_id=4953555
+            // see: http://bugs.java.com/view_bug.do?bug_id=4953555
             Signature sig = this.signatureAlgorithm;
             try {
                 this.signatureAlgorithm = Signature.getInstance(signatureAlgorithm.getAlgorithm());
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureECDSA.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureECDSA.java	Fri Aug 26 14:47:52 2016 -0700
@@ -252,7 +252,7 @@
             this.signatureAlgorithm.initVerify((PublicKey) publicKey);
         } catch (InvalidKeyException ex) {
             // reinstantiate Signature object to work around bug in JDK
-            // see: http://bugs.sun.com/view_bug.do?bug_id=4953555
+            // see: http://bugs.java.com/view_bug.do?bug_id=4953555
             Signature sig = this.signatureAlgorithm;
             try {
                 this.signatureAlgorithm = Signature.getInstance(signatureAlgorithm.getAlgorithm());
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java	Fri Aug 26 14:47:52 2016 -0700
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * $Id: ApacheTransform.java 1333869 2012-05-04 10:42:44Z coheigea $
@@ -38,7 +38,6 @@
 
 import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
 import com.sun.org.apache.xml.internal.security.transforms.Transform;
-import com.sun.org.apache.xml.internal.security.transforms.Transforms;
 
 import javax.xml.crypto.*;
 import javax.xml.crypto.dom.DOMCryptoContext;
@@ -150,7 +149,7 @@
 
         if (Utils.secureValidation(xc)) {
             String algorithm = getAlgorithm();
-            if (Transforms.TRANSFORM_XSLT.equals(algorithm)) {
+            if (Policy.restrictAlg(algorithm)) {
                 throw new TransformException(
                     "Transform " + algorithm + " is forbidden when secure validation is enabled"
                 );
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * $Id: DOMManifest.java 1333415 2012-05-03 12:03:51Z coheigea $
@@ -110,9 +110,10 @@
                                            localName + ", expected Reference");
             }
             refs.add(new DOMReference(refElem, context, provider));
-            if (secVal && (refs.size() > DOMSignedInfo.MAXIMUM_REFERENCE_COUNT)) {
-                String error = "A maxiumum of " + DOMSignedInfo.MAXIMUM_REFERENCE_COUNT + " "
-                    + "references per Manifest are allowed with secure validation";
+            if (secVal && Policy.restrictNumReferences(refs.size())) {
+                String error = "A maximum of " + Policy.maxReferences()
+                    + " references per Manifest are allowed when"
+                    + " secure validation is enabled";
                 throw new MarshalException(error);
             }
             refElem = DOMUtils.getNextSiblingElement(refElem);
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java	Fri Aug 26 14:47:52 2016 -0700
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * ===========================================================================
@@ -51,7 +51,6 @@
 import org.w3c.dom.Node;
 
 import org.jcp.xml.dsig.internal.DigesterOutputStream;
-import com.sun.org.apache.xml.internal.security.algorithms.MessageDigestAlgorithm;
 import com.sun.org.apache.xml.internal.security.exceptions.Base64DecodingException;
 import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
 import com.sun.org.apache.xml.internal.security.utils.Base64;
@@ -67,11 +66,6 @@
     implements Reference, DOMURIReference {
 
    /**
-    * The maximum number of transforms per reference, if secure validation is enabled.
-    */
-   public static final int MAXIMUM_TRANSFORM_COUNT = 5;
-
-   /**
     * Look up useC14N11 system property. If true, an explicit C14N11 transform
     * will be added if necessary when generating the signature. See section
     * 3.1.1 of http://www.w3.org/2007/xmlsec/Drafts/xmldsig-core/ for more info.
@@ -208,9 +202,10 @@
                 }
                 transforms.add
                     (new DOMTransform(transformElem, context, provider));
-                if (secVal && (transforms.size() > MAXIMUM_TRANSFORM_COUNT)) {
-                    String error = "A maxiumum of " + MAXIMUM_TRANSFORM_COUNT + " "
-                        + "transforms per Reference are allowed with secure validation";
+                if (secVal && Policy.restrictNumTransforms(transforms.size())) {
+                    String error = "A maximum of " + Policy.maxTransforms()
+                        + " transforms per Reference are allowed when"
+                        + " secure validation is enabled";
                     throw new MarshalException(error);
                 }
                 transformElem = DOMUtils.getNextSiblingElement(transformElem);
@@ -227,10 +222,10 @@
         Element dmElem = nextSibling;
         this.digestMethod = DOMDigestMethod.unmarshal(dmElem);
         String digestMethodAlgorithm = this.digestMethod.getAlgorithm();
-        if (secVal
-            && MessageDigestAlgorithm.ALGO_ID_DIGEST_NOT_RECOMMENDED_MD5.equals(digestMethodAlgorithm)) {
+        if (secVal && Policy.restrictAlg(digestMethodAlgorithm)) {
             throw new MarshalException(
-                "It is forbidden to use algorithm " + digestMethod + " when secure validation is enabled"
+                "It is forbidden to use algorithm " + digestMethodAlgorithm +
+                " when secure validation is enabled"
             );
         }
 
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java	Fri Aug 26 14:47:52 2016 -0700
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * ===========================================================================
@@ -149,9 +149,10 @@
                 }
                 transforms.add
                     (new DOMTransform(transformElem, context, provider));
-                if (secVal && (transforms.size() > DOMReference.MAXIMUM_TRANSFORM_COUNT)) {
-                    String error = "A maxiumum of " + DOMReference.MAXIMUM_TRANSFORM_COUNT + " "
-                        + "transforms per Reference are allowed with secure validation";
+                if (secVal && Policy.restrictNumTransforms(transforms.size())) {
+                    String error = "A maximum of " + Policy.maxTransforms()
+                        + " transforms per Reference are allowed when"
+                        + " secure validation is enabled";
                     throw new MarshalException(error);
                 }
                 transformElem = DOMUtils.getNextSiblingElement(transformElem);
@@ -238,7 +239,8 @@
         }
 
         // guard against RetrievalMethod loops
-        if ((data instanceof NodeSetData) && Utils.secureValidation(context)) {
+        if ((data instanceof NodeSetData) && Utils.secureValidation(context)
+            && Policy.restrictRetrievalMethodLoops()) {
             NodeSetData<?> nsd = (NodeSetData<?>)data;
             Iterator<?> i = nsd.iterator();
             if (i.hasNext()) {
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java	Fri Aug 26 14:47:52 2016 -0700
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * $Id: DOMSignedInfo.java 1333415 2012-05-03 12:03:51Z coheigea $
@@ -45,7 +45,6 @@
 import org.w3c.dom.Node;
 
 import com.sun.org.apache.xml.internal.security.utils.Base64;
-import com.sun.org.apache.xml.internal.security.utils.Constants;
 import com.sun.org.apache.xml.internal.security.utils.UnsyncBufferedOutputStream;
 
 /**
@@ -55,22 +54,9 @@
  */
 public final class DOMSignedInfo extends DOMStructure implements SignedInfo {
 
-    /**
-     * The maximum number of references per Manifest, if secure validation is enabled.
-     */
-    public static final int MAXIMUM_REFERENCE_COUNT = 30;
-
     private static java.util.logging.Logger log =
         java.util.logging.Logger.getLogger("org.jcp.xml.dsig.internal.dom");
 
-    /** Signature - NOT Recommended RSAwithMD5 */
-    private static final String ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5 =
-        Constants.MoreAlgorithmsSpecNS + "rsa-md5";
-
-    /** HMAC - NOT Recommended HMAC-MD5 */
-    private static final String ALGO_ID_MAC_HMAC_NOT_RECOMMENDED_MD5 =
-        Constants.MoreAlgorithmsSpecNS + "hmac-md5";
-
     private List<Reference> references;
     private CanonicalizationMethod canonicalizationMethod;
     private SignatureMethod signatureMethod;
@@ -158,10 +144,10 @@
         boolean secVal = Utils.secureValidation(context);
 
         String signatureMethodAlgorithm = signatureMethod.getAlgorithm();
-        if (secVal && ((ALGO_ID_MAC_HMAC_NOT_RECOMMENDED_MD5.equals(signatureMethodAlgorithm)
-                || ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5.equals(signatureMethodAlgorithm)))) {
+        if (secVal && Policy.restrictAlg(signatureMethodAlgorithm)) {
             throw new MarshalException(
-                "It is forbidden to use algorithm " + signatureMethod + " when secure validation is enabled"
+                "It is forbidden to use algorithm " + signatureMethodAlgorithm +
+                " when secure validation is enabled"
             );
         }
 
@@ -179,9 +165,10 @@
             }
             refList.add(new DOMReference(refElem, context, provider));
 
-            if (secVal && (refList.size() > MAXIMUM_REFERENCE_COUNT)) {
-                String error = "A maxiumum of " + MAXIMUM_REFERENCE_COUNT + " "
-                    + "references per Manifest are allowed with secure validation";
+            if (secVal && Policy.restrictNumReferences(refList.size())) {
+                String error = "A maximum of " + Policy.maxReferences()
+                    + " references per Manifest are allowed when"
+                    + " secure validation is enabled";
                 throw new MarshalException(error);
             }
             refElem = DOMUtils.getNextSiblingElement(refElem);
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMURIDereferencer.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMURIDereferencer.java	Fri Aug 26 14:47:52 2016 -0700
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * $Id: DOMURIDereferencer.java 1231033 2012-01-13 12:12:12Z coheigea $
@@ -73,6 +73,11 @@
 
         boolean secVal = Utils.secureValidation(context);
 
+        if (secVal && Policy.restrictReferenceUriScheme(uri)) {
+            throw new URIReferenceException(
+                "Uri " + uri + " is forbidden when secure validation is enabled");
+        }
+
         // Check if same-document URI and already registered on the context
         if (uri != null && uri.length() != 0 && uri.charAt(0) == '#') {
             String id = uri.substring(1);
@@ -83,12 +88,19 @@
                 id = id.substring(i1+1, i2);
             }
 
-            Node referencedElem = dcc.getElementById(id);
+            // check if element is registered by Id
+            Node referencedElem = uriAttr.getOwnerDocument().getElementById(id);
+            if (referencedElem == null) {
+               // see if element is registered in DOMCryptoContext
+               referencedElem = dcc.getElementById(id);
+            }
             if (referencedElem != null) {
-                if (secVal) {
+                if (secVal && Policy.restrictDuplicateIds()) {
                     Element start = referencedElem.getOwnerDocument().getDocumentElement();
                     if (!XMLUtils.protectAgainstWrappingAttack(start, (Element)referencedElem, id)) {
-                        String error = "Multiple Elements with the same ID " + id + " were detected";
+                        String error = "Multiple Elements with the same ID "
+                            + id + " detected when secure validation"
+                            + " is enabled";
                         throw new URIReferenceException(error);
                     }
                 }
@@ -110,9 +122,9 @@
 
         try {
             ResourceResolver apacheResolver =
-                ResourceResolver.getInstance(uriAttr, baseURI, secVal);
+                ResourceResolver.getInstance(uriAttr, baseURI, false);
             XMLSignatureInput in = apacheResolver.resolve(uriAttr,
-                                                          baseURI, secVal);
+                                                          baseURI, false);
             if (in.isOctetStream()) {
                 return new ApacheOctetStreamData(in);
             } else {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/Policy.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.jcp.xml.dsig.internal.dom;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.security.AccessController;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.Security;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+/**
+ * The secure validation policy as specified by the
+ * jdk.xml.dsig.secureValidationPolicy security property.
+ */
+public final class Policy {
+
+    // all restrictions are initialized to be unconstrained
+    private static Set<URI> disallowedAlgs = new HashSet<>();
+    private static int maxTrans = Integer.MAX_VALUE;
+    private static int maxRefs = Integer.MAX_VALUE;
+    private static Set<String> disallowedRefUriSchemes = new HashSet<>();
+    private static boolean noDuplicateIds = false;
+    private static boolean noRMLoops = false;
+
+    static {
+        try {
+            initialize();
+        } catch (Exception e) {
+            throw new SecurityException(
+                "Cannot initialize the secure validation policy", e);
+        }
+    }
+
+    private Policy() {}
+
+    private static void initialize() {
+        String prop =
+            AccessController.doPrivileged((PrivilegedAction<String>) () ->
+                Security.getProperty("jdk.xml.dsig.secureValidationPolicy"));
+        if (prop == null || prop.isEmpty()) {
+            // no policy specified, so don't enforce any restrictions
+            return;
+        }
+        String[] entries = prop.split(",");
+        for (String entry : entries) {
+            String[] tokens = entry.split("\\s");
+            String type = tokens[0];
+            switch(type) {
+                case "disallowAlg":
+                    if (tokens.length != 2) {
+                        error(entry);
+                    }
+                    disallowedAlgs.add(URI.create(tokens[1]));
+                    break;
+                case "maxTransforms":
+                    if (tokens.length != 2) {
+                        error(entry);
+                    }
+                    maxTrans = Integer.parseUnsignedInt(tokens[1]);
+                    break;
+                case "maxReferences":
+                    if (tokens.length != 2) {
+                        error(entry);
+                    }
+                    maxRefs = Integer.parseUnsignedInt(tokens[1]);
+                    break;
+                case "disallowReferenceUriSchemes":
+                    if (tokens.length == 1) {
+                        error(entry);
+                    }
+                    for (int i = 1; i < tokens.length; i++) {
+                        String scheme = tokens[i];
+                        disallowedRefUriSchemes.add(
+                            scheme.toLowerCase(Locale.ROOT));
+                    }
+                    break;
+                case "noDuplicateIds":
+                    if (tokens.length != 1) {
+                        error(entry);
+                    }
+                    noDuplicateIds = true;
+                    break;
+                case "noRetrievalMethodLoops":
+                    if (tokens.length != 1) {
+                        error(entry);
+                    }
+                    noRMLoops = true;
+                    break;
+                default:
+                    error(entry);
+            }
+        }
+    }
+
+    public static boolean restrictAlg(String alg) {
+        try {
+            URI uri = new URI(alg);
+            return disallowedAlgs.contains(uri);
+        } catch (URISyntaxException use) {
+            return false;
+        }
+    }
+
+    public static boolean restrictNumTransforms(int numTrans) {
+        return (numTrans > maxTrans);
+    }
+
+    public static boolean restrictNumReferences(int numRefs) {
+        return (numRefs > maxRefs);
+    }
+
+    public static boolean restrictReferenceUriScheme(String uri) {
+        if (uri != null) {
+            String scheme = java.net.URI.create(uri).getScheme();
+            if (scheme != null) {
+                return disallowedRefUriSchemes.contains(
+                    scheme.toLowerCase(Locale.ROOT));
+            }
+        }
+        return false;
+    }
+
+    public static boolean restrictDuplicateIds() {
+        return noDuplicateIds;
+    }
+
+    public static boolean restrictRetrievalMethodLoops() {
+        return noRMLoops;
+    }
+
+    public static Set<URI> disabledAlgs() {
+        return Collections.<URI>unmodifiableSet(disallowedAlgs);
+    }
+
+    public static int maxTransforms() {
+        return maxTrans;
+    }
+
+    public static int maxReferences() {
+        return maxRefs;
+    }
+
+    public static Set<String> disabledReferenceUriSchemes() {
+        return Collections.<String>unmodifiableSet(disallowedRefUriSchemes);
+    }
+
+    private static void error(String entry) {
+        throw new IllegalArgumentException(
+            "Invalid jdk.xml.dsig.secureValidationPolicy entry: " + entry);
+    }
+}
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11RSACipher.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11RSACipher.java	Fri Aug 26 14:47:52 2016 -0700
@@ -358,7 +358,9 @@
                 System.arraycopy(buffer, 0, tmpBuffer, 0, bufOfs);
                 tmpBuffer = p11.C_Sign(session.id(), tmpBuffer);
                 if (tmpBuffer.length > outLen) {
-                    throw new BadPaddingException("Output buffer too small");
+                    throw new BadPaddingException(
+                        "Output buffer (" + outLen + ") is too small to " +
+                        "hold the produced data (" + tmpBuffer.length + ")");
                 }
                 System.arraycopy(tmpBuffer, 0, out, outOfs, tmpBuffer.length);
                 n = tmpBuffer.length;
--- a/jdk/src/jdk.crypto.pkcs11/share/native/libj2pkcs11/p11_util.c	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/jdk.crypto.pkcs11/share/native/libj2pkcs11/p11_util.c	Fri Aug 26 14:47:52 2016 -0700
@@ -558,7 +558,7 @@
     pCharArray = (*env)->GetStringUTFChars(env, jArray, &isCopy);
     if (pCharArray == NULL) { return; }
 
-    *ckpLength = strlen(pCharArray);
+    *ckpLength = (CK_ULONG) strlen(pCharArray);
     *ckpArray = (CK_UTF8CHAR_PTR) malloc((*ckpLength + 1) * sizeof(CK_UTF8CHAR));
     if (*ckpArray == NULL) {
         (*env)->ReleaseStringUTFChars(env, (jstring) jArray, pCharArray);
--- a/jdk/src/jdk.crypto.pkcs11/unix/native/libj2pkcs11/j2secmod_md.c	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/jdk.crypto.pkcs11/unix/native/libj2pkcs11/j2secmod_md.c	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,6 +49,7 @@
 JNIEXPORT jlong JNICALL Java_sun_security_pkcs11_Secmod_nssGetLibraryHandle
   (JNIEnv *env, jclass thisClass, jstring jLibName)
 {
+    void *hModule;
     const char *libName = (*env)->GetStringUTFChars(env, jLibName, NULL);
     if (libName == NULL) {
         return 0L;
@@ -56,9 +57,9 @@
 
     // look up existing handle only, do not load
 #if defined(AIX)
-    void *hModule = dlopen(libName, RTLD_LAZY);
+    hModule = dlopen(libName, RTLD_LAZY);
 #else
-    void *hModule = dlopen(libName, RTLD_NOLOAD);
+    hModule = dlopen(libName, RTLD_NOLOAD);
 #endif
     dprintf2("-handle for %s: %u\n", libName, hModule);
     (*env)->ReleaseStringUTFChars(env, jLibName, libName);
--- a/jdk/src/jdk.crypto.pkcs11/windows/native/libj2pkcs11/j2secmod_md.c	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/jdk.crypto.pkcs11/windows/native/libj2pkcs11/j2secmod_md.c	Fri Aug 26 14:47:52 2016 -0700
@@ -31,6 +31,9 @@
 
 #include "j2secmod.h"
 
+extern void throwNullPointerException(JNIEnv *env, const char *message);
+extern void throwIOException(JNIEnv *env, const char *message);
+
 void *findFunction(JNIEnv *env, jlong jHandle, const char *functionName) {
     HINSTANCE hModule = (HINSTANCE)jHandle;
     void *fAddress = GetProcAddress(hModule, functionName);
--- a/jdk/src/jdk.internal.opt/share/classes/module-info.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/jdk.internal.opt/share/classes/module-info.java	Fri Aug 26 14:47:52 2016 -0700
@@ -24,5 +24,5 @@
  */
 
 module jdk.internal.opt {
-    exports jdk.internal.joptsimple to jdk.jlink;
+    exports jdk.internal.joptsimple to jdk.jlink, jdk.jshell;
 }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -78,28 +78,21 @@
         private final List<String> args;
         private final Set<String> modules;
 
-        public DefaultExecutableImage(Path home, Set<String> modules) {
-            this(home, modules, createArgs(home));
-        }
-
-        private DefaultExecutableImage(Path home, Set<String> modules,
-                List<String> args) {
+        DefaultExecutableImage(Path home, Set<String> modules) {
             Objects.requireNonNull(home);
-            Objects.requireNonNull(args);
             if (!Files.exists(home)) {
                 throw new IllegalArgumentException("Invalid image home");
             }
             this.home = home;
             this.modules = Collections.unmodifiableSet(modules);
-            this.args = Collections.unmodifiableList(args);
+            this.args = createArgs(home);
         }
 
         private static List<String> createArgs(Path home) {
             Objects.requireNonNull(home);
-            List<String> javaArgs = new ArrayList<>();
-            javaArgs.add(home.resolve("bin").
-                    resolve(getJavaProcessName()).toString());
-            return javaArgs;
+            Path binDir = home.resolve("bin");
+            String java = Files.exists(binDir.resolve("java"))? "java" : "java.exe";
+            return List.of(binDir.resolve(java).toString());
         }
 
         @Override
@@ -130,6 +123,7 @@
     private final Path root;
     private final Path mdir;
     private final Set<String> modules = new HashSet<>();
+    private String targetOsName;
 
     /**
      * Default image builder constructor.
@@ -171,6 +165,11 @@
     @Override
     public void storeFiles(ResourcePool files) {
         try {
+            // populate release properties up-front. targetOsName
+            // field is assigned from there and used elsewhere.
+            Properties release = releaseProperties(files);
+            Path bin = root.resolve("bin");
+
             files.entries().forEach(f -> {
                 if (!f.type().equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE)) {
                     try {
@@ -186,11 +185,11 @@
                     modules.add(m.name());
                 }
             });
-            storeFiles(modules, releaseProperties(files));
+
+            storeFiles(modules, release);
 
             if (Files.getFileStore(root).supportsFileAttributeView(PosixFileAttributeView.class)) {
                 // launchers in the bin directory need execute permission
-                Path bin = root.resolve("bin");
                 if (Files.isDirectory(bin)) {
                     Files.list(bin)
                             .filter(f -> !f.toString().endsWith(".diz"))
@@ -208,7 +207,11 @@
                 }
             }
 
-            prepareApplicationFiles(files, modules);
+            // If native files are stripped completely, <root>/bin dir won't exist!
+            // So, don't bother generating launcher scripts.
+            if (Files.isDirectory(bin)) {
+                 prepareApplicationFiles(files, modules);
+            }
         } catch (IOException ex) {
             throw new PluginException(ex);
         }
@@ -226,6 +229,11 @@
             props.setProperty("JAVA_VERSION", System.getProperty("java.version"));
         });
 
+        this.targetOsName = props.getProperty("OS_NAME");
+        if (this.targetOsName == null) {
+            throw new PluginException("TargetPlatform attribute is missing for java.base module");
+        }
+
         Optional<ResourcePoolEntry> release = pool.findEntry("/java.base/release");
         if (release.isPresent()) {
             try (InputStream is = release.get().content()) {
@@ -373,7 +381,7 @@
         Files.createLink(dstFile, target);
     }
 
-    private static String nativeDir(String filename) {
+    private String nativeDir(String filename) {
         if (isWindows()) {
             if (filename.endsWith(".dll") || filename.endsWith(".diz")
                     || filename.endsWith(".pdb") || filename.endsWith(".map")) {
@@ -386,8 +394,8 @@
         }
     }
 
-    private static boolean isWindows() {
-        return System.getProperty("os.name").startsWith("Windows");
+    private boolean isWindows() {
+        return targetOsName.startsWith("Windows");
     }
 
     /**
@@ -452,12 +460,10 @@
         }
     }
 
-    private static String getJavaProcessName() {
-        return isWindows() ? "java.exe" : "java";
-    }
-
     public static ExecutableImage getExecutableImage(Path root) {
-        if (Files.exists(root.resolve("bin").resolve(getJavaProcessName()))) {
+        Path binDir = root.resolve("bin");
+        if (Files.exists(binDir.resolve("java")) ||
+            Files.exists(binDir.resolve("java.exe"))) {
             return new DefaultExecutableImage(root, retrieveModules(root));
         }
         return null;
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java	Fri Aug 26 14:47:52 2016 -0700
@@ -172,7 +172,7 @@
     private final Plugin lastSorter;
     private final List<Plugin> plugins = new ArrayList<>();
     private final List<ResourcePrevisitor> resourcePrevisitors = new ArrayList<>();
-
+    private final boolean validate;
 
     public ImagePluginStack() {
         this(null, Collections.emptyList(), null);
@@ -181,6 +181,13 @@
     public ImagePluginStack(ImageBuilder imageBuilder,
             List<Plugin> plugins,
             Plugin lastSorter) {
+        this(imageBuilder, plugins, lastSorter, true);
+    }
+
+    public ImagePluginStack(ImageBuilder imageBuilder,
+            List<Plugin> plugins,
+            Plugin lastSorter,
+            boolean validate) {
         this.imageBuilder = Objects.requireNonNull(imageBuilder);
         this.lastSorter = lastSorter;
         this.plugins.addAll(Objects.requireNonNull(plugins));
@@ -190,6 +197,7 @@
                 resourcePrevisitors.add((ResourcePrevisitor) p);
             }
         });
+        this.validate = validate;
     }
 
     public void operate(ImageProvider provider) throws Exception {
@@ -268,6 +276,7 @@
                 frozenOrder = ((OrderedResourcePoolManager.OrderedResourcePool)resPool).getOrderedList();
             }
         }
+
         return resPool;
     }
 
@@ -458,7 +467,11 @@
             throws Exception {
         Objects.requireNonNull(original);
         Objects.requireNonNull(transformed);
-        imageBuilder.storeFiles(new LastPoolManager(transformed).resourcePool());
+        ResourcePool lastPool = new LastPoolManager(transformed).resourcePool();
+        if (validate) {
+            ResourcePoolConfiguration.validate(lastPool);
+        }
+        imageBuilder.storeFiles(lastPool);
     }
 
     public ExecutableImage getExecutableImage() throws IOException {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PathResourcePoolEntry.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PathResourcePoolEntry.java	Fri Aug 26 14:47:52 2016 -0700
@@ -5,7 +5,7 @@
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classfile" exception as provided
+ * 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolConfiguration.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.tools.jlink.internal;
+
+import java.lang.module.Configuration;
+import java.lang.module.ModuleDescriptor;
+import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReference;
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.ByteBuffer;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
+import jdk.tools.jlink.plugin.PluginException;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
+import jdk.tools.jlink.plugin.ResourcePoolModule;
+
+final class ResourcePoolConfiguration {
+    private ResourcePoolConfiguration() {}
+
+    private static ModuleDescriptor descriptorOf(ResourcePoolModule mod) {
+        ModuleDescriptor md = mod.descriptor();
+
+        // drop hashes
+        ModuleDescriptor.Builder builder = new ModuleDescriptor.Builder(md.name());
+        md.requires().stream()
+          .forEach(builder::requires);
+        md.exports().stream()
+          .forEach(builder::exports);
+        md.uses().stream()
+          .forEach(builder::uses);
+        md.provides().values().stream()
+          .forEach(builder::provides);
+
+        // build the proper concealed packages
+        Set<String> exps = md.exports().stream()
+            .map(ModuleDescriptor.Exports::source)
+            .collect(Collectors.toSet());
+
+        mod.packages().stream()
+           .filter(pn -> !exps.contains(pn))
+           .forEach(builder::conceals);
+
+        md.version().ifPresent(builder::version);
+        md.mainClass().ifPresent(builder::mainClass);
+        md.osName().ifPresent(builder::osName);
+        md.osArch().ifPresent(builder::osArch);
+        md.osVersion().ifPresent(builder::osVersion);
+
+        return builder.build();
+    }
+
+    private static ModuleReference moduleReference(ModuleDescriptor desc) {
+        return new ModuleReference(desc, null, () -> {
+            IOException ioe = new IOException("<module reader unsupported>");
+            throw new UncheckedIOException(ioe);
+        });
+    }
+
+    private static Map<String, ModuleReference> allModRefs(ResourcePool pool) {
+        return pool.moduleView().modules().
+            collect(Collectors.toMap(ResourcePoolModule::name,
+                m -> moduleReference(descriptorOf(m))));
+    }
+
+    private static void checkPackages(ResourcePool pool) {
+        // check that each resource pool module's packages()
+        // returns a set that is consistent with the module
+        // descriptor of that module.
+
+        pool.moduleView().modules().forEach(m -> {
+            ModuleDescriptor desc = m.descriptor();
+            if (!desc.packages().equals(m.packages())) {
+                throw new RuntimeException("Module " + m.name() +
+                   "'s descriptor returns inconsistent package set");
+            }
+        });
+    }
+
+    static Configuration validate(ResourcePool pool) {
+        checkPackages(pool);
+        final Map<String, ModuleReference> nameToModRef = allModRefs(pool);
+        final Set<ModuleReference> allRefs = new HashSet<>(nameToModRef.values());
+
+        final ModuleFinder finder = new ModuleFinder() {
+            @Override
+            public Optional<ModuleReference> find(String name) {
+                return Optional.ofNullable(nameToModRef.get(name));
+            }
+
+            @Override
+            public Set<ModuleReference> findAll() {
+                return allRefs;
+            }
+        };
+
+        return Configuration.empty().resolveRequires(
+            finder, ModuleFinder.of(), nameToModRef.keySet());
+    }
+}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java	Fri Aug 26 14:47:52 2016 -0700
@@ -24,7 +24,11 @@
  */
 package jdk.tools.jlink.internal.plugins;
 
+import java.io.File;
+import java.io.IOException;
 import java.lang.invoke.MethodType;
+import java.nio.file.Files;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.EnumSet;
 import java.util.HashMap;
@@ -32,6 +36,7 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 import jdk.internal.misc.SharedSecrets;
 import jdk.internal.misc.JavaLangInvokeAccess;
 import jdk.tools.jlink.plugin.ResourcePoolEntry;
@@ -47,15 +52,9 @@
 
     private static final String NAME = "generate-jli-classes";
 
-    private static final String BMH_PARAM = "bmh";
-
-    private static final String BMH_SPECIES_PARAM = "bmh-species";
-
-    private static final String DMH_PARAM = "dmh";
-
     private static final String DESCRIPTION = PluginsResourceBundle.getDescription(NAME);
 
-    private static final String DIRECT_METHOD_HANDLE = "java/lang/invoke/DirectMethodHandle$Holder";
+    private static final String DIRECT_HOLDER = "java/lang/invoke/DirectMethodHandle$Holder";
     private static final String DMH_INVOKE_VIRTUAL = "invokeVirtual";
     private static final String DMH_INVOKE_STATIC = "invokeStatic";
     private static final String DMH_INVOKE_SPECIAL = "invokeSpecial";
@@ -63,15 +62,17 @@
     private static final String DMH_INVOKE_INTERFACE = "invokeInterface";
     private static final String DMH_INVOKE_STATIC_INIT = "invokeStaticInit";
 
-    private static final String DELEGATING_METHOD_HANDLE = "java/lang/invoke/DelegatingMethodHandle$Holder";
-
-    private static final String BASIC_FORMS_HANDLE = "java/lang/invoke/LambdaForm$Holder";
+    private static final String DELEGATING_HOLDER = "java/lang/invoke/DelegatingMethodHandle$Holder";
+    private static final String BASIC_FORMS_HOLDER = "java/lang/invoke/LambdaForm$Holder";
+    private static final String INVOKERS_HOLDER = "java/lang/invoke/Invokers$Holder";
 
     private static final JavaLangInvokeAccess JLIA
             = SharedSecrets.getJavaLangInvokeAccess();
 
     List<String> speciesTypes;
 
+    List<String> invokerTypes;
+
     Map<String, List<String>> dmhMethods;
 
     public GenerateJLIClassesPlugin() {
@@ -117,21 +118,29 @@
     }
 
     /**
+     * @return the default invoker forms to generate.
+     */
+    private static List<String> defaultInvokers() {
+        return List.of("LL_L", "LL_I", "LILL_I", "L6_L");
+    }
+
+    /**
      * @return the list of default DirectMethodHandle methods to generate.
      */
-    public static Map<String, List<String>> defaultDMHMethods() {
+    private static Map<String, List<String>> defaultDMHMethods() {
         return Map.of(
-            DMH_INVOKE_VIRTUAL, List.of("_L", "L_L", "LI_I", "LL_V"),
-            DMH_INVOKE_SPECIAL, List.of("L_I", "L_L", "LF_L", "LD_L", "LL_L",
-                "L3_L", "L4_L", "L5_L", "L6_L", "L7_L", "LI_I", "LI_L", "LIL_I",
-                "LII_I", "LII_L", "LLI_L", "LLI_I", "LILI_I", "LIIL_L",
-                "LIILL_L", "LIILL_I", "LIIL_I", "LILIL_I", "LILILL_I",
-                "LILII_I", "LI3_I", "LI3L_I", "LI3LL_I", "LI3_L", "LI4_I"),
-            DMH_INVOKE_STATIC, List.of("II_I", "IL_I", "ILIL_I", "ILII_I",
-                "_I", "_L", "_V", "D_L", "F_L", "I_I", "II_L", "LI_L",
-                "L_V", "L_L", "LL_L", "L3_L", "L4_L", "L5_L", "L6_L",
-                "L7_L", "L8_L", "L9_L", "L9I_L", "L9II_L", "L9IIL_L",
-                "L10_L", "L11_L", "L12_L", "L13_L", "L13I_L", "L13II_L")
+            DMH_INVOKE_VIRTUAL, List.of("L_L", "LL_L", "LLI_I", "L3_V"),
+            DMH_INVOKE_SPECIAL, List.of("LL_I", "LL_L", "LLF_L", "LLD_L", "L3_L",
+                "L4_L", "L5_L", "L6_L", "L7_L", "L8_L", "LLI_I", "LLI_L",
+                "LLIL_I", "LLII_I", "LLII_L", "L3I_L", "L3I_I", "LLILI_I",
+                "LLIIL_L", "LLIILL_L", "LLIILL_I", "LLIIL_I", "LLILIL_I",
+                "LLILILL_I", "LLILII_I", "LLI3_I", "LLI3L_I", "LLI3LL_I",
+                "LLI3_L", "LLI4_I"),
+            DMH_INVOKE_STATIC, List.of("LII_I", "LIL_I", "LILIL_I", "LILII_I",
+                "L_I", "L_L", "L_V", "LD_L", "LF_L", "LI_I", "LII_L", "LLI_L",
+                "LL_V", "LL_L", "L3_L", "L4_L", "L5_L", "L6_L", "L7_L",
+                "L8_L", "L9_L", "L10_L", "L10I_L", "L10II_L", "L10IIL_L",
+                "L11_L", "L12_L", "L13_L", "L14_L", "L14I_L", "L14II_L")
         );
     }
 
@@ -150,72 +159,91 @@
     public void configure(Map<String, String> config) {
         String mainArgument = config.get(NAME);
 
-        // Enable by default
-        boolean bmhEnabled = true;
-        boolean dmhEnabled = true;
-        if (mainArgument != null) {
-            List<String> args = Arrays.asList(mainArgument.split(","));
-            if (!args.contains(BMH_PARAM)) {
-                bmhEnabled = false;
-            }
-            if (!args.contains(DMH_PARAM)) {
-                dmhEnabled = false;
-            }
-        }
+        if (mainArgument != null && mainArgument.startsWith("@")) {
+            File file = new File(mainArgument.substring(1));
+            if (file.exists()) {
+                speciesTypes = new ArrayList<>();
+                invokerTypes = new ArrayList<>();
+                dmhMethods = new HashMap<>();
+                Stream<String> lines = fileLines(file);
 
-        if (!bmhEnabled) {
-            speciesTypes = List.of();
+                lines.map(line -> line.split(" "))
+                    .forEach(parts -> {
+                        switch (parts[0]) {
+                            case "[BMH_RESOLVE]":
+                                speciesTypes.add(expandSignature(parts[1]));
+                                break;
+                            case "[LF_RESOLVE]":
+                                String methodType = parts[3];
+                                validateMethodType(methodType);
+                                if (parts[1].contains("Invokers")) {
+                                    invokerTypes.add(methodType);
+                                } else if (parts[1].contains("DirectMethodHandle")) {
+                                    String dmh = parts[2];
+                                    // ignore getObject etc for now (generated
+                                    // by default)
+                                    if (DMH_METHOD_TYPE_MAP.containsKey(dmh)) {
+                                        addDMHMethodType(dmh, methodType);
+                                    }
+                                }
+                                break;
+                            default: break; // ignore
+                        }
+                });
+            }
         } else {
-            String args = config.get(BMH_SPECIES_PARAM);
-            List<String> bmhSpecies;
-            if (args != null && !args.isEmpty()) {
-                bmhSpecies = Arrays.stream(args.split(","))
-                    .map(String::trim)
-                    .filter(s -> !s.isEmpty())
-                    .collect(Collectors.toList());
-            } else {
-                bmhSpecies = defaultSpecies();
-            }
-
+            List<String> bmhSpecies = defaultSpecies();
             // Expand BMH species signatures
             speciesTypes = bmhSpecies.stream()
                     .map(type -> expandSignature(type))
                     .collect(Collectors.toList());
-        }
+
+            invokerTypes = defaultInvokers();
+            validateMethodTypes(invokerTypes);
 
-        // DirectMethodHandles
-        if (!dmhEnabled) {
-            dmhMethods = Map.of();
-        } else {
-            dmhMethods = new HashMap<>();
-            for (String dmhParam : DMH_METHOD_TYPE_MAP.keySet()) {
-                String args = config.get(dmhParam);
-                if (args != null && !args.isEmpty()) {
-                    List<String> dmhMethodTypes = Arrays.stream(args.split(","))
-                            .map(String::trim)
-                            .filter(s -> !s.isEmpty())
-                            .collect(Collectors.toList());
-                    dmhMethods.put(dmhParam, dmhMethodTypes);
-                    // Validation check
-                    for (String type : dmhMethodTypes) {
-                        String[] typeParts = type.split("_");
-                        // check return type (second part)
-                        if (typeParts.length != 2 || typeParts[1].length() != 1
-                                || "LJIFDV".indexOf(typeParts[1].charAt(0)) == -1) {
-                            throw new PluginException(
-                                    "Method type signature must be of form [LJIFD]*_[LJIFDV]");
-                        }
-                        // expand and check arguments (first part)
-                        expandSignature(typeParts[0]);
-                    }
-                }
-            }
-            if (dmhMethods.isEmpty()) {
-                dmhMethods = defaultDMHMethods();
+            dmhMethods = defaultDMHMethods();
+            for (List<String> dmhMethodTypes : dmhMethods.values()) {
+                validateMethodTypes(dmhMethodTypes);
             }
         }
     }
 
+    private void addDMHMethodType(String dmh, String methodType) {
+        validateMethodType(methodType);
+        List<String> methodTypes = dmhMethods.get(dmh);
+        if (methodTypes == null) {
+            methodTypes = new ArrayList<>();
+            dmhMethods.put(dmh, methodTypes);
+        }
+        methodTypes.add(methodType);
+    }
+
+    private Stream<String> fileLines(File file) {
+        try {
+            return Files.lines(file.toPath());
+        } catch (IOException io) {
+            throw new PluginException("Couldn't read file");
+        }
+    }
+
+    private void validateMethodTypes(List<String> dmhMethodTypes) {
+        for (String type : dmhMethodTypes) {
+            validateMethodType(type);
+        }
+    }
+
+    private void validateMethodType(String type) {
+        String[] typeParts = type.split("_");
+        // check return type (second part)
+        if (typeParts.length != 2 || typeParts[1].length() != 1
+                || "LJIFDV".indexOf(typeParts[1].charAt(0)) == -1) {
+            throw new PluginException(
+                    "Method type signature must be of form [LJIFD]*_[LJIFDV]");
+        }
+        // expand and check arguments (first part)
+        expandSignature(typeParts[0]);
+    }
+
     private static void requireBasicType(char c) {
         if ("LIJFD".indexOf(c) < 0) {
             throw new PluginException(
@@ -228,9 +256,10 @@
         // Copy all but DMH_ENTRY to out
         in.transformAndCopy(entry -> {
                 // filter out placeholder entries
-                if (entry.path().equals(DIRECT_METHOD_HANDLE_ENTRY) ||
-                    entry.path().equals(DELEGATING_METHOD_HANDLE_ENTRY) ||
-                    entry.path().equals(BASIC_FORMS_HANDLE_ENTRY)) {
+                if (entry.path().equals(DIRECT_METHOD_HOLDER_ENTRY) ||
+                    entry.path().equals(DELEGATING_METHOD_HOLDER_ENTRY) ||
+                    entry.path().equals(INVOKERS_HOLDER_ENTRY) ||
+                    entry.path().equals(BASIC_FORMS_HOLDER_ENTRY)) {
                     return null;
                 } else {
                     return entry;
@@ -265,42 +294,72 @@
         for (List<String> entry : dmhMethods.values()) {
             count += entry.size();
         }
-        MethodType[] methodTypes = new MethodType[count];
+        MethodType[] directMethodTypes = new MethodType[count];
         int[] dmhTypes = new int[count];
         int index = 0;
         for (Map.Entry<String, List<String>> entry : dmhMethods.entrySet()) {
             String dmhType = entry.getKey();
             for (String type : entry.getValue()) {
-                methodTypes[index] = asMethodType(type);
+                // The DMH type to actually ask for is retrieved by removing
+                // the first argument, which needs to be of Object.class
+                MethodType mt = asMethodType(type);
+                if (mt.parameterCount() < 1 ||
+                    mt.parameterType(0) != Object.class) {
+                    throw new PluginException(
+                            "DMH type parameter must start with L");
+                }
+                directMethodTypes[index] = mt.dropParameterTypes(0, 1);
                 dmhTypes[index] = DMH_METHOD_TYPE_MAP.get(dmhType);
                 index++;
             }
         }
+        MethodType[] invokerMethodTypes = new MethodType[this.invokerTypes.size()];
+        for (int i = 0; i < invokerTypes.size(); i++) {
+            // The invoker type to ask for is retrieved by removing the first
+            // and the last argument, which needs to be of Object.class
+            MethodType mt = asMethodType(invokerTypes.get(i));
+            final int lastParam = mt.parameterCount() - 1;
+            if (mt.parameterCount() < 2 ||
+                    mt.parameterType(0) != Object.class ||
+                    mt.parameterType(lastParam) != Object.class) {
+                throw new PluginException(
+                        "Invoker type parameter must start and end with L");
+            }
+            mt = mt.dropParameterTypes(lastParam, lastParam + 1);
+            invokerMethodTypes[i] = mt.dropParameterTypes(0, 1);
+        }
         try {
             byte[] bytes = JLIA.generateDirectMethodHandleHolderClassBytes(
-                    DIRECT_METHOD_HANDLE, methodTypes, dmhTypes);
+                    DIRECT_HOLDER, directMethodTypes, dmhTypes);
             ResourcePoolEntry ndata = ResourcePoolEntry
-                    .create(DIRECT_METHOD_HANDLE_ENTRY, bytes);
+                    .create(DIRECT_METHOD_HOLDER_ENTRY, bytes);
             out.add(ndata);
 
             bytes = JLIA.generateDelegatingMethodHandleHolderClassBytes(
-                    DELEGATING_METHOD_HANDLE, methodTypes);
-            ndata = ResourcePoolEntry.create(DELEGATING_METHOD_HANDLE_ENTRY, bytes);
+                    DELEGATING_HOLDER, directMethodTypes);
+            ndata = ResourcePoolEntry.create(DELEGATING_METHOD_HOLDER_ENTRY, bytes);
             out.add(ndata);
 
-            bytes = JLIA.generateBasicFormsClassBytes(BASIC_FORMS_HANDLE);
-            ndata = ResourcePoolEntry.create(BASIC_FORMS_HANDLE_ENTRY, bytes);
+            bytes = JLIA.generateInvokersHolderClassBytes(INVOKERS_HOLDER,
+                    invokerMethodTypes);
+            ndata = ResourcePoolEntry.create(INVOKERS_HOLDER_ENTRY, bytes);
+            out.add(ndata);
+
+            bytes = JLIA.generateBasicFormsClassBytes(BASIC_FORMS_HOLDER);
+            ndata = ResourcePoolEntry.create(BASIC_FORMS_HOLDER_ENTRY, bytes);
             out.add(ndata);
         } catch (Exception ex) {
             throw new PluginException(ex);
         }
     }
-    private static final String DIRECT_METHOD_HANDLE_ENTRY =
-            "/java.base/" + DIRECT_METHOD_HANDLE + ".class";
-    private static final String DELEGATING_METHOD_HANDLE_ENTRY =
-            "/java.base/" + DELEGATING_METHOD_HANDLE + ".class";
-    private static final String BASIC_FORMS_HANDLE_ENTRY =
-            "/java.base/" + BASIC_FORMS_HANDLE + ".class";
+    private static final String DIRECT_METHOD_HOLDER_ENTRY =
+            "/java.base/" + DIRECT_HOLDER + ".class";
+    private static final String DELEGATING_METHOD_HOLDER_ENTRY =
+            "/java.base/" + DELEGATING_HOLDER + ".class";
+    private static final String BASIC_FORMS_HOLDER_ENTRY =
+            "/java.base/" + BASIC_FORMS_HOLDER + ".class";
+    private static final String INVOKERS_HOLDER_ENTRY =
+            "/java.base/" + INVOKERS_HOLDER + ".class";
 
     // Convert LL -> LL, L3 -> LLL
     private static String expandSignature(String signature) {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties	Fri Aug 26 14:47:52 2016 -0700
@@ -56,7 +56,7 @@
 
 copy-files.description=\
 If files to copy are not absolute path, JDK home dir is used.\n\
-e.g.: jrt-fs.jar,LICENSE,/home/me/myfile.txt=somewehere/conf.txt
+e.g.: jrt-fs.jar,LICENSE,/home/me/myfile.txt=somewhere/conf.txt
 
 exclude-files.argument=<pattern-list> of files to exclude
 
@@ -68,10 +68,12 @@
 exclude-resources.description=\
 Specify resources to exclude. e.g.: **.jcov,glob:**/META-INF/**
 
-generate-jli-classes.argument=<bmh[:bmh-species=LL,L3,...]>
+generate-jli-classes.argument=<@filename>
 
 generate-jli-classes.description=\
-Concrete java.lang.invoke classes to generate
+Takes a file hinting to jlink what java.lang.invoke classes to pre-generate. If\n\
+this flag is not specified a default set of classes will be generated, so to \n\
+disable pre-generation supply the name of an empty or non-existing file
 
 installed-modules.description=Fast loading of module descriptors (always enabled)
 
--- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java	Fri Aug 26 14:47:52 2016 -0700
@@ -165,8 +165,8 @@
             walk(inode.child, process);
         } else {
             process.accept(inode);
-            walk(inode.sibling, process);
         }
+        walk(inode.sibling, process);
     }
 
     /**
--- a/jdk/test/ProblemList.txt	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/ProblemList.txt	Fri Aug 26 14:47:52 2016 -0700
@@ -124,10 +124,6 @@
 # jdk_lang
 
 java/lang/StringCoding/CheckEncodings.sh                        7008363 generic-all
-java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java	8160690 generic-all
-java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java	8160690 generic-all
-java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java	8160690 generic-all
-java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java	8160690 generic-all
 
 ############################################################################
 
@@ -211,8 +207,6 @@
 
 java/rmi/transport/dgcDeadLock/DGCDeadLock.java                 8029360 macosx-all
 
-sun/rmi/runtime/Log/6409194/NoConsoleOutput.java                8164124 windows-all
-
 ############################################################################
 
 # jdk_security
--- a/jdk/test/java/lang/StackWalker/VerifyStackTrace.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/java/lang/StackWalker/VerifyStackTrace.java	Fri Aug 26 14:47:52 2016 -0700
@@ -205,12 +205,13 @@
                     .replaceAll("java.base@(\\d+\\.){0,3}(\\d+)/", "java.base/")
                     .replaceAll("/[0-9]+\\.run", "/xxxxxxxx.run")
                     .replaceAll("/[0-9]+\\.invoke", "/xxxxxxxx.invoke")
-                    // DMHs may or may not be pre-generated, making frames differ
+                    // LFs may or may not be pre-generated, making frames differ
                     .replaceAll("DirectMethodHandle\\$Holder", "LambdaForm\\$DMH")
-                    .replaceAll("DMH\\.invoke", "DMH/xxxxxxxx.invoke")
+                    .replaceAll("Invokers\\$Holder", "LambdaForm\\$MH")
+                    .replaceAll("MH\\.invoke", "MH/xxxxxxxx.invoke")
                     // invoke frames may or may not have basic method type
                     // information encoded for diagnostic purposes
-                    .replaceAll("xx\\.invoke([A-Za-z]*)_[A-Z]+_[A-Z]", "xx.invoke$1")
+                    .replaceAll("xx\\.invoke([A-Za-z]*)_[A-Z_]+", "xx.invoke$1")
                     .replaceAll("\\$[0-9]+", "\\$??");
         } else {
             return produced;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/HttpCookie/CookieNegativeMaxAge.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8005068
+ * @summary Check that any negative maxAge is treated as "unspecified" and
+ * if header contains cookie with "expires" attribute in the past then cookie
+ * is created with maxAge=0 meaning it is specified to be immediately expired.
+ * @run main CookieNegativeMaxAge
+ */
+
+
+import java.net.HttpCookie;
+import java.util.List;
+
+public class CookieNegativeMaxAge {
+
+    public static void main(String... args) {
+        HttpCookie cookie = new HttpCookie("testCookie", "value");
+        cookie.setMaxAge(Integer.MIN_VALUE);
+        if (cookie.hasExpired()) {
+            throw new RuntimeException("Cookie has unexpectedly expired");
+        }
+
+        List<HttpCookie> cookies = HttpCookie.parse("Set-Cookie: " +
+                "expiredCookie=value; expires=Thu, 01 Jan 1970 00:00:00 GMT");
+        if (cookies.size() == 1) {
+            if (cookies.get(0).getMaxAge() != 0) {
+                throw new RuntimeException("Cookie maxAge expected to be 0");
+            }
+        } else {
+            throw new RuntimeException("Header was incorrectly parsed");
+        }
+    }
+}
--- a/jdk/test/java/net/MulticastSocket/NoLoopbackPackets.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/java/net/MulticastSocket/NoLoopbackPackets.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,6 +68,7 @@
 
         MulticastSocket msock = null;
         List<SocketAddress> failedGroups = new ArrayList<SocketAddress>();
+        Sender sender = null;
         try {
             msock = new MulticastSocket();
             int port = msock.getLocalPort();
@@ -80,9 +81,8 @@
             groups.add(new InetSocketAddress(InetAddress.getByName("::ffff:224.1.1.2"), port));
             groups.add(new InetSocketAddress(InetAddress.getByName("ff02::1:1"), port));
 
-            Thread sender = new Thread(new Sender(groups));
-            sender.setDaemon(true); // we want sender to stop when main thread exits
-            sender.start();
+            sender = new Sender(groups);
+            new Thread(sender).start();
 
             // Now try to receive multicast packets. we should not see any of them
             // since we disable loopback mode.
@@ -107,6 +107,9 @@
             }
         } finally {
             if (msock != null) try { msock.close(); } catch (Exception e) {}
+            if (sender != null) {
+                sender.stop();
+            }
         }
 
         if (failedGroups.size() > 0) {
@@ -119,6 +122,7 @@
 
     static class Sender implements Runnable {
         private List<SocketAddress> sendToGroups;
+        private volatile boolean stop;
 
         public Sender(List<SocketAddress> groups) {
             sendToGroups = groups;
@@ -136,7 +140,7 @@
 
                 MulticastSocket msock = new MulticastSocket();
                 msock.setLoopbackMode(true);    // disable loopback mode
-                for (;;) {
+                while (!stop) {
                     for (DatagramPacket packet : packets) {
                         msock.send(packet);
                     }
@@ -147,5 +151,9 @@
                 throw new RuntimeException(e);
             }
         }
+
+        void stop() {
+            stop = true;
+        }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/httpclient/ProxyAuthTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ */
+
+/*
+ * @test
+ * @bug 8163561
+ * @modules java.base/sun.net.www
+ * @summary Verify that Proxy-Authenticate header is correctly handled
+ *
+ * @run main/othervm ProxyAuthTest
+ */
+
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.net.Authenticator;
+import java.net.InetSocketAddress;
+import java.net.PasswordAuthentication;
+import java.net.ProxySelector;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpResponse;
+import java.util.Base64;
+
+import sun.net.www.MessageHeader;
+
+public class ProxyAuthTest {
+    private static final String AUTH_USER = "user";
+    private static final String AUTH_PASSWORD = "password";
+
+    public static void main(String[] args) throws Exception {
+        try (ServerSocket ss = new ServerSocket(0)) {
+            int port = ss.getLocalPort();
+            MyProxy proxy = new MyProxy(ss);
+            (new Thread(proxy)).start();
+            System.out.println("Proxy listening port " + port);
+
+            Auth auth = new Auth();
+            InetSocketAddress paddr = new InetSocketAddress("localhost", port);
+
+            URI uri = new URI("http://www.google.ie/");
+            HttpClient client = HttpClient.create()
+                    .proxy(ProxySelector.of(paddr))
+                    .authenticator(auth)
+                    .build();
+            HttpResponse resp = client.request(uri)
+                    .GET()
+                    .responseAsync()
+                    .get();
+            if (resp.statusCode() != 404) {
+                throw new RuntimeException("Unexpected status code: " + resp.statusCode());
+            }
+
+            if (auth.isCalled) {
+                System.out.println("Authenticator is called");
+            } else {
+                throw new RuntimeException("Authenticator is not called");
+            }
+
+            if (!proxy.matched) {
+                throw new RuntimeException("Proxy authentication failed");
+            }
+        }
+    }
+
+    static class Auth extends Authenticator {
+        private volatile boolean isCalled;
+
+        @Override
+        protected PasswordAuthentication getPasswordAuthentication() {
+            System.out.println("scheme: " + this.getRequestingScheme());
+            isCalled = true;
+            return new PasswordAuthentication(AUTH_USER,
+                    AUTH_PASSWORD.toCharArray());
+        }
+    }
+
+    static class MyProxy implements Runnable {
+        final ServerSocket ss;
+        private volatile boolean matched;
+
+        MyProxy(ServerSocket ss) {
+            this.ss = ss;
+        }
+
+        public void run() {
+            for (int i = 0; i < 2; i++) {
+                try (Socket s = ss.accept();
+                     InputStream in = s.getInputStream();
+                     OutputStream os = s.getOutputStream();
+                     BufferedWriter writer = new BufferedWriter(
+                             new OutputStreamWriter(os));
+                     PrintWriter out = new PrintWriter(writer);) {
+                    MessageHeader headers = new MessageHeader(in);
+                    System.out.println("Proxy: received " + headers);
+
+                    String authInfo = headers
+                            .findValue("Proxy-Authorization");
+                    if (authInfo != null) {
+                        authenticate(authInfo);
+                        out.print("HTTP/1.1 404 Not found\r\n");
+                        out.print("\r\n");
+                        System.out.println("Proxy: 404");
+                        out.flush();
+                    } else {
+                        out.print("HTTP/1.1 407 Proxy Authorization Required\r\n");
+                        out.print(
+                                "Proxy-Authenticate: Basic realm=\"a fake realm\"\r\n");
+                        out.print("\r\n");
+                        System.out.println("Proxy: Authorization required");
+                        out.flush();
+                    }
+                } catch (IOException x) {
+                    System.err.println("Unexpected IOException from proxy.");
+                    x.printStackTrace();
+                    break;
+                }
+            }
+        }
+
+        private void authenticate(String authInfo) throws IOException {
+            try {
+                authInfo.trim();
+                int ind = authInfo.indexOf(' ');
+                String recvdUserPlusPass = authInfo.substring(ind + 1).trim();
+                // extract encoded username:passwd
+                String value = new String(
+                        Base64.getMimeDecoder().decode(recvdUserPlusPass));
+                String userPlusPassword = AUTH_USER + ":" + AUTH_PASSWORD;
+                if (userPlusPassword.equals(value)) {
+                    matched = true;
+                    System.out.println("Proxy: client authentication successful");
+                } else {
+                    System.err.println(
+                            "Proxy: client authentication failed, expected ["
+                                    + userPlusPassword + "], actual [" + value
+                                    + "]");
+                }
+            } catch (Exception e) {
+                throw new IOException(
+                        "Proxy received invalid Proxy-Authorization value: "
+                                + authInfo);
+            }
+        }
+    }
+
+}
+
--- a/jdk/test/java/nio/channels/AsynchronousChannelGroup/Basic.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/Basic.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -119,19 +119,31 @@
             ExecutorService pool = Executors.newCachedThreadPool();
             AsynchronousChannelGroup group = AsynchronousChannelGroup
                     .withCachedThreadPool(pool, rand.nextInt(10));
-            testShutdownWithChannels(pool, group);
+            try {
+                testShutdownWithChannels(pool, group);
+            } finally {
+                group.shutdown();
+            }
         }
         for (int i = 0; i < 100; i++) {
             int nThreads = 1 + rand.nextInt(8);
             AsynchronousChannelGroup group = AsynchronousChannelGroup
                     .withFixedThreadPool(nThreads, threadFactory);
-            testShutdownWithChannels(null, group);
+            try {
+                testShutdownWithChannels(null, group);
+            } finally {
+                group.shutdown();
+            }
         }
         for (int i = 0; i < 100; i++) {
             ExecutorService pool = Executors.newCachedThreadPool();
             AsynchronousChannelGroup group = AsynchronousChannelGroup
                     .withThreadPool(pool);
-            testShutdownWithChannels(pool, group);
+            try {
+                testShutdownWithChannels(pool, group);
+            } finally {
+                group.shutdown();
+            }
         }
     }
 
@@ -164,19 +176,31 @@
             ExecutorService pool = pool = Executors.newCachedThreadPool();
             AsynchronousChannelGroup group = AsynchronousChannelGroup
                     .withCachedThreadPool(pool, rand.nextInt(5));
-            testShutdownNow(pool, group);
+            try {
+                testShutdownNow(pool, group);
+            } finally {
+                group.shutdown();
+            }
         }
         for (int i = 0; i < 10; i++) {
             int nThreads = 1 + rand.nextInt(8);
             AsynchronousChannelGroup group = AsynchronousChannelGroup
                     .withFixedThreadPool(nThreads, threadFactory);
-            testShutdownNow(null, group);
+            try {
+                testShutdownNow(null, group);
+            } finally {
+                group.shutdown();
+            }
         }
         for (int i = 0; i < 10; i++) {
             ExecutorService pool = Executors.newCachedThreadPool();
             AsynchronousChannelGroup group = AsynchronousChannelGroup
                     .withThreadPool(pool);
-            testShutdownNow(pool, group);
+            try {
+                testShutdownNow(pool, group);
+            } finally {
+                group.shutdown();
+            }
         }
     }
 
@@ -186,78 +210,78 @@
         AsynchronousChannelGroup group =
             AsynchronousChannelGroup.withFixedThreadPool(1, threadFactory);
 
-        AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(group);
-        AsynchronousServerSocketChannel listener = AsynchronousServerSocketChannel.open(group);
+        try (AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(group);
+                AsynchronousServerSocketChannel listener =
+                    AsynchronousServerSocketChannel.open(group)) {
 
-        // initiate accept
-        listener.bind(new InetSocketAddress(0));
-        Future<AsynchronousSocketChannel> result = listener.accept();
-
-        // shutdown group
-        group.shutdown();
-        if (!group.isShutdown())
-            throw new RuntimeException("Group should be shutdown");
+            // initiate accept
+            listener.bind(new InetSocketAddress(0));
+            Future<AsynchronousSocketChannel> result = listener.accept();
 
-        // attempt to create another channel
-        try {
-            AsynchronousSocketChannel.open(group);
-            throw new RuntimeException("ShutdownChannelGroupException expected");
-        } catch (ShutdownChannelGroupException x) {
-        }
-        try {
-            AsynchronousServerSocketChannel.open(group);
-            throw new RuntimeException("ShutdownChannelGroupException expected");
-        } catch (ShutdownChannelGroupException x) {
-        }
+            // shutdown group
+            group.shutdown();
+            if (!group.isShutdown())
+                throw new RuntimeException("Group should be shutdown");
+
+            // attempt to create another channel
+            try {
+                AsynchronousSocketChannel.open(group);
+                throw new RuntimeException("ShutdownChannelGroupException expected");
+            } catch (ShutdownChannelGroupException x) {
+            }
+            try {
+                AsynchronousServerSocketChannel.open(group);
+                throw new RuntimeException("ShutdownChannelGroupException expected");
+            } catch (ShutdownChannelGroupException x) {
+            }
 
-        // attempt to create another channel by connecting. This should cause
-        // the accept operation to fail.
-        InetAddress lh = InetAddress.getLocalHost();
-        int port = ((InetSocketAddress)listener.getLocalAddress()).getPort();
-        InetSocketAddress isa = new InetSocketAddress(lh, port);
-        ch.connect(isa).get();
-        try {
-            result.get();
-            throw new RuntimeException("Connection was accepted");
-        } catch (ExecutionException x) {
-            Throwable cause = x.getCause();
-            if (!(cause instanceof IOException))
-                throw new RuntimeException("Cause should be IOException");
-            cause = cause.getCause();
-            if (!(cause instanceof ShutdownChannelGroupException))
-                throw new RuntimeException("IOException cause should be ShutdownChannelGroupException");
-        }
+            // attempt to create another channel by connecting. This should cause
+            // the accept operation to fail.
+            InetAddress lh = InetAddress.getLocalHost();
+            int port = ((InetSocketAddress)listener.getLocalAddress()).getPort();
+            InetSocketAddress isa = new InetSocketAddress(lh, port);
+            ch.connect(isa).get();
+            try {
+                result.get();
+                throw new RuntimeException("Connection was accepted");
+            } catch (ExecutionException x) {
+                Throwable cause = x.getCause();
+                if (!(cause instanceof IOException))
+                    throw new RuntimeException("Cause should be IOException");
+                cause = cause.getCause();
+                if (!(cause instanceof ShutdownChannelGroupException))
+                    throw new RuntimeException("IOException cause should be ShutdownChannelGroupException");
+            }
 
-        // initiate another accept even though channel group is shutdown.
-        Future<AsynchronousSocketChannel> res = listener.accept();
-        try {
-            res.get(3, TimeUnit.SECONDS);
-            throw new RuntimeException("TimeoutException expected");
-        } catch (TimeoutException x) {
+            // initiate another accept even though channel group is shutdown.
+            Future<AsynchronousSocketChannel> res = listener.accept();
+            try {
+                res.get(3, TimeUnit.SECONDS);
+                throw new RuntimeException("TimeoutException expected");
+            } catch (TimeoutException x) {
+            }
+            // connect to the listener which should cause the accept to complete
+            AsynchronousSocketChannel.open().connect(isa);
+            try {
+                res.get();
+                throw new RuntimeException("Connection was accepted");
+            } catch (ExecutionException x) {
+                Throwable cause = x.getCause();
+                if (!(cause instanceof IOException))
+                    throw new RuntimeException("Cause should be IOException");
+                cause = cause.getCause();
+                if (!(cause instanceof ShutdownChannelGroupException))
+                    throw new RuntimeException("IOException cause should be ShutdownChannelGroupException");
+            }
+
+            // group should *not* terminate as channels are open
+            boolean terminated = group.awaitTermination(3, TimeUnit.SECONDS);
+            if (terminated) {
+                throw new RuntimeException("Group should not have terminated");
+            }
+        } finally {
+            group.shutdown();
         }
-        // connect to the listener which should cause the accept to complete
-        AsynchronousSocketChannel.open().connect(isa);
-        try {
-            res.get();
-            throw new RuntimeException("Connection was accepted");
-        } catch (ExecutionException x) {
-            Throwable cause = x.getCause();
-            if (!(cause instanceof IOException))
-                throw new RuntimeException("Cause should be IOException");
-            cause = cause.getCause();
-            if (!(cause instanceof ShutdownChannelGroupException))
-                throw new RuntimeException("IOException cause should be ShutdownChannelGroupException");
-        }
-
-        // group should *not* terminate as channels are open
-        boolean terminated = group.awaitTermination(3, TimeUnit.SECONDS);
-        if (terminated)
-            throw new RuntimeException("Group should not have terminated");
-
-        // close channel; group should terminate quickly
-        ch.close();
-        listener.close();
-        awaitTermination(group);
     }
 
     static void miscTests() throws Exception {
--- a/jdk/test/java/nio/channels/AsynchronousChannelGroup/GroupOfOne.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/GroupOfOne.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,34 +41,36 @@
 public class GroupOfOne {
 
     public static void main(String[] args) throws Exception {
+        final List<AsynchronousSocketChannel> accepted = new ArrayList<>();
+
         // create listener to accept connections
-        final AsynchronousServerSocketChannel listener =
-            AsynchronousServerSocketChannel.open()
-                .bind(new InetSocketAddress(0));
-        final List<AsynchronousSocketChannel> accepted = new ArrayList<AsynchronousSocketChannel>();
-        listener.accept((Void)null, new CompletionHandler<AsynchronousSocketChannel,Void>() {
-            public void completed(AsynchronousSocketChannel ch, Void att) {
-                synchronized (accepted) {
-                    accepted.add(ch);
+        try (final AsynchronousServerSocketChannel listener =
+                AsynchronousServerSocketChannel.open()) {
+
+            listener.bind(new InetSocketAddress(0));
+            listener.accept((Void)null, new CompletionHandler<AsynchronousSocketChannel,Void>() {
+                public void completed(AsynchronousSocketChannel ch, Void att) {
+                    synchronized (accepted) {
+                        accepted.add(ch);
+                    }
+                    listener.accept((Void)null, this);
                 }
-                listener.accept((Void)null, this);
-            }
-            public void failed(Throwable exc, Void att) {
-            }
-        });
+                public void failed(Throwable exc, Void att) {
+                }
+            });
 
-        int port = ((InetSocketAddress)(listener.getLocalAddress())).getPort();
-        SocketAddress sa = new InetSocketAddress(InetAddress.getLocalHost(), port);
+            int port = ((InetSocketAddress)(listener.getLocalAddress())).getPort();
+            SocketAddress sa = new InetSocketAddress(InetAddress.getLocalHost(), port);
 
-        test(sa, true, false);
-        test(sa, false, true);
-        test(sa, true, true);
-
-        // clean-up
-        listener.close();
-        synchronized (accepted) {
-            for (AsynchronousSocketChannel ch: accepted) {
-                ch.close();
+            test(sa, true, false);
+            test(sa, false, true);
+            test(sa, true, true);
+        } finally {
+            // clean-up
+            synchronized (accepted) {
+                for (AsynchronousSocketChannel ch: accepted) {
+                    ch.close();
+                }
             }
         }
     }
@@ -86,60 +88,60 @@
                     return new Thread(r);
                 }});
         final AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(group);
+        try {
+            // the latch counts down when:
+            // 1. The read operation fails (expected)
+            // 2. the close/shutdown completes
+            final CountDownLatch latch = new CountDownLatch(2);
 
-        // the latch counts down when:
-        // 1. The read operation fails (expected)
-        // 2. the close/shutdown completes
-        final CountDownLatch latch = new CountDownLatch(2);
+            ch.connect(sa, (Void)null, new CompletionHandler<Void,Void>() {
+                public void completed(Void result, Void att)  {
+                    System.out.println("Connected");
 
-        ch.connect(sa, (Void)null, new CompletionHandler<Void,Void>() {
-            public void completed(Void result, Void att)  {
-                System.out.println("Connected");
+                    // initiate I/O operation that does not complete (successfully)
+                    ByteBuffer buf = ByteBuffer.allocate(100);
+                    ch.read(buf, (Void)null, new CompletionHandler<Integer,Void>() {
+                        public void completed(Integer bytesRead, Void att)  {
+                            throw new RuntimeException();
+                        }
+                        public void failed(Throwable exc, Void att) {
+                            if (!(exc instanceof AsynchronousCloseException))
+                                throw new RuntimeException(exc);
+                            System.out.println("Read failed (expected)");
+                            latch.countDown();
+                        }
+                    });
 
-                // initiate I/O operation that does not complete (successfully)
-                ByteBuffer buf = ByteBuffer.allocate(100);
-                ch.read(buf, (Void)null, new CompletionHandler<Integer,Void>() {
-                    public void completed(Integer bytesRead, Void att)  {
+                    // close channel or shutdown group
+                    try {
+                        if (closeChannel) {
+                            System.out.print("Close channel ...");
+                            ch.close();
+                            System.out.println(" done.");
+                        }
+                        if (shutdownGroup) {
+                            System.out.print("Shutdown group ...");
+                            group.shutdownNow();
+                            System.out.println(" done.");
+                        }
+                        latch.countDown();
+                    } catch (IOException e) {
                         throw new RuntimeException();
                     }
-                    public void failed(Throwable exc, Void att) {
-                        if (!(exc instanceof AsynchronousCloseException))
-                            throw new RuntimeException(exc);
-                        System.out.println("Read failed (expected)");
-                        latch.countDown();
-                    }
-                });
+                }
+                public void failed(Throwable exc, Void att) {
+                    throw new RuntimeException(exc);
+                }
+            });
 
-                // close channel or shutdown group
-                try {
-                    if (closeChannel) {
-                        System.out.print("Close channel ...");
-                        ch.close();
-                        System.out.println(" done.");
-                    }
-                    if (shutdownGroup) {
-                        System.out.print("Shutdown group ...");
-                        group.shutdownNow();
-                        System.out.println(" done.");
-                    }
-                    latch.countDown();
-                } catch (IOException e) {
-                    throw new RuntimeException();
-                }
-            }
-            public void failed(Throwable exc, Void att) {
-                throw new RuntimeException(exc);
-            }
-        });
-
-        latch.await();
-
-        // clean-up
-        group.shutdown();
-        boolean terminated = group.awaitTermination(20, TimeUnit.SECONDS);
-        if (!terminated)
-            throw new RuntimeException("Group did not terminate");
-
+            latch.await();
+        } finally {
+            // clean-up
+            group.shutdown();
+            boolean terminated = group.awaitTermination(20, TimeUnit.SECONDS);
+            if (!terminated)
+                throw new RuntimeException("Group did not terminate");
+        }
         System.out.println("TEST OKAY");
     }
 }
--- a/jdk/test/java/nio/channels/AsynchronousChannelGroup/Identity.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/Identity.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,89 +76,91 @@
     }
 
     public static void main(String[] args) throws Exception {
-        // create listener to accept connections
-        final AsynchronousServerSocketChannel listener =
-            AsynchronousServerSocketChannel.open()
-                .bind(new InetSocketAddress(0));
-        listener.accept((Void)null, new CompletionHandler<AsynchronousSocketChannel,Void>() {
-            public void completed(final AsynchronousSocketChannel ch, Void att) {
-                listener.accept((Void)null, this);
-                final ByteBuffer buf = ByteBuffer.allocate(100);
-                ch.read(buf, ch, new CompletionHandler<Integer,AsynchronousSocketChannel>() {
-                    public void completed(Integer bytesRead, AsynchronousSocketChannel ch) {
-                        if (bytesRead < 0) {
-                            try { ch.close(); } catch (IOException ignore) { }
-                        } else {
-                            buf.clear();
-                            ch.read(buf, ch, this);
-                        }
-                    }
-                    public void failed(Throwable exc, AsynchronousSocketChannel ch) {
-                        try { ch.close(); } catch (IOException ignore) { }
-                    }
-                });
-            }
-            public void failed(Throwable exc, Void att) {
-            }
-        });
-        int port = ((InetSocketAddress)(listener.getLocalAddress())).getPort();
-        SocketAddress sa = new InetSocketAddress(InetAddress.getLocalHost(), port);
-
         // create 3-10 channels, each in its own group
         final int groupCount = 3 + rand.nextInt(8);
-        AsynchronousChannelGroup[] groups = new AsynchronousChannelGroup[groupCount];
+        final AsynchronousChannelGroup[] groups = new AsynchronousChannelGroup[groupCount];
         final AsynchronousSocketChannel[] channels = new AsynchronousSocketChannel[groupCount];
-        for (int i=0; i<groupCount; i++) {
-            ThreadFactory factory = createThreadFactory(i);
-            AsynchronousChannelGroup group;
-            if (rand.nextBoolean()) {
-                int nThreads = 1 + rand.nextInt(10);
-                group = AsynchronousChannelGroup.withFixedThreadPool(nThreads, factory);
-            } else {
-                ExecutorService pool = Executors.newCachedThreadPool(factory);
-                group = AsynchronousChannelGroup.withCachedThreadPool(pool, rand.nextInt(5));
-            }
-            groups[i] = group;
+
+        // create listener to accept connections
+        try (final AsynchronousServerSocketChannel listener =
+                AsynchronousServerSocketChannel.open()) {
 
-            // create channel in group and connect it to the server
-            AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(group);
-            ch.connect(sa).get();
-            channels[i] = ch;
-        }
+            listener.bind(new InetSocketAddress(0));
+            listener.accept((Void)null, new CompletionHandler<AsynchronousSocketChannel,Void>() {
+                public void completed(final AsynchronousSocketChannel ch, Void att) {
+                    listener.accept((Void)null, this);
+                    final ByteBuffer buf = ByteBuffer.allocate(100);
+                    ch.read(buf, ch, new CompletionHandler<Integer,AsynchronousSocketChannel>() {
+                        public void completed(Integer bytesRead, AsynchronousSocketChannel ch) {
+                            if (bytesRead < 0) {
+                                try { ch.close(); } catch (IOException ignore) { }
+                            } else {
+                                buf.clear();
+                                ch.read(buf, ch, this);
+                            }
+                        }
+                        public void failed(Throwable exc, AsynchronousSocketChannel ch) {
+                            try { ch.close(); } catch (IOException ignore) { }
+                        }
+                    });
+                }
+                public void failed(Throwable exc, Void att) {
+                }
+            });
+            int port = ((InetSocketAddress)(listener.getLocalAddress())).getPort();
+            SocketAddress sa = new InetSocketAddress(InetAddress.getLocalHost(), port);
 
-        // randomly write to each channel, ensuring that the completion handler
-        // is always invoked by a thread with the right identity.
-        final AtomicInteger writeCount = new AtomicInteger(100);
-        channels[0].write(getBuffer(), 0, new CompletionHandler<Integer,Integer>() {
-            public void completed(Integer bytesWritten, Integer groupId) {
-                if (bytesWritten != 1)
-                    fail("Expected 1 byte to be written");
-                if (!myGroup.get().equals(groupId))
-                    fail("Handler invoked by thread with the wrong identity");
-                if (writeCount.decrementAndGet() > 0) {
-                    int id = rand.nextInt(groupCount);
-                    channels[id].write(getBuffer(), id, this);
+            for (int i=0; i<groupCount; i++) {
+                ThreadFactory factory = createThreadFactory(i);
+                AsynchronousChannelGroup group;
+                if (rand.nextBoolean()) {
+                    int nThreads = 1 + rand.nextInt(10);
+                    group = AsynchronousChannelGroup.withFixedThreadPool(nThreads, factory);
                 } else {
-                    done.countDown();
+                    ExecutorService pool = Executors.newCachedThreadPool(factory);
+                    group = AsynchronousChannelGroup.withCachedThreadPool(pool, rand.nextInt(5));
                 }
+                groups[i] = group;
+
+                // create channel in group and connect it to the server
+                AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(group);
+                ch.connect(sa).get();
+                channels[i] = ch;
             }
-            public void failed(Throwable exc, Integer groupId) {
-                fail(exc.getMessage());
-            }
-        });
-
-        // wait until done
-        done.await();
 
-        // clean-up
-        for (AsynchronousSocketChannel ch: channels)
-            ch.close();
-        for (AsynchronousChannelGroup group: groups)
-            group.shutdownNow();
-        listener.close();
+            // randomly write to each channel, ensuring that the completion handler
+            // is always invoked by a thread with the right identity.
+            final AtomicInteger writeCount = new AtomicInteger(100);
+            channels[0].write(getBuffer(), 0, new CompletionHandler<Integer,Integer>() {
+                public void completed(Integer bytesWritten, Integer groupId) {
+                    if (bytesWritten != 1)
+                        fail("Expected 1 byte to be written");
+                    if (!myGroup.get().equals(groupId))
+                        fail("Handler invoked by thread with the wrong identity");
+                    if (writeCount.decrementAndGet() > 0) {
+                        int id = rand.nextInt(groupCount);
+                        channels[id].write(getBuffer(), id, this);
+                    } else {
+                        done.countDown();
+                    }
+                }
+                public void failed(Throwable exc, Integer groupId) {
+                    fail(exc.getMessage());
+                }
+            });
 
-        if (failed.get())
-            throw new RuntimeException("Test failed - see log for details");
+            // wait until done
+            done.await();
+        } finally {
+            // clean-up
+            for (AsynchronousSocketChannel ch: channels)
+                ch.close();
+            for (AsynchronousChannelGroup group: groups)
+                group.shutdownNow();
+
+            if (failed.get())
+                throw new RuntimeException("Test failed - see log for details");
+        }
     }
 
     static ByteBuffer getBuffer() {
--- a/jdk/test/java/nio/channels/AsynchronousChannelGroup/Restart.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/Restart.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,21 +66,30 @@
         // group with fixed thread pool
         int nThreads = 1 + rand.nextInt(4);
         AsynchronousChannelGroup group =
-            AsynchronousChannelGroup.withFixedThreadPool(nThreads, factory);
-        testRestart(group, 100);
-        group.shutdown();
+                AsynchronousChannelGroup.withFixedThreadPool(nThreads, factory);
+        try {
+            testRestart(group, 100);
+        } finally {
+            group.shutdown();
+        }
 
         // group with cached thread pool
         ExecutorService pool = Executors.newCachedThreadPool(factory);
         group = AsynchronousChannelGroup.withCachedThreadPool(pool, rand.nextInt(5));
-        testRestart(group, 100);
-        group.shutdown();
+        try {
+            testRestart(group, 100);
+        } finally {
+            group.shutdown();
+        }
 
         // group with custom thread pool
-        group = AsynchronousChannelGroup
-                .withThreadPool(Executors.newFixedThreadPool(1+rand.nextInt(5), factory));
-        testRestart(group, 100);
-        group.shutdown();
+        group = AsynchronousChannelGroup.withThreadPool(
+                Executors.newFixedThreadPool(1+rand.nextInt(5), factory));
+        try {
+            testRestart(group, 100);
+        } finally {
+            group.shutdown();
+        }
 
         // give time for threads to terminate
         Thread.sleep(3000);
@@ -92,45 +101,43 @@
     static void testRestart(AsynchronousChannelGroup group, int count)
         throws Exception
     {
-        AsynchronousServerSocketChannel listener =
-            AsynchronousServerSocketChannel.open(group)
-                .bind(new InetSocketAddress(0));
+        try (AsynchronousServerSocketChannel listener =
+                AsynchronousServerSocketChannel.open(group)) {
 
-        for (int i=0; i<count; i++) {
-            final CountDownLatch latch = new CountDownLatch(1);
+            listener.bind(new InetSocketAddress(0));
+            for (int i=0; i<count; i++) {
+                final CountDownLatch latch = new CountDownLatch(1);
 
-            listener.accept((Void)null, new CompletionHandler<AsynchronousSocketChannel,Void>() {
-                public void completed(AsynchronousSocketChannel ch, Void att) {
-                    try {
-                        ch.close();
-                    } catch (IOException ignore) { }
+                listener.accept((Void)null, new CompletionHandler<AsynchronousSocketChannel,Void>() {
+                    public void completed(AsynchronousSocketChannel ch, Void att) {
+                        try {
+                            ch.close();
+                        } catch (IOException ignore) { }
 
-                    latch.countDown();
+                        latch.countDown();
 
-                    // throw error or runtime exception
-                    if (rand.nextBoolean()) {
-                        throw new Error();
-                    } else {
-                        throw new RuntimeException();
+                        // throw error or runtime exception
+                        if (rand.nextBoolean()) {
+                            throw new Error();
+                        } else {
+                            throw new RuntimeException();
+                        }
                     }
-                }
-                public void failed(Throwable exc, Void att) {
-                }
-            });
+                    public void failed(Throwable exc, Void att) {
+                    }
+                });
 
-            // establish loopback connection which should cause completion
-            // handler to be invoked.
-            int port = ((InetSocketAddress)(listener.getLocalAddress())).getPort();
-            AsynchronousSocketChannel ch = AsynchronousSocketChannel.open();
-            InetAddress lh = InetAddress.getLocalHost();
-            ch.connect(new InetSocketAddress(lh, port)).get();
-            ch.close();
+                // establish loopback connection which should cause completion
+                // handler to be invoked.
+                int port = ((InetSocketAddress)(listener.getLocalAddress())).getPort();
+                try (AsynchronousSocketChannel ch = AsynchronousSocketChannel.open()) {
+                    InetAddress lh = InetAddress.getLocalHost();
+                    ch.connect(new InetSocketAddress(lh, port)).get();
+                }
 
-            // wait for handler to be invoked
-            latch.await();
+                // wait for handler to be invoked
+                latch.await();
+            }
         }
-
-        // clean-up
-        listener.close();
     }
 }
--- a/jdk/test/java/nio/channels/FileChannel/Lock.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/java/nio/channels/FileChannel/Lock.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,8 +22,8 @@
  */
 
 /* @test
- * @bug 4429043 4493595 6332756 6709457
- * @summary The FileChannel file locking
+ * @bug 4429043 4493595 6332756 6709457 7146506
+ * @summary Test FileChannel file locking
  */
 
 import java.io.*;
@@ -33,17 +33,14 @@
 /**
  * Testing FileChannel's lock method.
  */
-
 public class Lock {
 
     public static void main(String[] args) throws Exception {
-        if (args.length > 0) {
-            if(args[0].equals("1")) {
-                MadWriter mw = new MadWriter(args[1], false);
-            } else {
-                MadWriter mw = new MadWriter(args[1], true);
-            }
+        if (args.length == 2) {
+            attemptLock(args[1], args[0].equals("2"));
             return;
+        } else if (args.length != 0) {
+            throw new RuntimeException("Wrong number of parameters.");
         }
         File blah = File.createTempFile("blah", null);
         blah.deleteOnExit();
@@ -56,120 +53,128 @@
         test2(blah, false);
         test3(blah);
         test4(blah);
-        blah.delete();
-    }
-
-    private static void test2(File blah, boolean b) throws Exception {
-        RandomAccessFile raf = new RandomAccessFile(blah, "rw");
-        FileChannel channel = raf.getChannel();
-        FileLock lock;
-        if (b)
-            lock = channel.lock();
-        else
-            lock = channel.tryLock();
-        lock.release();
-        channel.close();
     }
 
+    /**
+     * Test mutual locking with other process
+     */
     static void test1(File blah, String str) throws Exception {
+        try (RandomAccessFile fis = new RandomAccessFile(blah, "rw")) {
+            FileChannel fc = fis.getChannel();
+            FileLock lock = null;
 
-        // Grab the lock
-        RandomAccessFile fis = new RandomAccessFile(blah, "rw");
-        FileChannel fc = fis.getChannel();
-        FileLock lock = null;
+            // grab the lock
+            if (str.equals("1")) {
+                lock = fc.lock(0, 10, false);
+                if (lock == null)
+                    throw new RuntimeException("Lock should not return null");
+                try {
+                    fc.lock(5, 10, false);
+                    throw new RuntimeException("Overlapping locks allowed");
+                } catch (OverlappingFileLockException e) {} // correct result
+            }
+
+            // execute the tamperer
+            String command = System.getProperty("java.home") +
+                File.separator + "bin" + File.separator + "java";
+            String testClasses = System.getProperty("test.classes");
+            if (testClasses != null)
+                command += " -cp " + testClasses;
+            command += " Lock " + str + " " + blah;
+            Process p = Runtime.getRuntime().exec(command);
 
-        if (str.equals("1")) {
-            lock = fc.lock(0, 10, false);
-            if (lock == null)
-                throw new RuntimeException("Lock should not return null");
-            try {
-                FileLock lock2 = fc.lock(5, 10, false);
-                throw new RuntimeException("Overlapping locks allowed");
-            } catch (OverlappingFileLockException e) {
-                // Correct result
+            // evaluate System.out of child process
+            String s;
+            boolean hasOutput = false;
+            InputStreamReader isr;
+            isr = new InputStreamReader(p.getInputStream());
+            BufferedReader br = new BufferedReader(isr);
+            while ((s = br.readLine()) != null) {
+                // only throw on Unix as windows over NFS fails...
+                if ((File.separatorChar == '/') && !s.equals("good")) {
+                    throw new RuntimeException("Failed: " + s);
+                }
+                hasOutput = true;
+            }
+
+            // evaluate System.err in case of System.out of child process
+            // was empty
+            if (!hasOutput) {
+                isr = new InputStreamReader(p.getErrorStream());
+                br = new BufferedReader(isr);
+                if ((s = br.readLine()) != null) {
+                    System.err.println("Error output:");
+                    System.err.println(s);
+                    while ((s = br.readLine()) != null) {
+                        System.err.println(s);
+                    }
+                }
+                throw new RuntimeException("Failed, no output");
+            }
+
+            // clean up, check multiple releases
+            if (lock != null) {
+                lock.release();
+                lock.release();
             }
         }
-
-        // Exec the tamperer
-        String command = System.getProperty("java.home") +
-            File.separator + "bin" + File.separator + "java";
-        String testClasses = System.getProperty("test.classes");
-        if (testClasses != null)
-            command += " -cp " + testClasses;
-        command += " Lock " + str + " " + blah;
-        Process p = Runtime.getRuntime().exec(command);
-
-        BufferedReader in = new BufferedReader
-            (new InputStreamReader(p.getInputStream()));
+    }
 
-        String s;
-        int count = 0;
-        while ((s = in.readLine()) != null) {
-            if (!s.equals("good")) {
-                if (File.separatorChar == '/') {
-                    // Fails on windows over NFS...
-                    throw new RuntimeException("Failed: "+s);
-                }
-            }
-            count++;
-        }
-
-        if (count == 0) {
-            in = new BufferedReader(new InputStreamReader(p.getErrorStream()));
-            while ((s = in.readLine()) != null) {
-                System.err.println("Error output: " + s);
-            }
-            throw new RuntimeException("Failed, no output");
-        }
-
-        // Clean up
-        if (lock != null) {
-            /* Check multiple releases */
-            lock.release();
+    /**
+     * Basic test for FileChannel.lock() and FileChannel.tryLock()
+     */
+    static void test2(File blah, boolean b) throws Exception {
+        try (RandomAccessFile raf = new RandomAccessFile(blah, "rw")) {
+            FileChannel channel = raf.getChannel();
+            FileLock lock;
+            if (b)
+                lock = channel.lock();
+            else
+                lock = channel.tryLock();
             lock.release();
         }
-        fc.close();
-        fis.close();
     }
 
-    // The overlap check for file locks should be JVM-wide
-    private static void test3(File blah) throws Exception {
-        FileChannel fc1 = new RandomAccessFile(blah, "rw").getChannel();
-        FileChannel fc2 = new RandomAccessFile(blah, "rw").getChannel();
+    /**
+     * Test that overlapping file locking is not possible when using different
+     * FileChannel objects to the same file path
+     */
+    static void test3(File blah) throws Exception {
+        try (RandomAccessFile raf1 = new RandomAccessFile(blah, "rw");
+             RandomAccessFile raf2 = new RandomAccessFile(blah, "rw"))
+        {
+            FileChannel fc1 = raf1.getChannel();
+            FileChannel fc2 = raf2.getChannel();
 
-        // lock via one channel, and then attempt to lock the same file
-        // using a second channel
-        FileLock fl1 = fc1.lock();
-        try {
-            fc2.tryLock();
-            throw new RuntimeException("Overlapping locks allowed");
-        } catch (OverlappingFileLockException x) {
-        }
-        try {
+            // lock via one channel, and then attempt to lock the same file
+            // using a second channel
+            FileLock fl1 = fc1.lock();
+            try {
+                fc2.tryLock();
+                throw new RuntimeException("Overlapping locks allowed");
+            } catch (OverlappingFileLockException x) {}
+            try {
+                fc2.lock();
+                throw new RuntimeException("Overlapping locks allowed");
+            } catch (OverlappingFileLockException x) {}
+
+            // release lock and the attempt to lock with the second channel
+            // should succeed.
+            fl1.release();
             fc2.lock();
-            throw new RuntimeException("Overlapping locks allowed");
-        } catch (OverlappingFileLockException x) {
+            try {
+                fc1.lock();
+                throw new RuntimeException("Overlapping locks allowed");
+            } catch (OverlappingFileLockException x) {}
         }
-
-        // release lock and the attempt to lock with the second channel
-        // should succeed.
-        fl1.release();
-        FileLock fl2 = fc2.lock();
-        try {
-            fc1.lock();
-            throw new RuntimeException("Overlapping locks allowed");
-        } catch (OverlappingFileLockException x) {
-        }
-
-        fc1.close();
-        fc2.close();
     }
 
     /**
      * Test file locking when file is opened for append
      */
     static void test4(File blah) throws Exception {
-        try (FileChannel fc = new FileOutputStream(blah, true).getChannel()) {
+        try (FileOutputStream fos = new FileOutputStream(blah, true)) {
+            FileChannel fc = fos.getChannel();
             fc.tryLock().release();
             fc.tryLock(0L, 1L, false).release();
             fc.lock().release();
@@ -182,30 +187,31 @@
             fc.lock(0L, 1L, false).release();
         }
     }
-}
 
-class MadWriter {
-    public MadWriter(String s, boolean b) throws Exception {
-        File f = new File(s);
-        RandomAccessFile fos = new RandomAccessFile(f, "rw");
-        FileChannel fc = fos.getChannel();
-        if (fc.tryLock(10, 10, false) == null) {
-            System.out.println("bad: Failed to grab adjacent lock");
+    /**
+     * Utility method to be run in secondary process which tries to acquire a
+     * lock on a FileChannel
+     */
+    static void attemptLock(String fileName,
+                            boolean expectsLock) throws Exception
+    {
+        File f = new File(fileName);
+        try (RandomAccessFile raf = new RandomAccessFile(f, "rw")) {
+            FileChannel fc = raf.getChannel();
+            if (fc.tryLock(10, 10, false) == null) {
+                System.out.println("bad: Failed to grab adjacent lock");
+            }
+            if (fc.tryLock(0, 10, false) == null) {
+                if (expectsLock)
+                    System.out.println("bad");
+                else
+                    System.out.println("good");
+            } else {
+                if (expectsLock)
+                    System.out.println("good");
+                else
+                    System.out.println("bad");
+            }
         }
-        FileLock lock = fc.tryLock(0, 10, false);
-        if (lock == null) {
-            if (b)
-                System.out.println("bad");
-            else
-                System.out.println("good");
-        } else {
-            if (b)
-                System.out.println("good");
-            else
-                System.out.println("bad");
-        }
-        fc.close();
-        fos.close();
     }
-
 }
--- a/jdk/test/java/nio/file/Files/probeContentType/Basic.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/java/nio/file/Files/probeContentType/Basic.java	Fri Aug 26 14:47:52 2016 -0700
@@ -95,7 +95,7 @@
         return 0;
     }
 
-    static int checkContentTypes(String[] extensions, String[][] expectedTypes)
+    static int checkContentTypes(String[] extensions, String[] expectedTypes)
         throws IOException {
         if (extensions.length != expectedTypes.length) {
             System.err.println("Parameter array lengths differ");
@@ -112,27 +112,10 @@
                     System.err.println("Content type of " + extension
                             + " cannot be determined");
                     failures++;
-                } else {
-                    boolean isTypeFound = false;
-                    for (String s : expectedTypes[i]) {
-                        if (type.equals(s)) {
-                            isTypeFound = true;
-                            break;
-                        }
-                    }
-                    if (!isTypeFound) {
-                        System.err.printf("Content type: %s; expected: ", type);
-                        int j = 0;
-                        for (String s : expectedTypes[i]) {
-                            if (j++ == 0) {
-                                System.err.printf("%s", s);
-                            } else {
-                                System.err.printf(", or %s", s);
-                            }
-                        }
-                        System.err.println();
-                        failures++;
-                    }
+                } else if (!type.equals(expectedTypes[i])) {
+                    System.err.printf("Content type: %s; expected: %s%n",
+                        type, expectedTypes);
+                    failures++;
                 }
             } finally {
                 Files.delete(file);
@@ -174,8 +157,6 @@
 
         // Verify that certain media extensions are mapped to the correct type.
         String[] extensions = new String[]{
-            "aac",
-            "flac",
             "jpg",
             "mp3",
             "mp4",
@@ -183,15 +164,13 @@
             "png",
             "webm"
         };
-        String[][] expectedTypes = new String[][] {
-            {"audio/aac", "audio/x-aac", "audio/vnd.dlna.adts"},
-            {"audio/flac", "audio/x-flac"},
-            {"image/jpeg"},
-            {"audio/mpeg"},
-            {"video/mp4"},
-            {"application/pdf"},
-            {"image/png"},
-            {"video/webm"}
+        String[] expectedTypes = new String[] {
+            "image/jpeg",
+            "audio/mpeg",
+            "video/mp4",
+            "application/pdf",
+            "image/png",
+            "video/webm"
         };
         failures += checkContentTypes(extensions, expectedTypes);
 
--- a/jdk/test/java/nio/file/Path/PathOps.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/java/nio/file/Path/PathOps.java	Fri Aug 26 14:47:52 2016 -0700
@@ -197,6 +197,19 @@
         return this;
     }
 
+    PathOps relativizeFail(String other) {
+        out.format("test relativize %s\n", other);
+        checkPath();
+        Path that = FileSystems.getDefault().getPath(other);
+        try {
+            Path result = path.relativize(that);
+            out.format("\tExpected: IllegalArgumentException");
+            out.format("\tActual: %s\n",  result);
+            fail();
+        } catch (IllegalArgumentException expected) { }
+        return this;
+    }
+
     PathOps normalize(String expected) {
         out.println("check normalized path");
         checkPath();
@@ -572,29 +585,709 @@
             .resolveSibling("C:\\", "C:\\");
 
         // relativize
-        test("foo")
-            .relativize("foo", "")
-            .relativize("bar", "..\\bar")
+        test("C:\\a")
+            .relativize("C:\\a", "")
+            .relativize("C:\\", "..")
+            .relativize("C:\\.", "..")
+            .relativize("C:\\..", "..")
+            .relativize("C:\\..\\..", "..")
+            .relativize("C:\\a\\b", "b")
+            .relativize("C:\\a\\b\\c", "b\\c")
+            .relativize("C:\\a\\.", "")        // "." also valid
+            .relativize("C:\\a\\..", "..")
+            .relativize("C:\\x", "..\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("\\")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("C:\\a\\b")
+            .relativize("C:\\a\\b", "")
+            .relativize("C:\\a", "..")
+            .relativize("C:\\", "..\\..")
+            .relativize("C:\\.", "..\\..")
+            .relativize("C:\\..", "..\\..")
+            .relativize("C:\\..\\..", "..\\..")
+            .relativize("C:\\a\\b\\c", "c")
+            .relativize("C:\\a\\.", "..")
+            .relativize("C:\\a\\..", "..\\..")
+            .relativize("C:\\x", "..\\..\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("\\")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("C:\\a\\b\\c")
+            .relativize("C:\\a\\b\\c", "")
+            .relativize("C:\\a\\b", "..")
+            .relativize("C:\\a", "..\\..")
+            .relativize("C:\\", "..\\..\\..")
+            .relativize("C:\\.", "..\\..\\..")
+            .relativize("C:\\..", "..\\..\\..")
+            .relativize("C:\\..\\..", "..\\..\\..")
+            .relativize("C:\\..\\..\\..", "..\\..\\..")
+            .relativize("C:\\..\\..\\..\\..", "..\\..\\..")
+            .relativize("C:\\a\\b\\c\\d", "d")
+            .relativize("C:\\a\\b\\c\\d\\e", "d\\e")
+            .relativize("C:\\a\\b\\c\\.", "")        // "." also valid
+            .relativize("C:\\a\\b\\c\\..", "..")
+            .relativize("C:\\a\\x", "..\\..\\x")
+            .relativize("C:\\x", "..\\..\\..\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("\\")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("C:\\..\\a")
+            .relativize("C:\\a", "")
+            .relativize("C:\\", "..")
+            .relativize("C:\\.", "..")
+            .relativize("C:\\..", "..")
+            .relativize("C:\\..\\..", "..")
+            .relativize("C:\\a\\b", "b")
+            .relativize("C:\\a\\b\\c", "b\\c")
+            .relativize("C:\\a\\.", "")        // "." also valid
+            .relativize("C:\\a\\..", "..")
+            .relativize("C:\\x", "..\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("\\")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("C:\\..\\a\\b")
+            .relativize("C:\\a\\b", "")
+            .relativize("C:\\a", "..")
+            .relativize("C:\\", "..\\..")
+            .relativize("C:\\.", "..\\..")
+            .relativize("C:\\..", "..\\..")
+            .relativize("C:\\..\\..", "..\\..")
+            .relativize("C:\\..\\..\\..", "..\\..")
+            .relativize("C:\\..\\..\\..\\..", "..\\..")
+            .relativize("C:\\a\\b\\c", "c")
+            .relativize("C:\\a\\b\\.", "")        // "." also valid
+            .relativize("C:\\a\\b\\..", "..")
+            .relativize("C:\\a\\x", "..\\x")
+            .relativize("C:\\x", "..\\..\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("\\")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("C:\\..\\..\\a\\b")
+            .relativize("C:\\a\\b", "")
+            .relativize("C:\\a", "..")
+            .relativize("C:\\", "..\\..")
+            .relativize("C:\\.", "..\\..")
+            .relativize("C:\\..", "..\\..")
+            .relativize("C:\\..\\..", "..\\..")
+            .relativize("C:\\..\\..\\..", "..\\..")
+            .relativize("C:\\..\\..\\..\\..", "..\\..")
+            .relativize("C:\\a\\b\\c", "c")
+            .relativize("C:\\a\\b\\.", "")        // "." also valid
+            .relativize("C:\\a\\b\\..", "..")
+            .relativize("C:\\a\\x", "..\\x")
+            .relativize("C:\\x", "..\\..\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("\\")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("C:\\..\\a\\b\\c")
+            .relativize("C:\\a\\b\\c", "")
+            .relativize("C:\\a\\b", "..")
+            .relativize("C:\\a", "..\\..")
+            .relativize("C:\\", "..\\..\\..")
+            .relativize("C:\\.", "..\\..\\..")
+            .relativize("C:\\..", "..\\..\\..")
+            .relativize("C:\\..\\..", "..\\..\\..")
+            .relativize("C:\\..\\..\\..", "..\\..\\..")
+            .relativize("C:\\..\\..\\..\\..", "..\\..\\..")
+            .relativize("C:\\a\\b\\c\\d", "d")
+            .relativize("C:\\a\\b\\c\\d\\e", "d\\e")
+            .relativize("C:\\a\\b\\c\\.", "")        // "." also valid
+            .relativize("C:\\a\\b\\c\\..", "..")
+            .relativize("C:\\a\\x", "..\\..\\x")
+            .relativize("C:\\x", "..\\..\\..\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("\\")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("C:\\..\\..\\a\\b\\c")
+            .relativize("C:\\a\\b\\c", "")
+            .relativize("C:\\a\\b", "..")
+            .relativize("C:\\a", "..\\..")
+            .relativize("C:\\", "..\\..\\..")
+            .relativize("C:\\.", "..\\..\\..")
+            .relativize("C:\\..", "..\\..\\..")
+            .relativize("C:\\..\\..", "..\\..\\..")
+            .relativize("C:\\..\\..\\..", "..\\..\\..")
+            .relativize("C:\\..\\..\\..\\..", "..\\..\\..")
+            .relativize("C:\\a\\b\\c\\d", "d")
+            .relativize("C:\\a\\b\\c\\d\\e", "d\\e")
+            .relativize("C:\\a\\b\\c\\.", "")        // "." also valid
+            .relativize("C:\\a\\b\\c\\..", "..")
+            .relativize("C:\\a\\x", "..\\..\\x")
+            .relativize("C:\\x", "..\\..\\..\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("\\")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("C:\\..\\..\\..\\a\\b\\c")
+            .relativize("C:\\a\\b\\c", "")
+            .relativize("C:\\a\\b", "..")
+            .relativize("C:\\a", "..\\..")
+            .relativize("C:\\", "..\\..\\..")
+            .relativize("C:\\.", "..\\..\\..")
+            .relativize("C:\\..", "..\\..\\..")
+            .relativize("C:\\..\\..", "..\\..\\..")
+            .relativize("C:\\..\\..\\..", "..\\..\\..")
+            .relativize("C:\\..\\..\\..\\..", "..\\..\\..")
+            .relativize("C:\\a\\b\\c\\d", "d")
+            .relativize("C:\\a\\b\\c\\d\\e", "d\\e")
+            .relativize("C:\\a\\b\\c\\.", "")        // "." also valid
+            .relativize("C:\\a\\b\\c\\..", "..")
+            .relativize("C:\\a\\x", "..\\..\\x")
+            .relativize("C:\\x", "..\\..\\..\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("\\")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("C:\\.\\a")
+            .relativize("C:\\a", "")
+            .relativize("C:\\", "..")
+            .relativize("C:\\.", "..")
+            .relativize("C:\\..", "..")
+            .relativize("C:\\..\\..", "..")
+            .relativize("C:\\a\\b", "b")
+            .relativize("C:\\a\\b\\c", "b\\c")
+            .relativize("C:\\a\\.", "")        // "." also valid
+            .relativize("C:\\a\\..", "..")
+            .relativize("C:\\x", "..\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("\\")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("C:\\..\\a")
+            .relativize("C:\\a", "")
+            .relativize("C:\\", "..")
+            .relativize("C:\\.", "..")
+            .relativize("C:\\..", "..")
+            .relativize("C:\\..\\..", "..")
+            .relativize("C:\\a\\b", "b")
+            .relativize("C:\\a\\b\\c", "b\\c")
+            .relativize("C:\\a\\.", "")        // "." also valid
+            .relativize("C:\\a\\..", "..")
+            .relativize("C:\\x", "..\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("\\")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("C:\\a\\..")
+            .relativize("C:\\a", "a")
+            .relativize("C:\\", "")          // "." is also valid
+            .relativize("C:\\.", "")
+            .relativize("C:\\..", "")
+            .relativize("C:\\..\\..", "")
+            .relativize("C:\\a\\.", "a")
+            .relativize("C:\\a\\..", "")
+            .relativize("C:\\x", "x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("\\")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("C:a")
+            .relativize("C:a", "")
+            .relativize("C:", "..")
+            .relativize("C:.", "..")
+            .relativize("C:..", "..\\..")
+            .relativize("C:..\\..", "..\\..\\..")
+            .relativize("C:.\\..", "..\\..")
+            .relativize("C:a\\b", "b")
+            .relativize("C:a\\b\\c", "b\\c")
+            .relativize("C:..\\x", "..\\..\\x")
+            .relativizeFail("C:\\x")
+            .relativizeFail("x")
+            .relativizeFail("\\")
+            .relativizeFail("\\x");
+        test("C:a\\b")
+            .relativize("C:a\\b", "")
+            .relativize("C:a", "..")
+            .relativize("C:", "..\\..")
+            .relativize("C:.", "..\\..")
+            .relativize("C:..", "..\\..\\..")
+            .relativize("C:..\\..", "..\\..\\..\\..")
+            .relativize("C:.\\..", "..\\..\\..")
+            .relativize("C:a\\b\\c", "c")
+            .relativize("C:..\\x", "..\\..\\..\\x")
+            .relativizeFail("C:\\x")
+            .relativizeFail("x")
+            .relativizeFail("\\")
+            .relativizeFail("\\x");
+        test("C:a\\b\\c")
+            .relativize("C:a\\b\\c", "")
+            .relativize("C:a\\b", "..")
+            .relativize("C:a", "..\\..")
+            .relativize("C:", "..\\..\\..")
+            .relativize("C:.", "..\\..\\..")
+            .relativize("C:..", "..\\..\\..\\..")
+            .relativize("C:..\\..", "..\\..\\..\\..\\..")
+            .relativize("C:.\\..", "..\\..\\..\\..")
+            .relativize("C:a\\b\\c\\d", "d")
+            .relativize("C:a\\b\\c\\d\\e", "d\\e")
+            .relativize("C:a\\x", "..\\..\\x")
+            .relativize("C:..\\x", "..\\..\\..\\..\\x")
+            .relativizeFail("C:\\x")
+            .relativizeFail("x")
+            .relativizeFail("\\")
+            .relativizeFail("\\x");
+        test("C:")
+            .relativize("C:a", "a")
+            .relativize("C:a\\b\\c", "a\\b\\c")
+            .relativize("C:", "")
+            .relativize("C:.", "")              // "" also valid
+            .relativize("C:..", "..")
+            .relativize("C:..\\..", "..\\..")
+            .relativize("C:.\\..", "..")
+            .relativizeFail("C:\\x")
+            .relativizeFail("\\")
+            .relativizeFail("\\x");
+        test("C:..")
+            .relativize("C:..\\a", "a")
+            .relativize("C:..", "")
+            .relativize("C:.\\..", "")
+            .relativizeFail("C:\\x")
+            .relativizeFail("\\")
+            .relativizeFail("\\x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("x");
+        test("C:..\\a")
+            .relativize("C:..\\a\\b", "b")
+            .relativize("C:..\\a", "")
+            .relativize("C:..", "..")
+            .relativize("C:.\\..", "..")
+            .relativizeFail("C:\\x")
+            .relativizeFail("\\")
+            .relativizeFail("\\x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("x");
+        test("C:..\\a\\b")
+            .relativize("C:..\\a\\b\\c", "c")
+            .relativize("C:..\\a\\b", "")
+            .relativize("C:..\\a", "..")
+            .relativize("C:..", "..\\..")
+            .relativize("C:.\\..", "..\\..")
+            .relativizeFail("C:\\x")
+            .relativizeFail("\\")
+            .relativizeFail("\\x")
+            .relativizeFail("")
+            .relativizeFail("x");
+        test("C:a\\..")
+            .relativize("C:b", "b")
+            .relativize("C:", "")
+            .relativize("C:.", "")       // "." also valid
+            .relativize("C:..", "..")
+            .relativize("C:a\\..\\b", "b")
+            .relativize("C:a\\..", "")
+            .relativize("C:..\\b", "..\\b")
+            .relativize("C:b\\..", "")
+            .relativizeFail("C:\\x")
+            .relativizeFail("\\")
+            .relativizeFail("\\x")
+            .relativizeFail("x");
+        test("C:a\\..\\b")
+            .relativize("C:a\\..\\b", "")
+            .relativize("C:a\\..", "..")
+            .relativize("C:", "..")
+            .relativize("C:.", "..")
+            .relativize("C:..", "..\\..")
+            .relativize("C:b", "")
+            .relativize("C:c", "..\\c")
+            .relativize("C:..\\c", "..\\..\\c")
+            .relativize("C:a\\..\\b\\c", "c")
+            .relativizeFail("C:\\x")
+            .relativizeFail("\\")
+            .relativizeFail("\\x")
+            .relativizeFail("x");
+        test("\\a")
+            .relativize("\\a", "")
+            .relativize("\\", "..")
+            .relativize("\\.", "..")
+            .relativize("\\..", "..")
+            .relativize("\\..\\..", "..")
+            .relativize("\\a\\b", "b")
+            .relativize("\\a\\b\\c", "b\\c")
+            .relativize("\\a\\.", "")        // "." also valid
+            .relativize("\\a\\..", "..")
+            .relativize("\\x", "..\\x")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("\\a\\b")
+            .relativize("\\a\\b", "")
+            .relativize("\\a", "..")
+            .relativize("\\", "..\\..")
+            .relativize("\\.", "..\\..")
+            .relativize("\\..", "..\\..")
+            .relativize("\\..\\..", "..\\..")
+            .relativize("\\a\\b\\c", "c")
+            .relativize("\\a\\.", "..")
+            .relativize("\\a\\..", "..\\..")
+            .relativize("\\x", "..\\..\\x")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("\\a\\b\\c")
+            .relativize("\\a\\b\\c", "")
+            .relativize("\\a\\b", "..")
+            .relativize("\\a", "..\\..")
+            .relativize("\\", "..\\..\\..")
+            .relativize("\\.", "..\\..\\..")
+            .relativize("\\..", "..\\..\\..")
+            .relativize("\\..\\..", "..\\..\\..")
+            .relativize("\\..\\..\\..", "..\\..\\..")
+            .relativize("\\..\\..\\..\\..", "..\\..\\..")
+            .relativize("\\a\\b\\c\\d", "d")
+            .relativize("\\a\\b\\c\\d\\e", "d\\e")
+            .relativize("\\a\\b\\c\\.", "")        // "." also valid
+            .relativize("\\a\\b\\c\\..", "..")
+            .relativize("\\a\\x", "..\\..\\x")
+            .relativize("\\x", "..\\..\\..\\x")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("\\..\\a")
+            .relativize("\\a", "")
+            .relativize("\\", "..")
+            .relativize("\\.", "..")
+            .relativize("\\..", "..")
+            .relativize("\\..\\..", "..")
+            .relativize("\\a\\b", "b")
+            .relativize("\\a\\b\\c", "b\\c")
+            .relativize("\\a\\.", "")        // "." also valid
+            .relativize("\\a\\..", "..")
+            .relativize("\\x", "..\\x")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("\\..\\a\\b")
+            .relativize("\\a\\b", "")
+            .relativize("\\a", "..")
+            .relativize("\\", "..\\..")
+            .relativize("\\.", "..\\..")
+            .relativize("\\..", "..\\..")
+            .relativize("\\..\\..", "..\\..")
+            .relativize("\\..\\..\\..", "..\\..")
+            .relativize("\\..\\..\\..\\..", "..\\..")
+            .relativize("\\a\\b\\c", "c")
+            .relativize("\\a\\b\\.", "")        // "." also valid
+            .relativize("\\a\\b\\..", "..")
+            .relativize("\\a\\x", "..\\x")
+            .relativize("\\x", "..\\..\\x")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("\\..\\..\\a\\b")
+            .relativize("\\a\\b", "")
+            .relativize("\\a", "..")
+            .relativize("\\", "..\\..")
+            .relativize("\\.", "..\\..")
+            .relativize("\\..", "..\\..")
+            .relativize("\\..\\..", "..\\..")
+            .relativize("\\..\\..\\..", "..\\..")
+            .relativize("\\..\\..\\..\\..", "..\\..")
+            .relativize("\\a\\b\\c", "c")
+            .relativize("\\a\\b\\.", "")        // "." also valid
+            .relativize("\\a\\b\\..", "..")
+            .relativize("\\a\\x", "..\\x")
+            .relativize("\\x", "..\\..\\x")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("\\..\\a\\b\\c")
+            .relativize("\\a\\b\\c", "")
+            .relativize("\\a\\b", "..")
+            .relativize("\\a", "..\\..")
+            .relativize("\\", "..\\..\\..")
+            .relativize("\\.", "..\\..\\..")
+            .relativize("\\..", "..\\..\\..")
+            .relativize("\\..\\..", "..\\..\\..")
+            .relativize("\\..\\..\\..", "..\\..\\..")
+            .relativize("\\..\\..\\..\\..", "..\\..\\..")
+            .relativize("\\a\\b\\c\\d", "d")
+            .relativize("\\a\\b\\c\\d\\e", "d\\e")
+            .relativize("\\a\\b\\c\\.", "")        // "." also valid
+            .relativize("\\a\\b\\c\\..", "..")
+            .relativize("\\a\\x", "..\\..\\x")
+            .relativize("\\x", "..\\..\\..\\x")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("\\..\\..\\a\\b\\c")
+            .relativize("\\a\\b\\c", "")
+            .relativize("\\a\\b", "..")
+            .relativize("\\a", "..\\..")
+            .relativize("\\", "..\\..\\..")
+            .relativize("\\.", "..\\..\\..")
+            .relativize("\\..", "..\\..\\..")
+            .relativize("\\..\\..", "..\\..\\..")
+            .relativize("\\..\\..\\..", "..\\..\\..")
+            .relativize("\\..\\..\\..\\..", "..\\..\\..")
+            .relativize("\\a\\b\\c\\d", "d")
+            .relativize("\\a\\b\\c\\d\\e", "d\\e")
+            .relativize("\\a\\b\\c\\.", "")        // "." also valid
+            .relativize("\\a\\b\\c\\..", "..")
+            .relativize("\\a\\x", "..\\..\\x")
+            .relativize("\\x", "..\\..\\..\\x")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("\\..\\..\\..\\a\\b\\c")
+            .relativize("\\a\\b\\c", "")
+            .relativize("\\a\\b", "..")
+            .relativize("\\a", "..\\..")
+            .relativize("\\", "..\\..\\..")
+            .relativize("\\.", "..\\..\\..")
+            .relativize("\\..", "..\\..\\..")
+            .relativize("\\..\\..", "..\\..\\..")
+            .relativize("\\..\\..\\..", "..\\..\\..")
+            .relativize("\\..\\..\\..\\..", "..\\..\\..")
+            .relativize("\\a\\b\\c\\d", "d")
+            .relativize("\\a\\b\\c\\d\\e", "d\\e")
+            .relativize("\\a\\b\\c\\.", "")        // "." also valid
+            .relativize("\\a\\b\\c\\..", "..")
+            .relativize("\\a\\x", "..\\..\\x")
+            .relativize("\\x", "..\\..\\..\\x")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("\\.\\a")
+            .relativize("\\a", "")
+            .relativize("\\", "..")
+            .relativize("\\.", "..")
+            .relativize("\\..", "..")
+            .relativize("\\..\\..", "..")
+            .relativize("\\a\\b", "b")
+            .relativize("\\a\\b\\c", "b\\c")
+            .relativize("\\a\\.", "")        // "." also valid
+            .relativize("\\a\\..", "..")
+            .relativize("\\x", "..\\x")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("\\..\\a")
+            .relativize("\\a", "")
+            .relativize("\\", "..")
+            .relativize("\\.", "..")
+            .relativize("\\..", "..")
+            .relativize("\\..\\..", "..")
+            .relativize("\\a\\b", "b")
+            .relativize("\\a\\b\\c", "b\\c")
+            .relativize("\\a\\.", "")        // "." also valid
+            .relativize("\\a\\..", "..")
+            .relativize("\\x", "..\\x")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("\\a\\..")
+            .relativize("\\a", "a")
+            .relativize("\\", "")          // "." is also valid
+            .relativize("\\.", "")
+            .relativize("\\..", "")
+            .relativize("\\..\\..", "")
+            .relativize("\\a\\.", "a")
+            .relativize("\\a\\..", "")
+            .relativize("\\x", "x")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("\\")
+            .relativize("\\a", "a")
+            .relativize("\\", "")          // "." is also valid
+            .relativize("\\.", "")
+            .relativize("\\..", "")
+            .relativize("\\..\\..", "")
+            .relativize("\\a\\.", "a")
+            .relativize("\\a\\..", "")
+            .relativize("\\x", "x")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("a")
+            .relativize("a", "")
+            .relativize("", "..")
+            .relativize(".", "..")
             .relativize("..", "..\\..")
-            .relativize("", "..");
-        test("foo\\bar")
-            .relativize("foo\\bar", "")
-            .relativize("foo", "..")
-            .relativize("gus", "..\\..\\gus")
+            .relativize("..\\..", "..\\..\\..")
+            .relativize(".\\..", "..\\..")
+            .relativize("a\\b", "b")
+            .relativize("a\\b\\c", "b\\c")
+            .relativize("..\\x", "..\\..\\x")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("\\")
+            .relativizeFail("\\x");
+        test("a\\b")
+            .relativize("a\\b", "")
+            .relativize("a", "..")
+            .relativize("", "..\\..")
+            .relativize(".", "..\\..")
             .relativize("..", "..\\..\\..")
-            .relativize("", "..\\..");
-        test("C:\\a\\b\\c")
-            .relativize("C:\\a", "..\\..")
-            .relativize("C:\\a\\b\\c", "")
-            .relativize("C:\\x", "..\\..\\..\\x");
-        test("\\\\server\\share\\foo")
-            .relativize("\\\\server\\share\\bar", "..\\bar")
-            .relativize("\\\\server\\share\\foo", "");
+            .relativize("..\\..", "..\\..\\..\\..")
+            .relativize(".\\..", "..\\..\\..")
+            .relativize("a\\b\\c", "c")
+            .relativize("..\\x", "..\\..\\..\\x")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("\\")
+            .relativizeFail("\\x");
+        test("a\\b\\c")
+            .relativize("a\\b\\c", "")
+            .relativize("a\\b", "..")
+            .relativize("a", "..\\..")
+            .relativize("", "..\\..\\..")
+            .relativize(".", "..\\..\\..")
+            .relativize("..", "..\\..\\..\\..")
+            .relativize("..\\..", "..\\..\\..\\..\\..")
+            .relativize(".\\..", "..\\..\\..\\..")
+            .relativize("a\\b\\c\\d", "d")
+            .relativize("a\\b\\c\\d\\e", "d\\e")
+            .relativize("a\\x", "..\\..\\x")
+            .relativize("..\\x", "..\\..\\..\\..\\x")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("\\")
+            .relativizeFail("\\x");
         test("")
             .relativize("a", "a")
             .relativize("a\\b\\c", "a\\b\\c")
+            .relativize("", "")
+            .relativize(".", ".")
             .relativize("..", "..")
-            .relativize("", "");
+            .relativize("..\\..", "..\\..")
+            .relativize(".\\..", ".\\..")     // ".." also valid
+            .relativizeFail("\\")
+            .relativizeFail("\\x");
+        test("..")
+            .relativize("..\\a", "a")
+            .relativize("..", "")
+            .relativize(".\\..", "")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("\\")
+            .relativizeFail("\\x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("x");
+        test("..\\a")
+            .relativize("..\\a\\b", "b")
+            .relativize("..\\a", "")
+            .relativize("..", "..")
+            .relativize(".\\..", "..")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("\\")
+            .relativizeFail("\\x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("x");
+        test("..\\a\\b")
+            .relativize("..\\a\\b\\c", "c")
+            .relativize("..\\a\\b", "")
+            .relativize("..\\a", "..")
+            .relativize("..", "..\\..")
+            .relativize(".\\..", "..\\..")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("\\")
+            .relativizeFail("\\x")
+            .relativizeFail("")
+            .relativizeFail("x");
+        test("a\\..")
+            .relativize("b", "b")
+            .relativize("", "")
+            .relativize(".", "")       // "." also valid
+            .relativize("..", "..")
+            .relativize("a\\..\\b", "b")
+            .relativize("a\\..", "")
+            .relativize("..\\b", "..\\b")
+            .relativize("b\\..", "")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("\\")
+            .relativizeFail("\\x");
+        test("a\\..\\b")
+            .relativize("a\\..\\b", "")
+            .relativize("a\\..", "..")
+            .relativize("", "..")
+            .relativize(".", "..")
+            .relativize("..", "..\\..")
+            .relativize("b", "")
+            .relativize("c", "..\\c")
+            .relativize("..\\c", "..\\..\\c")
+            .relativize("a\\..\\b\\c", "c")
+            .relativizeFail("C:\\x")
+            .relativizeFail("C:x")
+            .relativizeFail("\\")
+            .relativizeFail("\\x");
 
         // normalize
         test("C:\\")
@@ -971,20 +1664,324 @@
             .resolve("", "");
 
         // relativize
+        test("/a")
+            .relativize("/a", "")
+            .relativize("/", "..")
+            .relativize("/.", "..")
+            .relativize("/..", "..")
+            .relativize("/../..", "..")
+            .relativize("/a/b", "b")
+            .relativize("/a/b/c", "b/c")
+            .relativize("/a/.", "")        // "." also valid
+            .relativize("/a/..", "..")
+            .relativize("/x", "../x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("/a/b")
+            .relativize("/a/b", "")
+            .relativize("/a", "..")
+            .relativize("/", "../..")
+            .relativize("/.", "../..")
+            .relativize("/..", "../..")
+            .relativize("/../..", "../..")
+            .relativize("/a/b/c", "c")
+            .relativize("/a/.", "..")
+            .relativize("/a/..", "../..")
+            .relativize("/x", "../../x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
         test("/a/b/c")
             .relativize("/a/b/c", "")
+            .relativize("/a/b", "..")
+            .relativize("/a", "../..")
+            .relativize("/", "../../..")
+            .relativize("/.", "../../..")
+            .relativize("/..", "../../..")
+            .relativize("/../..", "../../..")
+            .relativize("/../../..", "../../..")
+            .relativize("/../../../..", "../../..")
+            .relativize("/a/b/c/d", "d")
             .relativize("/a/b/c/d/e", "d/e")
+            .relativize("/a/b/c/.", "")        // "." also valid
+            .relativize("/a/b/c/..", "..")
+            .relativize("/a/x", "../../x")
+            .relativize("/x", "../../../x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("/../a")
+            .relativize("/a", "")
+            .relativize("/", "..")
+            .relativize("/.", "..")
+            .relativize("/..", "..")
+            .relativize("/../..", "..")
+            .relativize("/a/b", "b")
+            .relativize("/a/b/c", "b/c")
+            .relativize("/a/.", "")        // "." also valid
+            .relativize("/a/..", "..")
+            .relativize("/x", "../x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("/../a/b")
+            .relativize("/a/b", "")
+            .relativize("/a", "..")
+            .relativize("/", "../..")
+            .relativize("/.", "../..")
+            .relativize("/..", "../..")
+            .relativize("/../..", "../..")
+            .relativize("/../../..", "../..")
+            .relativize("/../../../..", "../..")
+            .relativize("/a/b/c", "c")
+            .relativize("/a/b/.", "")        // "." also valid
+            .relativize("/a/b/..", "..")
+            .relativize("/a/x", "../x")
+            .relativize("/x", "../../x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("/../../a/b")
+            .relativize("/a/b", "")
+            .relativize("/a", "..")
+            .relativize("/", "../..")
+            .relativize("/.", "../..")
+            .relativize("/..", "../..")
+            .relativize("/../..", "../..")
+            .relativize("/../../..", "../..")
+            .relativize("/../../../..", "../..")
+            .relativize("/a/b/c", "c")
+            .relativize("/a/b/.", "")        // "." also valid
+            .relativize("/a/b/..", "..")
+            .relativize("/a/x", "../x")
+            .relativize("/x", "../../x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("/../a/b/c")
+            .relativize("/a/b/c", "")
+            .relativize("/a/b", "..")
+            .relativize("/a", "../..")
+            .relativize("/", "../../..")
+            .relativize("/.", "../../..")
+            .relativize("/..", "../../..")
+            .relativize("/../..", "../../..")
+            .relativize("/../../..", "../../..")
+            .relativize("/../../../..", "../../..")
+            .relativize("/a/b/c/d", "d")
+            .relativize("/a/b/c/d/e", "d/e")
+            .relativize("/a/b/c/.", "")        // "." also valid
+            .relativize("/a/b/c/..", "..")
+            .relativize("/a/x", "../../x")
+            .relativize("/x", "../../../x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("/../../a/b/c")
+            .relativize("/a/b/c", "")
+            .relativize("/a/b", "..")
+            .relativize("/a", "../..")
+            .relativize("/", "../../..")
+            .relativize("/.", "../../..")
+            .relativize("/..", "../../..")
+            .relativize("/../..", "../../..")
+            .relativize("/../../..", "../../..")
+            .relativize("/../../../..", "../../..")
+            .relativize("/a/b/c/d", "d")
+            .relativize("/a/b/c/d/e", "d/e")
+            .relativize("/a/b/c/.", "")        // "." also valid
+            .relativize("/a/b/c/..", "..")
             .relativize("/a/x", "../../x")
-            .relativize("/x", "../../../x");
+            .relativize("/x", "../../../x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("/../../../a/b/c")
+            .relativize("/a/b/c", "")
+            .relativize("/a/b", "..")
+            .relativize("/a", "../..")
+            .relativize("/", "../../..")
+            .relativize("/.", "../../..")
+            .relativize("/..", "../../..")
+            .relativize("/../..", "../../..")
+            .relativize("/../../..", "../../..")
+            .relativize("/../../../..", "../../..")
+            .relativize("/a/b/c/d", "d")
+            .relativize("/a/b/c/d/e", "d/e")
+            .relativize("/a/b/c/.", "")        // "." also valid
+            .relativize("/a/b/c/..", "..")
+            .relativize("/a/x", "../../x")
+            .relativize("/x", "../../../x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("/./a")
+            .relativize("/a", "")
+            .relativize("/", "..")
+            .relativize("/.", "..")
+            .relativize("/..", "..")
+            .relativize("/../..", "..")
+            .relativize("/a/b", "b")
+            .relativize("/a/b/c", "b/c")
+            .relativize("/a/.", "")        // "." also valid
+            .relativize("/a/..", "..")
+            .relativize("/x", "../x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("/../a")
+            .relativize("/a", "")
+            .relativize("/", "..")
+            .relativize("/.", "..")
+            .relativize("/..", "..")
+            .relativize("/../..", "..")
+            .relativize("/a/b", "b")
+            .relativize("/a/b/c", "b/c")
+            .relativize("/a/.", "")        // "." also valid
+            .relativize("/a/..", "..")
+            .relativize("/x", "../x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("/a/..")
+            .relativize("/a", "a")
+            .relativize("/", "")          // "." is also valid
+            .relativize("/.", "")
+            .relativize("/..", "")
+            .relativize("/../..", "")
+            .relativize("/a/.", "a")
+            .relativize("/a/..", "")
+            .relativize("/x", "x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("/")
+            .relativize("/a", "a")
+            .relativize("/", "")          // "." is also valid
+            .relativize("/.", "")
+            .relativize("/..", "")
+            .relativize("/../..", "")
+            .relativize("/a/.", "a")
+            .relativize("/a/..", "")
+            .relativize("/x", "x")
+            .relativizeFail("x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("..");
+        test("a")
+            .relativize("a", "")
+            .relativize("", "..")
+            .relativize(".", "..")
+            .relativize("..", "../..")
+            .relativize("../..", "../../..")
+            .relativize("./..", "../..")
+            .relativize("a/b", "b")
+            .relativize("a/b/c", "b/c")
+            .relativize("../x", "../../x")
+            .relativizeFail("/")
+            .relativizeFail("/x");
+        test("a/b")
+            .relativize("a/b", "")
+            .relativize("a", "..")
+            .relativize("", "../..")
+            .relativize(".", "../..")
+            .relativize("..", "../../..")
+            .relativize("../..", "../../../..")
+            .relativize("./..", "../../..")
+            .relativize("a/b/c", "c")
+            .relativize("../x", "../../../x")
+            .relativizeFail("/")
+            .relativizeFail("/x");
         test("a/b/c")
+            .relativize("a/b/c", "")
+            .relativize("a/b", "..")
+            .relativize("a", "../..")
+            .relativize("", "../../..")
+            .relativize(".", "../../..")
+            .relativize("..", "../../../..")
+            .relativize("../..", "../../../../..")
+            .relativize("./..", "../../../..")
             .relativize("a/b/c/d", "d")
+            .relativize("a/b/c/d/e", "d/e")
             .relativize("a/x", "../../x")
-            .relativize("x", "../../../x")
-            .relativize("", "../../..");
+            .relativize("../x", "../../../../x")
+            .relativizeFail("/")
+            .relativizeFail("/x");
         test("")
             .relativize("a", "a")
             .relativize("a/b/c", "a/b/c")
-            .relativize("", "");
+            .relativize("", "")
+            .relativize(".", ".")
+            .relativize("..", "..")
+            .relativize("../..", "../..")
+            .relativize("./..", "./..")     // ".." also valid
+            .relativizeFail("/")
+            .relativizeFail("/x");
+        test("..")
+            .relativize("../a", "a")
+            .relativize("..", "")
+            .relativize("./..", "")
+            .relativizeFail("/")
+            .relativizeFail("/x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("x");
+        test("../a")
+            .relativize("../a/b", "b")
+            .relativize("../a", "")
+            .relativize("..", "..")
+            .relativize("./..", "..")
+            .relativizeFail("/")
+            .relativizeFail("/x")
+            .relativizeFail("")
+            .relativizeFail(".")
+            .relativizeFail("x");
+        test("../a/b")
+            .relativize("../a/b/c", "c")
+            .relativize("../a/b", "")
+            .relativize("../a", "..")
+            .relativize("..", "../..")
+            .relativize("./..", "../..")
+            .relativizeFail("/")
+            .relativizeFail("/x")
+            .relativizeFail("")
+            .relativizeFail("x");
+        test("a/..")
+            .relativize("b", "b")
+            .relativize("", "")
+            .relativize(".", "")       // "." also valid
+            .relativize("..", "..")
+            .relativize("a/../b", "b")
+            .relativize("a/..", "")
+            .relativize("../b", "../b")
+            .relativize("b/..", "")
+            .relativizeFail("/")
+            .relativizeFail("/x");
+        test("a/../b")
+            .relativize("a/../b", "")
+            .relativize("a/..", "..")
+            .relativize("", "..")
+            .relativize(".", "..")
+            .relativize("..", "../..")
+            .relativize("b", "")
+            .relativize("c", "../c")
+            .relativize("../c", "../../c")
+            .relativize("a/../b/c", "c")
+            .relativizeFail("/")
+            .relativizeFail("/x");
 
         // normalize
         test("/")
--- a/jdk/test/java/nio/file/WatchService/LotsOfCancels.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/java/nio/file/WatchService/LotsOfCancels.java	Fri Aug 26 14:47:52 2016 -0700
@@ -53,10 +53,11 @@
             Path testDir = Paths.get(System.getProperty("test.dir", "."));
             Path top = Files.createTempDirectory(testDir, "LotsOfCancels");
             for (int i=1; i<=16; i++) {
+                int id = i;
                 Path dir = Files.createDirectory(top.resolve("dir-" + i));
                 WatchService watcher = FileSystems.getDefault().newWatchService();
-                pool.submit(() -> handle(dir, watcher));
-                pool.submit(() -> poll(watcher));
+                pool.submit(() -> handle(id, dir, watcher));
+                pool.submit(() -> poll(id, watcher));
             }
         } finally {
             pool.shutdown();
@@ -74,7 +75,8 @@
      * Stress the given WatchService, specifically the cancel method, in
      * the given directory. Closes the WatchService when done.
      */
-    static void handle(Path dir, WatchService watcher) {
+    static void handle(int id, Path dir, WatchService watcher) {
+        System.out.printf("begin handle %d%n", id);
         try {
             try {
                 Path file = dir.resolve("anyfile");
@@ -85,12 +87,15 @@
                     key.cancel();
                 }
             } finally {
+                System.out.printf("WatchService %d closing ...%n", id);
                 watcher.close();
+                System.out.printf("WatchService %d closed %n", id);
             }
         } catch (Exception e) {
             e.printStackTrace();
             failed = true;
         }
+        System.out.printf("end handle %d%n", id);
     }
 
     /**
@@ -98,7 +103,8 @@
      * queue drained, it also hogs a CPU core which seems necessary to
      * tickle the original bug.
      */
-    static void poll(WatchService watcher) {
+    static void poll(int id, WatchService watcher) {
+        System.out.printf("begin poll %d%n", id);
         try {
             for (;;) {
                 WatchKey key = watcher.take();
@@ -108,10 +114,12 @@
                 }
             }
         } catch (ClosedWatchServiceException expected) {
-            // nothing to do
+            // nothing to do but print
+            System.out.printf("poll %d expected exception %s%n", id, expected);
         } catch (Exception e) {
             e.printStackTrace();
             failed = true;
         }
+        System.out.printf("end poll %d%n", id);
     }
 }
--- a/jdk/test/java/nio/file/WatchService/UpdateInterference.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/java/nio/file/WatchService/UpdateInterference.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,9 @@
 import static java.nio.file.StandardWatchEventKinds.*;
 
 public class UpdateInterference {
+
+    private static volatile boolean stop;
+
     public static void main(String[] args) throws IOException, InterruptedException {
         final Path root = Files.createTempDirectory("test");
         final Path foo = root.resolve("foo");
@@ -43,64 +46,89 @@
         Files.createDirectory(bar);
         Files.createDirectory(baz);
 
-        final WatchService watcher = root.getFileSystem().newWatchService();
-        final WatchKey fooKey = foo.register(watcher, ENTRY_CREATE);
-        final WatchKey barKey = bar.register(watcher, ENTRY_CREATE);
+        try (final WatchService watcher = root.getFileSystem().newWatchService()) {
+            final WatchKey fooKey = foo.register(watcher, ENTRY_CREATE);
+            final WatchKey barKey = bar.register(watcher, ENTRY_CREATE);
+
+            Thread t1 = null;
+            Thread t2 = null;
+            try {
+                t1 = new Thread() {
 
-        new Thread() {
-            { setDaemon(true); }
+                    @Override
+                    public void run() {
+                        while (!stop) {
+                            try {
+                                final Path temp = Files.createTempFile(foo, "temp", ".tmp");
+                                Files.delete(temp);
+                                Thread.sleep(10);
+                            } catch (IOException | InterruptedException e) {
+                                throw new RuntimeException(e);
+                            }
+                        }
+                    }
+                };
+
+                t2 = new Thread() {
 
-            @Override
-            public void run() {
-                while (true) {
-                    try {
-                        final Path temp = Files.createTempFile(foo, "temp", ".tmp");
-                        Files.delete(temp);
-                        Thread.sleep(10);
-                    } catch (IOException | InterruptedException e) {
-                        throw new RuntimeException(e);
+                    @Override
+                    public void run() {
+                        WatchKey bazKeys[] = new WatchKey[32];
+                        while (!stop) {
+                            try {
+                                for( int i = 0; i < bazKeys.length; i++) {
+                                    bazKeys[i] = baz.register(watcher, ENTRY_CREATE);
+                                }
+                                for( int i = 0; i < bazKeys.length; i++) {
+                                    bazKeys[i].cancel();
+                                }
+                                Thread.sleep(1);
+                            } catch (IOException | InterruptedException e) {
+                                throw new RuntimeException(e);
+                            }
+                        }
                     }
+                };
+
+                t1.start();
+                t2.start();
+
+                long time = System.currentTimeMillis();
+                while ((System.currentTimeMillis() - time) < 15000) {
+                    final WatchKey key = watcher.poll(60, TimeUnit.SECONDS);
+                    if (key == null) continue;
+
+                    if (key != fooKey) {
+                        List<WatchEvent<?>> pollEvents = key.pollEvents();
+                        for (WatchEvent<?> watchEvent : pollEvents) {
+                            System.out.println(watchEvent.count() + " " +
+                                            watchEvent.kind() + " " +
+                                            watchEvent.context());
+                        }
+                        throw new RuntimeException("Event received for unexpected key");
+                    }
+                    key.reset();
+                }
+            } finally {
+                // the threads should stop before WatchService is closed
+                // to avoid ClosedWatchServiceException
+                stop = true;
+
+                // wait for threads to finish
+                if (t1 != null) {
+                    t1.join();
+                }
+
+                if (t2 != null) {
+                    t2.join();
                 }
             }
-        }.start();
-
-        new Thread() {
-            { setDaemon(true); }
-
-            @Override
-            public void run() {
-                WatchKey bazKeys[] = new WatchKey[32];
-                while (true) {
-                    try {
-                        for( int i = 0; i < bazKeys.length; i++) {
-                            bazKeys[i] = baz.register(watcher, ENTRY_CREATE);
-                        }
-                        for( int i = 0; i < bazKeys.length; i++) {
-                            bazKeys[i].cancel();
-                        }
-                        Thread.sleep(1);
-                    } catch (IOException | InterruptedException e) {
-                        throw new RuntimeException(e);
-                    }
-                }
-            }
-        }.start();
-
-        long time = System.currentTimeMillis();
-        while ((System.currentTimeMillis() - time) < 15000) {
-            final WatchKey key = watcher.poll(60, TimeUnit.SECONDS);
-            if (key == null) continue;
-
-            if (key != fooKey) {
-                List<WatchEvent<?>> pollEvents = key.pollEvents();
-                for (WatchEvent<?> watchEvent : pollEvents) {
-                    System.out.println(watchEvent.count() + " " +
-                                       watchEvent.kind() + " " +
-                                       watchEvent.context());
-                }
-                throw new RuntimeException("Event received for unexpected key");
-            }
-            key.reset();
+        } finally {
+            // clean up
+            Files.delete(foo);
+            Files.delete(bar);
+            Files.delete(baz);
+            Files.delete(root);
         }
     }
 }
--- a/jdk/test/java/time/tck/java/time/TCKZoneOffset.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/java/time/tck/java/time/TCKZoneOffset.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -419,6 +419,21 @@
         ZoneOffset.ofHoursMinutesSeconds(-19, 0, 0);
     }
 
+    @Test(expectedExceptions=DateTimeException.class)
+    public void test_factory_int_hours_minutes_seconds_minutesMinValue() {
+        ZoneOffset.ofHoursMinutesSeconds(0, Integer.MIN_VALUE, -1);
+    }
+
+    @Test(expectedExceptions=DateTimeException.class)
+    public void test_factory_int_hours_minutes_seconds_secondsMinValue() {
+        ZoneOffset.ofHoursMinutesSeconds(0, 0, Integer.MIN_VALUE);
+    }
+
+    @Test(expectedExceptions=DateTimeException.class)
+    public void test_factory_int_hours_minutes_seconds_minutesAndSecondsMinValue() {
+        ZoneOffset.ofHoursMinutesSeconds(0, Integer.MIN_VALUE, Integer.MIN_VALUE);
+    }
+
     //-----------------------------------------------------------------------
     @Test
     public void test_factory_ofTotalSeconds() {
@@ -437,6 +452,11 @@
         ZoneOffset.ofTotalSeconds(-18 * 60 * 60 - 1);
     }
 
+    @Test(expectedExceptions=DateTimeException.class)
+    public void test_factory_ofTotalSeconds_minValue() {
+        ZoneOffset.ofTotalSeconds(Integer.MIN_VALUE);
+    }
+
     //-----------------------------------------------------------------------
     // from()
     //-----------------------------------------------------------------------
--- a/jdk/test/java/util/concurrent/tck/ConcurrentHashMapTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/java/util/concurrent/tck/ConcurrentHashMapTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -360,6 +360,21 @@
     }
 
     /**
+     * Test keySet().removeAll on empty map
+     */
+    public void testKeySet_empty_removeAll() {
+        ConcurrentHashMap<Integer, String> map = new ConcurrentHashMap<>();
+        Set<Integer> set = map.keySet();
+        set.removeAll(Collections.emptyList());
+        assertTrue(map.isEmpty());
+        assertTrue(set.isEmpty());
+        // following is test for JDK-8163353
+        set.removeAll(Collections.emptySet());
+        assertTrue(map.isEmpty());
+        assertTrue(set.isEmpty());
+    }
+
+    /**
      * keySet.toArray returns contains all keys
      */
     public void testKeySetToArray() {
--- a/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java	Fri Aug 26 14:47:52 2016 -0700
@@ -80,7 +80,7 @@
         }
 
         try (JarFile jf = new JarFile(multirelease)) {
-            Assert.assertFalse(jf.isMultiRelease());
+            Assert.assertTrue(jf.isMultiRelease());
         }
 
         try (JarFile jf = new JarFile(multirelease, true, ZipFile.OPEN_READ, Runtime.version())) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/crypto/CryptoPermissions/TestUnlimited.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8061842
+ * @summary Package jurisdiction policy files as something other than JAR
+ * @run main/othervm TestUnlimited "" exception
+ * @run main/othervm TestUnlimited limited fail
+ * @run main/othervm TestUnlimited unlimited pass
+ * @run main/othervm TestUnlimited unlimited/ pass
+ * @run main/othervm TestUnlimited NosuchDir exception
+ * @run main/othervm TestUnlimited . exception
+ * @run main/othervm TestUnlimited /tmp/unlimited exception
+ * @run main/othervm TestUnlimited ../policy/unlimited exception
+ * @run main/othervm TestUnlimited ./unlimited exception
+ * @run main/othervm TestUnlimited /unlimited exception
+ */
+import javax.crypto.*;
+import java.security.Security;
+
+public class TestUnlimited {
+
+    public static void main(String[] args) throws Exception {
+        /*
+         * Override the Security property to allow for unlimited policy.
+         * Would need appropriate permissions if Security Manager were
+         * active.
+         */
+        if (args.length != 2) {
+            throw new Exception("Two args required");
+        }
+
+        boolean expected = args[1].equals("pass");
+        boolean exception = args[1].equals("exception");
+        boolean result = false;
+
+        System.out.println("Testing: " + args[0]);
+
+        if (args[0].equals("\"\"")) {
+            Security.setProperty("crypto.policy", "");
+        } else {
+            Security.setProperty("crypto.policy", args[0]);
+        }
+
+        /*
+         * Use the AES as the test Cipher
+         * If there is an error initializing, we will never get past here.
+         */
+        try {
+            int maxKeyLen = Cipher.getMaxAllowedKeyLength("AES");
+            System.out.println("max AES key len:" + maxKeyLen);
+            if (maxKeyLen > 128) {
+                System.out.println("Unlimited policy is active");
+                result = true;
+            } else {
+                System.out.println("Unlimited policy is NOT active");
+                result = false;
+            }
+        } catch (Throwable e) {
+            if (!exception) {
+                throw new Exception();
+            }
+        }
+
+        System.out.println(
+                "Expected:\t" + expected + "\nResult:\t\t" + result);
+        if (expected != result) {
+            throw new Exception();
+        }
+
+        System.out.println("DONE!");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/crypto/dsig/SecureValidationPolicy.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8151893
+ * @summary Tests for the jdk.xml.dsig.secureValidationPolicy security property
+ * @modules java.xml.crypto/org.jcp.xml.dsig.internal.dom
+ */
+
+import java.security.Security;
+import java.util.List;
+import org.jcp.xml.dsig.internal.dom.Policy;
+
+public class SecureValidationPolicy {
+
+    public static void main(String[] args) throws Exception {
+
+        List<String> restrictedSchemes = List.of("file:/tmp/foo",
+            "http://java.com", "https://java.com");
+        List<String> restrictedAlgs = List.of(
+            "http://www.w3.org/TR/1999/REC-xslt-19991116",
+            "http://www.w3.org/2001/04/xmldsig-more#rsa-md5",
+            "http://www.w3.org/2001/04/xmldsig-more#hmac-md5",
+            "http://www.w3.org/2001/04/xmldsig-more#md5");
+
+        // Test expected defaults
+        System.out.println("Testing defaults");
+        if (!Policy.restrictNumTransforms(6)) {
+            throw new Exception("maxTransforms not enforced");
+        }
+        if (!Policy.restrictNumReferences(31)) {
+            throw new Exception("maxReferences not enforced");
+        }
+        for (String scheme : restrictedSchemes) {
+            if (!Policy.restrictReferenceUriScheme(scheme)) {
+                throw new Exception(scheme + " scheme not restricted");
+            }
+        }
+        for (String alg : restrictedAlgs) {
+            if (!Policy.restrictAlg(alg)) {
+                throw new Exception(alg + " alg not restricted");
+            }
+        }
+        if (!Policy.restrictDuplicateIds()) {
+            throw new Exception("noDuplicateIds not enforced");
+        }
+        if (!Policy.restrictRetrievalMethodLoops()) {
+            throw new Exception("noRetrievalMethodLoops not enforced");
+        }
+    }
+}
--- a/jdk/test/jdk/lambda/TEST.properties	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/jdk/lambda/TEST.properties	Fri Aug 26 14:47:52 2016 -0700
@@ -3,4 +3,4 @@
 TestNG.dirs = .
 
 javatest.maxOutputSize = 250000
-modules = jdk.compiler
+modules = jdk.compiler jdk.zipfs
--- a/jdk/test/jdk/modules/etc/VerifyModuleDelegation.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/jdk/modules/etc/VerifyModuleDelegation.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @summary Verify the defining class loader of each module never delegates
  *          to its child class loader. Also sanity check java.compact2
  *          requires.
+ * @modules java.compact2
  * @run testng/othervm --add-modules=ALL-SYSTEM VerifyModuleDelegation
  */
 
@@ -33,7 +34,9 @@
 import java.lang.module.ModuleFinder;
 import java.lang.module.ModuleReference;
 import java.lang.reflect.Layer;
+import java.lang.reflect.Module;
 import java.util.Set;
+import static java.util.stream.Collectors.toSet;
 
 import static java.lang.module.ModuleDescriptor.Requires.Modifier.*;
 
@@ -58,8 +61,9 @@
             .requires(Set.of(PUBLIC), "java.xml")
             .build();
 
-    private static final Set<ModuleReference> MREFS
-            = ModuleFinder.ofSystem().findAll();
+    private static final Set<ModuleDescriptor> MREFS
+            = Layer.boot().modules().stream().map(Module::getDescriptor)
+                .collect(toSet());
 
     private void check(ModuleDescriptor md, ModuleDescriptor ref) {
         assertTrue(md.requires().size() == ref.requires().size());
@@ -69,7 +73,7 @@
     @Test
     public void checkJavaBase() {
         ModuleDescriptor md =
-                MREFS.stream().map(ModuleReference::descriptor)
+                MREFS.stream()
                      .filter(d -> d.name().equals(JAVA_BASE))
                      .findFirst().orElseThrow(Error::new);
 
@@ -78,7 +82,7 @@
     @Test
     public void checkCompact2() {
         ModuleDescriptor md =
-                MREFS.stream().map(ModuleReference::descriptor)
+                MREFS.stream()
                      .filter(d -> d.name().equals(JAVA_COMPACT2))
                      .findFirst().orElseThrow(Error::new);
         check(md, COMPACT2);
@@ -87,7 +91,7 @@
     @Test
     public void checkLoaderDelegation() {
         Layer boot = Layer.boot();
-        MREFS.stream().map(ModuleReference::descriptor)
+        MREFS.stream()
              .forEach(md -> md.requires().stream().forEach(req ->
                  {
                      // check if M requires D and D's loader must be either the
--- a/jdk/test/jdk/modules/scenarios/container/ContainerTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/jdk/modules/scenarios/container/ContainerTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -26,6 +26,8 @@
  * @library /lib/testlibrary
  * @modules jdk.jartool/sun.tools.jar
  *          jdk.compiler
+ *          jdk.zipfs
+ *          java.se
  * @build ContainerTest CompilerUtils jdk.testlibrary.*
  * @run testng ContainerTest
  * @summary Starts a simple container that uses dynamic configurations
--- a/jdk/test/jdk/nio/zipfs/MultiReleaseJarTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/jdk/nio/zipfs/MultiReleaseJarTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -28,7 +28,7 @@
  * @library /lib/testlibrary/java/util/jar
  * @build Compiler JarBuilder CreateMultiReleaseTestJars
  * @run testng MultiReleaseJarTest
- * @modules java.compiler
+ * @modules jdk.compiler
  *          jdk.jartool
  *          jdk.zipfs
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/nio/zipfs/jarfs/JFSTester.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8164389
+ * @summary walk entries in a jdk.nio.zipfs.JarFileSystem
+ * @modules jdk.jartool/sun.tools.jar
+ * @run testng JFSTester
+ */
+
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.net.URI;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+public class JFSTester {
+    private URI jarURI;
+    private Path jarfile;
+
+    @BeforeClass
+    public void initialize() throws Exception {
+        String userdir = System.getProperty("user.dir",".");
+        jarfile = Paths.get(userdir, "test.jar");
+        String srcdir = System.getProperty("test.src");
+        String[] args = (
+                        "-cf "
+                        + jarfile.toString()
+                        + " -C "
+                        + srcdir
+                        + " root --release 9 -C "
+                        + srcdir
+                        + System.getProperty("file.separator")
+                        + "v9 root"
+        ).split(" +");
+        new sun.tools.jar.Main(System.out, System.err, "jar").run(args);
+        String ssp = jarfile.toUri().toString();
+        jarURI = new URI("jar", ssp, null);
+    }
+
+    @AfterClass
+    public void close() throws IOException {
+        Files.deleteIfExists(jarfile);
+    }
+
+    @Test
+    public void testWalk() throws IOException {
+
+        // no configuration, treat multi-release jar as unversioned
+        Map<String,String> env = new HashMap<>();
+        Set<String> contents = doTest(env);
+        Set<String> baseContents = Set.of(
+                "This is leaf 1.\n",
+                "This is leaf 2.\n",
+                "This is leaf 3.\n",
+                "This is leaf 4.\n"
+        );
+        Assert.assertEquals(contents, baseContents);
+
+        // a configuration and jar file is multi-release
+        env.put("multi-release", "9");
+        contents = doTest(env);
+        Set<String> versionedContents = Set.of(
+                "This is versioned leaf 1.\n",
+                "This is versioned leaf 2.\n",
+                "This is versioned leaf 3.\n",
+                "This is versioned leaf 4.\n"
+        );
+        Assert.assertEquals(contents, versionedContents);
+    }
+
+    private Set<String> doTest(Map<String,String> env) throws IOException {
+        Set<String> contents;
+        try (FileSystem fs = FileSystems.newFileSystem(jarURI, env)) {
+            Path root = fs.getPath("root");
+            contents = Files.walk(root)
+                    .filter(p -> !Files.isDirectory(p))
+                    .map(this::pathToContents)
+                    .collect(Collectors.toSet());
+        }
+        return contents;
+    }
+
+    private String pathToContents(Path path) {
+        try {
+            return new String(Files.readAllBytes(path));
+        } catch (IOException x) {
+            throw new UncheckedIOException(x);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/nio/zipfs/jarfs/root/dir1/leaf1.txt	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,1 @@
+This is leaf 1.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/nio/zipfs/jarfs/root/dir1/leaf2.txt	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,1 @@
+This is leaf 2.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/nio/zipfs/jarfs/root/dir2/leaf3.txt	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,1 @@
+This is leaf 3.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/nio/zipfs/jarfs/root/dir2/leaf4.txt	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,1 @@
+This is leaf 4.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/nio/zipfs/jarfs/v9/root/dir1/leaf1.txt	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,1 @@
+This is versioned leaf 1.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/nio/zipfs/jarfs/v9/root/dir1/leaf2.txt	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,1 @@
+This is versioned leaf 2.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/nio/zipfs/jarfs/v9/root/dir2/leaf3.txt	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,1 @@
+This is versioned leaf 3.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/nio/zipfs/jarfs/v9/root/dir2/leaf4.txt	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,1 @@
+This is versioned leaf 4.
--- a/jdk/test/jdk/security/JavaDotSecurity/final_java_security	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/jdk/security/JavaDotSecurity/final_java_security	Fri Aug 26 14:47:52 2016 -0700
@@ -10,6 +10,7 @@
 foo.6=9a
 foo.7=10
 foo.8=12
+crypto.policy=somepolicy
 
 package.access=sun.,\
                solaris.,\
--- a/jdk/test/jdk/security/JavaDotSecurity/ifdefs.sh	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/jdk/security/JavaDotSecurity/ifdefs.sh	Fri Aug 26 14:47:52 2016 -0700
@@ -46,7 +46,13 @@
 fi
 
 $JAVAC -d . $TOOLSRC
-$JAVA $TOOLNAME $TESTSRC/raw_java_security outfile solaris sparc $TESTSRC/more_restricted
+$JAVA $TOOLNAME \
+    $TESTSRC/raw_java_security \
+    outfile \
+    solaris \
+    sparc \
+    somepolicy \
+    $TESTSRC/more_restricted
 
 # On Windows, line end could be different. -b is a cross-platform option.
-diff -b outfile $TESTSRC/final_java_security
\ No newline at end of file
+diff -b outfile $TESTSRC/final_java_security
--- a/jdk/test/jdk/security/JavaDotSecurity/raw_java_security	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/jdk/security/JavaDotSecurity/raw_java_security	Fri Aug 26 14:47:52 2016 -0700
@@ -44,6 +44,7 @@
 #ifndef macosx-x64
 foo.tbd=12
 #endif
+crypto.policy=crypto.policydir-tbd
 
 package.access=sun.,\
 #ifdef solaris
--- a/jdk/test/jdk/security/jarsigner/Spec.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/jdk/security/jarsigner/Spec.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
  * @modules java.base/sun.security.tools.keytool
  *          java.base/sun.security.provider.certpath
  *          jdk.jartool
+ *          jdk.crypto.ec
  */
 
 import com.sun.jarsigner.ContentSigner;
--- a/jdk/test/sun/security/krb5/auto/BadKdc1.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/sun/security/krb5/auto/BadKdc1.java	Fri Aug 26 14:47:52 2016 -0700
@@ -44,16 +44,16 @@
        }
 
        BadKdc.go(
-               "121212222222(32){1,2}1222(32){1,2}", // 1 2
+               "121212222222(32){1,3}1222(32){1,3}", // 1 2
                // The above line means try kdc1 for 2 seconds then kdc1
                // for 2 seconds... finally kdc3 for 2 seconds.
-               "1222(32){1,2}1222(32){1,2}",    // 1 2
+               "1222(32){1,3}1222(32){1,3}",    // 1 2
                // refresh
-               "121212222222(32){1,2}1222(32){1,2}",  // 1 2
+               "121212222222(32){1,3}1222(32){1,3}",  // 1 2
                // k3 off k2 on
-               "(122212(22){1,2}|1222323232-)", // 1
+               "(122212(22){1,3}|1222323232-)", // 1
                // k1 on
-               "(12(12){1,2}|122212|122232-)"  // empty
+               "(12(12){1,3}|122212|122232-)"  // empty
        );
    }
 }
--- a/jdk/test/sun/security/krb5/auto/BadKdc2.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/sun/security/krb5/auto/BadKdc2.java	Fri Aug 26 14:47:52 2016 -0700
@@ -42,14 +42,14 @@
         Security.setProperty(
                 "krb5.kdc.bad.policy", "tryLess:2," + BadKdc.toReal(1000));
         BadKdc.go(
-                "121212222222(32){1,2}11112121(32){1,2}", // 1 2
-                "11112121(32){1,2}11112121(32){1,2}", // 1 2
+                "121212222222(32){1,3}11112121(32){1,3}", // 1 2
+                "11112121(32){1,3}11112121(32){1,3}", // 1 2
                 // refresh
-                "121212222222(32){1,2}11112121(32){1,2}", // 1 2
+                "121212222222(32){1,3}11112121(32){1,3}", // 1 2
                 // k3 off k2 on
-                "1111(21){1,2}1111(22){1,2}", // 1
+                "1111(21){1,3}1111(22){1,3}", // 1
                 // k1 on
-                "(11){1,2}(12){1,2}"  // empty
+                "(11){1,3}(12){1,3}"  // empty
         );
     }
 }
--- a/jdk/test/sun/security/krb5/auto/BadKdc4.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/sun/security/krb5/auto/BadKdc4.java	Fri Aug 26 14:47:52 2016 -0700
@@ -37,12 +37,12 @@
             throws Exception {
         Security.setProperty("krb5.kdc.bad.policy", "");
         BadKdc.go(
-            "121212222222(32){1,2}121212222222(32){1,2}",
-            "121212222222(32){1,2}121212222222(32){1,2}",
+            "121212222222(32){1,3}121212222222(32){1,3}",
+            "121212222222(32){1,3}121212222222(32){1,3}",
             // refresh
-            "121212222222(32){1,2}121212222222(32){1,2}",
+            "121212222222(32){1,3}121212222222(32){1,3}",
             // k3 off k2 on
-            "121212(22){1,2}121212(22){1,2}",
+            "121212(22){1,3}121212(22){1,3}",
             // k1 on
             "(12){2,4}"
         );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/KdcPolicy.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,366 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+import java.net.DatagramSocket;
+import java.net.ServerSocket;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.security.Security;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import javax.security.auth.login.LoginException;
+import sun.security.krb5.Asn1Exception;
+import sun.security.krb5.Config;
+
+/*
+ * @test
+ * @bug 8164656
+ * @run main/othervm KdcPolicy udp
+ * @run main/othervm KdcPolicy tcp
+ * @summary krb5.kdc.bad.policy test
+ */
+public class KdcPolicy {
+
+    // Is this test on UDP?
+    static boolean udp;
+
+    public static void main(String[] args) throws Exception {
+
+        udp = args[0].equals("udp");
+
+        try {
+            main0();
+        } catch (LoginException le) {
+            Throwable cause = le.getCause();
+            if (cause instanceof Asn1Exception) {
+                System.out.println("Another process sends a packet to " +
+                        "this server. Ignored.");
+                return;
+            }
+            throw le;
+        }
+    }
+
+    static DebugMatcher cm = new DebugMatcher();
+
+    static void main0() throws Exception {
+
+        System.setProperty("sun.security.krb5.debug", "true");
+
+        // One real KDC. Must be created before fake KDCs
+        // to read the TestHosts file.
+        OneKDC kdc = new OneKDC(null);
+
+        // Two fake KDCs, d1 and d2 only listen but do not respond.
+
+        if (udp) {
+            try (DatagramSocket d1 = new DatagramSocket();
+                 DatagramSocket d2 = new DatagramSocket()) {
+                run(d1.getLocalPort(), d2.getLocalPort(), kdc.getPort());
+            }
+        } else {
+            try (ServerSocket d1 = new ServerSocket(0);
+                 ServerSocket d2 = new ServerSocket(0)) {
+                run(d1.getLocalPort(), d2.getLocalPort(), kdc.getPort());
+            }
+        }
+    }
+
+    static void run(int p1, int p2, int p3) throws Exception {
+
+        // cm.kdc() will return a and b for fake KDCs, and c for real KDC.
+        cm.addPort(-1).addPort(p1).addPort(p2).addPort(p3);
+
+        System.setProperty("java.security.krb5.conf", "alternative-krb5.conf");
+
+        // Check default timeout is 30s. Use real KDC only, otherwise too
+        // slow to wait for timeout.
+        writeConf(-1, -1, p3);
+        test("c30000c30000");
+
+        // 1. Default policy is tryLast
+        //Security.setProperty("krb5.kdc.bad.policy", "tryLast");
+
+        // Need a real KDC, otherwise there is no last good.
+        // This test waste 3 seconds waiting for d1 to timeout.
+        // It is possible the real KDC cannot fulfil the request
+        // in 3s, so it might fail (either 1st time or 2nd time).
+        writeConf(1, 3000, p1, p3);
+        test("a3000c3000c3000|a3000c3000-|a3000c3000c3000-");
+
+        // If a test case won't use a real KDC, it can be sped up.
+        writeConf(3, 5, p1, p2);
+        test("a5a5a5b5b5b5-");  // default max_retries == 3
+        test("a5a5a5b5b5b5-");  // all bad means no bad
+
+        // 2. No policy.
+        Security.setProperty("krb5.kdc.bad.policy", "");
+        Config.refresh();
+
+        // This case needs a real KDC, otherwise, all bad means no
+        // bad and we cannot tell the difference. This case waste 3
+        // seconds on d1 to timeout twice. It is possible the real KDC
+        // cannot fulfil the request within 3s, so it might fail
+        // (either 1st time or 2nd time).
+        writeConf(1, 3000, p1, p3);
+        test("a3000c3000a3000c3000|a3000c3000-|a3000c3000a3000c3000-");
+
+        // 3. tryLess with no argument means tryLess:1,5000
+        Security.setProperty("krb5.kdc.bad.policy", "tryLess");
+
+        // This case will waste 11s. We are checking that the default
+        // value of 5000 in tryLess is only used if it's less than timeout
+        // in krb5.conf
+        writeConf(1, 6000, p1);
+        test("a6000-"); // timeout in krb5.conf is 6s
+        test("a5000-"); // tryLess to 5s. This line can be made faster if
+                        // d1 is a read KDC, but we have no existing method
+                        // to start KDC on an existing ServerSocket (port).
+
+        writeConf(-1, 4, p1, p2);
+        test("a4a4a4b4b4b4-");  // default max_retries == 3
+        test("a4b4-");          // tryLess to 1. And since 4 < 5000, use 4.
+        Config.refresh();
+        test("a4a4a4b4b4b4-");
+
+        writeConf(5, 4, p1, p2);
+        test("a4a4a4a4a4b4b4b4b4b4-"); // user-provided max_retries == 5
+        test("a4b4-");
+        Config.refresh();
+        test("a4a4a4a4a4b4b4b4b4b4-");
+
+        // 3. tryLess with arguments
+        Security.setProperty("krb5.kdc.bad.policy",
+                "tryLess:2,5");
+
+        writeConf(-1, 6, p1, p2);
+        test("a6a6a6b6b6b6-");  // default max_retries == 3
+        test("a5a5b5b5-");      // tryLess to 2
+        Config.refresh();
+        test("a6a6a6b6b6b6-");
+
+        writeConf(5, 4, p1, p2);
+        test("a4a4a4a4a4b4b4b4b4b4-");  // user-provided max_retries == 5
+        test("a4a4b4b4-");              // tryLess to 2
+        Config.refresh();
+        test("a4a4a4a4a4b4b4b4b4b4-");
+    }
+
+    /**
+     * Writes a krb5.conf file.
+     * @param max max_retries, -1 if not set
+     * @param to kdc_timeout, -1 if not set
+     * @param ports where KDCs listen on
+     */
+    static void writeConf(int max, int to, int... ports) throws Exception {
+
+        // content of krb5.conf
+        String conf = "";
+
+        // Extra settings in [libdefaults]
+        String inDefaults = "";
+
+        // Extra settings in [realms]
+        String inRealm = "";
+
+        // We will randomly put extra settings only in [libdefaults],
+        // or in [realms] but with different values in [libdefaults],
+        // to prove that settings in [realms] override those in [libdefaults].
+        Random r = new Random();
+
+        if (max > 0) {
+            if (r.nextBoolean()) {
+                inDefaults += "max_retries = " + max + "\n";
+            } else {
+                inRealm += "   max_retries = " + max + "\n";
+                inDefaults += "max_retries = " + (max + 1) + "\n";
+            }
+        }
+
+        if (to > 0) {
+            if (r.nextBoolean()) {
+                inDefaults += "kdc_timeout = " + to + "\n";
+            } else {
+                inRealm += "   kdc_timeout = " + to + "\n";
+                inDefaults += "kdc_timeout = " + (to + 1) + "\n";
+            }
+        }
+
+        if (udp) {
+            if (r.nextBoolean()) {
+                inDefaults += "udp_preference_limit = 10000\n";
+            } else if (r.nextBoolean()) {
+                inRealm += "   udp_preference_limit = 10000\n";
+                inDefaults += "udp_preference_limit = 1\n";
+            } // else no settings means UDP
+        } else {
+            if (r.nextBoolean()) {
+                inDefaults += "udp_preference_limit = 1\n";
+            } else {
+                inRealm += "   udp_preference_limit = 1\n";
+                inDefaults += "udp_preference_limit = 10000\n";
+            }
+        }
+
+        conf = "[libdefaults]\n" +
+                "default_realm = " + OneKDC.REALM + "\n" +
+                inDefaults +
+                "\n" +
+                "[realms]\n" +
+                OneKDC.REALM + " = {\n";
+
+        for (int port : ports) {
+            conf += "   kdc = " + OneKDC.KDCHOST + ":" + port + "\n" +
+                    inRealm;
+        }
+
+        conf += "}\n";
+
+        Files.write(Paths.get("alternative-krb5.conf"), conf.getBytes());
+        Config.refresh();
+    }
+
+    /**
+     * One call of krb5 login. As long as the result matches one of expected,
+     * the test is considered as success. The grammar of expected is
+     *
+     *    kdc#, timeout, kdc#, timeout, ..., optional "-" for failure
+     */
+    static void test(String... expected) throws Exception {
+
+        System.out.println("------------------TEST----------------------");
+        PrintStream oldOut = System.out;
+        boolean failed = false;
+        ByteArrayOutputStream bo = new ByteArrayOutputStream();
+        System.setOut(new PrintStream(bo));
+        try {
+            Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false);
+        } catch (Exception e) {
+            failed = true;
+        } finally {
+            System.setOut(oldOut);
+        }
+
+        String[] lines = new String(bo.toByteArray()).split("\n");
+        StringBuilder sb = new StringBuilder();
+        for (String line: lines) {
+            if (cm.match(line)) {
+                if (udp != cm.isUDP()) {
+                    sb.append("x");
+                }
+                sb.append(cm.kdc()).append(cm.timeout());
+            }
+        }
+        if (failed) sb.append('-');
+
+        String output = sb.toString();
+
+        boolean found = false;
+        for (String ex : expected) {
+            if (output.matches(ex)) {
+                System.out.println("Expected: " + ex + ", actual " + output);
+                found = true;
+                break;
+            }
+        }
+
+        if (!found) {
+            System.out.println("--------------- ERROR START -------------");
+            System.out.println(new String(bo.toByteArray()));
+            System.out.println("--------------- ERROR END ---------------");
+            throw new Exception("Does not match. Output is " + output);
+        }
+    }
+
+    /**
+     * A helper class to match the krb5 debug output:
+     * >>> KDCCommunication: kdc=host UDP:11555, timeout=200,Attempt =1, #bytes=138
+     *
+     * Example:
+     *  DebugMatcher cm = new DebugMatcher();
+     *  cm.addPort(12345).addPort(11555);
+     *  for (String line : debugOutput) {
+     *      if (cm.match(line)) {
+     *          System.out.printf("%c%d\n", cm.kdc(), cm.timeout());
+     *          // shows b200 for the example above
+     *      }
+     *  }
+     */
+    static class DebugMatcher {
+
+        static final Pattern re = Pattern.compile(
+                ">>> KDCCommunication: kdc=\\S+ (TCP|UDP):(\\d+), " +
+                        "timeout=(\\d+),Attempt\\s*=(\\d+)");
+
+        List<Integer> kdcPorts = new ArrayList<>();
+        Matcher matcher;
+
+        /**
+         * Add KDC ports one by one. See {@link #kdc()}.
+         */
+        DebugMatcher addPort(int port) {
+            if (port > 0) {
+                kdcPorts.add(port);
+            } else {
+                kdcPorts.clear();
+            }
+            return this;
+        }
+
+        /**
+         * When a line matches the ">>> KDCCommunication:" pattern. After a
+         * match, the getters below can be called on this match.
+         */
+        boolean match(String line) {
+            matcher = re.matcher(line);
+            return matcher.find();
+        }
+
+        /**
+         * Protocol of this match, "UDP" or "TCP".
+         */
+        boolean isUDP() {
+            return matcher.group(1).equals("UDP");
+        }
+
+        /**
+         * KDC for this match, "a" for the one 1st added bt addPort(), "b"
+         * for second, etc. Undefined for not added.
+         */
+        char kdc() {
+            int port = Integer.parseInt(matcher.group(2));
+            return (char) (kdcPorts.indexOf(port) + 'a');
+        }
+
+        /**
+         * Timeout value for this match.
+         */
+        int timeout() {
+            return Integer.parseInt(matcher.group(3));
+        }
+    }
+}
--- a/jdk/test/sun/security/ssl/SSLSocketImpl/CloseSocket.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/sun/security/ssl/SSLSocketImpl/CloseSocket.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,67 +26,96 @@
  * @bug 4674913
  * @summary Verify that EOFException are correctly handled during the handshake
  * @author Andreas Sterbenz
+ * @run main/othervm CloseSocket
  */
 
-import java.io.*;
-import java.net.*;
-
-import javax.net.ssl.*;
+import javax.net.SocketFactory;
+import javax.net.ssl.SSLSocket;
+import javax.net.ssl.SSLSocketFactory;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.ArrayList;
 
 public class CloseSocket {
 
+    private static ArrayList<TestCase> testCases = new ArrayList<>();
+
+    static {
+        testCases.add(socket -> socket.startHandshake());
+        testCases.add(socket -> {
+            InputStream in = socket.getInputStream();
+            in.read();
+        });
+        testCases.add(socket -> {
+            OutputStream out = socket.getOutputStream();
+            out.write(43);
+        });
+    }
+
     public static void main(String[] args) throws Exception {
-        final ServerSocket serverSocket = new ServerSocket(0);
-        int serverPort = serverSocket.getLocalPort();
-        new Thread() {
-            public void run() {
-                try {
-                    Socket s = serverSocket.accept();
-                    System.out.println("Server accepted connection");
-                    // wait a bit before closing the socket to give
-                    // the client time to send its hello message
-                    Thread.currentThread().sleep(100);
-                    s.close();
-                    System.out.println("Server closed socket, done.");
-                } catch (Exception e) {
-                    System.out.println("Server exception:");
-                    e.printStackTrace();
+        try (Server server = new Server()) {
+            new Thread(server).start();
+
+            SocketFactory factory = SSLSocketFactory.getDefault();
+            try (SSLSocket socket = (SSLSocket) factory.createSocket("localhost",
+                    server.getPort())) {
+                socket.setSoTimeout(2000);
+                System.out.println("Client established TCP connection");
+                boolean failed = false;
+                for (TestCase testCase : testCases) {
+                    try {
+                        testCase.test(socket);
+                        System.out.println("ERROR: no exception");
+                        failed = true;
+                    } catch (IOException e) {
+                        System.out.println("Failed as expected: " + e);
+                    }
+                }
+                if (failed) {
+                    throw new Exception("One or more tests failed");
                 }
             }
-        }.start();
-        SSLSocketFactory factory = (SSLSocketFactory)SSLSocketFactory.getDefault();
-        SSLSocket socket = (SSLSocket)factory.createSocket("localhost", serverPort);
-        System.out.println("Client established TCP connection");
-        boolean failed = false;
-        try {
-            System.out.println("Starting handshake...");
-            socket.startHandshake();
-            System.out.println("ERROR: no exception");
-            failed = true;
-        } catch (IOException e) {
-            System.out.println("Failed as expected: " + e);
-        }
-        try {
-            System.out.println("Trying read...");
-            InputStream in = socket.getInputStream();
-            int b = in.read();
-            System.out.println("ERROR: no exception, read: " + b);
-            failed = true;
-        } catch (IOException e) {
-            System.out.println("Failed as expected: " + e);
-        }
-        try {
-            System.out.println("Trying read...");
-            OutputStream out = socket.getOutputStream();
-            out.write(43);
-            System.out.println("ERROR: no exception");
-            failed = true;
-        } catch (IOException e) {
-            System.out.println("Failed as expected: " + e);
-        }
-        if (failed) {
-            throw new Exception("One or more tests failed");
         }
     }
 
+    static class Server implements AutoCloseable, Runnable {
+
+        final ServerSocket serverSocket;
+
+        Server() throws IOException {
+            serverSocket = new ServerSocket(0);
+        }
+
+        public int getPort() {
+            return serverSocket.getLocalPort();
+        }
+
+        @Override
+        public void run() {
+            try (Socket s = serverSocket.accept()) {
+                System.out.println("Server accepted connection");
+                // wait a bit before closing the socket to give
+                // the client time to send its hello message
+                Thread.currentThread().sleep(100);
+                s.close();
+                System.out.println("Server closed socket, done.");
+            } catch (Exception e) {
+                throw new RuntimeException("Problem in test execution", e);
+            }
+        }
+
+        @Override
+        public void close() throws Exception {
+            if (!serverSocket.isClosed()) {
+                serverSocket.close();
+            }
+        }
+    }
+
+    interface TestCase {
+        void test(SSLSocket socket) throws IOException;
+    }
 }
--- a/jdk/test/tools/jlink/CustomPluginTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/tools/jlink/CustomPluginTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -67,6 +67,7 @@
 
         testHelloProvider(helper, pluginModulePath);
         testCustomPlugins(helper, pluginModulePath);
+        testModuleVerification(helper, pluginModulePath);
     }
 
     private void testCustomPlugins(Helper helper, Path pluginModulePath) {
@@ -93,8 +94,7 @@
         String name = "customplugin";
         Path src = Paths.get(System.getProperty("test.src")).resolve(name);
         Path classes = helper.getJmodClassesDir().resolve(name);
-        JImageGenerator.compile(src, classes,
-                                "--add-exports", "jdk.jlink/jdk.tools.jlink.internal=customplugin");
+        JImageGenerator.compile(src, classes);
         return JImageGenerator.getJModTask()
                 .addClassPath(classes)
                 .jmod(helper.getJmodDir().resolve(name + ".jmod"))
@@ -136,4 +136,44 @@
             throw new AssertionError("Custom plugin not called");
         }
     }
+
+    private void testModuleVerification(Helper helper, Path pluginModulePath) throws IOException {
+        {
+            // dependent module missing check
+            String moduleName = "bar"; // 8147491
+            Path jmodFoo = helper.generateDefaultJModule("foo").assertSuccess();
+            Path jmodBar = helper.generateDefaultJModule(moduleName, "foo").assertSuccess();
+            // rogue filter removes "foo" module resources which are
+            // required by "bar" module. Module checks after plugin
+            // application should detect and report error.
+            JImageGenerator.getJLinkTask()
+                .modulePath(helper.defaultModulePath())
+                .pluginModulePath(pluginModulePath)
+                .output(helper.createNewImageDir(moduleName))
+                .addMods(moduleName)
+                .option("--rogue-filter")
+                .option("/foo/")
+                .call()
+                .assertFailure("java.lang.module.ResolutionException");
+        }
+
+        {
+            // package exported by one module used as concealed package
+            // in another module. But, module-info.class is not updated!
+            String moduleName = "jdk.scripting.nashorn";
+            JImageGenerator.getJLinkTask()
+                .modulePath(helper.defaultModulePath())
+                .pluginModulePath(pluginModulePath)
+                .output(helper.createNewImageDir(moduleName))
+                .addMods(moduleName)
+                // "java.logging" includes a package 'javax.script'
+                // which is an exported package from "java.scripting" module!
+                // module-info.class of java.logging left "as is".
+                .option("--rogue-adder")
+                .option("/java.logging/javax/script/Foo.class")
+                .call()
+                .assertFailure(
+                    "Module java.logging's descriptor returns inconsistent package set");
+        }
+    }
 }
--- a/jdk/test/tools/jlink/ImageFileCreatorTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/tools/jlink/ImageFileCreatorTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -220,7 +220,7 @@
         };
 
         ImagePluginStack stack = new ImagePluginStack(noopBuilder, Collections.emptyList(),
-                null);
+                null, false);
 
         ImageFileCreator.create(archives, ByteOrder.nativeOrder(), stack);
     }
--- a/jdk/test/tools/jlink/customplugin/module-info.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/tools/jlink/customplugin/module-info.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,4 +25,6 @@
     requires jdk.jlink;
     provides jdk.tools.jlink.plugin.Plugin with plugin.HelloPlugin;
     provides jdk.tools.jlink.plugin.Plugin with plugin.CustomPlugin;
+    provides jdk.tools.jlink.plugin.Plugin with plugin.RogueAdderPlugin;
+    provides jdk.tools.jlink.plugin.Plugin with plugin.RogueFilterPlugin;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jlink/customplugin/plugin/RogueAdderPlugin.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package plugin;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.lang.module.ModuleDescriptor;
+import java.util.Collections;
+import java.util.Map;
+import java.util.function.Function;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
+import jdk.tools.jlink.plugin.ResourcePoolModule;
+import jdk.tools.jlink.plugin.Plugin;
+
+/**
+ * Rogue adder plugin
+ */
+public final class RogueAdderPlugin implements Plugin {
+    public static final String NAME = "rogue-adder";
+    private String resName;
+
+    @Override
+    public String getName() {
+        return NAME;
+    }
+
+    @Override
+    public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
+        in.transformAndCopy(Function.identity(), out);
+        out.add(ResourcePoolEntry.create(resName, new byte[1]));
+        return out.build();
+    }
+
+    @Override
+    public String getDescription() {
+        return NAME + "-description";
+    }
+
+    @Override
+    public Category getType() {
+        return Category.FILTER;
+    }
+
+    @Override
+    public boolean hasArguments() {
+        return true;
+    }
+
+    @Override
+    public void configure(Map<String, String> config) {
+        resName = config.get(NAME);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jlink/customplugin/plugin/RogueFilterPlugin.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package plugin;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.util.Collections;
+import java.util.Map;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.Plugin;
+
+/**
+ * Rogue filter plugin
+ */
+public final class RogueFilterPlugin implements Plugin {
+    public static final String NAME = "rogue-filter";
+    private String prefix;
+
+    @Override
+    public String getName() {
+        return NAME;
+    }
+
+    @Override
+    public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
+        in.transformAndCopy((file) -> {
+            return file.path().startsWith(prefix)? null : file;
+        }, out);
+        return out.build();
+    }
+
+    @Override
+    public String getDescription() {
+        return NAME + "-description";
+    }
+
+    @Override
+    public Category getType() {
+        return Category.FILTER;
+    }
+
+    @Override
+    public boolean hasArguments() {
+        return true;
+    }
+
+    @Override
+    public void configure(Map<String, String> config) {
+        prefix = config.get(NAME);
+    }
+}
--- a/jdk/test/tools/jlink/plugins/GenerateJLIClassesPluginTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/GenerateJLIClassesPluginTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -73,47 +73,6 @@
                     classFilesForSpecies(GenerateJLIClassesPlugin.defaultSpecies()),
                     List.of());
 
-
-        // Test a valid set of options
-        result = JImageGenerator.getJLinkTask()
-                .modulePath(helper.defaultModulePath())
-                .output(helper.createNewImageDir("generate-jli"))
-                .option("--generate-jli-classes=bmh:bmh-species=LL,L3")
-                .addMods("java.base")
-                .call();
-
-        image = result.assertSuccess();
-
-        JImageValidator.validate(
-                image.resolve("lib").resolve("modules"),
-                classFilesForSpecies(List.of("LL", "L3")),
-                classFilesForSpecies(List.of("L4")));
-
-
-        // Test disabling BMH species generation
-        result = JImageGenerator.getJLinkTask()
-                .modulePath(helper.defaultModulePath())
-                .output(helper.createNewImageDir("generate-jli"))
-                .option("--generate-jli-classes=not-bmh:bmh-species=LL,L3")
-                .addMods("java.base")
-                .call();
-
-        image = result.assertSuccess();
-        JImageValidator.validate(
-            image.resolve("lib").resolve("modules"),
-            List.of(),
-            classFilesForSpecies(List.of("LL", "L3", "L4")));
-
-
-        // Test an invalid set of options
-        result = JImageGenerator.getJLinkTask()
-                .modulePath(helper.defaultModulePath())
-                .output(helper.createNewImageDir("generate-jli"))
-                .option("--generate-jli-classes=bmh:bmh-species=LL,L7V")
-                .addMods("java.base")
-                .call();
-
-        result.assertFailure();
     }
 
     private static List<String> classFilesForSpecies(List<String> species) {
--- a/jdk/test/tools/launcher/VersionCheck.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/jdk/test/tools/launcher/VersionCheck.java	Fri Aug 26 14:47:52 2016 -0700
@@ -82,6 +82,7 @@
         "jcmd",
         "jconsole",
         "jcontrol",
+        "jdeprscan",
         "jdeps",
         "jimage",
         "jinfo",
--- a/langtools/.hgtags	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/.hgtags	Fri Aug 26 14:47:52 2016 -0700
@@ -375,3 +375,4 @@
 3665ebc22a42c8f33777ee025ba0e300e6086a8c jdk-9+130
 aebfafc43714d5a27d5064d8a0011eaccde633cf jdk-9+131
 2c17b65a37a8d7afdb9f96d5f11b28a3f21c78f2 jdk-9+132
+7efa4b3477b2b93edbdb4abf827b74c6391f056e jdk-9+133
--- a/langtools/make/CompileInterim.gmk	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/make/CompileInterim.gmk	Fri Aug 26 14:47:52 2016 -0700
@@ -32,7 +32,7 @@
 include SetupJavaCompilers.gmk
 
 ################################################################################
-# Setup the rules to build interim langtools, which is compiled by the boot 
+# Setup the rules to build interim langtools, which is compiled by the boot
 # javac and can be run on the boot jdk. This will be used to compile
 # the rest of the product. Each module is compiled separately to allow a modular
 # boot jdk to override system classes using -Xoverride:.
@@ -45,7 +45,8 @@
       DISABLE_SJAVAC := true, \
       SRC := $(LANGTOOLS_TOPDIR)/src/$(strip $1)/share/classes \
           $$(wildcard $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1)), \
-      EXCLUDES := sun com/sun/tools/jdeps com/sun/tools/javap, \
+      EXCLUDES := sun com/sun/tools/jdeps com/sun/tools/javap \
+          com/sun/tools/jdeprscan, \
       EXCLUDE_FILES := module-info.java, \
       COPY := .gif .png .xml .css .js javax.tools.JavaCompilerTool, \
       BIN := $(BUILDTOOLS_OUTPUTDIR)/override_modules/$(strip $1), \
--- a/langtools/make/build.xml	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/make/build.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -88,18 +88,18 @@
         <dirset dir="${src.dir}" includes="*.*"/>
     </pathconvert>
 
-    <pathconvert property="xpatch.rest" pathsep=" -Xpatch:">
+    <pathconvert property="xpatch.rest" pathsep=" --patch-module=">
         <regexpmapper from="${file.separator}([^${file.separator}]+)$" to='\1="${build.modules}${file.separator}\1"' />
         <dirset dir="${src.dir}" includes="*.*"/>
     </pathconvert>
 
-    <pathconvert property="xpatch.noquotes.rest" pathsep=" -Xpatch:">
+    <pathconvert property="xpatch.noquotes.rest" pathsep=" --patch-module=">
         <regexpmapper from="${file.separator}([^${file.separator}]+)$" to="\1=${build.modules}${file.separator}\1" />
         <dirset dir="${src.dir}" includes="*.*"/>
     </pathconvert>
 
-    <property name="xpatch.cmd" value="-Xpatch:${xpatch.rest}"/>
-    <property name="xpatch.noquotes.cmd" value="-Xpatch:${xpatch.noquotes.rest}"/>
+    <property name="xpatch.cmd" value="--patch-module=${xpatch.rest}"/>
+    <property name="xpatch.noquotes.cmd" value="--patch-module=${xpatch.noquotes.rest}"/>
 
     <!-- java.marker is set to a marker file to check for within a Java install dir.
          The best file to check for across Solaris/Linux/Windows/MacOS is one of the
@@ -207,7 +207,7 @@
             <arg line="-source ${javac.source} -target ${javac.target}" />
             <arg value="-d" />
             <arg value="${build.modules}" />
-            <arg line="${javac.opts} -modulesourcepath ${src.dir}${file.separator}*${file.separator}share${file.separator}classes:${build.gensrc} -m ${modules.names}" />
+            <arg line="${javac.opts} --module-source-path ${src.dir}${file.separator}*${file.separator}share${file.separator}classes:${build.gensrc} -m ${modules.names}" />
         </exec>
         <delete>
             <fileset dir="${build.modules}" includes="**/module-info.class"/>
--- a/langtools/make/diags-examples.xml	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/make/diags-examples.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -80,12 +80,12 @@
             includeAntRuntime="no"
             debug="${javac.debug}"
             debuglevel="${javac.debuglevel}">
-            <compilerarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"/>
-            <compilerarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED"/>
-            <compilerarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED"/>
-            <compilerarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED"/>
-            <compilerarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED"/>
-            <compilerarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"/>
+            <compilerarg line="--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"/>
+            <compilerarg line="--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED"/>
+            <compilerarg line="--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED"/>
+            <compilerarg line="--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED"/>
+            <compilerarg line="--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED"/>
+            <compilerarg line="--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"/>
         </javac>
     </target>
 
@@ -111,12 +111,12 @@
                 <arg value="-showFiles"/>
                 <arg value="-title"/>
                 <arg value="Examples of javac diagnostics"/>
-                <jvmarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"/>
-                <jvmarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED"/>
-                <jvmarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED"/>
-                <jvmarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED"/>
-                <jvmarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED"/>
-                <jvmarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"/>
+                <jvmarg line="--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"/>
+                <jvmarg line="--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED"/>
+                <jvmarg line="--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED"/>
+                <jvmarg line="--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED"/>
+                <jvmarg line="--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED"/>
+                <jvmarg line="--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"/>
             </java>
             </sequential>
         </macrodef>
--- a/langtools/make/gendata/Gendata-jdk.compiler.gmk	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/make/gendata/Gendata-jdk.compiler.gmk	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -41,9 +41,9 @@
 
 ifeq ($(BOOT_JDK_MODULAR), true)
   COMPILECREATESYMBOLS_ADD_EXPORTS := \
-      -XaddExports:jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
-      -XaddExports:jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED \
-      -XaddExports:jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED
+      --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
+      --add-exports=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED \
+      --add-exports=jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED
 endif
 
 $(SUPPORT_OUTPUTDIR)/symbols/ct.sym-files/_the.symbols: \
--- a/langtools/make/intellij/runConfigurations/javah.xml	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/make/intellij/runConfigurations/javah.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -2,7 +2,7 @@
   <configuration default="false" name="javah" type="Application" factoryName="Application">
     <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
     <option name="MAIN_CLASS_NAME" value="com.sun.tools.javah.Main" />
-    <option name="VM_PARAMETERS" value='@XPATCH@ -XaddExports:jdk.compiler/com.sun.tools.javah=ALL-UNNAMED' />
+    <option name="VM_PARAMETERS" value='@XPATCH@ --add-exports=jdk.compiler/com.sun.tools.javah=ALL-UNNAMED' />
     <option name="PROGRAM_PARAMETERS" value="" />
     <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
     <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
--- a/langtools/make/intellij/runConfigurations/javap.xml	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/make/intellij/runConfigurations/javap.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -2,7 +2,7 @@
   <configuration default="false" name="javap" type="Application" factoryName="Application">
     <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
     <option name="MAIN_CLASS_NAME" value="com.sun.tools.javap.Main" />
-    <option name="VM_PARAMETERS" value='@XPATCH@ -XaddExports:jdk.jdeps/com.sun.tools.javap=ALL-UNNAMED' />
+    <option name="VM_PARAMETERS" value='@XPATCH@ --add-exports=jdk.jdeps/com.sun.tools.javap=ALL-UNNAMED' />
     <option name="PROGRAM_PARAMETERS" value="" />
     <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
     <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
--- a/langtools/make/intellij/runConfigurations/jshell.xml	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/make/intellij/runConfigurations/jshell.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -2,7 +2,7 @@
   <configuration default="false" name="jshell" type="Application" factoryName="Application">
     <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
     <option name="MAIN_CLASS_NAME" value="jdk.internal.jshell.tool.JShellTool" />
-    <option name="VM_PARAMETERS" value='@XPATCH@ -XaddExports:jdk.jshell/jdk.internal.jshell.tool=ALL-UNNAMED' />
+    <option name="VM_PARAMETERS" value='@XPATCH@ --add-exports=jdk.jshell/jdk.internal.jshell.tool=ALL-UNNAMED' />
     <option name="PROGRAM_PARAMETERS" value="" />
     <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
     <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
--- a/langtools/make/intellij/runConfigurations/sjavac.xml	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/make/intellij/runConfigurations/sjavac.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -2,7 +2,7 @@
   <configuration default="false" name="sjavac" type="Application" factoryName="Application">
     <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
     <option name="MAIN_CLASS_NAME" value="com.sun.tools.sjavac.Main" />
-    <option name="VM_PARAMETERS" value='@XPATCH@ -XaddExports:jdk.compiler/com.sun.tools.sjavac=ALL-UNNAMED' />
+    <option name="VM_PARAMETERS" value='@XPATCH@ --add-exports=jdk.compiler/com.sun.tools.sjavac=ALL-UNNAMED' />
     <option name="PROGRAM_PARAMETERS" value="" />
     <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
     <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
--- a/langtools/make/netbeans/langtools/build.xml	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/make/netbeans/langtools/build.xml	Fri Aug 26 14:47:52 2016 -0700
@@ -218,11 +218,11 @@
 
             <sequential>
                 <java fork="true" jvm="${langtools.jdk.home}/bin/java" classname="@{mainclass}">
-                    <jvmarg line="-Xpatch:java.compiler=@{build.modules}/java.compiler"/>
-                    <jvmarg line="-Xpatch:jdk.compiler=@{build.modules}/jdk.compiler"/>
-                    <jvmarg line="-Xpatch:jdk.javadoc=@{build.modules}/jdk.javadoc"/>
-                    <jvmarg line="-Xpatch:jdk.jdeps=@{build.modules}/jdk.jdeps"/>
-                    <jvmarg line="-Xpatch:jdk.jshell=@{build.modules}/jdk.jshell"/>
+                    <jvmarg line="--patch-module=java.compiler=@{build.modules}/java.compiler"/>
+                    <jvmarg line="--patch-module=jdk.compiler=@{build.modules}/jdk.compiler"/>
+                    <jvmarg line="--patch-module=jdk.javadoc=@{build.modules}/jdk.javadoc"/>
+                    <jvmarg line="--patch-module=jdk.jdeps=@{build.modules}/jdk.jdeps"/>
+                    <jvmarg line="--patch-module=jdk.jshell=@{build.modules}/jdk.jshell"/>
                     <jvmarg line="@{jpda.jvmargs}"/>
                     <arg line="@{args}"/>
                 </java>
--- a/langtools/make/tools/crules/DefinedByAnalyzer.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/make/tools/crules/DefinedByAnalyzer.java	Fri Aug 26 14:47:52 2016 -0700
@@ -23,10 +23,15 @@
 
 package crules;
 
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
 import com.sun.source.util.JavacTask;
 import com.sun.source.util.TaskEvent.Kind;
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Symbol.MethodSymbol;
+import com.sun.tools.javac.tree.JCTree.JCClassDecl;
 import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
 import com.sun.tools.javac.tree.TreeScanner;
 import com.sun.tools.javac.util.DefinedBy;
@@ -44,8 +49,21 @@
         eventKind = Kind.ANALYZE;
     }
 
+    //only java.compiler and jdk.compiler modules implement the APIs,
+    //so only these need the @DefinedBy annotation:
+    private static final Set<String> MODULE = new HashSet<>(Arrays.asList(
+        "java.compiler",
+        "jdk.compiler"
+    ));
+
     class DefinedByVisitor extends TreeScanner {
         @Override
+        public void visitClassDef(JCClassDecl tree) {
+            if (MODULE.contains(tree.sym.packge().modle.name.toString())) {
+                super.visitClassDef(tree);
+            }
+        }
+        @Override
         public void visitMethodDef(JCMethodDecl tree) {
             if (!isAPIPackage(packageName(tree.sym))) {
                 boolean seenAPIPackage = false;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java	Fri Aug 26 14:47:52 2016 -0700
@@ -369,6 +369,7 @@
                 }
             };
         addRootPackageFor(unnamedModule);
+        unnamedModule.enclosedPackages = unnamedModule.enclosedPackages.prepend(unnamedModule.unnamedPackage);
 
         errModule = new ModuleSymbol(names.empty, null) { };
         addRootPackageFor(errModule);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Fri Aug 26 14:47:52 2016 -0700
@@ -418,10 +418,15 @@
             final ListBuffer<Symbol> abstracts = new ListBuffer<>();
             for (Symbol sym : membersCache.getSymbols(new DescriptorFilter(origin))) {
                 Type mtype = memberType(origin.type, sym);
-                if (abstracts.isEmpty() ||
-                        (sym.name == abstracts.first().name &&
+                if (abstracts.isEmpty()) {
+                    abstracts.append(sym);
+                } else if ((sym.name == abstracts.first().name &&
                         overrideEquivalent(mtype, memberType(origin.type, abstracts.first())))) {
-                    abstracts.append(sym);
+                    if (!abstracts.stream().filter(msym -> msym.owner.isSubClass(sym.enclClass(), Types.this))
+                            .map(msym -> memberType(origin.type, msym))
+                            .anyMatch(abstractMType -> isSubSignature(abstractMType, mtype))) {
+                        abstracts.append(sym);
+                    }
                 } else {
                     //the target method(s) should be the only abstract members of t
                     throw failure("not.a.functional.intf.1",  origin,
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java	Fri Aug 26 14:47:52 2016 -0700
@@ -61,6 +61,7 @@
 import java.util.Set;
 import java.util.function.BiFunction;
 import java.util.function.BiPredicate;
+import java.util.stream.Collectors;
 
 import com.sun.tools.javac.main.Option;
 
@@ -1475,16 +1476,11 @@
                     //not a throws undet var
                     return false;
                 }
-                Infer infer = inferenceContext.infer;
-                for (Type db : t.getBounds(InferenceBound.UPPER)) {
-                    if (t.isInterface()) continue;
-                    if (infer.types.asSuper(infer.syms.runtimeExceptionType, db.tsym) == null) {
-                        //upper bound is not a supertype of RuntimeException - give up
-                        return false;
-                    }
-                }
-
-                return true;
+                Types types = inferenceContext.types;
+                Symtab syms = inferenceContext.infer.syms;
+                return t.getBounds(InferenceBound.UPPER).stream()
+                        .filter(b -> !inferenceContext.free(b))
+                        .allMatch(u -> types.isSubtype(syms.runtimeExceptionType, u));
             }
 
             @Override
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -124,7 +124,7 @@
     /**
      * Build the documentation.
      *
-     * @throws IOException if there was a problem writing the output.
+     * @throws IOException if there is a problem writing the output
      */
     public abstract void build() throws IOException;
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/api/JavadocTaskImpl.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/api/JavadocTaskImpl.java	Fri Aug 26 14:47:52 2016 -0700
@@ -34,8 +34,6 @@
 
 import com.sun.tools.javac.util.ClientCodeException;
 import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
 import jdk.javadoc.internal.tool.Start;
 
 /**
@@ -68,14 +66,12 @@
         setLocale(Locale.getDefault());
     }
 
-    @DefinedBy(Api.COMPILER)
     public void setLocale(Locale locale) {
         if (used.get())
             throw new IllegalStateException();
         this.locale = locale;
     }
 
-    @DefinedBy(Api.COMPILER)
     public Boolean call() {
         if (!used.getAndSet(true)) {
             initContext();
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/api/JavadocTool.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/api/JavadocTool.java	Fri Aug 26 14:47:52 2016 -0700
@@ -49,8 +49,6 @@
 import com.sun.tools.javac.file.BaseFileManager;
 import com.sun.tools.javac.util.ClientCodeException;
 import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.Log;
 import jdk.javadoc.internal.tool.ToolOption;
 
@@ -64,7 +62,7 @@
  * or deletion without notice.</b></p>
  */
 public class JavadocTool implements DocumentationTool {
-    @Override @DefinedBy(Api.COMPILER)
+    @Override
     public DocumentationTask getTask(
             Writer out,
             JavaFileManager fileManager,
@@ -129,7 +127,7 @@
     }
 
     // TODO: used shared static method in JavacFileManager
-    @Override @DefinedBy(Api.COMPILER)
+    @Override
     public StandardJavaFileManager getStandardFileManager(
             DiagnosticListener<? super JavaFileObject> diagnosticListener,
             Locale locale,
@@ -145,7 +143,7 @@
         return new JavacFileManager(context, true, charset);
     }
 
-    @Override @DefinedBy(Api.COMPILER)
+    @Override
     public int run(InputStream in, OutputStream out, OutputStream err, String... arguments) {
         PrintWriter err_pw = new PrintWriter(err == null ? System.err : err, true);
         PrintWriter out_pw = new PrintWriter(out == null ? System.out : out);
@@ -157,13 +155,13 @@
         }
     }
 
-    @Override @DefinedBy(Api.COMPILER)
+    @Override
     public Set<SourceVersion> getSourceVersions() {
         return Collections.unmodifiableSet(
                 EnumSet.range(SourceVersion.RELEASE_3, SourceVersion.latest()));
     }
 
-    @Override @DefinedBy(Api.COMPILER)
+    @Override
     public int isSupportedOption(String option) {
         if (option == null)
             throw new NullPointerException();
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -39,8 +39,6 @@
 import javax.lang.model.type.TypeVariable;
 import javax.lang.model.util.SimpleTypeVisitor9;
 
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.toolkit.Content;
@@ -314,27 +312,27 @@
             SimpleTypeVisitor9<Boolean, Void> stv = new SimpleTypeVisitor9<Boolean, Void>() {
                 boolean foundTypeVariable = false;
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public Boolean visitArray(ArrayType t, Void p) {
                     visit(t.getComponentType());
                     buf.append(utils.getDimension(t));
                     return foundTypeVariable;
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public Boolean visitTypeVariable(TypeVariable t, Void p) {
                     buf.append(utils.asTypeElement(t).getQualifiedName());
                     foundTypeVariable = true;
                     return foundTypeVariable;
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public Boolean visitDeclared(DeclaredType t, Void p) {
                     buf.append(utils.getQualifiedTypeName(t));
                     return foundTypeVariable;
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 protected Boolean defaultAction(TypeMirror e, Void p) {
                     buf.append(e);
                     return foundTypeVariable;
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -26,7 +26,6 @@
 package jdk.javadoc.internal.doclets.formats.html;
 
 import java.io.*;
-import java.nio.file.*;
 import java.util.*;
 import java.util.zip.*;
 
@@ -38,7 +37,6 @@
 import javax.lang.model.util.SimpleElementVisitor9;
 
 import com.sun.source.doctree.DocTree;
-import com.sun.tools.javac.util.DefinedBy;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
@@ -46,9 +44,9 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 import jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder;
 
 /**
@@ -93,6 +91,7 @@
      *
      * @return a content tree for the tree label
      */
+    @Override
     protected Content getNavLinkIndex() {
         Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.indexLabel);
         return li;
@@ -183,7 +182,7 @@
         SearchIndexItem si = new SearchIndexItem();
         new SimpleElementVisitor9<Void, Void>() {
 
-            @Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
+            @Override
             public Void visitModule(ModuleElement e, Void p) {
                 if (configuration.showModules) {
                     addDescription(e, dl, si);
@@ -192,21 +191,21 @@
                 return null;
             }
 
-            @Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
+            @Override
             public Void visitPackage(PackageElement e, Void p) {
                 addDescription(e, dl, si);
                 configuration.packageSearchIndex.add(si);
                 return null;
             }
 
-            @Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
+            @Override
             public Void visitType(TypeElement e, Void p) {
                 addDescription(e, dl, si);
                 configuration.typeSearchIndex.add(si);
                 return null;
             }
 
-            @Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
+            @Override
             protected Void defaultAction(Element e, Void p) {
                 addDescription(e, dl, si);
                 configuration.memberSearchIndex.add(si);
@@ -242,6 +241,7 @@
      *
      * @param pkg the package to be documented
      * @param dlTree the content tree to which the description will be added
+     * @param si the search index item to be updated
      */
     protected void addDescription(PackageElement pkg, Content dlTree, SearchIndexItem si) {
         Content link = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
@@ -265,6 +265,7 @@
      *
      * @param typeElement the class being documented
      * @param dlTree the content tree to which the description will be added
+     * @param si the search index item to be updated
      */
     protected void addDescription(TypeElement typeElement, Content dlTree, SearchIndexItem si) {
         Content link = getLink(new LinkInfoImpl(configuration,
@@ -332,9 +333,9 @@
     }
 
     protected void addDescription(SearchIndexItem sii, Content dlTree) {
-        String path = pathToRoot.isEmpty() ? "" : pathToRoot.getPath() + "/";
-        path += sii.getUrl();
-        HtmlTree labelLink = HtmlTree.A(path, new StringContent(sii.getLabel()));
+        String siiPath = pathToRoot.isEmpty() ? "" : pathToRoot.getPath() + "/";
+        siiPath += sii.getUrl();
+        HtmlTree labelLink = HtmlTree.A(siiPath, new StringContent(sii.getLabel()));
         Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.searchTagLink, labelLink));
         dt.addContent(" - ");
         dt.addContent(contents.getContent("doclet.Search_tag_in", sii.getHolder()));
@@ -430,7 +431,10 @@
         return "I:" + getName(unicode);
     }
 
-    protected void createSearchIndexFiles() {
+    /**
+     * @throws DocFileIOException if there is a problem creating any of the search index files
+     */
+    protected void createSearchIndexFiles() throws DocFileIOException {
         if (configuration.showModules) {
             createSearchIndexFile(DocPaths.MODULE_SEARCH_INDEX_JSON, DocPaths.MODULE_SEARCH_INDEX_ZIP,
                     configuration.moduleSearchIndex);
@@ -445,54 +449,37 @@
                 configuration.tagSearchIndex);
     }
 
+    /**
+     * @throws DocFileIOException if there is a problem creating the search index file
+     */
     protected void createSearchIndexFile(DocPath searchIndexFile, DocPath searchIndexZip,
-            List<SearchIndexItem> searchIndex) {
+            List<SearchIndexItem> searchIndex) throws DocFileIOException {
         if (!searchIndex.isEmpty()) {
-            try {
-                StringBuilder searchVar = new StringBuilder("[");
-                boolean first = true;
-                DocFile searchFile = DocFile.createFileForOutput(configuration, searchIndexFile);
-                Path p = Paths.get(searchFile.getPath());
-                for (SearchIndexItem item : searchIndex) {
-                    if (first) {
-                        searchVar.append(item.toString());
-                        first = false;
-                    } else {
-                        searchVar.append(",").append(item.toString());
-                    }
+            StringBuilder searchVar = new StringBuilder("[");
+            boolean first = true;
+            for (SearchIndexItem item : searchIndex) {
+                if (first) {
+                    searchVar.append(item.toString());
+                    first = false;
+                } else {
+                    searchVar.append(",").append(item.toString());
                 }
-                searchVar.append("]");
-                Files.write(p, searchVar.toString().getBytes());
-                DocFile zipFile = DocFile.createFileForOutput(configuration, searchIndexZip);
-                try (FileOutputStream fos = new FileOutputStream(zipFile.getPath());
-                        ZipOutputStream zos = new ZipOutputStream(fos)) {
-                    zipFile(searchFile.getPath(), searchIndexFile, zos);
+            }
+            searchVar.append("]");
+
+            DocFile zipFile = DocFile.createFileForOutput(configuration, searchIndexZip);
+            try (OutputStream fos = zipFile.openOutputStream();
+                    ZipOutputStream zos = new ZipOutputStream(fos)) {
+                try {
+                    ZipEntry ze = new ZipEntry(searchIndexFile.getPath());
+                    zos.putNextEntry(ze);
+                    zos.write(searchVar.toString().getBytes());
+                } finally {
+                    zos.closeEntry();
                 }
-                Files.delete(p);
             } catch (IOException ie) {
-                throw new DocletAbortException(ie);
+                throw new DocFileIOException(zipFile, DocFileIOException.Mode.WRITE, ie);
             }
         }
     }
-
-    protected void zipFile(String inputFile, DocPath file, ZipOutputStream zos) {
-        try {
-            try {
-                ZipEntry ze = new ZipEntry(file.getPath());
-                zos.putNextEntry(ze);
-                try (FileInputStream fis = new FileInputStream(new File(inputFile))) {
-                    byte[] buf = new byte[2048];
-                    int len = fis.read(buf);
-                    while (len > 0) {
-                        zos.write(buf, 0, len);
-                        len = fis.read(buf);
-                    }
-                }
-            } finally {
-                zos.closeEntry();
-            }
-        } catch (IOException e) {
-            throw new DocletAbortException(e);
-        }
-    }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.Map;
 import java.util.Set;
 import java.util.SortedMap;
@@ -39,6 +38,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 
 /**
@@ -123,8 +123,9 @@
      *
      * @param title the title of the window.
      * @param includeScript boolean set true if windowtitle script is to be included
+     * @throws DocFileIOException if there is a problem building the module index file
      */
-    protected void buildModuleIndexFile(String title, boolean includeScript) throws IOException {
+    protected void buildModuleIndexFile(String title, boolean includeScript) throws DocFileIOException {
         String windowOverview = configuration.getText(title);
         Content body = getBody(includeScript, getWindowTitle(windowOverview));
         addNavigationBarHeader(body);
@@ -144,9 +145,10 @@
      * @param title the title of the window.
      * @param includeScript boolean set true if windowtitle script is to be included
      * @param mdle the name of the module being documented
+     * @throws DocFileIOException if there is an exception building the module packages index file
      */
     protected void buildModulePackagesIndexFile(String title,
-            boolean includeScript, ModuleElement mdle) throws IOException {
+            boolean includeScript, ModuleElement mdle) throws DocFileIOException {
         String windowOverview = configuration.getText(title);
         Content body = getBody(includeScript, getWindowTitle(windowOverview));
         addNavigationBarHeader(body);
@@ -163,8 +165,7 @@
      *
      * @param body the document tree to which the overview will be added
      */
-    protected void addOverview(Content body) throws IOException {
-    }
+    protected void addOverview(Content body) { }
 
     /**
      * Adds the frame or non-frame module index to the documentation tree.
@@ -259,6 +260,7 @@
      *
      * @return a Content object to be added to the documentation tree
      */
+    @Override
     protected Content getNavLinkContents() {
         Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.overviewLabel);
         return li;
@@ -269,22 +271,19 @@
      *
      * @param div the document tree to which the all classes link will be added
      */
-    protected void addAllClassesLink(Content div) {
-    }
+    protected void addAllClassesLink(Content div) { }
 
     /**
      * Do nothing. This will be overridden in ModuleIndexFrameWriter.
      *
      * @param div the document tree to which the all packages link will be added
      */
-    protected void addAllPackagesLink(Content div) {
-    }
+    protected void addAllPackagesLink(Content div) { }
 
     /**
      * Do nothing. This will be overridden in ModulePackageIndexFrameWriter.
      *
      * @param div the document tree to which the all modules link will be added
      */
-    protected void addAllModulesLink(Content div) {
-    }
+    protected void addAllModulesLink(Content div) { }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.*;
 
 import javax.lang.model.element.PackageElement;
@@ -36,6 +35,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 
 /**
@@ -109,8 +109,9 @@
      *
      * @param title the title of the window.
      * @param includeScript boolean set true if windowtitle script is to be included
+     * @throws DocFileIOException if there is a problem building the package index file
      */
-    protected void buildPackageIndexFile(String title, boolean includeScript) throws IOException {
+    protected void buildPackageIndexFile(String title, boolean includeScript) throws DocFileIOException {
         String windowOverview = configuration.getText(title);
         Content body = getBody(includeScript, getWindowTitle(windowOverview));
         addNavigationBarHeader(body);
@@ -127,8 +128,7 @@
      *
      * @param body the document tree to which the overview will be added
      */
-    protected void addOverview(Content body) throws IOException {
-    }
+    protected void addOverview(Content body) { }
 
     /**
      * Adds the frame or non-frame package index to the documentation tree.
@@ -190,6 +190,7 @@
      *
      * @return a Content object to be added to the documentation tree
      */
+    @Override
     protected Content getNavLinkContents() {
         Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.overviewLabel);
         return li;
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.*;
 
 import javax.lang.model.element.TypeElement;
@@ -37,7 +36,6 @@
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 
 
 /**
@@ -67,8 +65,6 @@
      * @param configuration  The current configuration
      * @param filename   File to be generated.
      * @param classtree  Tree built by {@link ClassTree}.
-     * @throws IOException
-     * @throws DocletAbortException
      */
     protected AbstractTreeWriter(ConfigurationImpl configuration,
                                  DocPath filename, ClassTree classtree) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.IOException;
 
 import javax.lang.model.element.Element;
 import javax.lang.model.element.TypeElement;
@@ -35,10 +34,9 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.Messages;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 import jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder;
 
 
@@ -75,8 +73,6 @@
      * @param configuration  The current configuration
      * @param filename       Path to the file which is getting generated.
      * @param indexbuilder   Unicode based Index from {@link IndexBuilder}
-     * @throws IOException
-     * @throws DocletAbortException
      */
     public AllClassesFrameWriter(ConfigurationImpl configuration,
                                  DocPath filename, IndexBuilder indexbuilder) {
@@ -90,10 +86,10 @@
      * destination directory.
      *
      * @param indexBuilder IndexBuilder object for all classes index.
-     * @throws DocletAbortException
+     * @throws DocFileIOException
      */
     public static void generate(ConfigurationImpl configuration,
-            IndexBuilder indexBuilder) {
+            IndexBuilder indexBuilder) throws DocFileIOException {
         if (configuration.frames) {
             generate(configuration, indexBuilder, DocPaths.ALLCLASSES_FRAME, true);
             generate(configuration, indexBuilder, DocPaths.ALLCLASSES_NOFRAME, false);
@@ -103,27 +99,19 @@
     }
 
     private static void generate(ConfigurationImpl configuration, IndexBuilder indexBuilder,
-            DocPath fileName, boolean wantFrames) {
-        try {
-            AllClassesFrameWriter allclassgen = new AllClassesFrameWriter(configuration,
-                    fileName, indexBuilder);
-            allclassgen.buildAllClassesFile(wantFrames);
-            allclassgen = new AllClassesFrameWriter(configuration,
-                                                    fileName, indexBuilder);
-            allclassgen.buildAllClassesFile(false);
-        } catch (IOException exc) {
-            Messages messages = configuration.getMessages();
-            messages.error("doclet.exception_encountered",
-                           exc.toString(), fileName);
-            throw new DocletAbortException(exc);
-        }
+        DocPath fileName, boolean wantFrames) throws DocFileIOException {
+        AllClassesFrameWriter allclassgen = new AllClassesFrameWriter(configuration,
+                fileName, indexBuilder);
+        allclassgen.buildAllClassesFile(wantFrames);
+        allclassgen = new AllClassesFrameWriter(configuration,
+                                                fileName, indexBuilder);
     }
 
     /**
      * Print all the classes in the file.
      * @param wantFrames True if we want frames.
      */
-    protected void buildAllClassesFile(boolean wantFrames) throws IOException {
+    protected void buildAllClassesFile(boolean wantFrames) throws DocFileIOException {
         String label = configuration.getText("doclet.All_Classes");
         Content body = getBody(false, getWindowTitle(label));
         Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.IOException;
 import java.util.List;
 
 import javax.lang.model.element.PackageElement;
@@ -42,9 +41,9 @@
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.builders.MemberSummaryBuilder;
 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
 
 /**
@@ -78,11 +77,9 @@
      * @param annotationType the annotation type being documented.
      * @param prevType the previous class that was documented.
      * @param nextType the next class being documented.
-     * @throws java.lang.Exception
      */
     public AnnotationTypeWriterImpl(ConfigurationImpl configuration,
-            TypeElement annotationType, TypeMirror prevType, TypeMirror nextType)
-            throws Exception {
+            TypeElement annotationType, TypeMirror prevType, TypeMirror nextType) {
         super(configuration, DocPath.forClass(configuration.utils, annotationType));
         this.annotationType = annotationType;
         configuration.currentTypeElement = annotationType;
@@ -243,7 +240,7 @@
      * {@inheritDoc}
      */
     @Override
-    public void printDocument(Content contentTree) throws IOException {
+    public void printDocument(Content contentTree) throws DocFileIOException {
         printHtmlDocument(configuration.metakeywords.getMetaKeywords(annotationType),
                 true, contentTree);
     }
@@ -352,22 +349,17 @@
      */
     @Override
     protected void addSummaryDetailLinks(Content subDiv) {
-        try {
-            Content div = HtmlTree.DIV(getNavSummaryLinks());
-            div.addContent(getNavDetailLinks());
-            subDiv.addContent(div);
-        } catch (Exception e) {
-            throw new DocletAbortException(e);
-        }
+        Content div = HtmlTree.DIV(getNavSummaryLinks());
+        div.addContent(getNavDetailLinks());
+        subDiv.addContent(div);
     }
 
     /**
      * Get summary links for navigation bar.
      *
      * @return the content tree for the navigation summary links
-     * @throws java.lang.Exception
      */
-    protected Content getNavSummaryLinks() throws Exception {
+    protected Content getNavSummaryLinks() {
         Content li = HtmlTree.LI(contents.summaryLabel);
         li.addContent(Contents.SPACE);
         Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
@@ -417,9 +409,8 @@
      * Get detail links for the navigation bar.
      *
      * @return the content tree for the detail links
-     * @throws java.lang.Exception
      */
-    protected Content getNavDetailLinks() throws Exception {
+    protected Content getNavDetailLinks() {
         Content li = HtmlTree.LI(contents.detailLabel);
         li.addContent(Contents.SPACE);
         Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -47,12 +46,11 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
 import jdk.javadoc.internal.doclets.toolkit.util.ClassUseMapper;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 
 /**
  * Generate class usage information.
@@ -112,12 +110,10 @@
      * Constructor.
      *
      * @param filename the file to be generated.
-     * @throws IOException
-     * @throws DocletAbortException
      */
     public ClassUseWriter(ConfigurationImpl configuration,
                           ClassUseMapper mapper, DocPath filename,
-                          TypeElement typeElement) throws IOException {
+                          TypeElement typeElement) {
         super(configuration, filename);
         this.typeElement = typeElement;
         if (mapper.classToPackageAnnotations.containsKey(typeElement)) {
@@ -175,9 +171,12 @@
 
     /**
      * Write out class use pages.
-     * @throws DocletAbortException
+     *
+     * @param configuration the configuration for this doclet
+     * @param classtree the class tree hierarchy
+     * @throws DocFileIOException if there is an error while generating the documentation
      */
-    public static void generate(ConfigurationImpl configuration, ClassTree classtree)  {
+    public static void generate(ConfigurationImpl configuration, ClassTree classtree) throws DocFileIOException  {
         ClassUseMapper mapper = new ClassUseMapper(configuration, classtree);
         for (TypeElement aClass : configuration.docEnv.getIncludedTypeElements()) {
             // If -nodeprecated option is set and the containing package is marked
@@ -217,28 +216,25 @@
 
     /**
      * Generate a class page.
+     *
+     * @throws DocFileIOException if there is a problem while generating the documentation
      */
     public static void generate(ConfigurationImpl configuration, ClassUseMapper mapper,
-                                TypeElement typeElement) {
+                                TypeElement typeElement) throws DocFileIOException {
         ClassUseWriter clsgen;
         DocPath path = DocPath.forPackage(configuration.utils, typeElement)
                               .resolve(DocPaths.CLASS_USE)
                               .resolve(DocPath.forName(configuration.utils, typeElement));
-        try {
-            clsgen = new ClassUseWriter(configuration, mapper, path, typeElement);
-            clsgen.generateClassUseFile();
-        } catch (IOException exc) {
-            Messages messages = configuration.getMessages();
-            messages.error("doclet.exception_encountered",
-                    exc.toString(), path.getPath());
-            throw new DocletAbortException(exc);
-        }
+        clsgen = new ClassUseWriter(configuration, mapper, path, typeElement);
+        clsgen.generateClassUseFile();
     }
 
     /**
      * Generate the class use elements.
+     *
+     * @throws DocFileIOException if there is a problem while generating the documentation
      */
-    protected void generateClassUseFile() throws IOException {
+    protected void generateClassUseFile() throws DocFileIOException {
         HtmlTree body = getClassUseHeader();
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.classUseContainer);
@@ -270,7 +266,7 @@
      *
      * @param contentTree the content tree to which the class use information will be added
      */
-    protected void addClassUse(Content contentTree) throws IOException {
+    protected void addClassUse(Content contentTree) {
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
         ul.addStyle(HtmlStyle.blockList);
         if (configuration.packages.size() > 1) {
@@ -286,7 +282,7 @@
      *
      * @param contentTree the content tree to which the packages elements will be added
      */
-    protected void addPackageList(Content contentTree) throws IOException {
+    protected void addPackageList(Content contentTree) {
         Content caption = getTableCaption(configuration.getContent(
                 "doclet.ClassUse_Packages.that.use.0",
                 getLink(new LinkInfoImpl(configuration,
@@ -314,7 +310,7 @@
      *
      * @param contentTree the content tree to which the package annotation elements will be added
      */
-    protected void addPackageAnnotationList(Content contentTree) throws IOException {
+    protected void addPackageAnnotationList(Content contentTree) {
         if (!utils.isAnnotationType(typeElement) ||
                 pkgToPackageAnnotations == null ||
                 pkgToPackageAnnotations.isEmpty()) {
@@ -352,7 +348,7 @@
      *
      * @param contentTree the content tree to which the class elements will be added
      */
-    protected void addClassList(Content contentTree) throws IOException {
+    protected void addClassList(Content contentTree) {
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
         ul.addStyle(HtmlStyle.blockList);
         for (PackageElement pkg : pkgSet) {
@@ -383,7 +379,7 @@
      * @param pkg the package that uses the given class
      * @param contentTree the content tree to which the package use information will be added
      */
-    protected void addPackageUse(PackageElement pkg, Content contentTree) throws IOException {
+    protected void addPackageUse(PackageElement pkg, Content contentTree) {
         Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
                 getHyperLink(getPackageAnchorName(pkg), new StringContent(utils.getPackageName(pkg))));
         contentTree.addContent(tdFirst);
@@ -399,7 +395,7 @@
      * @param pkg the package that uses the given class
      * @param contentTree the content tree to which the class use information will be added
      */
-    protected void addClassUse(PackageElement pkg, Content contentTree) throws IOException {
+    protected void addClassUse(PackageElement pkg, Content contentTree) {
         Content classLink = getLink(new LinkInfoImpl(configuration,
             LinkInfoImpl.Kind.CLASS_USE_HEADER, typeElement));
         Content pkgLink = getPackageLink(pkg, utils.getPackageName(pkg));
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.IOException;
 import java.util.*;
 
 import javax.lang.model.element.AnnotationMirror;
@@ -37,8 +36,6 @@
 import javax.lang.model.util.SimpleElementVisitor8;
 
 import com.sun.source.doctree.DocTree;
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
@@ -50,9 +47,9 @@
 import jdk.javadoc.internal.doclets.toolkit.taglets.ParamTaglet;
 import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap.Kind;
@@ -91,11 +88,9 @@
      * @param prevClass the previous class that was documented.
      * @param nextClass the next class being documented.
      * @param classTree the class tree for the given class.
-     * @throws java.io.IOException
      */
     public ClassWriterImpl(ConfigurationImpl configuration, TypeElement typeElement,
-            TypeElement prevClass, TypeElement nextClass, ClassTree classTree)
-            throws IOException {
+            TypeElement prevClass, TypeElement nextClass, ClassTree classTree) {
         super(configuration, DocPath.forClass(configuration.utils, typeElement));
         this.typeElement = typeElement;
         configuration.currentTypeElement = typeElement;
@@ -272,7 +267,7 @@
      * {@inheritDoc}
      */
     @Override
-    public void printDocument(Content contentTree) throws IOException {
+    public void printDocument(Content contentTree) throws DocFileIOException {
         printHtmlDocument(configuration.metakeywords.getMetaKeywords(typeElement),
                 true, contentTree);
     }
@@ -563,7 +558,7 @@
         if (outerClass == null)
             return;
         new SimpleElementVisitor8<Void, Void>() {
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public Void visitType(TypeElement e, Void p) {
                 Content label = utils.isInterface(e)
                         ? contents.enclosingInterfaceLabel
@@ -677,14 +672,11 @@
      *
      * @param subDiv the content tree to which the summary detail links will be added
      */
+    @Override
     protected void addSummaryDetailLinks(Content subDiv) {
-        try {
-            Content div = HtmlTree.DIV(getNavSummaryLinks());
-            div.addContent(getNavDetailLinks());
-            subDiv.addContent(div);
-        } catch (Exception e) {
-            throw new DocletAbortException(e);
-        }
+        Content div = HtmlTree.DIV(getNavSummaryLinks());
+        div.addContent(getNavDetailLinks());
+        subDiv.addContent(div);
     }
 
     /**
@@ -692,7 +684,7 @@
      *
      * @return the content tree for the navigation summary links
      */
-    protected Content getNavSummaryLinks() throws Exception {
+    protected Content getNavSummaryLinks() {
         Content li = HtmlTree.LI(contents.summaryLabel);
         li.addContent(Contents.SPACE);
         Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
@@ -727,9 +719,8 @@
      * Get detail links for the navigation bar.
      *
      * @return the content tree for the detail links
-     * @throws java.lang.Exception
      */
-    protected Content getNavDetailLinks() throws Exception {
+    protected Content getNavDetailLinks() {
         Content li = HtmlTree.LI(contents.detailLabel);
         li.addContent(Contents.SPACE);
         Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java	Fri Aug 26 14:47:52 2016 -0700
@@ -50,7 +50,6 @@
 import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
 
 import static javax.tools.Diagnostic.Kind.*;
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java	Fri Aug 26 14:47:52 2016 -0700
@@ -41,6 +41,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.ConstantsSummaryWriter;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocLink;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 
@@ -379,7 +380,8 @@
     /**
      * {@inheritDoc}
      */
-    public void printDocument(Content contentTree) throws IOException {
+    @Override
+    public void printDocument(Content contentTree) throws DocFileIOException {
         printHtmlDocument(null, true, contentTree);
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.ArrayList;
 import java.util.EnumMap;
 import java.util.List;
@@ -35,13 +34,11 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.DeprecatedAPIListBuilder;
+import jdk.javadoc.internal.doclets.toolkit.util.DeprecatedAPIListBuilder.DeprElementKind;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
-
-import static jdk.javadoc.internal.doclets.toolkit.util.DeprecatedAPIListBuilder.*;
 
 /**
  * Generate File to list all the deprecated classes and class members with the
@@ -189,11 +186,11 @@
     /**
      * Constructor.
      *
-     * @param filename the file to be generated.
+     * @param configuration the configuration for this doclet
+     * @param filename the file to be generated
      */
 
-    public DeprecatedListWriter(ConfigurationImpl configuration,
-                                DocPath filename) throws IOException {
+    public DeprecatedListWriter(ConfigurationImpl configuration, DocPath filename) {
         super(configuration, filename);
         this.configuration = configuration;
         NestedClassWriterImpl classW = new NestedClassWriterImpl(this);
@@ -236,29 +233,23 @@
      * Then instantiate DeprecatedListWriter and generate File.
      *
      * @param configuration the current configuration of the doclet.
+     * @throws DocFileIOException if there is a problem writing the deprecated list
      */
-    public static void generate(ConfigurationImpl configuration) {
+    public static void generate(ConfigurationImpl configuration) throws DocFileIOException {
         DocPath filename = DocPaths.DEPRECATED_LIST;
-        try {
-            DeprecatedListWriter depr =
-                   new DeprecatedListWriter(configuration, filename);
-            depr.generateDeprecatedListFile(
-                   new DeprecatedAPIListBuilder(configuration));
-        } catch (IOException exc) {
-            Messages messages = configuration.getMessages();
-            messages.error("doclet.exception_encountered",
-                        exc.toString(), filename);
-            throw new DocletAbortException(exc);
-        }
+        DeprecatedListWriter depr = new DeprecatedListWriter(configuration, filename);
+        depr.generateDeprecatedListFile(
+               new DeprecatedAPIListBuilder(configuration));
     }
 
     /**
      * Generate the deprecated API list.
      *
      * @param deprapi list of deprecated API built already.
+     * @throws DocFileIOException if there is a problem writing the deprecated list
      */
     protected void generateDeprecatedListFile(DeprecatedAPIListBuilder deprapi)
-            throws IOException {
+            throws DocFileIOException {
         HtmlTree body = getHeader();
         HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
                 ? HtmlTree.MAIN()
@@ -378,6 +369,7 @@
      *
      * @return a content tree for the deprecated label
      */
+    @Override
     protected Content getNavLinkDeprecated() {
         Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.deprecatedLabel);
         return li;
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,17 +25,14 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
-
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.Messages;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 
 
 /**
@@ -67,7 +64,6 @@
      *
      * @param configuration for this run
      * @param filename File to be generated.
-     * @throws java.io.IOException
      */
     public FrameOutputWriter(ConfigurationImpl configuration, DocPath filename) {
         super(configuration, filename);
@@ -79,28 +75,20 @@
      * file which will have the description of all the frames in the
      * documentation. The name of the generated file is "index.html" which is
      * the default first file for Html documents.
-     * @throws DocletAbortException
+     * @param configuration the configuration for this doclet
+     * @throws DocFileIOException if there is a problem generating the frame file
      */
-    public static void generate(ConfigurationImpl configuration) {
-        FrameOutputWriter framegen;
-        DocPath filename = DocPath.empty;
-        try {
-            filename = DocPaths.INDEX;
-            framegen = new FrameOutputWriter(configuration, filename);
-            framegen.generateFrameFile();
-        } catch (IOException exc) {
-            Messages messages = configuration.getMessages();
-            messages.error("doclet.exception_encountered",
-                        exc.toString(), filename);
-            throw new DocletAbortException(exc);
-        }
+    public static void generate(ConfigurationImpl configuration) throws DocFileIOException {
+        FrameOutputWriter framegen = new FrameOutputWriter(configuration, DocPaths.INDEX);
+        framegen.generateFrameFile();
     }
 
     /**
      * Generate the constants in the "index.html" file. Print the frame details
      * as well as warning if browser is not supporting the Html frames.
+     * @throws DocFileIOException if there is a problem generating the frame file
      */
-    protected void generateFrameFile() throws IOException {
+    protected void generateFrameFile() throws DocFileIOException {
         Content frame = getFrameDetails();
         HtmlTree body = new HtmlTree(HtmlTag.BODY);
         body.addAttr(HtmlAttr.ONLOAD, "loadFrames()");
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,18 +25,15 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
-
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.Messages;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 
 
 /**
@@ -68,27 +65,21 @@
      * file. The name of the generated file is "help-doc.html". The help file
      * will get generated if and only if "-helpfile" and "-nohelp" is not used
      * on the command line.
-     * @throws DocletAbortException
+     *
+     * @throws DocFileIOException if there is a problem while generating the documentation
      */
-    public static void generate(ConfigurationImpl configuration) {
-        HelpWriter helpgen;
-        DocPath filename = DocPath.empty;
-        try {
-            filename = DocPaths.HELP_DOC;
-            helpgen = new HelpWriter(configuration, filename);
-            helpgen.generateHelpFile();
-        } catch (IOException exc) {
-            Messages messages = configuration.getMessages();
-            messages.error("doclet.exception_encountered",
-                        exc.toString(), filename);
-            throw new DocletAbortException(exc);
-        }
+    public static void generate(ConfigurationImpl configuration) throws DocFileIOException {
+        DocPath filename = DocPaths.HELP_DOC;
+        HelpWriter helpgen = new HelpWriter(configuration, filename);
+        helpgen.generateHelpFile();
     }
 
     /**
      * Generate the help file contents.
+     *
+     * @throws DocFileIOException if there is a problem while generating the documentation
      */
-    protected void generateHelpFile() throws IOException {
+    protected void generateHelpFile() throws DocFileIOException {
         String title = configuration.getText("doclet.Window_Help_title");
         HtmlTree body = getBody(true, getWindowTitle(title));
         HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.*;
 
 import javax.lang.model.element.ModuleElement;
@@ -36,14 +35,14 @@
 import jdk.javadoc.doclet.DocletEnvironment;
 import jdk.javadoc.doclet.Reporter;
 import jdk.javadoc.internal.doclets.toolkit.AbstractDoclet;
-import jdk.javadoc.internal.doclets.toolkit.Configuration;
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder;
 import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 import jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder;
 
 /**
@@ -92,25 +91,27 @@
      * Create the configuration instance.
      * Override this method to use a different
      * configuration.
+     * @return the configuration for this doclet
      */
     @Override // defined by AbstractDoclet
-    public Configuration configuration() {
+    public ConfigurationImpl configuration() {
         return configuration;
     }
 
     /**
      * Start the generation of files. Call generate methods in the individual
-     * writers, which will in turn genrate the documentation files. Call the
+     * writers, which will in turn generate the documentation files. Call the
      * TreeWriter generation first to ensure the Class Hierarchy is built
      * first and then can be used in the later generation.
      *
      * For new format.
      *
+     * @throws DocletException if there is a problem while writing the other files
      * @see jdk.doclet.DocletEnvironment
      */
     @Override // defined by AbstractDoclet
     protected void generateOtherFiles(DocletEnvironment docEnv, ClassTree classtree)
-            throws Exception {
+            throws DocletException {
         super.generateOtherFiles(docEnv, classtree);
         if (configuration.linksource) {
             SourceToHTMLConverter.convertRoot(configuration,
@@ -191,7 +192,7 @@
         }
     }
 
-    protected void copyJqueryFiles() {
+    protected void copyJqueryFiles() throws DocletException {
         List<String> files = Arrays.asList(
                 "jquery-1.10.2.js",
                 "jquery-ui.js",
@@ -232,7 +233,8 @@
      * {@inheritDoc}
      */
     @Override // defined by AbstractDoclet
-    protected void generateClassFiles(SortedSet<TypeElement> arr, ClassTree classtree) {
+    protected void generateClassFiles(SortedSet<TypeElement> arr, ClassTree classtree)
+            throws DocletException {
         List<TypeElement> list = new ArrayList<>(arr);
         ListIterator<TypeElement> iterator = list.listIterator();
         TypeElement klass = null;
@@ -241,32 +243,24 @@
             klass = iterator.next();
             TypeElement next = iterator.nextIndex() == list.size()
                     ? null : list.get(iterator.nextIndex());
+
             if (utils.isHidden(klass) ||
                     !(configuration.isGeneratedDoc(klass) && utils.isIncluded(klass))) {
                 continue;
             }
-            try {
-                if (utils.isAnnotationType(klass)) {
-                    AbstractBuilder annotationTypeBuilder =
-                        configuration.getBuilderFactory()
-                            .getAnnotationTypeBuilder(klass,
-                                prev == null ? null : prev.asType(),
-                                next == null ? null : next.asType());
-                    annotationTypeBuilder.build();
-                } else {
-                    AbstractBuilder classBuilder =
-                        configuration.getBuilderFactory().getClassBuilder(klass,
-                                prev, next, classtree);
-                    classBuilder.build();
-                }
-            } catch (IOException e) {
-                throw new DocletAbortException(e);
-            } catch (DocletAbortException de) {
-                de.printStackTrace();
-                throw de;
-            } catch (Exception e) {
-                e.printStackTrace();
-                throw new DocletAbortException(e);
+
+            if (utils.isAnnotationType(klass)) {
+                AbstractBuilder annotationTypeBuilder =
+                    configuration.getBuilderFactory()
+                        .getAnnotationTypeBuilder(klass,
+                            prev == null ? null : prev.asType(),
+                            next == null ? null : next.asType());
+                annotationTypeBuilder.build();
+            } else {
+                AbstractBuilder classBuilder =
+                    configuration.getBuilderFactory().getClassBuilder(klass,
+                            prev, next, classtree);
+                classBuilder.build();
             }
         }
     }
@@ -275,7 +269,7 @@
      * {@inheritDoc}
      */
     @Override // defined by AbstractDoclet
-    protected void generateModuleFiles() throws Exception {
+    protected void generateModuleFiles() throws DocletException {
         if (configuration.showModules) {
             if (configuration.frames) {
                 ModuleIndexFrameWriter.generate(configuration);
@@ -313,7 +307,7 @@
      * {@inheritDoc}
      */
     @Override // defined by AbstractDoclet
-    protected void generatePackageFiles(ClassTree classtree) throws Exception {
+    protected void generatePackageFiles(ClassTree classtree) throws DocletException {
         Set<PackageElement> packages = configuration.packages;
         if (packages.size() > 1 && configuration.frames) {
             PackageIndexFrameWriter.generate(configuration);
@@ -356,24 +350,18 @@
         return configuration.getSupportedOptions();
     }
 
-    private void performCopy(String filename) {
+    private void performCopy(String filename) throws DocFileIOException {
         if (filename.isEmpty())
             return;
 
-        try {
-            DocFile fromfile = DocFile.createFileForInput(configuration, filename);
-            DocPath path = DocPath.create(fromfile.getName());
-            DocFile toFile = DocFile.createFileForOutput(configuration, path);
-            if (toFile.isSameFile(fromfile))
-                return;
+        DocFile fromfile = DocFile.createFileForInput(configuration, filename);
+        DocPath path = DocPath.create(fromfile.getName());
+        DocFile toFile = DocFile.createFileForOutput(configuration, path);
+        if (toFile.isSameFile(fromfile))
+            return;
 
-            messages.notice("doclet.Copying_File_0_To_File_1",
-                    fromfile.toString(), path.getPath());
-            toFile.copyFile(fromfile);
-        } catch (IOException exc) {
-            messages.error("doclet.perform_copy_exception_encountered",
-                    exc.toString());
-            throw new DocletAbortException(exc);
-        }
+        messages.notice("doclet.Copying_File_0_To_File_1",
+                fromfile.toString(), path.getPath());
+        toFile.copyFile(fromfile);
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.regex.Matcher;
@@ -55,16 +54,14 @@
 import com.sun.source.doctree.EndElementTree;
 import com.sun.source.doctree.EntityTree;
 import com.sun.source.doctree.ErroneousTree;
+import com.sun.source.doctree.IndexTree;
 import com.sun.source.doctree.InheritDocTree;
-import com.sun.source.doctree.IndexTree;
 import com.sun.source.doctree.LinkTree;
 import com.sun.source.doctree.LiteralTree;
 import com.sun.source.doctree.SeeTree;
 import com.sun.source.doctree.StartElementTree;
 import com.sun.source.doctree.TextTree;
 import com.sun.source.util.SimpleDocTreeVisitor;
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
 
 import jdk.javadoc.internal.doclets.formats.html.markup.Comment;
 import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
@@ -87,14 +84,15 @@
 import jdk.javadoc.internal.doclets.toolkit.Resources;
 import jdk.javadoc.internal.doclets.toolkit.taglets.DocRootTaglet;
 import jdk.javadoc.internal.doclets.toolkit.taglets.TagletWriter;
+import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocLink;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
 import jdk.javadoc.internal.doclets.toolkit.util.ImplementedMethods;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
-import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
 
 import static com.sun.source.doctree.AttributeTree.ValueKind.*;
 import static com.sun.source.doctree.DocTree.Kind.*;
@@ -439,9 +437,10 @@
      * @param includeScript true if printing windowtitle script
      *                      false for files that appear in the left-hand frames
      * @param body the body htmltree to be included in the document
+     * @throws DocFileIOException if there is a problem writing the file
      */
     public void printHtmlDocument(List<String> metakeywords, boolean includeScript,
-            Content body) throws IOException {
+            Content body) throws DocFileIOException {
         Content htmlDocType = configuration.isOutputHtml5()
                 ? DocType.HTML5
                 : DocType.TRANSITIONAL;
@@ -1834,7 +1833,7 @@
                     return false;
                 }
 
-                @Override @DefinedBy(Api.COMPILER_TREE)
+                @Override
                 public Boolean visitAttribute(AttributeTree node, Content c) {
                     StringBuilder sb = new StringBuilder(SPACER).append(node.getName());
                     if (node.getValueKind() == ValueKind.EMPTY) {
@@ -1883,7 +1882,7 @@
                     return false;
                 }
 
-                @Override @DefinedBy(Api.COMPILER_TREE)
+                @Override
                 public Boolean visitComment(CommentTree node, Content c) {
                     if (isFirstSentence && isFirst(node)) {
                         commentRemoved = true;
@@ -1901,7 +1900,7 @@
                     return content;
                 }
 
-                @Override @DefinedBy(Api.COMPILER_TREE)
+                @Override
                 public Boolean visitDocRoot(DocRootTree node, Content c) {
                     Content docRootContent = TagletWriter.getInlineTagOutput(element,
                             configuration.tagletManager,
@@ -1916,20 +1915,20 @@
                     return false;
                 }
 
-                @Override @DefinedBy(Api.COMPILER_TREE)
+                @Override
                 public Boolean visitEndElement(EndElementTree node, Content c) {
                     RawHtml rawHtml = new RawHtml("</" + node.getName() + ">");
                     result.addContent(rawHtml);
                     return false;
                 }
 
-                @Override @DefinedBy(Api.COMPILER_TREE)
+                @Override
                 public Boolean visitEntity(EntityTree node, Content c) {
                     result.addContent(new RawHtml(node.toString()));
                     return false;
                 }
 
-                @Override @DefinedBy(Api.COMPILER_TREE)
+                @Override
                 public Boolean visitErroneous(ErroneousTree node, Content c) {
                     messages.warning(ch.getDocTreePath(node),
                             "doclet.tag.invalid_usage", node);
@@ -1937,7 +1936,7 @@
                     return false;
                 }
 
-                @Override @DefinedBy(Api.COMPILER_TREE)
+                @Override
                 public Boolean visitInheritDoc(InheritDocTree node, Content c) {
                     Content output = TagletWriter.getInlineTagOutput(element,
                             configuration.tagletManager, holderTag,
@@ -1947,7 +1946,7 @@
                     return (isFirstSentence && !output.isEmpty());
                 }
 
-                @Override @DefinedBy(Api.COMPILER_TREE)
+                @Override
                 public Boolean visitIndex(IndexTree node, Content p) {
                     Content output = TagletWriter.getInlineTagOutput(element,
                             configuration.tagletManager, holderTag, tag,
@@ -1958,14 +1957,14 @@
                     return false;
                 }
 
-                @Override @DefinedBy(Api.COMPILER_TREE)
+                @Override
                 public Boolean visitLink(LinkTree node, Content c) {
                     // we need to pass the DocTreeImpl here, so ignore node
                     result.addContent(seeTagToContent(element, tag));
                     return false;
                 }
 
-                @Override @DefinedBy(Api.COMPILER_TREE)
+                @Override
                 public Boolean visitLiteral(LiteralTree node, Content c) {
                     String s = node.getBody().toString();
                     Content content = new StringContent(utils.normalizeNewlines(s));
@@ -1975,14 +1974,14 @@
                     return false;
                 }
 
-                @Override @DefinedBy(Api.COMPILER_TREE)
+                @Override
                 public Boolean visitSee(SeeTree node, Content c) {
                     // we need to pass the DocTreeImpl here, so ignore node
                     result.addContent(seeTagToContent(element, tag));
                     return false;
                 }
 
-                @Override @DefinedBy(Api.COMPILER_TREE)
+                @Override
                 public Boolean visitStartElement(StartElementTree node, Content c) {
                     String text = "<" + node.getName();
                     RawHtml rawHtml = new RawHtml(utils.normalizeNewlines(text));
@@ -2010,7 +2009,7 @@
                     return utils.normalizeNewlines(text);
                 }
 
-                @Override @DefinedBy(Api.COMPILER_TREE)
+                @Override
                 public Boolean visitText(TextTree node, Content c) {
                     String text = node.getBody();
                     result.addContent(new RawHtml(textCleanup(text, isLast(node), commentRemoved)));
@@ -2018,7 +2017,7 @@
                     return false;
                 }
 
-                @Override @DefinedBy(Api.COMPILER_TREE)
+                @Override
                 protected Boolean defaultAction(DocTree node, Content c) {
                     Content output = TagletWriter.getInlineTagOutput(element,
                             configuration.tagletManager, holderTag, tag,
@@ -2096,27 +2095,27 @@
         }
 
         DocPath redirectPathFromRoot = new SimpleElementVisitor9<DocPath, Void>() {
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public DocPath visitType(TypeElement e, Void p) {
                 return DocPath.forPackage(utils.containingPackage(e));
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public DocPath visitPackage(PackageElement e, Void p) {
                 return DocPath.forPackage(e);
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public DocPath visitVariable(VariableElement e, Void p) {
                 return DocPath.forPackage(utils.containingPackage(e));
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public DocPath visitExecutable(ExecutableElement e, Void p) {
                 return DocPath.forPackage(utils.containingPackage(e));
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             protected DocPath defaultAction(Element e, Void p) {
                 return null;
             }
@@ -2180,8 +2179,8 @@
         head.addContent(javascript);
         if (configuration.createindex) {
             if (pathToRoot != null && script != null) {
-                String path = pathToRoot.isEmpty() ? "." : pathToRoot.getPath();
-                script.addContent(new RawHtml("var pathtoroot = \"" + path + "/\";loadScripts(document, \'script\');"));
+                String ptrPath = pathToRoot.isEmpty() ? "." : pathToRoot.getPath();
+                script.addContent(new RawHtml("var pathtoroot = \"" + ptrPath + "/\";loadScripts(document, \'script\');"));
             }
             addJQueryFile(head, DocPaths.JSZIP_MIN);
             addJQueryFile(head, DocPaths.JSZIPUTILS_MIN);
@@ -2377,13 +2376,13 @@
                     List<AnnotationValue> annotationTypeValues = new ArrayList<>();
 
                     new SimpleAnnotationValueVisitor9<Void, List<AnnotationValue>>() {
-                        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                        @Override
                         public Void visitArray(List<? extends AnnotationValue> vals, List<AnnotationValue> p) {
                             p.addAll(vals);
                             return null;
                         }
 
-                        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                        @Override
                         protected Void defaultAction(Object o, List<AnnotationValue> p) {
                             p.add(annotationValue);
                             return null;
@@ -2405,7 +2404,7 @@
                     List<AnnotationValue> annotationTypeValues = new ArrayList<>();
                     for (AnnotationValue a :  pairs.values()) {
                         new SimpleAnnotationValueVisitor9<Void, List<AnnotationValue>>() {
-                            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                            @Override
                             public Void visitArray(List<? extends AnnotationValue> vals, List<AnnotationValue> annotationTypeValues) {
                                for (AnnotationValue av : vals) {
                                    annotationTypeValues.add(av);
@@ -2481,12 +2480,12 @@
                 AnnotationValue annotationValue = map.get(element);
                 List<AnnotationValue> annotationTypeValues = new ArrayList<>();
                 new SimpleAnnotationValueVisitor9<Void, AnnotationValue>() {
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     public Void visitArray(List<? extends AnnotationValue> vals, AnnotationValue p) {
                         annotationTypeValues.addAll(vals);
                         return null;
                     }
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     protected Void defaultAction(Object o, AnnotationValue p) {
                         annotationTypeValues.add(p);
                         return null;
@@ -2519,13 +2518,13 @@
         for (ExecutableElement ee : pairs.keySet()) {
             annotationValue = pairs.get(ee);
             boolean rvalue = new SimpleAnnotationValueVisitor9<Boolean, Void>() {
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public Boolean visitArray(List<? extends AnnotationValue> vals, Void p) {
                     if (vals.size() > 1) {
                         if (vals.get(0) instanceof AnnotationMirror) {
                             isContainerDocumented = true;
                             return new SimpleAnnotationValueVisitor9<Boolean, Void>() {
-                                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                                @Override
                                 public Boolean visitAnnotation(AnnotationMirror a, Void p) {
                                     isContainerDocumented = true;
                                     Element asElement = a.getAnnotationType().asElement();
@@ -2534,7 +2533,7 @@
                                     }
                                     return true;
                                 }
-                                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                                @Override
                                 protected Boolean defaultAction(Object o, Void p) {
                                     return false;
                                 }
@@ -2544,7 +2543,7 @@
                     return false;
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 protected Boolean defaultAction(Object o, Void p) {
                     return false;
                 }
@@ -2559,10 +2558,10 @@
     private Content annotationValueToContent(AnnotationValue annotationValue) {
         return new SimpleAnnotationValueVisitor9<Content, Void>() {
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public Content visitType(TypeMirror t, Void p) {
                 return new SimpleTypeVisitor9<Content, Void>() {
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     public Content visitDeclared(DeclaredType t, Void p) {
                         LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
                                 LinkInfoImpl.Kind.ANNOTATION, t);
@@ -2572,13 +2571,13 @@
                         linkInfo.label = new StringContent(name + utils.getDimension(t) + ".class");
                         return getLink(linkInfo);
                     }
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     protected Content defaultAction(TypeMirror e, Void p) {
                         return new StringContent(t + utils.getDimension(t) + ".class");
                     }
                 }.visit(t);
             }
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public Content visitAnnotation(AnnotationMirror a, Void p) {
                 List<Content> list = getAnnotations(0, a, false);
                 ContentBuilder buf = new ContentBuilder();
@@ -2587,12 +2586,12 @@
                 }
                 return buf;
             }
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public Content visitEnumConstant(VariableElement c, Void p) {
                 return getDocLink(LinkInfoImpl.Kind.ANNOTATION,
                         c, c.getSimpleName(), false);
             }
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public Content visitArray(List<? extends AnnotationValue> vals, Void p) {
                 ContentBuilder buf = new ContentBuilder();
                 String sep = "";
@@ -2603,7 +2602,7 @@
                 }
                 return buf;
             }
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             protected Content defaultAction(Object o, Void p) {
                 return new StringContent(annotationValue.toString());
             }
@@ -2615,6 +2614,7 @@
      *
      * @return the configuration for this doclet.
      */
+    @Override
     public Configuration configuration() {
         return configuration;
     }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,8 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.IOException;
-
 import jdk.javadoc.internal.doclets.formats.html.markup.Comment;
 import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
 import jdk.javadoc.internal.doclets.formats.html.markup.DocType;
@@ -37,10 +35,9 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.Messages;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 
 import static jdk.javadoc.internal.doclets.formats.html.markup.HtmlDocWriter.CONTENT_TYPE;
 
@@ -53,28 +50,23 @@
  */
 public class IndexRedirectWriter extends HtmlDocletWriter {
 
-    public static void generate(ConfigurationImpl configuration) {
+    public static void generate(ConfigurationImpl configuration)
+            throws DocFileIOException {
         IndexRedirectWriter indexRedirect;
-        DocPath filename = DocPath.empty;
-        try {
-            filename = DocPaths.INDEX;
+        DocPath filename = DocPaths.INDEX;
             indexRedirect = new IndexRedirectWriter(configuration, filename);
             indexRedirect.generateIndexFile();
-        } catch (IOException exc) {
-            Messages messages = configuration.getMessages();
-            messages.error(
-                    "doclet.exception_encountered",
-                    exc.toString(), filename);
-            throw new DocletAbortException(exc);
-        }
     }
 
-    IndexRedirectWriter(ConfigurationImpl configuration, DocPath filename)
-            throws IOException {
+    IndexRedirectWriter(ConfigurationImpl configuration, DocPath filename) {
         super(configuration, filename);
     }
 
-    void generateIndexFile() throws IOException {
+    /**
+     * Generate an index file that redirects to an alternate file.
+     * @throws DocFileIOException if there is a problem generating the file
+     */
+    void generateIndexFile() throws DocFileIOException {
         Content htmlDocType = configuration.isOutputHtml5()
                 ? DocType.HTML5
                 : DocType.TRANSITIONAL;
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.*;
 
 import javax.lang.model.element.ModuleElement;
@@ -39,8 +38,8 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 
 
 /**
@@ -76,8 +75,7 @@
      * @param configuration the configuration of the doclet.
      * @param moduleElement moduleElement under consideration.
      */
-    public ModuleFrameWriter(ConfigurationImpl configuration, ModuleElement moduleElement)
-            throws IOException {
+    public ModuleFrameWriter(ConfigurationImpl configuration, ModuleElement moduleElement) {
         super(configuration, DocPaths.moduleTypeFrame(moduleElement));
         this.mdle = moduleElement;
         if (configuration.getSpecifiedPackages().isEmpty()) {
@@ -91,35 +89,29 @@
      *
      * @param configuration the current configuration of the doclet.
      * @param moduleElement The package for which "module_name-type-frame.html" is to be generated.
+     * @throws DocFileIOException if there is a problem generating the module summary file
      */
-    public static void generate(ConfigurationImpl configuration, ModuleElement moduleElement) {
-        ModuleFrameWriter mdlgen;
-        try {
-            mdlgen = new ModuleFrameWriter(configuration, moduleElement);
-            String mdlName = moduleElement.getQualifiedName().toString();
-            Content mdlLabel = new StringContent(mdlName);
-            HtmlTree body = mdlgen.getBody(false, mdlgen.getWindowTitle(mdlName));
-            HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
-                    ? HtmlTree.MAIN()
-                    : body;
-            Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
-                    mdlgen.getHyperLink(DocPaths.moduleSummary(moduleElement), mdlLabel, "", "classFrame"));
-            htmlTree.addContent(heading);
-            HtmlTree div = new HtmlTree(HtmlTag.DIV);
-            div.addStyle(HtmlStyle.indexContainer);
-            mdlgen.addClassListing(div);
-            htmlTree.addContent(div);
-            if (configuration.allowTag(HtmlTag.MAIN)) {
-                body.addContent(htmlTree);
-            }
-            mdlgen.printHtmlDocument(
-                    configuration.metakeywords.getMetaKeywordsForModule(moduleElement), false, body);
-        } catch (IOException exc) {
-            configuration.messages.error(
-                    "doclet.exception_encountered",
-                    exc.toString(), DocPaths.moduleTypeFrame(moduleElement).getPath());
-            throw new DocletAbortException(exc);
+    public static void generate(ConfigurationImpl configuration, ModuleElement moduleElement)
+            throws DocFileIOException {
+        ModuleFrameWriter mdlgen = new ModuleFrameWriter(configuration, moduleElement);
+        String mdlName = moduleElement.getQualifiedName().toString();
+        Content mdlLabel = new StringContent(mdlName);
+        HtmlTree body = mdlgen.getBody(false, mdlgen.getWindowTitle(mdlName));
+        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
+                ? HtmlTree.MAIN()
+                : body;
+        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
+                mdlgen.getHyperLink(DocPaths.moduleSummary(moduleElement), mdlLabel, "", "classFrame"));
+        htmlTree.addContent(heading);
+        HtmlTree div = new HtmlTree(HtmlTag.DIV);
+        div.addStyle(HtmlStyle.indexContainer);
+        mdlgen.addClassListing(div);
+        htmlTree.addContent(div);
+        if (configuration.allowTag(HtmlTag.MAIN)) {
+            body.addContent(htmlTree);
         }
+        mdlgen.printHtmlDocument(
+                configuration.metakeywords.getMetaKeywordsForModule(moduleElement), false, body);
     }
 
     /**
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.Map;
 import java.util.Set;
 
@@ -39,10 +38,9 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.Messages;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 
 /**
  * Generate the module index for the left-hand frame in the generated output.
@@ -65,27 +63,19 @@
      * @param filename Name of the module index file to be generated.
      */
     public ModuleIndexFrameWriter(ConfigurationImpl configuration,
-                                   DocPath filename) throws IOException {
+                                   DocPath filename) {
         super(configuration, filename);
     }
 
     /**
      * Generate the module index file named "module-overview-frame.html".
-     * @throws DocletAbortException
+     * @throws DocFileIOException
      * @param configuration the configuration object
      */
-    public static void generate(ConfigurationImpl configuration) {
-        ModuleIndexFrameWriter modulegen;
+    public static void generate(ConfigurationImpl configuration) throws DocFileIOException {
         DocPath filename = DocPaths.MODULE_OVERVIEW_FRAME;
-        try {
-            modulegen = new ModuleIndexFrameWriter(configuration, filename);
-            modulegen.buildModuleIndexFile("doclet.Window_Overview", false);
-        } catch (IOException exc) {
-            Messages messages = configuration.getMessages();
-            messages.error("doclet.exception_encountered",
-                        exc.toString(), filename);
-            throw new DocletAbortException(exc);
-        }
+        ModuleIndexFrameWriter modulegen = new ModuleIndexFrameWriter(configuration, filename);
+        modulegen.buildModuleIndexFile("doclet.Window_Overview", false);
     }
 
     /**
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,13 +25,11 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.*;
 
 import javax.lang.model.element.ModuleElement;
 import javax.lang.model.element.PackageElement;
 
-import jdk.javadoc.doclet.DocletEnvironment;
 import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
@@ -39,10 +37,9 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.Messages;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 import jdk.javadoc.internal.doclets.toolkit.util.Group;
 
 /**
@@ -68,15 +65,14 @@
     /**
      * HTML tree for main tag.
      */
-    private HtmlTree htmlTree = HtmlTree.MAIN();
+    private final HtmlTree htmlTree = HtmlTree.MAIN();
 
     /**
      * Construct the ModuleIndexWriter.
      * @param configuration the configuration object
      * @param filename the name of the generated file
-     * @throws java.io.IOException
      */
-    public ModuleIndexWriter(ConfigurationImpl configuration, DocPath filename) throws IOException {
+    public ModuleIndexWriter(ConfigurationImpl configuration, DocPath filename) {
         super(configuration, filename);
         modules = configuration.modules;
     }
@@ -85,20 +81,12 @@
      * Generate the module index page for the right-hand frame.
      *
      * @param configuration the current configuration of the doclet.
+     * @throws DocFileIOException if there is a problem generating the module index page
      */
-    public static void generate(ConfigurationImpl configuration) {
-        ModuleIndexWriter mdlgen;
+    public static void generate(ConfigurationImpl configuration) throws DocFileIOException {
         DocPath filename = DocPaths.overviewSummary(configuration.frames);
-        try {
-            mdlgen = new ModuleIndexWriter(configuration, filename);
-            mdlgen.buildModuleIndexFile("doclet.Window_Overview_Summary", true);
-        } catch (IOException exc) {
-            Messages messages = configuration.getMessages();
-            messages.error(
-                        "doclet.exception_encountered",
-                        exc.toString(), filename);
-            throw new DocletAbortException(exc);
-        }
+        ModuleIndexWriter mdlgen = new ModuleIndexWriter(configuration, filename);
+        mdlgen.buildModuleIndexFile("doclet.Window_Overview_Summary", true);
     }
 
     /**
@@ -106,6 +94,7 @@
      *
      * @param body the documentation tree to which the index will be added
      */
+    @Override
     protected void addIndex(Content body) {
         if (modules != null && !modules.isEmpty()) {
             addIndexContents(configuration.getText("doclet.Modules"),
@@ -190,6 +179,7 @@
      *
      * @param body the documentation tree to which the overview header will be added
      */
+    @Override
     protected void addOverviewHeader(Content body) {
         addConfigurationTitle(body);
         if (!utils.getBody(configuration.overviewElement).isEmpty()) {
@@ -233,9 +223,9 @@
      * "-overview" option on the command line.
      *
      * @param body the documentation tree to which the overview will be added
-     * @throws java.io.IOException
      */
-    protected void addOverview(Content body) throws IOException {
+    @Override
+    protected void addOverview(Content body) {
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.contentContainer);
         addOverviewComment(div);
@@ -254,6 +244,7 @@
      *
      * @param body the documentation tree to which the navigation bar header will be added
      */
+    @Override
     protected void addNavigationBarHeader(Content body) {
         Content htmlTree = (configuration.allowTag(HtmlTag.HEADER))
                 ? HtmlTree.HEADER()
@@ -271,6 +262,7 @@
      *
      * @param body the documentation tree to which the navigation bar footer will be added
      */
+    @Override
     protected void addNavigationBarFooter(Content body) {
         Content htmltree = (configuration.allowTag(HtmlTag.FOOTER))
                 ? HtmlTree.FOOTER()
@@ -282,10 +274,12 @@
         }
     }
 
+    @Override
     protected void addModulePackagesList(Map<ModuleElement, Set<PackageElement>> modules, String text,
             String tableSummary, Content body, ModuleElement mdle) {
     }
 
+    @Override
     protected void addModulesList(Map<ModuleElement, Set<PackageElement>> modules, String text,
             String tableSummary, Content body) {
     }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -41,10 +40,9 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.Messages;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 
 /**
  * Generate the module package index for the left-hand frame in the generated output.
@@ -66,29 +64,20 @@
      * @param configuration the configuration object
      * @param filename Name of the package index file to be generated.
      */
-    public ModulePackageIndexFrameWriter(ConfigurationImpl configuration,
-                                   DocPath filename) throws IOException {
+    public ModulePackageIndexFrameWriter(ConfigurationImpl configuration, DocPath filename)  {
         super(configuration, filename);
     }
 
     /**
      * Generate the module package index file.
-     * @throws DocletAbortException
+     * @throws DocFileIOException
      * @param configuration the configuration object
      * @param mdle the module being documented
      */
-    public static void generate(ConfigurationImpl configuration, ModuleElement mdle) {
-        ModulePackageIndexFrameWriter modpackgen;
+    public static void generate(ConfigurationImpl configuration, ModuleElement mdle) throws DocFileIOException {
         DocPath filename = DocPaths.moduleFrame(mdle);
-        try {
-            modpackgen = new ModulePackageIndexFrameWriter(configuration, filename);
-            modpackgen.buildModulePackagesIndexFile("doclet.Window_Overview", false, mdle);
-        } catch (IOException exc) {
-            Messages messages = configuration.getMessages();
-            messages.error("doclet.exception_encountered",
-                        exc.toString(), filename);
-            throw new DocletAbortException(exc);
-        }
+        ModulePackageIndexFrameWriter modpackgen = new ModulePackageIndexFrameWriter(configuration, filename);
+        modpackgen.buildModulePackagesIndexFile("doclet.Window_Overview", false, mdle);
     }
 
     /**
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.ArrayList;
 import java.util.EnumMap;
 import java.util.List;
@@ -46,8 +45,8 @@
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.ModuleSummaryWriter;
 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 
 /**
  * Class to generate file for each module contents in the right-hand
@@ -515,12 +514,8 @@
      * @param subDiv the content tree to which the summary detail links will be added
      */
     protected void addSummaryDetailLinks(Content subDiv) {
-        try {
-            Content div = HtmlTree.DIV(getNavSummaryLinks());
-            subDiv.addContent(div);
-        } catch (Exception e) {
-            throw new DocletAbortException(e);
-        }
+        Content div = HtmlTree.DIV(getNavSummaryLinks());
+        subDiv.addContent(div);
     }
 
     /**
@@ -528,7 +523,7 @@
      *
      * @return the content tree for the navigation summary links
      */
-    protected Content getNavSummaryLinks() throws Exception {
+    protected Content getNavSummaryLinks() {
         Content li = HtmlTree.LI(contents.moduleSubNavLabel);
         li.addContent(Contents.SPACE);
         Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
@@ -591,7 +586,8 @@
     /**
      * {@inheritDoc}
      */
-    public void printDocument(Content contentTree) throws IOException {
+    @Override
+    public void printDocument(Content contentTree) throws DocFileIOException {
         printHtmlDocument(configuration.metakeywords.getMetaKeywordsForModule(mdle),
                 true, contentTree);
     }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.*;
 
 import javax.lang.model.element.PackageElement;
@@ -38,10 +37,9 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.Messages;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 
 
 /**
@@ -62,7 +60,7 @@
     /**
      * The package being documented.
      */
-    private PackageElement packageElement;
+    private final PackageElement packageElement;
 
     /**
      * The classes to be documented.  Use this to filter out classes
@@ -96,35 +94,29 @@
      *
      * @param configuration the current configuration of the doclet.
      * @param packageElement The package for which "pacakge-frame.html" is to be generated.
+     * @throws DocFileIOException if there is a problem generating the package summary page
      */
-    public static void generate(ConfigurationImpl configuration, PackageElement packageElement) {
-        PackageFrameWriter packgen;
-        try {
-            packgen = new PackageFrameWriter(configuration, packageElement);
-            String pkgName = configuration.utils.getPackageName(packageElement);
-            HtmlTree body = packgen.getBody(false, packgen.getWindowTitle(pkgName));
-            Content pkgNameContent = new StringContent(pkgName);
-            HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
-                    ? HtmlTree.MAIN()
-                    : body;
-            Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
-                    packgen.getTargetPackageLink(packageElement, "classFrame", pkgNameContent));
-            htmlTree.addContent(heading);
-            HtmlTree div = new HtmlTree(HtmlTag.DIV);
-            div.addStyle(HtmlStyle.indexContainer);
-            packgen.addClassListing(div);
-            htmlTree.addContent(div);
-            if (configuration.allowTag(HtmlTag.MAIN)) {
-                body.addContent(htmlTree);
-            }
-            packgen.printHtmlDocument(
-                    configuration.metakeywords.getMetaKeywords(packageElement), false, body);
-        } catch (IOException exc) {
-            Messages messages = configuration.getMessages();
-            messages.error("doclet.exception_encountered",
-                    exc.toString(), DocPaths.PACKAGE_FRAME.getPath());
-            throw new DocletAbortException(exc);
+    public static void generate(ConfigurationImpl configuration, PackageElement packageElement)
+            throws DocFileIOException {
+        PackageFrameWriter packgen = new PackageFrameWriter(configuration, packageElement);
+        String pkgName = configuration.utils.getPackageName(packageElement);
+        HtmlTree body = packgen.getBody(false, packgen.getWindowTitle(pkgName));
+        Content pkgNameContent = new StringContent(pkgName);
+        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
+                ? HtmlTree.MAIN()
+                : body;
+        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
+                packgen.getTargetPackageLink(packageElement, "classFrame", pkgNameContent));
+        htmlTree.addContent(heading);
+        HtmlTree div = new HtmlTree(HtmlTag.DIV);
+        div.addStyle(HtmlStyle.indexContainer);
+        packgen.addClassListing(div);
+        htmlTree.addContent(div);
+        if (configuration.allowTag(HtmlTag.MAIN)) {
+            body.addContent(htmlTree);
         }
+        packgen.printHtmlDocument(
+                configuration.metakeywords.getMetaKeywords(packageElement), false, body);
     }
 
     /**
@@ -168,7 +160,7 @@
     /**
      * Add specific class kind listing. Also add label to the listing.
      *
-     * @param arr Array of specific class kinds, namely Class or Interface or Exception or Error
+     * @param list list of specific class kinds, namely Class or Interface or Exception or Error
      * @param labelContent content tree of the label to be added
      * @param contentTree the content tree to which the class kind listing will be added
      */
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.IOException;
 import java.util.Collection;
 
 import javax.lang.model.element.PackageElement;
@@ -37,10 +36,9 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.Messages;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 
 
 /**
@@ -62,32 +60,24 @@
      *
      * @param filename Name of the package index file to be generated.
      */
-    public PackageIndexFrameWriter(ConfigurationImpl configuration,
-                                   DocPath filename) throws IOException {
+    public PackageIndexFrameWriter(ConfigurationImpl configuration, DocPath filename) {
         super(configuration, filename);
     }
 
     /**
      * Generate the package index file named "overview-frame.html".
-     * @throws DocletAbortException
+     * @throws DocFileIOException
      */
-    public static void generate(ConfigurationImpl configuration) {
-        PackageIndexFrameWriter packgen;
+    public static void generate(ConfigurationImpl configuration) throws DocFileIOException {
         DocPath filename = DocPaths.OVERVIEW_FRAME;
-        try {
-            packgen = new PackageIndexFrameWriter(configuration, filename);
-            packgen.buildPackageIndexFile("doclet.Window_Overview", false);
-        } catch (IOException exc) {
-            Messages messages = configuration.getMessages();
-            messages.error("doclet.exception_encountered",
-                        exc.toString(), filename);
-            throw new DocletAbortException(exc);
-        }
+        PackageIndexFrameWriter packgen = new PackageIndexFrameWriter(configuration, filename);
+        packgen.buildPackageIndexFile("doclet.Window_Overview", false);
     }
 
     /**
      * {@inheritDoc}
      */
+    @Override
     protected void addPackagesList(Collection<PackageElement> packages, String text,
             String tableSummary, Content body) {
         Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
@@ -135,6 +125,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     protected void addNavigationBarHeader(Content body) {
         Content headerContent;
         if (configuration.packagesheader.length() > 0) {
@@ -150,6 +141,7 @@
     /**
      * Do nothing as there is no overview information in this page.
      */
+    @Override
     protected void addOverviewHeader(Content body) {
     }
 
@@ -159,6 +151,7 @@
      *
      * @param ul the Content object to which the "All Classes" link should be added
      */
+    @Override
     protected void addAllClassesLink(Content ul) {
         Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
                 contents.allClassesLabel, "", "packageFrame");
@@ -172,6 +165,7 @@
      *
      * @param ul the Content object to which the "All Modules" link should be added
      */
+    @Override
     protected void addAllModulesLink(Content ul) {
         Content linkContent = getHyperLink(DocPaths.MODULE_OVERVIEW_FRAME,
                 contents.allModulesLabel, "", "packageListFrame");
@@ -182,6 +176,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     protected void addNavigationBarFooter(Content body) {
         Content p = HtmlTree.P(Contents.SPACE);
         body.addContent(p);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,22 +25,19 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.*;
 
 import javax.lang.model.element.PackageElement;
 
-import jdk.javadoc.doclet.DocletEnvironment;
 import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.Messages;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 import jdk.javadoc.internal.doclets.toolkit.util.Group;
 
 /**
@@ -58,38 +55,35 @@
  */
 public class PackageIndexWriter extends AbstractPackageIndexWriter {
 
-    /**
-     * Root of the program structure. Used for "overview" documentation.
-     */
-    private DocletEnvironment docEnv;
 
     /**
      * Map representing the group of packages as specified on the command line.
      *
      * @see Group
      */
-    private Map<String, SortedSet<PackageElement>> groupPackageMap;
+    private final Map<String, SortedSet<PackageElement>> groupPackageMap;
 
     /**
      * List to store the order groups as specified on the command line.
      */
-    private List<String> groupList;
+    private final List<String> groupList;
 
     /**
      * HTML tree for main tag.
      */
-    private HtmlTree htmlTree = HtmlTree.MAIN();
+    private final HtmlTree htmlTree = HtmlTree.MAIN();
 
     /**
      * Construct the PackageIndexWriter. Also constructs the grouping
      * information as provided on the command line by "-group" option. Stores
      * the order of groups specified by the user.
      *
+     * @param configuration the configuration for this doclet
+     * @param filename the path of the page to be generated
      * @see Group
      */
-    public PackageIndexWriter(ConfigurationImpl configuration, DocPath filename) throws IOException {
+    public PackageIndexWriter(ConfigurationImpl configuration, DocPath filename) {
         super(configuration, filename);
-        this.docEnv = configuration.docEnv;
         groupPackageMap = configuration.group.groupPackages(packages);
         groupList = configuration.group.getGroupList();
     }
@@ -98,19 +92,12 @@
      * Generate the package index page for the right-hand frame.
      *
      * @param configuration the current configuration of the doclet.
+     * @throws DocFileIOException if there is a problem generating the package index page
      */
-    public static void generate(ConfigurationImpl configuration) {
-        PackageIndexWriter packgen;
+    public static void generate(ConfigurationImpl configuration) throws DocFileIOException {
         DocPath filename = DocPaths.overviewSummary(configuration.frames);
-        try {
-            packgen = new PackageIndexWriter(configuration, filename);
-            packgen.buildPackageIndexFile("doclet.Window_Overview_Summary", true);
-        } catch (IOException exc) {
-            Messages messages = configuration.getMessages();
-            messages.error("doclet.exception_encountered",
-                        exc.toString(), filename);
-            throw new DocletAbortException(exc);
-        }
+        PackageIndexWriter packgen = new PackageIndexWriter(configuration, filename);
+        packgen.buildPackageIndexFile("doclet.Window_Overview_Summary", true);
     }
 
     /**
@@ -119,6 +106,7 @@
      *
      * @param body the documentation tree to which the index will be added
      */
+    @Override
     protected void addIndex(Content body) {
         for (String groupname : groupList) {
             SortedSet<PackageElement> list = groupPackageMap.get(groupname);
@@ -133,6 +121,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     protected void addPackagesList(Collection<PackageElement> packages, String text,
             String tableSummary, Content body) {
         Content table = (configuration.isOutputHtml5())
@@ -183,6 +172,7 @@
      *
      * @param body the documentation tree to which the overview header will be added
      */
+    @Override
     protected void addOverviewHeader(Content body) {
         addConfigurationTitle(body);
         if (!utils.getBody(configuration.overviewElement).isEmpty()) {
@@ -227,7 +217,8 @@
      *
      * @param body the documentation tree to which the overview will be added
      */
-    protected void addOverview(Content body) throws IOException {
+    @Override
+    protected void addOverview(Content body) {
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.contentContainer);
         addOverviewComment(div);
@@ -246,6 +237,7 @@
      *
      * @param body the documentation tree to which the navigation bar header will be added
      */
+    @Override
     protected void addNavigationBarHeader(Content body) {
         Content htmlTree = (configuration.allowTag(HtmlTag.HEADER))
                 ? HtmlTree.HEADER()
@@ -263,6 +255,7 @@
      *
      * @param body the documentation tree to which the navigation bar footer will be added
      */
+    @Override
     protected void addNavigationBarFooter(Content body) {
         Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
                 ? HtmlTree.FOOTER()
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,8 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
-
 import javax.lang.model.element.PackageElement;
 
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
@@ -34,11 +32,10 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 
 
 /**
@@ -77,14 +74,11 @@
      * @param packageElement the current package
      * @param prev the previous package
      * @param next the next package
-     * @throws IOException
-     * @throws DocletAbortException
      */
     public PackageTreeWriter(ConfigurationImpl configuration,
                              DocPath path,
                              PackageElement packageElement,
-                             PackageElement prev, PackageElement next)
-                      throws IOException {
+                             PackageElement prev, PackageElement next) {
         super(configuration, path,
               new ClassTree(configuration.typeElementCatalog.allClasses(packageElement), configuration));
         this.packageElement = packageElement;
@@ -102,30 +96,22 @@
      * @param next     Next package in the alpha-ordered list.
      * @param noDeprecated  If true, do not generate any information for
      * deprecated classe or interfaces.
-     * @throws DocletAbortException
+     * @throws DocFileIOException if there is a problem generating the package tree page
      */
     public static void generate(ConfigurationImpl configuration,
                                 PackageElement pkg, PackageElement prev,
-                                PackageElement next, boolean noDeprecated) {
-        PackageTreeWriter packgen;
+                                PackageElement next, boolean noDeprecated)
+            throws DocFileIOException {
         DocPath path = DocPath.forPackage(pkg).resolve(DocPaths.PACKAGE_TREE);
-        try {
-            packgen = new PackageTreeWriter(configuration, path, pkg,
-                prev, next);
-            packgen.generatePackageTreeFile();
-        } catch (IOException exc) {
-            Messages messages = configuration.getMessages();
-            messages.error("doclet.exception_encountered",
-                        exc.toString(), path.getPath());
-            throw new DocletAbortException(exc);
-        }
+        PackageTreeWriter packgen = new PackageTreeWriter(configuration, path, pkg, prev, next);
+        packgen.generatePackageTreeFile();
     }
 
     /**
      * Generate a separate tree file for each package.
-     * @throws java.io.IOException
+     * @throws DocFileIOException if there is a problem generating the package tree file
      */
-    protected void generatePackageTreeFile() throws IOException {
+    protected void generatePackageTreeFile() throws DocFileIOException {
         HtmlTree body = getPackageTreeHeader();
         HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
                 ? HtmlTree.MAIN()
@@ -200,6 +186,7 @@
      *
      * @return a content tree for the link
      */
+    @Override
     protected Content getNavLinkPrevious() {
         if (prev == null) {
             return getNavLinkPrevious(null);
@@ -214,6 +201,7 @@
      *
      * @return a content tree for the link
      */
+    @Override
     protected Content getNavLinkNext() {
         if (next == null) {
             return getNavLinkNext(null);
@@ -241,6 +229,7 @@
      *
      * @return a content tree for the package link
      */
+    @Override
     protected Content getNavLinkPackage() {
         Content linkContent = getHyperLink(DocPaths.PACKAGE_SUMMARY,
                 contents.packageLabel);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.*;
 
 import javax.lang.model.element.PackageElement;
@@ -38,11 +37,10 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.ClassUseMapper;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 
 /**
  * Generate package usage information.
@@ -65,12 +63,10 @@
      * Constructor.
      *
      * @param filename the file to be generated.
-     * @throws IOException
-     * @throws DocletAbortException
      */
     public PackageUseWriter(ConfigurationImpl configuration,
                             ClassUseMapper mapper, DocPath filename,
-                            PackageElement pkgElement) throws IOException {
+                            PackageElement pkgElement) {
         super(configuration, DocPath.forPackage(pkgElement).resolve(filename));
         this.packageElement = pkgElement;
 
@@ -101,25 +97,21 @@
      * @param configuration the current configuration of the doclet.
      * @param mapper        the mapping of the class usage.
      * @param pkgElement    the package being documented.
+     * @throws DocFileIOException if there is a problem generating the package use page
      */
     public static void generate(ConfigurationImpl configuration,
-                                ClassUseMapper mapper, PackageElement pkgElement) {
-        PackageUseWriter pkgusegen;
+                                ClassUseMapper mapper, PackageElement pkgElement)
+            throws DocFileIOException {
         DocPath filename = DocPaths.PACKAGE_USE;
-        try {
-            pkgusegen = new PackageUseWriter(configuration, mapper, filename, pkgElement);
-            pkgusegen.generatePackageUseFile();
-        } catch (IOException exc) {
-            Messages messages = configuration.getMessages();
-            messages.error(exc.toString(), filename);
-            throw new DocletAbortException(exc);
-        }
+        PackageUseWriter pkgusegen = new PackageUseWriter(configuration, mapper, filename, pkgElement);
+        pkgusegen.generatePackageUseFile();
     }
 
     /**
      * Generate the package use list.
+     * @throws DocFileIOException if there is a problem generating the package use page
      */
-    protected void generatePackageUseFile() throws IOException {
+    protected void generatePackageUseFile() throws DocFileIOException {
         HtmlTree body = getPackageUseHeader();
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.contentContainer);
@@ -150,7 +142,7 @@
      *
      * @param contentTree the content tree to which the package use information will be added
      */
-    protected void addPackageUse(Content contentTree) throws IOException {
+    protected void addPackageUse(Content contentTree) {
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
         ul.addStyle(HtmlStyle.blockList);
         if (configuration.packages.size() > 1) {
@@ -165,7 +157,7 @@
      *
      * @param contentTree the content tree to which the package list will be added
      */
-    protected void addPackageList(Content contentTree) throws IOException {
+    protected void addPackageList(Content contentTree) {
         Content caption = getTableCaption(configuration.getContent(
                 "doclet.ClassUse_Packages.that.use.0",
                 getPackageLink(packageElement, utils.getPackageName(packageElement))));
@@ -193,7 +185,7 @@
      *
      * @param contentTree the content tree to which the class list will be added
      */
-    protected void addClassList(Content contentTree) throws IOException {
+    protected void addClassList(Content contentTree) {
         List<String> classTableHeader = Arrays.asList(
             configuration.getText("doclet.0_and_1",
                     configuration.getText("doclet.Class"),
@@ -254,7 +246,7 @@
      * @param pkg the package that used the given package
      * @param contentTree the content tree to which the information will be added
      */
-    protected void addPackageUse(PackageElement pkg, Content contentTree) throws IOException {
+    protected void addPackageUse(PackageElement pkg, Content contentTree) {
         Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
                 getHyperLink(utils.getPackageName(pkg),
                 new StringContent(utils.getPackageName(pkg))));
@@ -320,6 +312,7 @@
      *
      * @return a content tree for the package link
      */
+    @Override
     protected Content getNavLinkPackage() {
         Content linkContent = getHyperLink(DocPaths.PACKAGE_SUMMARY,
                 contents.packageLabel);
@@ -332,6 +325,7 @@
      *
      * @return a content tree for the use link
      */
+    @Override
     protected Content getNavLinkClassUse() {
         Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.useLabel);
         return li;
@@ -342,6 +336,7 @@
      *
      * @return a content tree for the tree link
      */
+    @Override
     protected Content getNavLinkTree() {
         Content linkContent = getHyperLink(DocPaths.PACKAGE_TREE,
                 contents.treeLabel);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.*;
 
 import javax.lang.model.element.ModuleElement;
@@ -42,6 +41,7 @@
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.PackageSummaryWriter;
 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 
@@ -112,6 +112,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public Content getPackageHeader(String heading) {
         HtmlTree bodyTree = getBody(true, getWindowTitle(utils.getPackageName(packageElement)));
         HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
@@ -166,6 +167,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public Content getContentHeader() {
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.contentContainer);
@@ -198,6 +200,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public Content getSummaryHeader() {
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
         ul.addStyle(HtmlStyle.blockList);
@@ -207,6 +210,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void addClassesSummary(SortedSet<TypeElement> classes, String label,
             String tableSummary, List<String> tableHeader, Content summaryContentTree) {
         if(!classes.isEmpty()) {
@@ -252,6 +256,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void addPackageDescription(Content packageContentTree) {
         if (!utils.getBody(packageElement).isEmpty()) {
             packageContentTree.addContent(
@@ -273,6 +278,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void addPackageTags(Content packageContentTree) {
         Content htmlTree = (configuration.allowTag(HtmlTag.SECTION))
                 ? sectionTree
@@ -283,6 +289,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void addPackageContent(Content contentTree, Content packageContentTree) {
         if (configuration.allowTag(HtmlTag.MAIN)) {
             packageContentTree.addContent(sectionTree);
@@ -296,6 +303,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void addPackageFooter(Content contentTree) {
         Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
                 ? HtmlTree.FOOTER()
@@ -310,7 +318,8 @@
     /**
      * {@inheritDoc}
      */
-    public void printDocument(Content contentTree) throws IOException {
+    @Override
+    public void printDocument(Content contentTree) throws DocFileIOException {
         printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageElement),
                 true, contentTree);
     }
@@ -320,6 +329,7 @@
      *
      * @return a content tree for the class use link
      */
+    @Override
     protected Content getNavLinkClassUse() {
         Content useLink = getHyperLink(DocPaths.PACKAGE_USE,
                 contents.useLabel, "", "");
@@ -332,6 +342,7 @@
      *
      * @return a content tree for the previous link
      */
+    @Override
     public Content getNavLinkPrevious() {
         Content li;
         if (prev == null) {
@@ -349,6 +360,7 @@
      *
      * @return a content tree for the next link
      */
+    @Override
     public Content getNavLinkNext() {
         Content li;
         if (next == null) {
@@ -367,6 +379,7 @@
      *
      * @return a content tree for the tree link
      */
+    @Override
     protected Content getNavLinkTree() {
         Content useLink = getHyperLink(DocPaths.PACKAGE_TREE,
                 contents.treeLabel, "", "");
@@ -392,6 +405,7 @@
      *
      * @return a content tree for the package link
      */
+    @Override
     protected Content getNavLinkPackage() {
         Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.packageLabel);
         return li;
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.*;
 
 import javax.lang.model.element.TypeElement;
@@ -39,8 +38,8 @@
 import jdk.javadoc.internal.doclets.toolkit.SerializedFormWriter;
 import jdk.javadoc.internal.doclets.toolkit.SerializedFormWriter.SerialFieldWriter;
 import jdk.javadoc.internal.doclets.toolkit.SerializedFormWriter.SerialMethodWriter;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 
 /**
  * Generate the Serialized Form Information Page.
@@ -64,11 +63,8 @@
 
     /**
      * @param configuration the configuration data for the doclet
-     * @throws IOException
-     * @throws DocletAbortException
      */
-    public SerializedFormWriterImpl(ConfigurationImpl configuration)
-            throws IOException {
+    public SerializedFormWriterImpl(ConfigurationImpl configuration) {
         super(configuration, DocPaths.SERIALIZED_FORM);
         visibleClasses = configuration.docEnv.getIncludedTypeElements();
     }
@@ -277,7 +273,8 @@
     /**
      * {@inheritDoc}
      */
-    public void printDocument(Content serializedTree) throws IOException {
+    @Override
+    public void printDocument(Content serializedTree) throws DocFileIOException {
         printHtmlDocument(null, true, serializedTree);
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SingleIndexWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SingleIndexWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.*;
 
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
@@ -33,10 +32,9 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.Messages;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 import jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder;
 
 
@@ -62,42 +60,37 @@
      * Construct the SingleIndexWriter with filename "index-all.html" and the
      * {@link IndexBuilder}
      *
+     * @param configuration the configuration for this doclet
      * @param filename     Name of the index file to be generated.
      * @param indexbuilder Unicode based Index from {@link IndexBuilder}
      */
     public SingleIndexWriter(ConfigurationImpl configuration,
                              DocPath filename,
-                             IndexBuilder indexbuilder) throws IOException {
+                             IndexBuilder indexbuilder) {
         super(configuration, filename, indexbuilder);
     }
 
     /**
      * Generate single index file, for all Unicode characters.
      *
+     * @param configuration the configuration for this doclet
      * @param indexbuilder IndexBuilder built by {@link IndexBuilder}
-     * @throws DocletAbortException
+     * @throws DocFileIOException if there is a problem generating the index
      */
     public static void generate(ConfigurationImpl configuration,
-                                IndexBuilder indexbuilder) {
-        SingleIndexWriter indexgen;
+                                IndexBuilder indexbuilder) throws DocFileIOException {
         DocPath filename = DocPaths.INDEX_ALL;
-        try {
-            indexgen = new SingleIndexWriter(configuration,
-                                             filename, indexbuilder);
-            indexgen.generateIndexFile();
-        } catch (IOException exc) {
-            Messages messages = configuration.getMessages();
-            messages.error("doclet.exception_encountered",
-                        exc.toString(), filename);
-            throw new DocletAbortException(exc);
-        }
+        SingleIndexWriter indexgen = new SingleIndexWriter(configuration,
+                                         filename, indexbuilder);
+        indexgen.generateIndexFile();
     }
 
     /**
      * Generate the contents of each index file, with Header, Footer,
      * Member Field, Method and Constructor Description.
+     * @throws DocFileIOException if there is a problem generating the index
      */
-    protected void generateIndexFile() throws IOException {
+    protected void generateIndexFile() throws DocFileIOException {
         String title = configuration.getText("doclet.Window_Single_Index");
         HtmlTree body = getBody(true, getWindowTitle(title));
         HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -42,10 +42,11 @@
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
+import jdk.javadoc.internal.doclets.toolkit.util.SimpleDocletException;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
 
 /**
@@ -79,7 +80,7 @@
 
     private final DocletEnvironment docEnv;
 
-    private DocPath outputdir;
+    private final DocPath outputdir;
 
     /**
      * Relative path from the documentation root to the file that is being
@@ -102,13 +103,15 @@
      * @param configuration the configuration.
      * @param docEnv the DocletEnvironment to convert.
      * @param outputdir the name of the directory to output to.
+     * @throws DocFileIOException if there is a problem generating an output file
+     * @throws SimpleDocletException if there is a problem reading a source file
      */
     public static void convertRoot(ConfigurationImpl configuration, DocletEnvironment docEnv,
-            DocPath outputdir) {
+            DocPath outputdir) throws DocFileIOException, SimpleDocletException {
         new SourceToHTMLConverter(configuration, docEnv, outputdir).generate();
     }
 
-    void generate() {
+    void generate() throws DocFileIOException, SimpleDocletException {
         if (docEnv == null || outputdir == null) {
             return;
         }
@@ -129,12 +132,15 @@
     }
 
     /**
-     * Convert the Classes in the given Package to an HTML.
+     * Convert the Classes in the given Package to an HTML file.
      *
      * @param pkg the Package to convert.
      * @param outputdir the name of the directory to output to.
+     * @throws DocFileIOException if there is a problem generating an output file
+     * @throws SimpleDocletException if there is a problem reading a source file
      */
-    public void convertPackage(PackageElement pkg, DocPath outputdir) {
+    public void convertPackage(PackageElement pkg, DocPath outputdir)
+            throws DocFileIOException, SimpleDocletException {
         if (pkg == null) {
             return;
         }
@@ -152,16 +158,20 @@
      * Convert the given Class to an HTML.
      *
      * @param te the class to convert.
-     * @param outputdir the name of the directory to output to.
+     * @param outputdir the name of the directory to output to
+     * @throws DocFileIOException if there is a problem generating the output file
+     * @throws SimpleDocletException if there is a problem reading the source file
      */
-    public void convertClass(TypeElement te, DocPath outputdir) {
+    public void convertClass(TypeElement te, DocPath outputdir)
+            throws DocFileIOException, SimpleDocletException {
         if (te == null) {
             return;
         }
+        FileObject fo = utils.getFileObject(te);
+        if (fo == null)
+            return;
+
         try {
-            FileObject fo = utils.getFileObject(te);
-            if (fo == null)
-                return;
             Reader r = fo.openReader(true);
             int lineno = 1;
             String line;
@@ -182,7 +192,8 @@
             body.addContent((configuration.allowTag(HtmlTag.MAIN)) ? HtmlTree.MAIN(div) : div);
             writeToFile(body, outputdir.resolve(DocPath.forClass(utils, te)));
         } catch (IOException e) {
-            throw new DocletAbortException(e);
+            String message = configuration.resources.getText("doclet.exception.read.file", fo.getName());
+            throw new SimpleDocletException(message, e);
         }
     }
 
@@ -192,7 +203,7 @@
      * @param body the documentation content to be written to the file.
      * @param path the path for the file.
      */
-    private void writeToFile(Content body, DocPath path) throws IOException {
+    private void writeToFile(Content body, DocPath path) throws DocFileIOException {
         Content htmlDocType = configuration.isOutputHtml5()
                 ? DocType.HTML5
                 : DocType.TRANSITIONAL;
@@ -207,6 +218,8 @@
         DocFile df = DocFile.createFileForOutput(configuration, path);
         try (Writer w = df.openWriter()) {
             htmlDocument.write(w, true);
+        } catch (IOException e) {
+            throw new DocFileIOException(df, DocFileIOException.Mode.WRITE, e);
         }
 
     }
@@ -287,9 +300,10 @@
     }
 
     /**
-     * Given a <code>Doc</code>, return an anchor name for it.
+     * Given an element, return an anchor name for it.
      *
-     * @param d the <code>Doc</code> to check.
+     * @param utils the utility class, used to get the line number of the element
+     * @param e the element to check.
      * @return the name of the anchor.
      */
     public static String getAnchorName(Utils utils, Element e) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
@@ -38,10 +37,9 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.Messages;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 import jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder;
 
 
@@ -71,20 +69,24 @@
      */
     protected int next;
 
-    private List<Character> indexElements;
+    private final List<Character> indexElements;
 
     /**
      * Construct the SplitIndexWriter. Uses path to this file and relative path
      * from this file.
      *
+     * @param configuration the configuration for this doclet
      * @param path       Path to the file which is getting generated.
      * @param indexbuilder Unicode based Index from {@link IndexBuilder}
+     * @param elements the collection of characters for which to generate index files
+     * @param prev  the previous character that was indexed
+     * @param next  the next character to be indexed
      */
     public SplitIndexWriter(ConfigurationImpl configuration,
                             DocPath path,
                             IndexBuilder indexbuilder,
                             Collection<Character> elements,
-                            int prev, int next) throws IOException {
+                            int prev, int next) {
         super(configuration, path, indexbuilder);
         this.indexElements = new ArrayList<>(elements);
         this.prev = prev;
@@ -95,34 +97,26 @@
      * Generate separate index files, for each Unicode character, listing all
      * the members starting with the particular unicode character.
      *
+     * @param configuration the configuration for this doclet
      * @param indexbuilder IndexBuilder built by {@link IndexBuilder}
-     * @throws DocletAbortException
+     * @throws DocFileIOException if there is a problem generating the index files
      */
     public static void generate(ConfigurationImpl configuration,
-                                IndexBuilder indexbuilder) {
-        SplitIndexWriter indexgen;
-        DocPath filename = DocPath.empty;
+                                IndexBuilder indexbuilder) throws DocFileIOException {
         DocPath path = DocPaths.INDEX_FILES;
-        try {
-            Set<Character> keys = new TreeSet<>(indexbuilder.getIndexMap().keySet());
-            keys.addAll(configuration.tagSearchIndexKeys);
-            ListIterator<Character> li = new ArrayList<>(keys).listIterator();
-            while (li.hasNext()) {
-                Object ch = li.next();
-                filename = DocPaths.indexN(li.nextIndex());
-                indexgen = new SplitIndexWriter(configuration,
-                        path.resolve(filename),
-                        indexbuilder, keys, li.previousIndex(), li.nextIndex());
-                indexgen.generateIndexFile((Character) ch);
-                if (!li.hasNext()) {
-                    indexgen.createSearchIndexFiles();
-                }
+        Set<Character> keys = new TreeSet<>(indexbuilder.getIndexMap().keySet());
+        keys.addAll(configuration.tagSearchIndexKeys);
+        ListIterator<Character> li = new ArrayList<>(keys).listIterator();
+        while (li.hasNext()) {
+            Object ch = li.next();
+            DocPath filename = DocPaths.indexN(li.nextIndex());
+            SplitIndexWriter indexgen = new SplitIndexWriter(configuration,
+                    path.resolve(filename),
+                    indexbuilder, keys, li.previousIndex(), li.nextIndex());
+            indexgen.generateIndexFile((Character) ch);
+            if (!li.hasNext()) {
+                indexgen.createSearchIndexFiles();
             }
-        } catch (IOException exc) {
-            Messages messages = configuration.getMessages();
-            messages.error("doclet.exception_encountered",
-                        exc.toString(), filename.getPath());
-            throw new DocletAbortException(exc);
         }
     }
 
@@ -132,8 +126,9 @@
      *
      * @param unicode Unicode character referring to the character for the
      * index.
+     * @throws DocFileIOException if there is a problem generating an index file
      */
-    protected void generateIndexFile(Character unicode) throws IOException {
+    protected void generateIndexFile(Character unicode) throws DocFileIOException {
         String title = configuration.getText("doclet.Window_Split_Index",
                 unicode.toString());
         HtmlTree body = getBody(true, getWindowTitle(title));
@@ -188,6 +183,7 @@
      *
      * @return a content tree for the link
      */
+    @Override
     public Content getNavLinkPrevious() {
         Content prevletterLabel = contents.prevLetter;
         if (prev == -1) {
@@ -205,6 +201,7 @@
      *
      * @return a content tree for the link
      */
+    @Override
     public Content getNavLinkNext() {
         Content nextletterLabel = contents.nextLetter;
         if (next == -1) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java	Fri Aug 26 14:47:52 2016 -0700
@@ -37,7 +37,6 @@
 
 import com.sun.source.doctree.DocTree;
 import com.sun.source.doctree.IndexTree;
-import com.sun.tools.javac.util.DefinedBy;
 import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
@@ -113,14 +112,14 @@
             si.setLabel(tagText);
             si.setDescription(desc);
             new SimpleElementVisitor9<Void, Void>() {
-                @Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
+                @Override
                 public Void visitModule(ModuleElement e, Void p) {
                     si.setUrl(DocPaths.moduleSummary(e).getPath() + "#" + anchorName);
                     si.setHolder(utils.getSimpleName(element));
                     return null;
                 }
 
-                @Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
+                @Override
                 public Void visitPackage(PackageElement e, Void p) {
                     si.setUrl(DocPath.forPackage(e).getPath()
                             + "/" + DocPaths.PACKAGE_SUMMARY.getPath() + "#" + anchorName);
@@ -128,14 +127,14 @@
                     return null;
                 }
 
-                @Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
+                @Override
                 public Void visitType(TypeElement e, Void p) {
                     si.setUrl(DocPath.forClass(utils, e).getPath() + "#" + anchorName);
                     si.setHolder(utils.getFullyQualifiedName(e));
                     return null;
                 }
 
-                @Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
+                @Override
                 public Void visitVariable(VariableElement e, Void p) {
                     TypeElement te = utils.getEnclosingTypeElement(e);
                     si.setUrl(DocPath.forClass(utils, te).getPath() + "#" + anchorName);
@@ -143,7 +142,7 @@
                     return null;
                 }
 
-                @Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
+                @Override
                 protected Void defaultAction(Element e, Void p) {
                     TypeElement te = utils.getEnclosingTypeElement(e);
                     si.setUrl(DocPath.forClass(utils, te).getPath() + "#" + anchorName);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.IOException;
 import java.util.SortedSet;
 
 import javax.lang.model.element.PackageElement;
@@ -36,11 +35,10 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 
 /**
  * Generate Class Hierarchy page for all the Classes in this run.  Use
@@ -67,7 +65,7 @@
      * True if there are no packages specified on the command line,
      * False otherwise.
      */
-    private boolean classesonly;
+    private final boolean classesOnly;
 
     /**
      * Constructor to construct TreeWriter object.
@@ -76,39 +74,33 @@
      * @param filename String filename
      * @param classtree the tree being built.
      */
-    public TreeWriter(ConfigurationImpl configuration,
-            DocPath filename, ClassTree classtree) throws IOException {
+    public TreeWriter(ConfigurationImpl configuration, DocPath filename, ClassTree classtree) {
         super(configuration, filename, classtree);
         packages = configuration.packages;
-        classesonly = packages.isEmpty();
+        classesOnly = packages.isEmpty();
     }
 
     /**
      * Create a TreeWriter object and use it to generate the
      * "overview-tree.html" file.
      *
+     * @param configuration the configuration for this doclet
      * @param classtree the class tree being documented.
-     * @throws  DocletAbortException
+     * @throws  DocFileIOException if there is a problem generating the overview tree page
      */
     public static void generate(ConfigurationImpl configuration,
-                                ClassTree classtree) {
-        TreeWriter treegen;
+                                ClassTree classtree) throws DocFileIOException {
         DocPath filename = DocPaths.OVERVIEW_TREE;
-        try {
-            treegen = new TreeWriter(configuration, filename, classtree);
-            treegen.generateTreeFile();
-        } catch (IOException exc) {
-            Messages messages = configuration.getMessages();
-            messages.error("doclet.exception_encountered",
-                        exc.toString(), filename);
-            throw new DocletAbortException(exc);
-        }
+        TreeWriter treegen = new TreeWriter(configuration, filename, classtree);
+        treegen.generateTreeFile();
     }
 
     /**
      * Generate the interface hierarchy and class hierarchy.
+     *
+     * @throws DocFileIOException if there is a problem generating the overview tree page
      */
-    public void generateTreeFile() throws IOException {
+    public void generateTreeFile() throws DocFileIOException {
         HtmlTree body = getTreeHeader();
         Content headContent = contents.hierarchyForAllPackages;
         Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false,
@@ -152,7 +144,7 @@
         if (isUnnamedPackage()) {
             return;
         }
-        if (!classesonly) {
+        if (!classesOnly) {
             Content span = HtmlTree.SPAN(HtmlStyle.packageHierarchyLabel,
                     contents.packageHierarchies);
             contentTree.addContent(span);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/WriterFactoryImpl.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/WriterFactoryImpl.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.IOException;
 
 import javax.lang.model.element.ModuleElement;
 import javax.lang.model.element.PackageElement;
@@ -69,7 +68,7 @@
      * {@inheritDoc}
      */
     @Override
-    public ConstantsSummaryWriter getConstantsSummaryWriter() throws Exception {
+    public ConstantsSummaryWriter getConstantsSummaryWriter() {
         return new ConstantsSummaryWriterImpl(configuration);
     }
 
@@ -78,7 +77,7 @@
      */
     @Override
     public PackageSummaryWriter getPackageSummaryWriter(PackageElement packageElement,
-            PackageElement prevPkg, PackageElement nextPkg) throws Exception {
+            PackageElement prevPkg, PackageElement nextPkg) {
         return new PackageWriterImpl(configuration, packageElement, prevPkg, nextPkg);
     }
 
@@ -86,7 +85,7 @@
      * {@inheritDoc}
      */
     public ModuleSummaryWriter getModuleSummaryWriter(ModuleElement mdle,
-        ModuleElement prevModule, ModuleElement nextModule) throws Exception {
+        ModuleElement prevModule, ModuleElement nextModule) {
         return new ModuleWriterImpl(configuration, mdle,
             prevModule, nextModule);
     }
@@ -96,7 +95,7 @@
      */
     @Override
     public ClassWriter getClassWriter(TypeElement typeElement, TypeElement prevClass,
-            TypeElement nextClass, ClassTree classTree) throws IOException {
+            TypeElement nextClass, ClassTree classTree) {
         return new ClassWriterImpl(configuration, typeElement, prevClass, nextClass, classTree);
     }
 
@@ -105,7 +104,7 @@
      */
     @Override
     public AnnotationTypeWriter getAnnotationTypeWriter(TypeElement annotationType,
-            TypeMirror prevType, TypeMirror nextType) throws Exception {
+            TypeMirror prevType, TypeMirror nextType) {
         return new AnnotationTypeWriterImpl(configuration, annotationType, prevType, nextType);
     }
 
@@ -113,8 +112,8 @@
      * {@inheritDoc}
      */
     @Override
-    public AnnotationTypeFieldWriter
-            getAnnotationTypeFieldWriter(AnnotationTypeWriter annotationTypeWriter) throws Exception {
+    public AnnotationTypeFieldWriter getAnnotationTypeFieldWriter(
+            AnnotationTypeWriter annotationTypeWriter) {
         TypeElement te = annotationTypeWriter.getAnnotationTypeElement();
         return new AnnotationTypeFieldWriterImpl(
             (SubWriterHolderWriter) annotationTypeWriter, te);
@@ -124,9 +123,8 @@
      * {@inheritDoc}
      */
     @Override
-    public AnnotationTypeOptionalMemberWriter
-            getAnnotationTypeOptionalMemberWriter(
-        AnnotationTypeWriter annotationTypeWriter) throws Exception {
+    public AnnotationTypeOptionalMemberWriter getAnnotationTypeOptionalMemberWriter(
+        AnnotationTypeWriter annotationTypeWriter) {
         TypeElement te = annotationTypeWriter.getAnnotationTypeElement();
         return new AnnotationTypeOptionalMemberWriterImpl(
             (SubWriterHolderWriter) annotationTypeWriter, te);
@@ -136,8 +134,8 @@
      * {@inheritDoc}
      */
     @Override
-    public AnnotationTypeRequiredMemberWriter
-            getAnnotationTypeRequiredMemberWriter(AnnotationTypeWriter annotationTypeWriter) throws Exception {
+    public AnnotationTypeRequiredMemberWriter getAnnotationTypeRequiredMemberWriter(
+            AnnotationTypeWriter annotationTypeWriter) {
         TypeElement te = annotationTypeWriter.getAnnotationTypeElement();
         return new AnnotationTypeRequiredMemberWriterImpl(
             (SubWriterHolderWriter) annotationTypeWriter, te);
@@ -147,8 +145,7 @@
      * {@inheritDoc}
      */
     @Override
-    public EnumConstantWriterImpl getEnumConstantWriter(ClassWriter classWriter)
-            throws Exception {
+    public EnumConstantWriterImpl getEnumConstantWriter(ClassWriter classWriter) {
         return new EnumConstantWriterImpl((SubWriterHolderWriter) classWriter,
                 classWriter.getTypeElement());
     }
@@ -157,8 +154,7 @@
      * {@inheritDoc}
      */
     @Override
-    public FieldWriterImpl getFieldWriter(ClassWriter classWriter)
-            throws Exception {
+    public FieldWriterImpl getFieldWriter(ClassWriter classWriter) {
         return new FieldWriterImpl((SubWriterHolderWriter) classWriter, classWriter.getTypeElement());
     }
 
@@ -166,8 +162,7 @@
      * {@inheritDoc}
      */
     @Override
-    public PropertyWriterImpl getPropertyWriter(ClassWriter classWriter)
-            throws Exception {
+    public PropertyWriterImpl getPropertyWriter(ClassWriter classWriter) {
         return new PropertyWriterImpl((SubWriterHolderWriter) classWriter,
                 classWriter.getTypeElement());
     }
@@ -176,8 +171,7 @@
      * {@inheritDoc}
      */
     @Override
-    public MethodWriterImpl getMethodWriter(ClassWriter classWriter)
-            throws Exception {
+    public MethodWriterImpl getMethodWriter(ClassWriter classWriter) {
         return new MethodWriterImpl((SubWriterHolderWriter) classWriter, classWriter.getTypeElement());
     }
 
@@ -185,8 +179,7 @@
      * {@inheritDoc}
      */
     @Override
-    public ConstructorWriterImpl getConstructorWriter(ClassWriter classWriter)
-            throws Exception {
+    public ConstructorWriterImpl getConstructorWriter(ClassWriter classWriter) {
         return new ConstructorWriterImpl((SubWriterHolderWriter) classWriter,
                 classWriter.getTypeElement());
     }
@@ -195,9 +188,8 @@
      * {@inheritDoc}
      */
     @Override
-    public MemberSummaryWriter getMemberSummaryWriter(
-            ClassWriter classWriter, VisibleMemberMap.Kind memberType)
-            throws Exception {
+    public MemberSummaryWriter getMemberSummaryWriter(ClassWriter classWriter,
+            VisibleMemberMap.Kind memberType) {
         switch (memberType) {
             case CONSTRUCTORS:
                 return getConstructorWriter(classWriter);
@@ -221,9 +213,8 @@
      * {@inheritDoc}
      */
     @Override
-    public MemberSummaryWriter getMemberSummaryWriter(
-        AnnotationTypeWriter annotationTypeWriter, VisibleMemberMap.Kind memberType)
-    throws Exception {
+    public MemberSummaryWriter getMemberSummaryWriter(AnnotationTypeWriter annotationTypeWriter,
+            VisibleMemberMap.Kind memberType) {
         switch (memberType) {
             case ANNOTATION_TYPE_FIELDS:
                 return (AnnotationTypeFieldWriterImpl)
@@ -243,7 +234,7 @@
      * {@inheritDoc}
      */
     @Override
-    public SerializedFormWriter getSerializedFormWriter() throws Exception {
+    public SerializedFormWriter getSerializedFormWriter() {
         return new SerializedFormWriterImpl(configuration);
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Comment.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Comment.java	Fri Aug 26 14:47:52 2016 -0700
@@ -29,7 +29,6 @@
 import java.io.Writer;
 
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
 
 /**
@@ -59,25 +58,21 @@
      * This method is not supported by the class.
      *
      * @param content content that needs to be added
-     * @throws DocletAbortException this method will always throw a
-     *                              DocletAbortException because it
-     *                              is not supported.
+     * @throws UnsupportedOperationException always
      */
     public void addContent(Content content) {
-        throw new DocletAbortException("not supported");
+        throw new UnsupportedOperationException();
     }
 
     /**
      * This method is not supported by the class.
      *
      * @param stringContent string content that needs to be added
-     * @throws DocletAbortException this method will always throw a
-     *                              DocletAbortException because it
-     *                              is not supported.
+     * @throws UnsupportedOperationException always
      */
     @Override
     public void addContent(CharSequence stringContent) {
-        throw new DocletAbortException("not supported");
+        throw new UnsupportedOperationException();
     }
 
     /**
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/DocType.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/DocType.java	Fri Aug 26 14:47:52 2016 -0700
@@ -29,7 +29,6 @@
 import java.io.Writer;
 
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
 
 /**
@@ -73,25 +72,21 @@
      * This method is not supported by the class.
      *
      * @param content content that needs to be added
-     * @throws DocletAbortException this method will always throw a
-     *                              DocletAbortException because it
-     *                              is not supported.
+     * @throws UnsupportedOperationException always
      */
     public void addContent(Content content) {
-        throw new DocletAbortException("not supported");
+        throw new UnsupportedOperationException();
     }
 
     /**
      * This method is not supported by the class.
      *
      * @param stringContent string content that needs to be added
-     * @throws DocletAbortException this method will always throw a
-     *                              DocletAbortException because it
-     *                              is not supported.
+     * @throws UnsupportedOperationException always
      */
     @Override
     public void addContent(CharSequence stringContent) {
-        throw new DocletAbortException("not supported");
+        throw new UnsupportedOperationException();
     }
 
     /**
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/FixedStringContent.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/FixedStringContent.java	Fri Aug 26 14:47:52 2016 -0700
@@ -28,7 +28,6 @@
 import java.io.Writer;
 
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
 
 /**
@@ -57,13 +56,11 @@
      * This method is not supported by the class.
      *
      * @param content content that needs to be added
-     * @throws DocletAbortException this method will always throw a
-     *                              DocletAbortException because it
-     *                              is not supported.
+     * @throws UnsupportedOperationException always
      */
     @Override
     public void addContent(Content content) {
-        throw new DocletAbortException("not supported");
+        throw new UnsupportedOperationException();
     }
 
     /**
@@ -71,13 +68,11 @@
      * HTML characters for the string content that is added.
      *
      * @param strContent string content to be added
-     * @throws DocletAbortException this method will always throw a
-     *                              DocletAbortException because it
-     *                              is not supported.
+     * @throws UnsupportedOperationException always
      */
     @Override
     public void addContent(CharSequence strContent) {
-        throw new DocletAbortException("not supported");
+        throw new UnsupportedOperationException();
     }
 
     /**
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html.markup;
 
-import java.io.*;
 import java.util.*;
 
 import javax.lang.model.element.ModuleElement;
@@ -38,6 +37,7 @@
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocLink;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
@@ -66,6 +66,7 @@
      * Constructor. Initializes the destination file name through the super
      * class HtmlWriter.
      *
+     * @param configuration the configuration for this doclet
      * @param filename String file name.
      */
     public HtmlDocWriter(Configuration configuration, DocPath filename) {
@@ -78,6 +79,7 @@
 
     /**
      * Accessor for configuration.
+     * @return the configuration for this doclet
      */
     public abstract Configuration configuration();
 
@@ -289,13 +291,9 @@
         DocLink mtFrameLink = new DocLink(DocPaths.moduleTypeFrame(mdle));
         DocLink cFrameLink = new DocLink(DocPaths.moduleSummary(mdle));
         HtmlTree anchor = HtmlTree.A(mdlLink.toString(), label);
-        StringBuilder onclickStr = new StringBuilder("updateModuleFrame('")
-                .append(mtFrameLink.toString())
-                .append("','")
-                .append(cFrameLink.toString())
-                .append("');");
+        String onclickStr = "updateModuleFrame('" + mtFrameLink + "','" + cFrameLink + "');";
         anchor.addAttr(HtmlAttr.TARGET, target);
-        anchor.addAttr(HtmlAttr.ONCLICK, onclickStr.toString());
+        anchor.addAttr(HtmlAttr.ONCLICK, onclickStr);
         return anchor;
     }
 
@@ -318,9 +316,10 @@
      * @param title Title of this HTML document
      * @param configuration the configuration object
      * @param body the body content tree to be added to the HTML document
+     * @throws DocFileIOException if there is an error writing the frames document
      */
     public void printFramesDocument(String title, ConfigurationImpl configuration,
-            HtmlTree body) throws IOException {
+            HtmlTree body) throws DocFileIOException {
         Content htmlDocType = configuration.isOutputHtml5()
                 ? DocType.HTML5
                 : DocType.TRANSITIONAL;
@@ -345,6 +344,7 @@
     /**
      * Returns a link to the stylesheet file.
      *
+     * @param configuration the configuration for this doclet
      * @return an HtmlTree for the lINK tag which provides the stylesheet location
      */
     public HtmlTree getStyleSheetProperties(ConfigurationImpl configuration) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocument.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocument.java	Fri Aug 26 14:47:52 2016 -0700
@@ -30,7 +30,6 @@
 import java.util.*;
 
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 
 /**
  * Class for generating an HTML document for javadoc output.
@@ -86,13 +85,11 @@
      * This method is not supported by the class.
      *
      * @param stringContent string content that needs to be added
-     * @throws DocletAbortException this method will always throw a
-     *                              DocletAbortException because it
-     *                              is not supported.
+     * @throws UnsupportedOperationException always
      */
     @Override
     public void addContent(CharSequence stringContent) {
-        throw new DocletAbortException("not supported");
+        throw new UnsupportedOperationException();
     }
 
     /**
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -32,6 +32,7 @@
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.Resources;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
 import jdk.javadoc.internal.doclets.toolkit.util.MethodTypes;
@@ -147,9 +148,11 @@
                 resources.getText("doclet.Type"));
     }
 
-    public void write(Content c) throws IOException {
+    public void write(Content c) throws DocFileIOException {
         try (Writer writer = docFile.openWriter()) {
             c.write(writer, true);
+        } catch (IOException e) {
+            throw new DocFileIOException(docFile, DocFileIOException.Mode.WRITE, e);
         }
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/RawHtml.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/RawHtml.java	Fri Aug 26 14:47:52 2016 -0700
@@ -29,7 +29,6 @@
 import java.io.Writer;
 
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
 
 /**
@@ -61,25 +60,21 @@
      * This method is not supported by the class.
      *
      * @param content content that needs to be added
-     * @throws DocletAbortException this method will always throw a
-     *                              DocletAbortException because it
-     *                              is not supported.
+     * @throws UnsupportedOperationException always
      */
     public void addContent(Content content) {
-        throw new DocletAbortException("not supported");
+        throw new UnsupportedOperationException();
     }
 
     /**
      * This method is not supported by the class.
      *
      * @param stringContent string content that needs to be added
-     * @throws DocletAbortException this method will always throw a
-     *                              DocletAbortException because it
-     *                              is not supported.
+     * @throws UnsupportedOperationException always
      */
     @Override
     public void addContent(CharSequence stringContent) {
-        throw new DocletAbortException("not supported");
+        throw new UnsupportedOperationException();
     }
 
     /**
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/StringContent.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/StringContent.java	Fri Aug 26 14:47:52 2016 -0700
@@ -29,7 +29,6 @@
 import java.io.Writer;
 
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
 
 /**
@@ -44,7 +43,7 @@
  */
 public class StringContent extends Content {
 
-    private StringBuilder stringContent;
+    private final StringBuilder stringContent;
 
     /**
      * Constructor to construct StringContent object.
@@ -67,13 +66,11 @@
      * This method is not supported by the class.
      *
      * @param content content that needs to be added
-     * @throws DocletAbortException this method will always throw a
-     *                              DocletAbortException because it
-     *                              is not supported.
+     * @throws UnsupportedOperationException always
      */
     @Override
     public void addContent(Content content) {
-        throw new DocletAbortException("not supported");
+        throw new UnsupportedOperationException();
     }
 
     /**
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties	Fri Aug 26 14:47:52 2016 -0700
@@ -189,7 +189,6 @@
 doclet.Error_in_packagelist=Error in using -group option: {0} {1}
 doclet.Groupname_already_used=In -group option, groupname already used: {0}
 doclet.Same_package_name_used=Package name format used twice: {0}
-doclet.exception_encountered=Exception encountered while processing {1}\n{0}
 
 # option specifiers
 doclet.usage.d.parameters=<directory>
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java	Fri Aug 26 14:47:52 2016 -0700
@@ -34,12 +34,17 @@
 
 import jdk.javadoc.doclet.Doclet;
 import jdk.javadoc.doclet.DocletEnvironment;
+import jdk.javadoc.doclets.StandardDoclet;
+import jdk.javadoc.internal.doclets.formats.html.HtmlDoclet;
 import jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder;
 import jdk.javadoc.internal.doclets.toolkit.builders.BuilderFactory;
 import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
+import jdk.javadoc.internal.doclets.toolkit.util.InternalException;
 import jdk.javadoc.internal.doclets.toolkit.util.PackageListWriter;
+import jdk.javadoc.internal.doclets.toolkit.util.ResourceIOException;
+import jdk.javadoc.internal.doclets.toolkit.util.SimpleDocletException;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
 
 import static javax.tools.Diagnostic.Kind.*;
@@ -107,30 +112,61 @@
             return false;
         }
 
+        boolean dumpOnError = false;  // set true to always show stack traces
+
         try {
             startGeneration(docEnv);
-        } catch (Configuration.Fault f) {
-            configuration.reporter.print(ERROR, f.getMessage());
-            return false;
-        } catch (DocletAbortException e) {
-            Throwable cause = e.getCause();
-            if (cause != null) {
-                if (cause.getLocalizedMessage() != null) {
-                    configuration.reporter.print(ERROR, cause.getLocalizedMessage());
-                } else {
-                    configuration.reporter.print(ERROR, cause.toString());
-                }
+            return true;
+
+        } catch (DocFileIOException e) {
+            switch (e.mode) {
+                case READ:
+                    messages.error("doclet.exception.read.file",
+                            e.fileName.getPath(), e.getCause());
+                    break;
+                case WRITE:
+                    messages.error("doclet.exception.write.file",
+                            e.fileName.getPath(), e.getCause());
             }
-            return false;
-        } catch (Exception exc) {
-            exc.printStackTrace(System.err);
-            return false;
+            dumpStack(dumpOnError, e);
+
+        } catch (ResourceIOException e) {
+            messages.error("doclet.exception.read.resource",
+                    e.resource.getPath(), e.getCause());
+            dumpStack(dumpOnError, e);
+
+        } catch (SimpleDocletException e) {
+            configuration.reporter.print(ERROR, e.getMessage());
+            dumpStack(dumpOnError, e);
+
+        } catch (InternalException e) {
+            configuration.reporter.print(ERROR, e.getMessage());
+            reportInternalError(e.getCause());
+
+        } catch (DocletException | RuntimeException | Error e) {
+            messages.error("doclet.internal.exception", e);
+            reportInternalError(e);
         }
-        return true;
+
+        return false;
+    }
+
+    private void reportInternalError(Throwable t) {
+        if (getClass().equals(StandardDoclet.class) || getClass().equals(HtmlDoclet.class)) {
+            System.err.println(configuration.getResources().getText("doclet.internal.report.bug"));
+        }
+        dumpStack(true, t);
+    }
+
+    private void dumpStack(boolean enabled, Throwable t) {
+        if (enabled && t != null) {
+            t.printStackTrace(System.err);
+        }
     }
 
     /**
      * Returns the SourceVersion indicating the features supported by this doclet.
+     *
      * @return SourceVersion
      */
     @Override
@@ -141,6 +177,7 @@
 
     /**
      * Create the configuration instance and returns it.
+     *
      * @return the configuration of the doclet.
      */
     public abstract Configuration configuration();
@@ -152,8 +189,9 @@
      * first and then can be used in the later generation.
      *
      * @see jdk.doclet.DocletEnvironment
+     * @throws DocletException if there is a problem while generating the documentation
      */
-    private void startGeneration(DocletEnvironment docEnv) throws Configuration.Fault, Exception {
+    private void startGeneration(DocletEnvironment docEnv) throws DocletException {
         if (docEnv.getIncludedTypeElements().isEmpty()) {
             messages.error("doclet.No_Public_Classes_To_Document");
             return;
@@ -166,7 +204,6 @@
         ClassTree classtree = new ClassTree(configuration, configuration.nodeprecated);
 
         generateClassFiles(docEnv, classtree);
-        configuration.utils.copyDocFiles(DocPaths.DOC_FILES);
 
         PackageListWriter.generate(configuration);
         generatePackageFiles(classtree);
@@ -179,10 +216,12 @@
     /**
      * Generate additional documentation that is added to the API documentation.
      *
-     * @param docEnv     the DocletEnvironment.
-     * @param classtree the data structure representing the class tree.
+     * @param docEnv     the DocletEnvironment
+     * @param classtree the data structure representing the class tree
+     * @throws DocletException if there is a problem while generating the documentation
      */
-    protected void generateOtherFiles(DocletEnvironment docEnv, ClassTree classtree) throws Exception {
+    protected void generateOtherFiles(DocletEnvironment docEnv, ClassTree classtree)
+            throws DocletException {
         BuilderFactory builderFactory = configuration.getBuilderFactory();
         AbstractBuilder constantsSummaryBuilder = builderFactory.getConstantsSummaryBuilder();
         constantsSummaryBuilder.build();
@@ -193,50 +232,59 @@
     /**
      * Generate the module documentation.
      *
+     * @throws DocletException if there is a problem while generating the documentation
+     *
      */
-    protected abstract void generateModuleFiles() throws Exception;
+    protected abstract void generateModuleFiles() throws DocletException;
 
     /**
      * Generate the package documentation.
      *
-     * @param classtree the data structure representing the class tree.
+     * @param classtree the data structure representing the class tree
+     * @throws DocletException if there is a problem while generating the documentation
      */
-    protected abstract void generatePackageFiles(ClassTree classtree) throws Exception;
+    protected abstract void generatePackageFiles(ClassTree classtree) throws DocletException;
 
     /**
      * Generate the class documentation.
      *
-     * @param classtree the data structure representing the class tree.
+     * @param arr the set of types to be documented
+     * @param classtree the data structure representing the class tree
+     * @throws DocletException if there is a problem while generating the documentation
      */
-    protected abstract void generateClassFiles(SortedSet<TypeElement> arr, ClassTree classtree);
+    protected abstract void generateClassFiles(SortedSet<TypeElement> arr, ClassTree classtree)
+            throws DocletException;
 
     /**
      * Iterate through all classes and construct documentation for them.
      *
-     * @param docEnv      the DocletEnvironment.
-     * @param classtree the data structure representing the class tree.
+     * @param docEnv      the DocletEnvironment
+     * @param classtree the data structure representing the class tree
+     * @throws DocletException if there is a problem while generating the documentation
      */
-    protected void generateClassFiles(DocletEnvironment docEnv, ClassTree classtree) {
+    protected void generateClassFiles(DocletEnvironment docEnv, ClassTree classtree)
+            throws DocletException {
         generateClassFiles(classtree);
         SortedSet<PackageElement> packages = new TreeSet<>(utils.makePackageComparator());
         packages.addAll(configuration.getSpecifiedPackages());
         configuration.modulePackages.values().stream().forEach(pset -> {
             packages.addAll(pset);
         });
-        packages.stream().forEach((pkg) -> {
+        for (PackageElement pkg : packages) {
             generateClassFiles(utils.getAllClasses(pkg), classtree);
-        });
+        }
     }
 
     /**
      * Generate the class files for single classes specified on the command line.
      *
-     * @param classtree the data structure representing the class tree.
+     * @param classtree the data structure representing the class tree
+     * @throws DocletException if there is a problem while generating the documentation
      */
-    private void generateClassFiles(ClassTree classtree) {
+    private void generateClassFiles(ClassTree classtree) throws DocletException {
         SortedSet<PackageElement> packages = configuration.typeElementCatalog.packages();
-        packages.stream().forEach((pkg) -> {
+        for (PackageElement pkg : packages) {
             generateClassFiles(configuration.typeElementCatalog.allClasses(pkg), classtree);
-        });
+        }
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AnnotationTypeWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AnnotationTypeWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,9 +25,9 @@
 
 package jdk.javadoc.internal.doclets.toolkit;
 
-import java.io.*;
+import javax.lang.model.element.TypeElement;
 
-import javax.lang.model.element.TypeElement;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 
 /**
  * The interface for writing annotation type output.
@@ -152,8 +152,9 @@
      * Print the document.
      *
      * @param contentTree content tree that will be printed as a document
+     * @throws DocFileIOException if there is a problem while writing the document
      */
-    public void printDocument(Content contentTree) throws IOException;
+    public void printDocument(Content contentTree) throws DocFileIOException;
 
     /**
      * Return the {@link TypeElement} being documented.
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ClassWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ClassWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,9 +25,9 @@
 
 package jdk.javadoc.internal.doclets.toolkit;
 
-import java.io.*;
+import javax.lang.model.element.TypeElement;
 
-import javax.lang.model.element.TypeElement;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 
 /**
  * The interface for writing class output.
@@ -193,8 +193,9 @@
      * Print the document.
      *
      * @param contentTree content tree that will be printed as a document
+     * @throws DocFileIOException if there is a problem while writing the document
      */
-    public void printDocument(Content contentTree) throws IOException;
+    public void printDocument(Content contentTree) throws DocFileIOException;
 
     /**
      * Return the TypeElement being documented.
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java	Fri Aug 26 14:47:52 2016 -0700
@@ -44,11 +44,12 @@
 import jdk.javadoc.internal.doclets.toolkit.taglets.TagletManager;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFileFactory;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
 import jdk.javadoc.internal.doclets.toolkit.util.Extern;
 import jdk.javadoc.internal.doclets.toolkit.util.Group;
 import jdk.javadoc.internal.doclets.toolkit.util.MetaKeywords;
+import jdk.javadoc.internal.doclets.toolkit.util.SimpleDocletException;
 import jdk.javadoc.internal.doclets.toolkit.util.TypeElementCatalog;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap.GetterSetter;
@@ -73,21 +74,6 @@
 public abstract class Configuration {
 
     /**
-     * Exception used to report a problem during setOptions.
-     */
-    public static class Fault extends Exception {
-        private static final long serialVersionUID = 0;
-
-        Fault(String msg) {
-            super(msg);
-        }
-
-        Fault(String msg, Exception cause) {
-            super(msg, cause);
-        }
-    }
-
-    /**
      * The factory for builders.
      */
     protected BuilderFactory builderFactory;
@@ -105,7 +91,7 @@
     /**
      * The default path to the builder XML.
      */
-    private static final String DEFAULT_BUILDER_XML = "resources/doclet.xml";
+    public static final String DEFAULT_BUILDER_XML = "resources/doclet.xml";
 
     /**
      * The path to Taglets
@@ -302,13 +288,17 @@
 
     /**
      * Return the build date for the doclet.
+     *
+     * @return the build date
      */
     public abstract String getDocletSpecificBuildDate();
 
     /**
-     * This method should be defined in all those doclets(configurations),
+     * This method should be defined in all those doclets (configurations),
      * which want to derive themselves from this Configuration. This method
      * can be used to finish up the options setup.
+     *
+     * @return true if successful and false otherwise
      */
 
     public abstract boolean finishOptionSettings();
@@ -638,8 +628,8 @@
      * when this is called all the option have been set, this method,
      * initializes certain components before anything else is started.
      */
-    private void finishOptionSettings0() throws Fault {
-        ensureOutputDirExists();
+    private void finishOptionSettings0() throws DocletException {
+        initDestDirectory();
         if (urlForLink != null && pkglistUrlForLink != null)
             extern.link(urlForLink, pkglistUrlForLink, reporter, false);
         if (urlForLinkOffline != null && pkglistUrlForLinkOffline != null)
@@ -658,43 +648,42 @@
      * Set the command line options supported by this configuration.
      *
      * @return true if the options are set successfully
-     * @throws DocletAbortException
+     * @throws DocletException if there is a problem while setting the options
      */
-    public boolean setOptions() throws Fault {
-        try {
-            initPackages();
-            initModules();
-            finishOptionSettings0();
-            if (!finishOptionSettings())
-                return false;
+    public boolean setOptions() throws DocletException {
+        initPackages();
+        initModules();
+        finishOptionSettings0();
+        if (!finishOptionSettings())
+            return false;
 
-        } catch (Fault f) {
-            throw new DocletAbortException(f.getMessage());
-        }
         return true;
     }
 
-    private void ensureOutputDirExists() throws Fault {
-        DocFile destDir = DocFile.createFileForDirectory(this, destDirName);
-        if (!destDir.exists()) {
-            //Create the output directory (in case it doesn't exist yet)
-            if (!destDirName.isEmpty())
+    private void initDestDirectory() throws DocletException {
+        if (!destDirName.isEmpty()) {
+            DocFile destDir = DocFile.createFileForDirectory(this, destDirName);
+            if (!destDir.exists()) {
+                //Create the output directory (in case it doesn't exist yet)
                 reporter.print(NOTE, getText("doclet.dest_dir_create", destDirName));
-            destDir.mkdirs();
-        } else if (!destDir.isDirectory()) {
-            throw new Fault(getText(
-                "doclet.destination_directory_not_directory_0",
-                destDir.getPath()));
-        } else if (!destDir.canWrite()) {
-            throw new Fault(getText(
-                "doclet.destination_directory_not_writable_0",
-                destDir.getPath()));
+                destDir.mkdirs();
+            } else if (!destDir.isDirectory()) {
+                throw new SimpleDocletException(getText(
+                        "doclet.destination_directory_not_directory_0",
+                        destDir.getPath()));
+            } else if (!destDir.canWrite()) {
+                throw new SimpleDocletException(getText(
+                        "doclet.destination_directory_not_writable_0",
+                        destDir.getPath()));
+            }
         }
+        DocFileFactory.getFactory(this).setDestDir(destDirName);
     }
 
     /**
      * Initialize the taglet manager.  The strings to initialize the simple custom tags should
      * be in the following format:  "[tag name]:[location str]:[heading]".
+     *
      * @param customTagStrs the set two dimensional arrays of strings.  These arrays contain
      * either -tag or -taglet arguments.
      */
@@ -819,7 +808,7 @@
                 if (!checkOutputFileEncoding(docencoding)) {
                     return false;
                 }
-            };
+            }
         }
         if (!docencodingfound && (encoding != null && !encoding.isEmpty())) {
             if (!checkOutputFileEncoding(encoding)) {
@@ -858,6 +847,7 @@
     /**
      * Return true if the given doc-file subdirectory should be excluded and
      * false otherwise.
+     *
      * @param docfilesubdir the doc-files subdirectory to check.
      * @return true if the directory is excluded.
      */
@@ -867,7 +857,9 @@
 
     /**
      * Return true if the given qualifier should be excluded and false otherwise.
+     *
      * @param qualifier the qualifier to check.
+     * @return true if the qualifier should be excluded
      */
     public boolean shouldExcludeQualifier(String qualifier){
         if (excludedQualifiers.contains("all") ||
@@ -888,6 +880,7 @@
     /**
      * Return the qualified name of the Element if its qualifier is not excluded.
      * Otherwise return the unqualified Element name.
+     *
      * @param te the TypeElement to check.
      * @return the class name
      */
@@ -931,6 +924,7 @@
      * Convenience method to obtain a resource from the doclet's
      * {@link Resources resources}.
      * Equivalent to <code>getResources.getText(key);</code>.
+     *
      * @param key the key for the desired string
      * @return the string for the given key
      * @throws MissingResourceException if the key is not found in either
@@ -942,6 +936,7 @@
      * Convenience method to obtain a resource from the doclet's
      * {@link Resources resources}.
      * Equivalent to <code>getResources.getText(key, args);</code>.
+     *
      * @param key the key for the desired string
      * @param args values to be substituted into the resulting string
      * @return the string for the given key
@@ -1009,6 +1004,7 @@
 
     /**
      * Return the doclet specific instance of a writer factory.
+     *
      * @return the {@link WriterFactory} for the doclet.
      */
     public abstract WriterFactory getWriterFactory();
@@ -1017,9 +1013,9 @@
      * Return the input stream to the builder XML.
      *
      * @return the input steam to the builder XML.
-     * @throws FileNotFoundException when the given XML file cannot be found.
+     * @throws DocFileIOException when the given XML file cannot be found or opened.
      */
-    public InputStream getBuilderXML() throws IOException {
+    public InputStream getBuilderXML() throws DocFileIOException {
         return builderXMLPath == null ?
             Configuration.class.getResourceAsStream(DEFAULT_BUILDER_XML) :
             DocFile.createFileForInput(this, builderXMLPath).openInputStream();
@@ -1027,6 +1023,7 @@
 
     /**
      * Return the Locale for this document.
+     *
      * @return the current locale
      */
     public abstract Locale getLocale();
@@ -1040,6 +1037,7 @@
 
     /**
      * Return the current file manager.
+     *
      * @return JavaFileManager
      */
     public abstract JavaFileManager getFileManager();
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ConstantsSummaryWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ConstantsSummaryWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,13 +25,14 @@
 
 package jdk.javadoc.internal.doclets.toolkit;
 
-import java.io.*;
 import java.util.*;
 
 import javax.lang.model.element.PackageElement;
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.element.VariableElement;
 
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
+
 /**
  * The interface for writing constants summary output.
  *
@@ -144,7 +145,8 @@
      * Print the constants summary document.
      *
      * @param contentTree content tree which should be printed
+     * @throws DocFileIOException if there is a problem while writing the document
      */
-    public abstract void printDocument(Content contentTree) throws IOException;
+    public abstract void printDocument(Content contentTree) throws DocFileIOException;
 
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Content.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Content.java	Fri Aug 26 14:47:52 2016 -0700
@@ -30,9 +30,6 @@
 import java.io.Writer;
 import java.util.Objects;
 
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
-
-
 /**
  * A class to create content for javadoc output pages.
  *
@@ -57,7 +54,7 @@
             write(out, true);
         } catch (IOException e) {
             // cannot happen from StringWriter
-            throw new DocletAbortException(e);
+            throw new AssertionError(e);
         }
         return out.toString();
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/DocletException.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.toolkit;
+
+
+/**
+ * Supertype for all checked doclet exceptions.
+ *
+ * <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>
+ *
+ * @apiNote This is primarily intended for the benefit of the builder API
+ *  in {@code jdk.javadoc.internal.doclets.toolkit.builders}.
+ */
+public class DocletException extends Exception {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Creates a DocletException with a given detail message.
+     *
+     * The message may or may not be intended for presentation to the end user.
+     *
+     * @param message the detail message.
+     */
+    protected DocletException(String message) {
+        super(message);
+        if (message == null || message.isEmpty()) {
+            throw new IllegalArgumentException();
+        }
+    }
+
+    /**
+     * Creates a DocletException with a given detail message and underlying cause.
+     *
+     * The message may or may not be intended for presentation to the end user.
+     *
+     * @param message the detail message.
+     * @param cause the underlying cause
+     */
+    protected DocletException(String message, Throwable cause) {
+        super(message, cause);
+        if (message == null || message.isEmpty()) {
+            throw new IllegalArgumentException();
+        }
+    }
+}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ModuleSummaryWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ModuleSummaryWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,10 +25,7 @@
 
 package jdk.javadoc.internal.doclets.toolkit;
 
-import java.io.*;
-import java.util.Set;
-
-import javax.lang.model.element.PackageElement;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 
 /**
  * The interface for writing module summary output.
@@ -130,6 +127,7 @@
      * Print the module summary document.
      *
      * @param contentTree the content tree that will be printed
+     * @throws DocFileIOException if there is a problem while writing the document
      */
-    public abstract void printDocument(Content contentTree) throws IOException;
+    public abstract void printDocument(Content contentTree) throws DocFileIOException;
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/OverviewElement.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/OverviewElement.java	Fri Aug 26 14:47:52 2016 -0700
@@ -35,8 +35,6 @@
 import javax.lang.model.element.Name;
 import javax.lang.model.type.TypeMirror;
 
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
 import jdk.javadoc.doclet.DocletEnvironment;
 
 /**
@@ -56,52 +54,52 @@
         this.docEnv = docEnv;
     }
 
-    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+    @Override
     public TypeMirror asType() {
         throw new UnsupportedOperationException("Unsupported method");
     }
 
-    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+    @Override
     public ElementKind getKind() {
         return ElementKind.OTHER;
     }
 
-    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+    @Override
     public Set<javax.lang.model.element.Modifier> getModifiers() {
         throw new UnsupportedOperationException("Unsupported method");
     }
 
-    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+    @Override
     public Name getSimpleName() {
         throw new UnsupportedOperationException("Unsupported method");
     }
 
-    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+    @Override
     public Element getEnclosingElement() {
         throw new UnsupportedOperationException("Unsupported method");
     }
 
-    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+    @Override
     public java.util.List<? extends Element> getEnclosedElements() {
         throw new UnsupportedOperationException("Unsupported method");
     }
 
-    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+    @Override
     public java.util.List<? extends AnnotationMirror> getAnnotationMirrors() {
         throw new UnsupportedOperationException("Unsupported method");
     }
 
-    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+    @Override
     public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
         throw new UnsupportedOperationException("Unsupported method");
     }
 
-    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+    @Override
     public <R, P> R accept(ElementVisitor<R, P> v, P p) {
         return v.visitUnknown(this, p);
     }
 
-    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+    @Override
     public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) {
         throw new UnsupportedOperationException("Unsupported method");
     }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/PackageSummaryWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/PackageSummaryWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,13 +25,13 @@
 
 package jdk.javadoc.internal.doclets.toolkit;
 
-import java.io.*;
-
 import java.util.List;
 import java.util.SortedSet;
 
 import javax.lang.model.element.TypeElement;
 
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
+
 /**
  * The interface for writing package summary output.
  *
@@ -118,7 +118,8 @@
      * Print the package summary document.
      *
      * @param contentTree the content tree that will be printed
+     * @throws DocFileIOException if there is a problem while writing the document
      */
-    public abstract void printDocument(Content contentTree) throws IOException;
+    public abstract void printDocument(Content contentTree) throws DocFileIOException;
 
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/SerializedFormWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/SerializedFormWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,13 +25,12 @@
 
 package jdk.javadoc.internal.doclets.toolkit;
 
-import java.io.*;
-
 import javax.lang.model.element.ExecutableElement;
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.element.VariableElement;
 
 import com.sun.source.doctree.DocTree;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 
 /**
  * The interface for writing serialized form output.
@@ -124,15 +123,17 @@
     public Content getClassContentHeader();
 
     /**
-     * Return an instance of a SerialFieldWriter.
+     * Return an instance of a SerialFieldWriter for a class.
      *
+     * @param typeElement the class
      * @return an instance of a SerialFieldWriter.
      */
     public SerialFieldWriter getSerialFieldWriter(TypeElement typeElement);
 
     /**
-     * Return an instance of a SerialMethodWriter.
+     * Return an instance of a SerialMethodWriter for a class.
      *
+     * @param typeElement the class
      * @return an instance of a SerialMethodWriter.
      */
     public SerialMethodWriter getSerialMethodWriter(TypeElement typeElement);
@@ -156,8 +157,9 @@
      * Print the serialized form document.
      *
      * @param serializedTree the content tree that will be printed
+     * @throws DocFileIOException if there is a problem while writing the document
      */
-    public abstract void printDocument(Content serializedTree) throws IOException;
+    public abstract void printDocument(Content serializedTree) throws DocFileIOException;
 
     /**
      * Write the serialized form for a given field.
@@ -199,7 +201,7 @@
         /**
          * Adds the description text for this member.
          *
-         * @param field the field to document.
+         * @param field the field to document
          * @param contentTree content tree to which the member description will be added
          */
         public void addMemberDescription(VariableElement field, Content contentTree);
@@ -207,7 +209,8 @@
         /**
          * Adds the description text for this member represented by the tag.
          *
-         * @param serialFieldTag the field to document (represented by tag).
+         * @param field the field to document
+         * @param serialFieldTag the field to document (represented by tag)
          * @param contentTree content tree to which the member description will be added
          */
         public void addMemberDescription(VariableElement field, DocTree serialFieldTag, Content contentTree);
@@ -215,7 +218,7 @@
         /**
          * Adds the tag information for this member.
          *
-         * @param field the field to document.
+         * @param field the field to document
          * @param contentTree content tree to which the member tags will be added
          */
         public void addMemberTags(VariableElement field, Content contentTree);
@@ -223,11 +226,11 @@
         /**
          * Adds the member header.
          *
-         * @param fieldType the type of the field.
+         * @param fieldType the type of the field
          * @param fieldTypeStr the type of the field in string format.  We will
-         * print this out if we can't link to the type.
-         * @param fieldDimensions the dimensions of the field.
-         * @param fieldName the name of the field.
+         * print this out if we can't link to the type
+         * @param fieldDimensions the dimensions of the field
+         * @param fieldName the name of the field
          * @param contentTree content tree to which the member header will be added
          */
         public void addMemberHeader(TypeElement fieldType, String fieldTypeStr,
@@ -239,7 +242,7 @@
          * for deprecation info, inline comment or tags,
          * do not print overview details.
          *
-         * @param field the field to check overview details for.
+         * @param field the field to check overview details for
          * @return true if overview details need to be printed
          */
         public boolean shouldPrintOverview(VariableElement field);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java	Fri Aug 26 14:47:52 2016 -0700
@@ -44,6 +44,7 @@
 import javax.lang.model.element.VariableElement;
 import javax.lang.model.type.TypeMirror;
 import javax.lang.model.util.Elements;
+import javax.tools.JavaFileManager.Location;
 import javax.tools.JavaFileObject;
 
 import com.sun.source.tree.CompilationUnitTree;
@@ -57,6 +58,7 @@
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
 import com.sun.tools.javac.code.Symbol.MethodSymbol;
+import com.sun.tools.javac.code.Symbol.ModuleSymbol;
 import com.sun.tools.javac.code.Symbol.VarSymbol;
 import com.sun.tools.javac.comp.AttrContext;
 import com.sun.tools.javac.comp.Env;
@@ -289,6 +291,14 @@
         return ((DocEnvImpl)(configuration.docEnv)).etable.shouldDocument(e);
     }
 
+    // TODO: jx.l.m ?
+    public Location getLocationForModule(ModuleElement mdle) {
+        ModuleSymbol msym = (ModuleSymbol)mdle;
+        return msym.sourceLocation != null
+                ? msym.sourceLocation
+                : msym.classLocation;
+    }
+
     //------------------Start of Serializable Implementation---------------------//
     private final static Map<TypeElement, NewSerializedForm> serializedForms = new HashMap<>();
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WriterFactory.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WriterFactory.java	Fri Aug 26 14:47:52 2016 -0700
@@ -52,8 +52,7 @@
      * @return the writer for the constant summary.  Return null if this
      * writer is not supported by the doclet.
      */
-    public abstract ConstantsSummaryWriter getConstantsSummaryWriter()
-        throws Exception;
+    public abstract ConstantsSummaryWriter getConstantsSummaryWriter();
 
     /**
      * Return the writer for the package summary.
@@ -65,8 +64,7 @@
      * writer is not supported by the doclet.
      */
     public abstract PackageSummaryWriter getPackageSummaryWriter(PackageElement
-        packageElement, PackageElement prevPkg, PackageElement nextPkg)
-    throws Exception;
+        packageElement, PackageElement prevPkg, PackageElement nextPkg);
 
     /**
      * Return the writer for the module summary.
@@ -78,8 +76,7 @@
      * writer is not supported by the doclet.
      */
     public abstract ModuleSummaryWriter getModuleSummaryWriter(
-        ModuleElement mdle, ModuleElement prevModule, ModuleElement nextModule)
-    throws Exception;
+        ModuleElement mdle, ModuleElement prevModule, ModuleElement nextModule);
 
     /**
      * Return the writer for a class.
@@ -92,8 +89,7 @@
      * writer is not supported by the doclet.
      */
     public abstract ClassWriter getClassWriter(TypeElement typeElement,
-        TypeElement prevClass, TypeElement nextClass, ClassTree classTree)
-            throws Exception;
+        TypeElement prevClass, TypeElement nextClass, ClassTree classTree);
 
     /**
      * Return the writer for an annotation type.
@@ -105,8 +101,7 @@
      * writer is not supported by the doclet.
      */
     public abstract AnnotationTypeWriter getAnnotationTypeWriter(
-        TypeElement annotationType, TypeMirror prevType, TypeMirror nextType)
-            throws Exception;
+        TypeElement annotationType, TypeMirror prevType, TypeMirror nextType);
 
     /**
      * Return the method writer for a given class.
@@ -115,8 +110,7 @@
      * @return the method writer for the give class.  Return null if this
      * writer is not supported by the doclet.
      */
-    public abstract MethodWriter getMethodWriter(ClassWriter classWriter)
-            throws Exception;
+    public abstract MethodWriter getMethodWriter(ClassWriter classWriter);
 
     /**
      * Return the annotation type field writer for a given annotation type.
@@ -128,7 +122,7 @@
      */
     public abstract AnnotationTypeFieldWriter
             getAnnotationTypeFieldWriter(
-        AnnotationTypeWriter annotationTypeWriter) throws Exception;
+        AnnotationTypeWriter annotationTypeWriter);
 
     /**
      * Return the annotation type optional member writer for a given annotation
@@ -141,7 +135,7 @@
      */
     public abstract AnnotationTypeOptionalMemberWriter
             getAnnotationTypeOptionalMemberWriter(
-        AnnotationTypeWriter annotationTypeWriter) throws Exception;
+        AnnotationTypeWriter annotationTypeWriter);
 
     /**
      * Return the annotation type required member writer for a given annotation type.
@@ -153,7 +147,7 @@
      */
     public abstract AnnotationTypeRequiredMemberWriter
             getAnnotationTypeRequiredMemberWriter(
-        AnnotationTypeWriter annotationTypeWriter) throws Exception;
+        AnnotationTypeWriter annotationTypeWriter);
 
     /**
      * Return the enum constant writer for a given class.
@@ -163,7 +157,7 @@
      * writer is not supported by the doclet.
      */
     public abstract EnumConstantWriter getEnumConstantWriter(
-        ClassWriter classWriter) throws Exception;
+        ClassWriter classWriter);
 
     /**
      * Return the field writer for a given class.
@@ -172,8 +166,7 @@
      * @return the field writer for the give class.  Return null if this
      * writer is not supported by the doclet.
      */
-    public abstract FieldWriter getFieldWriter(ClassWriter classWriter)
-            throws Exception;
+    public abstract FieldWriter getFieldWriter(ClassWriter classWriter);
 
     /**
      * Return the property writer for a given class.
@@ -182,8 +175,7 @@
      * @return the property writer for the give class.  Return null if this
      * writer is not supported by the doclet.
      */
-    public abstract PropertyWriter getPropertyWriter(ClassWriter classWriter)
-            throws Exception;
+    public abstract PropertyWriter getPropertyWriter(ClassWriter classWriter);
 
     /**
      * Return the constructor writer for a given class.
@@ -193,8 +185,7 @@
      * writer is not supported by the doclet.
      */
     public abstract ConstructorWriter getConstructorWriter(
-        ClassWriter classWriter)
-    throws Exception;
+        ClassWriter classWriter);
 
     /**
      * Return the specified member summary writer for a given class.
@@ -206,11 +197,9 @@
      * writer is not supported by the doclet.
      *
      * @see VisibleMemberMap
-     * @throws IllegalArgumentException if memberType is unknown.
      */
     public abstract MemberSummaryWriter getMemberSummaryWriter(
-        ClassWriter classWriter, VisibleMemberMap.Kind memberType)
-    throws Exception;
+        ClassWriter classWriter, VisibleMemberMap.Kind memberType);
 
     /**
      * Return the specified member summary writer for a given annotation type.
@@ -223,16 +212,14 @@
      * writer is not supported by the doclet.
      *
      * @see VisibleMemberMap
-     * @throws IllegalArgumentException if memberType is unknown.
      */
     public abstract MemberSummaryWriter getMemberSummaryWriter(
-        AnnotationTypeWriter annotationTypeWriter, VisibleMemberMap.Kind memberType)
-    throws Exception;
+        AnnotationTypeWriter annotationTypeWriter, VisibleMemberMap.Kind memberType);
 
     /**
      * Return the writer for the serialized form.
      *
      * @return the writer for the serialized form.
      */
-    public SerializedFormWriter getSerializedFormWriter() throws Exception;
+    public SerializedFormWriter getSerializedFormWriter();
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractBuilder.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractBuilder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.toolkit.builders;
 
-import java.io.*;
 import java.lang.reflect.*;
 import java.util.*;
 
@@ -33,8 +32,11 @@
 
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.Messages;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
+import jdk.javadoc.internal.doclets.toolkit.Resources;
+import jdk.javadoc.internal.doclets.toolkit.util.InternalException;
+import jdk.javadoc.internal.doclets.toolkit.util.SimpleDocletException;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
 
 import static javax.tools.Diagnostic.Kind.*;
@@ -91,6 +93,7 @@
     protected final Configuration configuration;
 
     protected final Messages messages;
+    protected final Resources resources;
     protected final Utils utils;
 
     /**
@@ -109,12 +112,12 @@
 
     /**
      * Construct a Builder.
-     * @param configuration the configuration used in this run
-     *        of the doclet.
+     * @param c a context providing information used in this run of the doclet
      */
     public AbstractBuilder(Context c) {
         this.configuration = c.configuration;
         this.messages = configuration.getMessages();
+        this.resources = configuration.getResources();
         this.utils = configuration.utils;
         this.containingPackagesSeen = c.containingPackagesSeen;
         this.layoutParser = c.layoutParser;
@@ -130,39 +133,55 @@
     /**
      * Build the documentation.
      *
-     * @throws IOException there was a problem writing the output.
+     * @throws DocletException if there is a problem building the documentation
      */
-    public abstract void build() throws IOException;
+    public abstract void build() throws DocletException;
 
     /**
      * Build the documentation, as specified by the given XML element.
      *
      * @param node the XML element that specifies which component to document.
      * @param contentTree content tree to which the documentation will be added
+     * @throws DocletException if there is a problem building the documentation
      */
-    protected void build(XMLNode node, Content contentTree) {
+    protected void build(XMLNode node, Content contentTree) throws DocletException {
         String component = node.name;
         try {
-            invokeMethod("build" + component,
-                    new Class<?>[]{XMLNode.class, Content.class},
-                    new Object[]{node, contentTree});
+            String methodName = "build" + component;
+            if (DEBUG) {
+                configuration.reporter.print(ERROR,
+                        "DEBUG: " + getClass().getName() + "." + methodName);
+            }
+            Method method = getClass().getMethod(methodName, XMLNode.class, Content.class);
+            method.invoke(this, node, contentTree);
+
         } catch (NoSuchMethodException e) {
-            e.printStackTrace(System.err);
-            configuration.reporter.print(ERROR, "Unknown element: " + component);
-            throw new DocletAbortException(e);
+            // Use SimpleDocletException instead of InternalException because there is nothing
+            // informative about about the place the exception occurred, here in this method.
+            // The problem is either a misconfigured doclet.xml file or a missing method in the
+            // user-supplied(?) doclet
+            String message = resources.getText("doclet.builder.unknown.component", component);
+            throw new SimpleDocletException(message, e);
+
         } catch (InvocationTargetException e) {
             Throwable cause = e.getCause();
-            if (cause instanceof DocletAbortException) {
-                throw (DocletAbortException) cause;
+            if (cause instanceof DocletException) {
+                throw (DocletException) cause;
             } else {
-                throw new DocletAbortException(e.getCause());
+                // use InternalException, so that a stacktrace showing the position of
+                // the internal exception is generated
+                String message = resources.getText("doclet.builder.exception.in.component", component,
+                        e.getCause());
+                throw new InternalException(message, e.getCause());
             }
-        } catch (Exception e) {
-            e.printStackTrace(System.err);
-            configuration.reporter.print(ERROR, "Exception " +
-                    e.getClass().getName() +
-                    " thrown while processing element: " + component);
-            throw new DocletAbortException(e);
+
+        } catch (ReflectiveOperationException e) {
+            // Use SimpleDocletException instead of InternalException because there is nothing
+            // informative about about the place the exception occurred, here in this method.
+            // The problem is specific to the method being invoked, such as illegal access
+            // or illegal argument.
+            String message = resources.getText("doclet.builder.exception.in.component", component, e);
+            throw new SimpleDocletException(message, e.getCause());
         }
     }
 
@@ -171,29 +190,10 @@
      *
      * @param node the XML element that specifies which components to document.
      * @param contentTree content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the children
      */
-    protected void buildChildren(XMLNode node, Content contentTree) {
+    protected void buildChildren(XMLNode node, Content contentTree) throws DocletException {
         for (XMLNode child : node.children)
             build(child, contentTree);
     }
-
-    /**
-     * Given the name and parameters, invoke the method in the builder.  This
-     * method is required to invoke the appropriate build method as instructed
-     * by the builder XML file.
-     *
-     * @param methodName   the name of the method that we would like to invoke.
-     * @param paramClasses the types for each parameter.
-     * @param params       the parameters of the method.
-     */
-    protected void invokeMethod(String methodName, Class<?>[] paramClasses,
-            Object[] params)
-    throws Exception {
-        if (DEBUG) {
-            configuration.reporter.print(ERROR, "DEBUG: " +
-                    this.getClass().getName() + "." + methodName);
-        }
-        Method method = this.getClass().getMethod(methodName, paramClasses);
-        method.invoke(this, params);
-    }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractMemberBuilder.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractMemberBuilder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -26,7 +26,7 @@
 package jdk.javadoc.internal.doclets.toolkit.builders;
 
 import jdk.javadoc.internal.doclets.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
 
 /**
  * The superclass for all member builders.  Member builders are only executed
@@ -44,7 +44,7 @@
 
     /**
      * Construct a SubBuilder.
-     * @param configuration the configuration used in this run
+     * @param context a context object, providing information used in this run
      *        of the doclet.
      */
     public AbstractMemberBuilder(Context context) {
@@ -54,32 +54,33 @@
     /**
      * This method is not supported by sub-builders.
      *
-     * @throws DocletAbortException this method will always throw a
-     * DocletAbortException because it is not supported.
+     * @throws AssertionError always
      */
-    public void build() throws DocletAbortException {
-        //You may not call the build method in a subbuilder.
-        throw new DocletAbortException("not supported");
+    @Override
+    public void build() {
+        // You may not call the build method in a subbuilder.
+        throw new AssertionError();
     }
 
 
     /**
-     * Build the sub component if there is anything to document.
+     * Builds the sub component if there is anything to document.
      *
      * @param node the XML element that specifies which components to document.
      * @param contentTree content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
     @Override
-    public void build(XMLNode node, Content contentTree) {
+    public void build(XMLNode node, Content contentTree) throws DocletException {
         if (hasMembersToDocument()) {
             super.build(node, contentTree);
         }
     }
 
     /**
-     * Return true if this subbuilder has anything to document.
+     * Returns true if this subbuilder has anything to document.
      *
-     * @return true if this subbuilder has anything to document.
+     * @return true if this subbuilder has anything to document
      */
     public abstract boolean hasMembersToDocument();
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,13 +25,12 @@
 
 package jdk.javadoc.internal.doclets.toolkit.builders;
 
-import java.io.*;
-
 import javax.lang.model.element.PackageElement;
 import javax.lang.model.element.TypeElement;
 
 import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeWriter;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
 
 
 /**
@@ -83,54 +82,59 @@
     }
 
     /**
-     * Construct a new ClassBuilder.
+     * Construct a new AnnotationTypeBuilder.
      *
      * @param context           the build context.
      * @param annotationTypeDoc the class being documented.
      * @param writer            the doclet specific writer.
+     * @return                  an AnnotationTypeBuilder
      */
     public static AnnotationTypeBuilder getInstance(Context context,
             TypeElement annotationTypeDoc,
-            AnnotationTypeWriter writer)
-            throws Exception {
+            AnnotationTypeWriter writer) {
         return new AnnotationTypeBuilder(context, annotationTypeDoc, writer);
     }
 
     /**
      * {@inheritDoc}
      */
-    public void build() throws IOException {
+    @Override
+    public void build() throws DocletException {
         build(layoutParser.parseXML(ROOT), contentTree);
     }
 
     /**
      * {@inheritDoc}
      */
+    @Override
     public String getName() {
         return ROOT;
     }
 
     /**
-      * Build the annotation type documentation.
-      *
-      * @param node the XML element that specifies which components to document
-      * @param contentTree the content tree to which the documentation will be added
-      */
-     public void buildAnnotationTypeDoc(XMLNode node, Content contentTree) throws Exception {
-         contentTree = writer.getHeader(configuration.getText("doclet.AnnotationType") +
-                " " + utils.getSimpleName(annotationType));
-         Content annotationContentTree = writer.getAnnotationContentHeader();
-         buildChildren(node, annotationContentTree);
-         writer.addAnnotationContentTree(contentTree, annotationContentTree);
-         writer.addFooter(contentTree);
-         writer.printDocument(contentTree);
-         copyDocFiles();
-     }
+     * Build the annotation type documentation.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param contentTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem building the documentation
+     */
+    public void buildAnnotationTypeDoc(XMLNode node, Content contentTree) throws DocletException {
+        contentTree = writer.getHeader(configuration.getText("doclet.AnnotationType") +
+               " " + utils.getSimpleName(annotationType));
+        Content annotationContentTree = writer.getAnnotationContentHeader();
+        buildChildren(node, annotationContentTree);
+        writer.addAnnotationContentTree(contentTree, annotationContentTree);
+        writer.addFooter(contentTree);
+        writer.printDocument(contentTree);
+        copyDocFiles();
+    }
 
-     /**
-      * Copy the doc files for the current TypeElement if necessary.
-      */
-     private void copyDocFiles() {
+    /**
+     * Copy the doc files for the current TypeElement if necessary.
+     *
+     * @throws DocletException if there is a problem building the documentation
+     */
+    private void copyDocFiles() throws DocletException {
         PackageElement containingPackage = utils.containingPackage(annotationType);
         if((configuration.packages == null ||
             !configuration.packages.contains(containingPackage) &&
@@ -141,15 +145,17 @@
             utils.copyDocFiles(containingPackage);
             containingPackagesSeen.add(containingPackage);
         }
-     }
+    }
 
     /**
      * Build the annotation information tree documentation.
      *
      * @param node the XML element that specifies which components to document
      * @param annotationContentTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem building the documentation
      */
-    public void buildAnnotationTypeInfo(XMLNode node, Content annotationContentTree) {
+    public void buildAnnotationTypeInfo(XMLNode node, Content annotationContentTree)
+            throws DocletException {
         Content annotationInfoTree = writer.getAnnotationInfoTreeHeader();
         buildChildren(node, annotationInfoTree);
         annotationContentTree.addContent(writer.getAnnotationInfo(annotationInfoTree));
@@ -201,9 +207,9 @@
      *
      * @param node the XML element that specifies which components to document
      * @param annotationContentTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem building the documentation
      */
-    public void buildMemberSummary(XMLNode node, Content annotationContentTree)
-            throws Exception {
+    public void buildMemberSummary(XMLNode node, Content annotationContentTree) throws DocletException {
         Content memberSummaryTree = writer.getMemberTreeHeader();
         configuration.getBuilderFactory().
                 getMemberSummaryBuilder(writer).buildChildren(node, memberSummaryTree);
@@ -215,8 +221,10 @@
      *
      * @param node the XML element that specifies which components to document
      * @param annotationContentTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem building the documentation
      */
-    public void buildAnnotationTypeMemberDetails(XMLNode node, Content annotationContentTree) {
+    public void buildAnnotationTypeMemberDetails(XMLNode node, Content annotationContentTree)
+            throws DocletException {
         Content memberDetailsTree = writer.getMemberTreeHeader();
         buildChildren(node, memberDetailsTree);
         if (memberDetailsTree.isValid()) {
@@ -229,9 +237,10 @@
      *
      * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem building the documentation
      */
     public void buildAnnotationTypeFieldDetails(XMLNode node, Content memberDetailsTree)
-            throws Exception {
+            throws DocletException {
         configuration.getBuilderFactory().
                 getAnnotationTypeFieldsBuilder(writer).buildChildren(node, memberDetailsTree);
     }
@@ -241,9 +250,10 @@
      *
      * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem building the documentation
      */
     public void buildAnnotationTypeOptionalMemberDetails(XMLNode node, Content memberDetailsTree)
-            throws Exception {
+            throws DocletException {
         configuration.getBuilderFactory().
                 getAnnotationTypeOptionalMemberBuilder(writer).buildChildren(node, memberDetailsTree);
     }
@@ -253,9 +263,10 @@
      *
      * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem building the documentation
      */
     public void buildAnnotationTypeRequiredMemberDetails(XMLNode node, Content memberDetailsTree)
-            throws Exception {
+            throws DocletException {
         configuration.getBuilderFactory().
                 getAnnotationTypeRequiredMemberBuilder(writer).buildChildren(node, memberDetailsTree);
     }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeFieldBuilder.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeFieldBuilder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -33,6 +33,7 @@
 import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeFieldWriter;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
 
 
@@ -100,6 +101,7 @@
      * @param context  the build context.
      * @param typeElement the class whose members are being documented.
      * @param writer the doclet specific writer.
+     * @return the new AnnotationTypeFieldBuilder
      */
     public static AnnotationTypeFieldBuilder getInstance(
             Context context, TypeElement typeElement,
@@ -138,7 +140,8 @@
     }
 
     /**
-     * summaryOrder.size()
+     * Returns whether or not there are members to document.
+     * @return whether or not there are members to document
      */
     @Override
     public boolean hasMembersToDocument() {
@@ -150,8 +153,10 @@
      *
      * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildAnnotationTypeField(XMLNode node, Content memberDetailsTree) {
+    public void buildAnnotationTypeField(XMLNode node, Content memberDetailsTree)
+            throws DocletException {
         buildAnnotationTypeMember(node, memberDetailsTree);
     }
 
@@ -160,8 +165,10 @@
      *
      * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree) {
+    public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree)
+            throws DocletException {
         if (writer == null) {
             return;
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -30,6 +30,7 @@
 import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeOptionalMemberWriter;
 import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeRequiredMemberWriter;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
 
 
@@ -67,6 +68,7 @@
      * @param context  the build context.
      * @param typeElement the class whose members are being documented.
      * @param writer the doclet specific writer.
+     * @return the new AnnotationTypeMemberBuilder
      */
     public static AnnotationTypeOptionalMemberBuilder getInstance(
             Context context, TypeElement typeElement,
@@ -88,8 +90,10 @@
      *
      * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildAnnotationTypeOptionalMember(XMLNode node, Content memberDetailsTree) {
+    public void buildAnnotationTypeOptionalMember(XMLNode node, Content memberDetailsTree)
+                throws DocletException {
         buildAnnotationTypeMember(node, memberDetailsTree);
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -33,6 +33,7 @@
 import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeRequiredMemberWriter;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
 
 
@@ -139,7 +140,8 @@
     }
 
     /**
-     * summaryOrder.size()
+     * Returns whether or not there are members to document.
+     * @return whether or not there are members to document
      */
     @Override
     public boolean hasMembersToDocument() {
@@ -151,8 +153,10 @@
      *
      * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildAnnotationTypeRequiredMember(XMLNode node, Content memberDetailsTree) {
+    public void buildAnnotationTypeRequiredMember(XMLNode node, Content memberDetailsTree)
+            throws DocletException {
         buildAnnotationTypeMember(node, memberDetailsTree);
     }
 
@@ -162,7 +166,8 @@
      * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
      */
-    public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree) {
+    public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree)
+            throws DocletException {
         if (writer == null) {
             return;
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/BuilderFactory.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/BuilderFactory.java	Fri Aug 26 14:47:52 2016 -0700
@@ -83,7 +83,7 @@
      * Return the builder that builds the constant summary.
      * @return the builder that builds the constant summary.
      */
-    public AbstractBuilder getConstantsSummaryBuilder() throws Exception {
+    public AbstractBuilder getConstantsSummaryBuilder() {
         return ConstantsSummaryBuilder.getInstance(context,
             writerFactory.getConstantsSummaryWriter());
     }
@@ -97,7 +97,7 @@
      * @return the builder that builds the constant summary.
      */
     public AbstractBuilder getPackageSummaryBuilder(PackageElement pkg, PackageElement prevPkg,
-            PackageElement nextPkg) throws Exception {
+            PackageElement nextPkg) {
         return PackageSummaryBuilder.getInstance(context, pkg,
             writerFactory.getPackageSummaryWriter(pkg, prevPkg, nextPkg));
     }
@@ -111,7 +111,7 @@
      * @return the builder that builds the module summary.
      */
     public AbstractBuilder getModuleSummaryBuilder(ModuleElement mdle, ModuleElement prevModule,
-            ModuleElement nextModule) throws Exception {
+            ModuleElement nextModule) {
         return ModuleSummaryBuilder.getInstance(context, mdle,
             writerFactory.getModuleSummaryWriter(mdle, prevModule, nextModule));
     }
@@ -127,8 +127,7 @@
      * writer is not supported by the doclet.
      */
     public AbstractBuilder getClassBuilder(TypeElement typeElement,
-            TypeElement prevClass, TypeElement nextClass, ClassTree classTree)
-            throws Exception {
+            TypeElement prevClass, TypeElement nextClass, ClassTree classTree) {
         return ClassBuilder.getInstance(context, typeElement,
             writerFactory.getClassWriter(typeElement, prevClass, nextClass, classTree));
     }
@@ -143,8 +142,7 @@
      * writer is not supported by the doclet.
      */
     public AbstractBuilder getAnnotationTypeBuilder(
-        TypeElement annotationType, TypeMirror prevType, TypeMirror nextType)
-            throws Exception {
+        TypeElement annotationType, TypeMirror prevType, TypeMirror nextType) {
         return AnnotationTypeBuilder.getInstance(context, annotationType,
             writerFactory.getAnnotationTypeWriter(annotationType, prevType, nextType));
     }
@@ -154,8 +152,7 @@
      *
      * @return an instance of the method builder for the given class.
      */
-    public AbstractBuilder getMethodBuilder(ClassWriter classWriter)
-           throws Exception {
+    public AbstractBuilder getMethodBuilder(ClassWriter classWriter) {
         return MethodBuilder.getInstance(context, classWriter.getTypeElement(),
             writerFactory.getMethodWriter(classWriter));
     }
@@ -168,8 +165,7 @@
      *         annotation type.
      */
     public AbstractBuilder getAnnotationTypeFieldsBuilder(
-            AnnotationTypeWriter annotationTypeWriter)
-    throws Exception {
+            AnnotationTypeWriter annotationTypeWriter) {
         return AnnotationTypeFieldBuilder.getInstance(context,
                 annotationTypeWriter.getAnnotationTypeElement(),
                 writerFactory.getAnnotationTypeFieldWriter(annotationTypeWriter));
@@ -183,8 +179,7 @@
      *         annotation type.
      */
     public AbstractBuilder getAnnotationTypeOptionalMemberBuilder(
-            AnnotationTypeWriter annotationTypeWriter)
-    throws Exception {
+            AnnotationTypeWriter annotationTypeWriter) {
         return AnnotationTypeOptionalMemberBuilder.getInstance(context,
             annotationTypeWriter.getAnnotationTypeElement(),
             writerFactory.getAnnotationTypeOptionalMemberWriter(annotationTypeWriter));
@@ -198,8 +193,7 @@
      *         annotation type.
      */
     public AbstractBuilder getAnnotationTypeRequiredMemberBuilder(
-            AnnotationTypeWriter annotationTypeWriter)
-    throws Exception {
+            AnnotationTypeWriter annotationTypeWriter) {
         return AnnotationTypeRequiredMemberBuilder.getInstance(context,
             annotationTypeWriter.getAnnotationTypeElement(),
             writerFactory.getAnnotationTypeRequiredMemberWriter(annotationTypeWriter));
@@ -210,8 +204,7 @@
      *
      * @return an instance of the enum constants builder for the given class.
      */
-    public AbstractBuilder getEnumConstantsBuilder(ClassWriter classWriter)
-            throws Exception {
+    public AbstractBuilder getEnumConstantsBuilder(ClassWriter classWriter) {
         return EnumConstantBuilder.getInstance(context, classWriter.getTypeElement(),
                 writerFactory.getEnumConstantWriter(classWriter));
     }
@@ -221,7 +214,7 @@
      *
      * @return an instance of the field builder for the given class.
      */
-    public AbstractBuilder getFieldBuilder(ClassWriter classWriter) throws Exception {
+    public AbstractBuilder getFieldBuilder(ClassWriter classWriter) {
         return FieldBuilder.getInstance(context, classWriter.getTypeElement(),
             writerFactory.getFieldWriter(classWriter));
     }
@@ -231,7 +224,7 @@
      *
      * @return an instance of the field builder for the given class.
      */
-    public AbstractBuilder getPropertyBuilder(ClassWriter classWriter) throws Exception {
+    public AbstractBuilder getPropertyBuilder(ClassWriter classWriter) {
         final PropertyWriter propertyWriter =
                 writerFactory.getPropertyWriter(classWriter);
         return PropertyBuilder.getInstance(context,
@@ -244,8 +237,7 @@
      *
      * @return an instance of the constructor builder for the given class.
      */
-    public AbstractBuilder getConstructorBuilder(ClassWriter classWriter)
-            throws Exception {
+    public AbstractBuilder getConstructorBuilder(ClassWriter classWriter) {
         return ConstructorBuilder.getInstance(context, classWriter.getTypeElement(),
             writerFactory.getConstructorWriter(classWriter));
     }
@@ -255,8 +247,7 @@
      *
      * @return an instance of the member summary builder for the given class.
      */
-    public AbstractBuilder getMemberSummaryBuilder(ClassWriter classWriter)
-            throws Exception {
+    public AbstractBuilder getMemberSummaryBuilder(ClassWriter classWriter) {
         return MemberSummaryBuilder.getInstance(classWriter, context);
     }
 
@@ -267,9 +258,7 @@
      * @return an instance of the member summary builder for the given
      *         annotation type.
      */
-    public AbstractBuilder getMemberSummaryBuilder(
-            AnnotationTypeWriter annotationTypeWriter)
-    throws Exception {
+    public AbstractBuilder getMemberSummaryBuilder(AnnotationTypeWriter annotationTypeWriter) {
         return MemberSummaryBuilder.getInstance(annotationTypeWriter, context);
     }
 
@@ -278,8 +267,7 @@
      *
      * @return the builder that builds the serialized form.
      */
-    public AbstractBuilder getSerializedFormBuilder()
-            throws Exception {
+    public AbstractBuilder getSerializedFormBuilder() {
         return SerializedFormBuilder.getInstance(context);
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,13 +25,13 @@
 
 package jdk.javadoc.internal.doclets.toolkit.builders;
 
-import java.io.*;
-
 import javax.lang.model.element.PackageElement;
 import javax.lang.model.element.TypeElement;
 
 import jdk.javadoc.internal.doclets.toolkit.ClassWriter;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
 
 /**
@@ -105,11 +105,12 @@
     }
 
     /**
-     * Construct a new ClassBuilder.
+     * Constructs a new ClassBuilder.
      *
      * @param context  the build context
      * @param typeElement the class being documented.
      * @param writer the doclet specific writer.
+     * @return the new ClassBuilder
      */
     public static ClassBuilder getInstance(Context context,
             TypeElement typeElement, ClassWriter writer) {
@@ -119,13 +120,15 @@
     /**
      * {@inheritDoc}
      */
-    public void build() throws IOException {
+    @Override
+    public void build() throws DocletException {
         build(layoutParser.parseXML(ROOT), contentTree);
     }
 
     /**
      * {@inheritDoc}
      */
+    @Override
     public String getName() {
         return ROOT;
     }
@@ -135,8 +138,9 @@
       *
       * @param node the XML element that specifies which components to document
       * @param contentTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
       */
-     public void buildClassDoc(XMLNode node, Content contentTree) throws Exception {
+     public void buildClassDoc(XMLNode node, Content contentTree) throws DocletException {
          String key;
          if (isInterface) {
              key =  "doclet.Interface";
@@ -170,15 +174,16 @@
      *
      * @param node the XML element that specifies which components to document
      * @param classContentTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildClassInfo(XMLNode node, Content classContentTree) {
+    public void buildClassInfo(XMLNode node, Content classContentTree) throws DocletException {
         Content classInfoTree = writer.getClassInfoTreeHeader();
         buildChildren(node, classInfoTree);
         classContentTree.addContent(writer.getClassInfo(classInfoTree));
     }
 
     /**
-     * Build the typeparameters of this class.
+     * Build the type parameters of this class.
      *
      * @param node the XML element that specifies which components to document
      * @param classInfoTree the content tree to which the documentation will be added
@@ -269,8 +274,10 @@
 
     /**
      * Copy the doc files.
+     *
+     * @throws DocFileIOException if there is a problem while copying the files
      */
-     private void copyDocFiles() {
+     private void copyDocFiles() throws DocFileIOException {
         PackageElement containingPackage = utils.containingPackage(typeElement);
         if((configuration.packages == null ||
             !configuration.packages.contains(containingPackage)) &&
@@ -318,8 +325,9 @@
      *
      * @param node the XML element that specifies which components to document
      * @param classContentTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildMemberSummary(XMLNode node, Content classContentTree) throws Exception {
+    public void buildMemberSummary(XMLNode node, Content classContentTree) throws DocletException {
         Content memberSummaryTree = writer.getMemberTreeHeader();
         configuration.getBuilderFactory().
                 getMemberSummaryBuilder(writer).buildChildren(node, memberSummaryTree);
@@ -331,8 +339,9 @@
      *
      * @param node the XML element that specifies which components to document
      * @param classContentTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildMemberDetails(XMLNode node, Content classContentTree) {
+    public void buildMemberDetails(XMLNode node, Content classContentTree) throws DocletException {
         Content memberDetailsTree = writer.getMemberTreeHeader();
         buildChildren(node, memberDetailsTree);
         classContentTree.addContent(writer.getMemberDetailsTree(memberDetailsTree));
@@ -343,9 +352,10 @@
      *
      * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
     public void buildEnumConstantsDetails(XMLNode node,
-            Content memberDetailsTree) throws Exception {
+            Content memberDetailsTree) throws DocletException {
         configuration.getBuilderFactory().
                 getEnumConstantsBuilder(writer).buildChildren(node, memberDetailsTree);
     }
@@ -355,9 +365,10 @@
      *
      * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
     public void buildFieldDetails(XMLNode node,
-            Content memberDetailsTree) throws Exception {
+            Content memberDetailsTree) throws DocletException {
         configuration.getBuilderFactory().
                 getFieldBuilder(writer).buildChildren(node, memberDetailsTree);
     }
@@ -365,10 +376,12 @@
     /**
      * Build the property documentation.
      *
-     * @param elements the XML elements that specify how a field is documented.
+     * @param node the XML element that specifies which components to document
+     * @param memberDetailsTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
     public void buildPropertyDetails(XMLNode node,
-            Content memberDetailsTree) throws Exception {
+            Content memberDetailsTree) throws DocletException {
         configuration.getBuilderFactory().
                 getPropertyBuilder(writer).buildChildren(node, memberDetailsTree);
     }
@@ -378,9 +391,10 @@
      *
      * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
     public void buildConstructorDetails(XMLNode node,
-            Content memberDetailsTree) throws Exception {
+            Content memberDetailsTree) throws DocletException {
         configuration.getBuilderFactory().
                 getConstructorBuilder(writer).buildChildren(node, memberDetailsTree);
     }
@@ -390,9 +404,10 @@
      *
      * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
     public void buildMethodDetails(XMLNode node,
-            Content memberDetailsTree) throws Exception {
+            Content memberDetailsTree) throws DocletException {
         configuration.getBuilderFactory().
                 getMethodBuilder(writer).buildChildren(node, memberDetailsTree);
     }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.toolkit.builders;
 
-import java.io.*;
 import java.util.*;
 
 import javax.lang.model.element.Element;
@@ -35,6 +34,7 @@
 
 import jdk.javadoc.internal.doclets.toolkit.ConstantsSummaryWriter;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
 
 
@@ -116,6 +116,7 @@
      *
      * @param context       the build context.
      * @param writer        the writer for the summary.
+     * @return the new ConstantsSummaryBuilder
      */
     public static ConstantsSummaryBuilder getInstance(Context context,
             ConstantsSummaryWriter writer) {
@@ -124,9 +125,10 @@
 
     /**
      * {@inheritDoc}
+     * @throws DocletException if there is a problem while building the documentation
      */
     @Override
-    public void build() throws IOException {
+    public void build() throws DocletException {
         if (writer == null) {
             //Doclet does not support this output.
             return;
@@ -147,8 +149,9 @@
      *
      * @param node the XML element that specifies which components to document
      * @param contentTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildConstantSummary(XMLNode node, Content contentTree) throws Exception {
+    public void buildConstantSummary(XMLNode node, Content contentTree) throws DocletException {
         contentTree = writer.getHeader();
         buildChildren(node, contentTree);
         writer.addFooter(contentTree);
@@ -177,8 +180,9 @@
      *
      * @param node the XML element that specifies which components to document
      * @param contentTree the tree to which the summaries will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildConstantSummaries(XMLNode node, Content contentTree) {
+    public void buildConstantSummaries(XMLNode node, Content contentTree) throws DocletException {
         printedPackageHeaders.clear();
         Content summariesTree = writer.getConstantSummaries();
         for (PackageElement aPackage : configuration.packages) {
@@ -211,8 +215,11 @@
      *
      * @param node the XML element that specifies which components to document
      * @param summariesTree the tree to which the class constant summary will be added
+     * @throws DocletException if there is a problem while building the documentation
+     *
      */
-    public void buildClassConstantSummary(XMLNode node, Content summariesTree) {
+    public void buildClassConstantSummary(XMLNode node, Content summariesTree)
+            throws DocletException {
         SortedSet<TypeElement> classes = !currentPackage.isUnnamed()
                 ? utils.getAllClasses(currentPackage)
                 : configuration.typeElementCatalog.allUnnamedClasses();
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -34,6 +34,7 @@
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.ConstructorWriter;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
 
 
@@ -112,6 +113,7 @@
      * @param context  the build context.
      * @param typeElement the class whoses members are being documented.
      * @param writer the doclet specific writer.
+     * @return the new ConstructorBuilder
      */
     public static ConstructorBuilder getInstance(Context context,
             TypeElement typeElement, ConstructorWriter writer) {
@@ -139,6 +141,7 @@
      * This information can be used for doclet specific documentation
      * generation.
      *
+     * @param typeElement the class
      * @return a list of constructors that will be documented.
      */
     public SortedSet<Element> members(TypeElement typeElement) {
@@ -159,8 +162,9 @@
      *
      * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
+     * @throws DocletException is there is a problem while building the documentation
      */
-    public void buildConstructorDoc(XMLNode node, Content memberDetailsTree) {
+    public void buildConstructorDoc(XMLNode node, Content memberDetailsTree) throws DocletException {
         if (writer == null) {
             return;
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/EnumConstantBuilder.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/EnumConstantBuilder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -33,6 +33,7 @@
 
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.EnumConstantWriter;
 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
 
@@ -102,6 +103,7 @@
      * @param context  the build context.
      * @param typeElement the class whoses members are being documented.
      * @param writer the doclet specific writer.
+     * @return the new EnumConstantsBuilder
      */
     public static EnumConstantBuilder getInstance(Context context,
             TypeElement typeElement, EnumConstantWriter writer) {
@@ -138,7 +140,9 @@
     }
 
     /**
-     * summaryOrder.size()
+     * Returns whether or not there are members to document.
+     *
+     * @return whether or not there are members to document
      */
     @Override
     public boolean hasMembersToDocument() {
@@ -150,8 +154,9 @@
      *
      * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
+     * @throws DocletException is there is a problem while building the documentation
      */
-    public void buildEnumConstant(XMLNode node, Content memberDetailsTree) {
+    public void buildEnumConstant(XMLNode node, Content memberDetailsTree) throws DocletException {
         if (writer == null) {
             return;
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -33,6 +33,7 @@
 
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.FieldWriter;
 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
 
@@ -103,6 +104,7 @@
      * @param context  the build context.
      * @param typeElement the class whoses members are being documented.
      * @param writer the doclet specific writer.
+     * @return the new FieldBuilder
      */
     public static FieldBuilder getInstance(Context context,
             TypeElement typeElement,
@@ -140,7 +142,9 @@
     }
 
     /**
-     * summaryOrder.size()
+     * Returns whether or not there are members to document.
+     *
+     * @return whether or not there are members to document
      */
     @Override
     public boolean hasMembersToDocument() {
@@ -152,8 +156,9 @@
      *
      * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildFieldDoc(XMLNode node, Content memberDetailsTree) {
+    public void buildFieldDoc(XMLNode node, Content memberDetailsTree) throws DocletException {
         if (writer == null) {
             return;
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/LayoutParser.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/LayoutParser.java	Fri Aug 26 14:47:52 2016 -0700
@@ -31,7 +31,8 @@
 import javax.xml.parsers.*;
 
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
+import jdk.javadoc.internal.doclets.toolkit.util.SimpleDocletException;
 import org.xml.sax.*;
 import org.xml.sax.helpers.DefaultHandler;
 
@@ -53,7 +54,7 @@
     /**
      * The map of XML elements that have been parsed.
      */
-    private Map<String,XMLNode> xmlElementsMap;
+    private final Map<String,XMLNode> xmlElementsMap;
     private XMLNode currentNode;
     private final Configuration configuration;
     private String currentRoot;
@@ -77,33 +78,38 @@
     /**
      * Parse the XML specifying the layout of the documentation.
      *
+     * @param root the name of the desired node
      * @return the list of XML elements parsed.
+     * @throws DocFileIOException if there is a problem reading a user-supplied build file
+     * @throws SimpleDocletException if there is a problem reading the system build file
      */
-    public XMLNode parseXML(String root) {
-        if (xmlElementsMap.containsKey(root)) {
-            return xmlElementsMap.get(root);
+    public XMLNode parseXML(String root) throws DocFileIOException, SimpleDocletException {
+        if (!xmlElementsMap.containsKey(root)) {
+            try {
+                currentRoot = root;
+                isParsing = false;
+                SAXParserFactory factory = SAXParserFactory.newInstance();
+                SAXParser saxParser = factory.newSAXParser();
+                InputStream in = configuration.getBuilderXML();
+                saxParser.parse(in, this);
+            } catch (IOException | ParserConfigurationException | SAXException e) {
+                String message = (configuration.builderXMLPath == null)
+                        ? configuration.getResources().getText("doclet.exception.read.resource",
+                                Configuration.DEFAULT_BUILDER_XML, e)
+                        : configuration.getResources().getText("doclet.exception.read.file",
+                                configuration.builderXMLPath, e);
+                throw new SimpleDocletException(message, e);
+            }
         }
-        try {
-            currentRoot = root;
-            isParsing = false;
-            SAXParserFactory factory = SAXParserFactory.newInstance();
-            SAXParser saxParser = factory.newSAXParser();
-            InputStream in = configuration.getBuilderXML();
-            saxParser.parse(in, this);
-            return xmlElementsMap.get(root);
-        } catch (Throwable t) {
-            t.printStackTrace();
-            throw new DocletAbortException(t);
-        }
+        return xmlElementsMap.get(root);
     }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    public void startElement(String namespaceURI, String sName, String qName,
-        Attributes attrs)
-    throws SAXException {
+    public void startElement(String namespaceURI, String sName, String qName, Attributes attrs)
+            throws SAXException {
         if (isParsing || qName.equals(currentRoot)) {
             isParsing = true;
             currentNode = new XMLNode(currentNode, qName);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -42,7 +42,6 @@
 import jdk.javadoc.internal.doclets.toolkit.WriterFactory;
 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFinder;
-import jdk.javadoc.internal.doclets.toolkit.util.Utils;
 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
 import jdk.javadoc.internal.doclets.toolkit.CommentUtils;
 
@@ -107,8 +106,7 @@
      * @param context       the build context.
      */
     public static MemberSummaryBuilder getInstance(
-            ClassWriter classWriter, Context context)
-            throws Exception {
+            ClassWriter classWriter, Context context) {
         MemberSummaryBuilder builder = new MemberSummaryBuilder(context,
                 classWriter.getTypeElement());
         WriterFactory wf = context.configuration.getWriterFactory();
@@ -129,8 +127,7 @@
      * @param configuration the current configuration of the doclet.
      */
     public static MemberSummaryBuilder getInstance(
-            AnnotationTypeWriter annotationTypeWriter, Context context)
-            throws Exception {
+            AnnotationTypeWriter annotationTypeWriter, Context context) {
         MemberSummaryBuilder builder = new MemberSummaryBuilder(context,
                 annotationTypeWriter.getAnnotationTypeElement());
         WriterFactory wf = context.configuration.getWriterFactory();
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -35,6 +35,7 @@
 import jdk.javadoc.internal.doclets.formats.html.ConfigurationImpl;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.MethodWriter;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFinder;
 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
@@ -156,8 +157,9 @@
      *
      * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildMethodDoc(XMLNode node, Content memberDetailsTree) {
+    public void buildMethodDoc(XMLNode node, Content memberDetailsTree) throws DocletException {
         if (writer == null) {
             return;
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,14 +25,12 @@
 
 package jdk.javadoc.internal.doclets.toolkit.builders;
 
-import java.io.IOException;
-import java.util.Set;
-
 import javax.lang.model.element.ModuleElement;
 import javax.lang.model.element.PackageElement;
 import javax.tools.StandardLocation;
 
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.ModuleSummaryWriter;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 
@@ -105,8 +103,11 @@
 
     /**
      * Build the module summary.
+     *
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void build() throws IOException {
+    @Override
+    public void build() throws DocletException {
         if (moduleWriter == null) {
             //Doclet does not support this output.
             return;
@@ -117,6 +118,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public String getName() {
         return ROOT;
     }
@@ -126,17 +128,14 @@
      *
      * @param node the XML element that specifies which components to document
      * @param contentTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildModuleDoc(XMLNode node, Content contentTree) throws Exception {
+    public void buildModuleDoc(XMLNode node, Content contentTree) throws DocletException {
         contentTree = moduleWriter.getModuleHeader(mdle.getSimpleName().toString());
         buildChildren(node, contentTree);
         moduleWriter.addModuleFooter(contentTree);
         moduleWriter.printDocument(contentTree);
-        // TEMPORARY:
-        // The use of SOURCE_PATH on the next line is temporary. As we transition into the
-        // modules world, this should migrate into using a location for the appropriate module
-        // on the MODULE_SOURCE_PATH, or (in the old doclet) simply deleted.
-        utils.copyDocFiles(configuration, StandardLocation.SOURCE_PATH, DocPaths.moduleSummary(mdle));
+        utils.copyDirectory(mdle, DocPaths.moduleSummary(mdle));
     }
 
     /**
@@ -145,8 +144,9 @@
      * @param node the XML element that specifies which components to document
      * @param contentTree the content tree to which the module contents
      *                    will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildContent(XMLNode node, Content contentTree) {
+    public void buildContent(XMLNode node, Content contentTree) throws DocletException {
         Content moduleContentTree = moduleWriter.getContentHeader();
         buildChildren(node, moduleContentTree);
         moduleWriter.addModuleContent(contentTree, moduleContentTree);
@@ -158,8 +158,9 @@
      * @param node the XML element that specifies which components to document
      * @param moduleContentTree the module content tree to which the summaries will
      *                           be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildSummary(XMLNode node, Content moduleContentTree) {
+    public void buildSummary(XMLNode node, Content moduleContentTree) throws DocletException {
         Content summaryContentTree = moduleWriter.getSummaryHeader();
         buildChildren(node, summaryContentTree);
         moduleContentTree.addContent(moduleWriter.getSummaryTree(summaryContentTree));
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,8 +25,6 @@
 
 package jdk.javadoc.internal.doclets.toolkit.builders;
 
-import java.io.*;
-
 import java.util.Arrays;
 import java.util.List;
 import java.util.Set;
@@ -36,6 +34,7 @@
 import javax.lang.model.element.TypeElement;
 
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.PackageSummaryWriter;
 
 
@@ -104,8 +103,11 @@
 
     /**
      * Build the package summary.
+     *
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void build() throws IOException {
+    @Override
+    public void build() throws DocletException {
         if (packageWriter == null) {
             //Doclet does not support this output.
             return;
@@ -116,6 +118,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public String getName() {
         return ROOT;
     }
@@ -125,8 +128,9 @@
      *
      * @param node the XML element that specifies which components to document
      * @param contentTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildPackageDoc(XMLNode node, Content contentTree) throws Exception {
+    public void buildPackageDoc(XMLNode node, Content contentTree) throws DocletException {
         contentTree = packageWriter.getPackageHeader(utils.getPackageName(packageElement));
         buildChildren(node, contentTree);
         packageWriter.addPackageFooter(contentTree);
@@ -140,8 +144,9 @@
      * @param node the XML element that specifies which components to document
      * @param contentTree the content tree to which the package contents
      *                    will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildContent(XMLNode node, Content contentTree) {
+    public void buildContent(XMLNode node, Content contentTree) throws DocletException {
         Content packageContentTree = packageWriter.getContentHeader();
         buildChildren(node, packageContentTree);
         packageWriter.addPackageContent(contentTree, packageContentTree);
@@ -153,8 +158,9 @@
      * @param node the XML element that specifies which components to document
      * @param packageContentTree the package content tree to which the summaries will
      *                           be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildSummary(XMLNode node, Content packageContentTree) {
+    public void buildSummary(XMLNode node, Content packageContentTree) throws DocletException {
         Content summaryContentTree = packageWriter.getSummaryHeader();
         buildChildren(node, summaryContentTree);
         packageContentTree.addContent(summaryContentTree);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -33,6 +33,7 @@
 
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.PropertyWriter;
 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
 
@@ -103,6 +104,7 @@
      * @param context  the build context.
      * @param typeElement the class whoses members are being documented.
      * @param writer the doclet specific writer.
+     * @return the new PropertyBuilder
      */
     public static PropertyBuilder getInstance(Context context,
             TypeElement typeElement,
@@ -140,7 +142,9 @@
     }
 
     /**
-     * summaryOrder.size()
+     * Returns whether or not there are members to document.
+     *
+     * @return whether or not there are members to document
      */
     @Override
     public boolean hasMembersToDocument() {
@@ -152,8 +156,9 @@
      *
      * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildPropertyDoc(XMLNode node, Content memberDetailsTree) {
+    public void buildPropertyDoc(XMLNode node, Content memberDetailsTree) throws DocletException {
         if (writer == null) {
             return;
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.toolkit.builders;
 
-import java.io.*;
 import java.util.*;
 
 import javax.lang.model.element.Element;
@@ -37,9 +36,9 @@
 import com.sun.source.doctree.DocTree;
 import com.sun.source.doctree.SerialFieldTree;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.SerializedFormWriter;
 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
-import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
 
 /**
@@ -114,7 +113,9 @@
 
     /**
      * Construct a new SerializedFormBuilder.
+     *
      * @param context  the build context.
+     * @return the new SerializedFormBuilder
      */
     public static SerializedFormBuilder getInstance(Context context) {
         return new SerializedFormBuilder(context);
@@ -122,22 +123,21 @@
 
     /**
      * Build the serialized form.
+     *
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void build() throws IOException {
+    @Override
+    public void build() throws DocletException {
         SortedSet<TypeElement> rootclasses = new TreeSet<>(utils.makeGeneralPurposeComparator());
         rootclasses.addAll(configuration.docEnv.getIncludedTypeElements());
         if (!serialClassFoundToDocument(rootclasses)) {
             //Nothing to document.
             return;
         }
-        try {
-            writer = configuration.getWriterFactory().getSerializedFormWriter();
-            if (writer == null) {
-                //Doclet does not support this output.
-                return;
-            }
-        } catch (Exception e) {
-            throw new DocletAbortException(e);
+        writer = configuration.getWriterFactory().getSerializedFormWriter();
+        if (writer == null) {
+            //Doclet does not support this output.
+            return;
         }
         build(layoutParser.parseXML(NAME), contentTree);
     }
@@ -145,6 +145,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public String getName() {
         return NAME;
     }
@@ -154,8 +155,9 @@
      *
      * @param node the XML element that specifies which components to document
      * @param serializedTree content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildSerializedForm(XMLNode node, Content serializedTree) throws Exception {
+    public void buildSerializedForm(XMLNode node, Content serializedTree) throws DocletException {
         serializedTree = writer.getHeader(configuration.getText(
                 "doclet.Serialized_Form"));
         buildChildren(node, serializedTree);
@@ -168,8 +170,10 @@
      *
      * @param node the XML element that specifies which components to document
      * @param serializedTree content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildSerializedFormSummaries(XMLNode node, Content serializedTree) {
+    public void buildSerializedFormSummaries(XMLNode node, Content serializedTree)
+            throws DocletException {
         Content serializedSummariesTree = writer.getSerializedSummariesHeader();
         for (PackageElement pkg : configuration.packages) {
             currentPackage = pkg;
@@ -184,8 +188,9 @@
      *
      * @param node the XML element that specifies which components to document
      * @param serializedSummariesTree content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildPackageSerializedForm(XMLNode node, Content serializedSummariesTree) {
+    public void buildPackageSerializedForm(XMLNode node, Content serializedSummariesTree) throws DocletException {
         Content packageSerializedTree = writer.getPackageSerializedHeader();
         SortedSet<TypeElement> classes = utils.getAllClassesUnfiltered(currentPackage);
         if (classes.isEmpty()) {
@@ -217,8 +222,10 @@
      *
      * @param node the XML element that specifies which components to document
      * @param packageSerializedTree content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildClassSerializedForm(XMLNode node, Content packageSerializedTree) {
+    public void buildClassSerializedForm(XMLNode node, Content packageSerializedTree)
+            throws DocletException {
         Content classSerializedTree = writer.getClassSerializedHeader();
         SortedSet<TypeElement> typeElements = utils.getAllClassesUnfiltered(currentPackage);
         for (TypeElement typeElement : typeElements) {
@@ -262,8 +269,9 @@
      *
      * @param node the XML element that specifies which components to document
      * @param classTree content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildClassContent(XMLNode node, Content classTree) {
+    public void buildClassContent(XMLNode node, Content classTree) throws DocletException {
         Content classContentTree = writer.getClassContentHeader();
         buildChildren(node, classContentTree);
         classTree.addContent(classContentTree);
@@ -275,8 +283,9 @@
      *
      * @param node the XML element that specifies which components to document
      * @param classContentTree content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildSerializableMethods(XMLNode node, Content classContentTree) {
+    public void buildSerializableMethods(XMLNode node, Content classContentTree) throws DocletException {
         Content serializableMethodTree = methodWriter.getSerializableMethodsHeader();
         SortedSet<ExecutableElement> members = utils.serializationMethods(currentTypeElement);
         if (!members.isEmpty()) {
@@ -329,8 +338,9 @@
      *
      * @param node the XML element that specifies which components to document
      * @param methodsContentTree content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildMethodInfo(XMLNode node, Content methodsContentTree)  {
+    public void buildMethodInfo(XMLNode node, Content methodsContentTree) throws DocletException  {
         if(configuration.nocomment){
             return;
         }
@@ -411,8 +421,10 @@
      *
      * @param node the XML element that specifies which components to document
      * @param classContentTree content tree to which the documentation will be added
+     * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildSerializableFields(XMLNode node, Content classContentTree) {
+    public void buildSerializableFields(XMLNode node, Content classContentTree)
+            throws DocletException {
         SortedSet<VariableElement> members = utils.serializableFields(currentTypeElement);
         if (!members.isEmpty()) {
             Content serializableFieldsTree = fieldWriter.getSerializableFieldsHeader();
@@ -533,10 +545,12 @@
     }
 
     /**
-     * Return true if the given Element should be included
+     * Returns true if the given Element should be included
      * in the serialized form.
      *
-     * @param element the Element object to check for serializability.
+     * @param utils the utils object
+     * @param element the Element object to check for serializability
+     * @return true if the element should be included in the serial form
      */
     public static boolean serialInclude(Utils utils, Element element) {
         if (element == null) {
@@ -548,7 +562,7 @@
     }
 
     /**
-     * Return true if the given TypeElement should be included
+     * Returns true if the given TypeElement should be included
      * in the serialized form.
      *
      * @param te the TypeElement object to check for serializability.
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties	Fri Aug 26 14:47:52 2016 -0700
@@ -14,17 +14,29 @@
 doclet.Option_doclint_no_qualifiers=Access qualifiers not permitted for -Xdoclint arguments
 doclet.Option_doclint_invalid_arg=Invalid argument for -Xdoclint option
 doclet.Option_doclint_package_invalid_arg=Invalid argument for -Xdoclint/package option
-doclet.exception_encountered= {0} encountered \n\
-\twhile attempting to create file: {1}
-doclet.perform_copy_exception_encountered= {0} encountered while \n\
-performing copy.
+doclet.builder.exception.in.component=An exception occurred while building a component: {0}\n\
+\t({1})
+doclet.builder.unknown.component=Unknown component referenced in doclet build file: {0}
+doclet.error.initializing.dest.dir=Error initializing destination directory: {0}
+doclet.exception.read.file=Error reading file: {0}\n\
+\t({1})
+doclet.exception.write.file=Error writing file: {0}\n\
+\t({1})
+doclet.exception.read.resource=Error reading system resource: {0}\n\
+\t({1})
+doclet.internal.exception=An internal exception has occurred. \n\
+\t({0})
+doclet.internal.report.bug=\
+Please file a bug against the javadoc tool via the Java bug reporting page\n\
+(http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com)\n\
+for duplicates. Include error messages and the following diagnostic in your report. Thank you.
 doclet.File_not_found=File not found: {0}
 doclet.Copy_Overwrite_warning=File {0} not copied to {1} due to existing file with same name...
 doclet.Copying_File_0_To_Dir_1=Copying file {0} to directory {1}...
 doclet.Copying_File_0_To_File_1=Copying file {0} to file {1}...
 doclet.No_Public_Classes_To_Document=No public or protected classes found to document.
-doclet.destination_directory_not_directory_0=Destination directory is not a directory {0}
-doclet.destination_directory_not_writable_0=Destination directory not writable {0}
+doclet.destination_directory_not_directory_0=Destination directory is not a directory: {0}
+doclet.destination_directory_not_writable_0=Destination directory not writable: {0}
 doclet.Encoding_not_supported=Encoding not supported: {0}
 doclet.Building_Tree=Building tree for all the packages and classes...
 doclet.Building_Index=Building index for all the packages and classes...
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java	Fri Aug 26 14:47:52 2016 -0700
@@ -39,8 +39,6 @@
 import javax.tools.StandardJavaFileManager;
 
 import com.sun.source.doctree.DocTree;
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.Resources;
@@ -377,7 +375,7 @@
                     return;
                 }
                 new SimpleElementVisitor9<Void, Void>() {
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     public Void visitModule(ModuleElement e, Void p) {
                         if (!taglet.inModule()) {
                             printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "module");
@@ -385,7 +383,7 @@
                         return null;
                     }
 
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     public Void visitPackage(PackageElement e, Void p) {
                         if (!taglet.inPackage()) {
                             printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "package");
@@ -393,7 +391,7 @@
                         return null;
                     }
 
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     public Void visitType(TypeElement e, Void p) {
                         if (!taglet.inType()) {
                             printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "class");
@@ -401,7 +399,7 @@
                         return null;
                     }
 
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     public Void visitExecutable(ExecutableElement e, Void p) {
                         if (utils.isConstructor(e) && !taglet.inConstructor()) {
                             printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "constructor");
@@ -411,7 +409,7 @@
                         return null;
                     }
 
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     public Void visitVariable(VariableElement e, Void p) {
                         if (utils.isField(e) && !taglet.inField()) {
                             printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "field");
@@ -419,7 +417,7 @@
                         return null;
                     }
 
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     public Void visitUnknown(Element e, Void p) {
                         if (utils.isOverviewElement(e) && !taglet.inOverview()) {
                             printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "overview");
@@ -427,7 +425,7 @@
                         return null;
                     }
 
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     protected Void defaultAction(Element e, Void p) {
                         return null;
                     }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java	Fri Aug 26 14:47:52 2016 -0700
@@ -44,8 +44,6 @@
 import javax.lang.model.util.SimpleTypeVisitor9;
 import javax.lang.model.util.Types;
 
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
 import jdk.javadoc.doclet.DocletEnvironment;
 import jdk.javadoc.internal.doclets.formats.html.ConfigurationImpl;
 
@@ -219,17 +217,17 @@
                 mapTypeParameters(classToFieldTypeParam, fd, fd);
                 mapAnnotations(annotationToField, fd, fd);
                 SimpleTypeVisitor9<Void, VariableElement> stv = new SimpleTypeVisitor9<Void, VariableElement>() {
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     public Void visitArray(ArrayType t, VariableElement p) {
                         return visit(t.getComponentType(), p);
                     }
 
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     public Void visitDeclared(DeclaredType t, VariableElement p) {
                         add(classToField, (TypeElement) t.asElement(), p);
                         return null;
                     }
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     public Void visitTypeVariable(TypeVariable t, VariableElement p) {
                         return visit(typeUtils.erasure(t), p);
                     }
@@ -249,7 +247,7 @@
                 mapTypeParameters(classToMethodTypeParam, method, method);
                 mapAnnotations(classToMethodAnnotations, method, method);
                 SimpleTypeVisitor9<Void, ExecutableElement> stv = new SimpleTypeVisitor9<Void, ExecutableElement>() {
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     public Void visitArray(ArrayType t, ExecutableElement p) {
                         TypeMirror componentType = t.getComponentType();
                         return visit(utils.isTypeVariable(componentType)
@@ -257,14 +255,14 @@
                                 : componentType, p);
                     }
 
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     public Void visitDeclared(DeclaredType t, ExecutableElement p) {
                         mapTypeParameters(classToMethodReturnTypeParam, t, p);
                         add(classToMethodReturn, (TypeElement) t.asElement(), p);
                         return null;
                     }
 
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     protected Void defaultAction(TypeMirror e, ExecutableElement p) {
                         return null;
                     }
@@ -349,12 +347,12 @@
                 // no duplicates please
                 if (classArgs.add(pType)) {
                     new SimpleTypeVisitor9<Void, ExecutableElement>() {
-                        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                        @Override
                         public Void visitArray(ArrayType t, ExecutableElement p) {
                             return visit(t.getComponentType(), p);
                         }
 
-                        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                        @Override
                         public Void visitDeclared(DeclaredType t, ExecutableElement p) {
                             add(isConstructor
                                     ? classToConstructorArgs
@@ -362,7 +360,7 @@
                                     (TypeElement) t.asElement(), p);
                             return null;
                         }
-                        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                        @Override
                         public Void visitTypeVariable(TypeVariable t, ExecutableElement p) {
                             visit(typeUtils.erasure(t), p);
                             return null;
@@ -383,27 +381,27 @@
         for (TypeMirror anException : ee.getThrownTypes()) {
             SimpleTypeVisitor9<Void, ExecutableElement> stv = new SimpleTypeVisitor9<Void, ExecutableElement>() {
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public Void visitArray(ArrayType t, ExecutableElement p) {
                     super.visit(t.getComponentType(), p);
                     return null;
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public Void visitDeclared(DeclaredType t, ExecutableElement p) {
                     add(isConstructor ? classToConstructorThrows : classToMethodThrows,
                             (TypeElement) t.asElement(), p);
                     return null;
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public Void visitError(ErrorType t, ExecutableElement p) {
                     add(isConstructor ? classToConstructorThrows : classToMethodThrows,
                             (TypeElement) t.asElement(), p);
                     return null;
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 protected Void defaultAction(TypeMirror e, ExecutableElement p) {
                     throw new AssertionError("this should not happen");
                 }
@@ -488,7 +486,7 @@
                         }
                     }
 
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     public Void visitType(TypeElement e, Void p) {
                         for (TypeParameterElement param : e.getTypeParameters()) {
                             addParameters(param);
@@ -496,7 +494,7 @@
                         return null;
                     }
 
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     public Void visitExecutable(ExecutableElement e, Void p) {
                         for (TypeParameterElement param : e.getTypeParameters()) {
                             addParameters(param);
@@ -504,13 +502,13 @@
                         return null;
                     }
 
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     protected Void defaultAction(Element e, Void p) {
                         mapTypeParameters(map, e.asType(), holder);
                         return null;
                     }
 
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                    @Override
                     public Void visitTypeParameter(TypeParameterElement e, Void p) {
                         addParameters(e);
                         return null;
@@ -524,7 +522,7 @@
 
         SimpleTypeVisitor9<Void, Void> tv = new SimpleTypeVisitor9<Void, Void>() {
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public Void visitWildcard(WildcardType t, Void p) {
                 TypeMirror bound = t.getExtendsBound();
                 if (bound != null) {
@@ -538,7 +536,7 @@
             }
 
             // ParameterizedType
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public Void visitDeclared(DeclaredType t, Void p) {
                 for (TypeMirror targ : t.getTypeArguments()) {
                     addTypeParameterToMap(map, targ, holder);
@@ -566,7 +564,7 @@
                 }
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public Void visitPackage(PackageElement e, Void p) {
                 for (AnnotationMirror a : e.getAnnotationMirrors()) {
                     refList(map, a.getAnnotationType().asElement()).add(holder);
@@ -574,7 +572,7 @@
                 return null;
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             protected Void defaultAction(Element e, Void p) {
                 addAnnotations(e);
                 return null;
@@ -586,12 +584,12 @@
             TypeMirror type, final T holder) {
         new SimpleTypeVisitor9<Void, Void>() {
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             protected Void defaultAction(TypeMirror e, Void p) {
                 return super.defaultAction(e, p);
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public Void visitDeclared(DeclaredType t, Void p) {
                 add(map, (TypeElement) t.asElement(), holder);
                 return null;
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/CommentHelper.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/CommentHelper.java	Fri Aug 26 14:47:52 2016 -0700
@@ -67,8 +67,6 @@
 import com.sun.source.util.DocTrees;
 import com.sun.source.util.SimpleDocTreeVisitor;
 import com.sun.source.util.TreePath;
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 
 import static com.sun.source.doctree.DocTree.Kind.*;
@@ -204,7 +202,7 @@
     private StringBuilder getText0(DocTree dt) {
         final StringBuilder sb = new StringBuilder();
         new SimpleDocTreeVisitor<Void, Void>() {
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public Void visitAttribute(AttributeTree node, Void p) {
                 sb.append(SPACER).append(node.getName());
                 if (node.getValueKind() == ValueKind.EMPTY) {
@@ -232,7 +230,7 @@
                 return null;
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public Void visitEndElement(EndElementTree node, Void p) {
                 sb.append("</")
                         .append(node.getName())
@@ -240,13 +238,13 @@
                 return null;
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public Void visitEntity(EntityTree node, Void p) {
                 sb.append(node.toString());
                 return null;
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public Void visitLink(LinkTree node, Void p) {
                 if (node.getReference() == null) {
                     return null;
@@ -259,7 +257,7 @@
                 return null;
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public Void visitLiteral(LiteralTree node, Void p) {
                 if (node.getKind() == CODE) {
                     sb.append("<").append(node.getKind().tagName).append(">");
@@ -271,13 +269,13 @@
                 return null;
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public Void visitReference(ReferenceTree node, Void p) {
                 sb.append(node.getSignature());
                 return null;
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public Void visitSee(SeeTree node, Void p) {
                 node.getReference().stream().forEach((dt) -> {
                     dt.accept(this, null);
@@ -285,7 +283,7 @@
                 return null;
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public Void visitSerial(SerialTree node, Void p) {
                 node.getDescription().stream().forEach((dt) -> {
                     dt.accept(this, null);
@@ -293,7 +291,7 @@
                 return null;
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public Void visitStartElement(StartElementTree node, Void p) {
                 sb.append("<");
                 sb.append(node.getName());
@@ -304,13 +302,13 @@
                 return null;
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public Void visitText(TextTree node, Void p) {
                 sb.append(node.getBody());
                 return null;
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public Void visitUnknownBlockTag(UnknownBlockTagTree node, Void p) {
                 node.getContent().stream().forEach((dt) -> {
                     dt.accept(this, null);
@@ -318,12 +316,12 @@
                 return null;
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public Void visitValue(ValueTree node, Void p) {
                 return node.getReference().accept(this, null);
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             protected Void defaultAction(DocTree node, Void p) {
                 sb.append(node.toString());
                 return null;
@@ -334,7 +332,7 @@
 
     public String getLabel(Configuration c, DocTree dtree) {
         return new SimpleDocTreeVisitor<String, Void>() {
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public String visitLink(LinkTree node, Void p) {
                 StringBuilder sb = new StringBuilder();
                 node.getLabel().stream().forEach((dt) -> {
@@ -343,7 +341,7 @@
                 return sb.toString();
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public String visitSee(SeeTree node, Void p) {
                 StringBuilder sb = new StringBuilder();
                 node.getReference().stream().filter((dt) -> (c.utils.isText(dt))).forEach((dt) -> {
@@ -352,7 +350,7 @@
                 return sb.toString();
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             protected String defaultAction(DocTree node, Void p) {
                 return "";
             }
@@ -429,7 +427,7 @@
 
     private Element getReferencedElement(Configuration c, DocTree dtree) {
         return new SimpleDocTreeVisitor<Element, Void>() {
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public Element visitSee(SeeTree node, Void p) {
                 for (DocTree dt : node.getReference()) {
                     return visit(dt, null);
@@ -437,27 +435,27 @@
                 return null;
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public Element visitLink(LinkTree node, Void p) {
                 return visit(node.getReference(), null);
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public Element visitValue(ValueTree node, Void p) {
                 return visit(node.getReference(), null);
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public Element visitReference(ReferenceTree node, Void p) {
                 return getElement(c, node);
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public Element visitSerialField(SerialFieldTree node, Void p) {
                 return visit(node.getType(), null);
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             protected Element defaultAction(DocTree node, Void p) {
                return null;
             }
@@ -466,7 +464,7 @@
 
     public  String getReferencedSignature(DocTree dtree) {
         return new SimpleDocTreeVisitor<String, Void>() {
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public String visitSee(SeeTree node, Void p) {
                 for (DocTree dt : node.getReference()) {
                     return visit(dt, null);
@@ -474,27 +472,27 @@
                 return null;
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public String visitLink(LinkTree node, Void p) {
                 return visit(node.getReference(), null);
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public String visitValue(ValueTree node, Void p) {
                 return visit(node.getReference(), null);
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public String visitReference(ReferenceTree node, Void p) {
                 return node.getSignature();
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public String visitSerialField(SerialFieldTree node, Void p) {
                 return visit(node.getType(), null);
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             protected String defaultAction(DocTree node, Void p) {
                return null;
             }
@@ -530,87 +528,87 @@
                 return out;
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public List<? extends DocTree> visitAuthor(AuthorTree node, Void p) {
                 return node.getName();
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public List<? extends DocTree> visitComment(CommentTree node, Void p) {
                 return asList(node.getBody());
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public List<? extends DocTree> visitDeprecated(DeprecatedTree node, Void p) {
                 return node.getBody();
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public List<? extends DocTree> visitDocComment(DocCommentTree node, Void p) {
                 return node.getBody();
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public List<? extends DocTree> visitLiteral(LiteralTree node, Void p) {
                 return asList(node.getBody().getBody());
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public List<? extends DocTree> visitSince(SinceTree node, Void p) {
                 return node.getBody();
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public List<? extends DocTree> visitText(TextTree node, Void p) {
                 return asList(node.getBody());
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public List<? extends DocTree> visitVersion(VersionTree node, Void p) {
                 return node.getBody();
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public List<? extends DocTree> visitParam(ParamTree node, Void p) {
                return node.getDescription();
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public List<? extends DocTree> visitReturn(ReturnTree node, Void p) {
                 return node.getDescription();
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public List<? extends DocTree> visitSee(SeeTree node, Void p) {
                 return node.getReference();
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public List<? extends DocTree> visitSerial(SerialTree node, Void p) {
                 return node.getDescription();
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public List<? extends DocTree> visitSerialData(SerialDataTree node, Void p) {
                 return node.getDescription();
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public List<? extends DocTree> visitSerialField(SerialFieldTree node, Void p) {
                 return node.getDescription();
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public List<? extends DocTree> visitThrows(ThrowsTree node, Void p) {
                  return node.getDescription();
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public List<? extends DocTree> visitUnknownBlockTag(UnknownBlockTagTree node, Void p) {
                 return node.getContent();
             }
 
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             protected List<? extends DocTree> defaultAction(DocTree node, Void p) {
                return Collections.emptyList();
             }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFile.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFile.java	Fri Aug 26 14:47:52 2016 -0700
@@ -26,13 +26,10 @@
 package jdk.javadoc.internal.doclets.toolkit.util;
 
 import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
-import java.io.OutputStreamWriter;
 import java.io.UnsupportedEncodingException;
 import java.io.Writer;
 
@@ -68,8 +65,6 @@
         return DocFileFactory.getFactory(configuration).createFileForOutput(path);
     }
 
-    private final Configuration configuration;
-
     /**
      * The location for this file. Maybe null if the file was created without
      * a location or path.
@@ -95,63 +90,85 @@
     }
 
     /** Create a DocFile without a location or path */
-    protected DocFile(Configuration configuration) {
-        this.configuration = configuration;
+    protected DocFile() {
         this.location = null;
         this.path = null;
     }
 
     /** Create a DocFile for a given location and relative path. */
-    protected DocFile(Configuration configuration, Location location, DocPath path) {
-        this.configuration = configuration;
+    protected DocFile(Location location, DocPath path) {
         this.location = location;
         this.path = path;
     }
 
-    /** Open an input stream for the file. */
-    public abstract InputStream openInputStream() throws IOException;
+    /**
+     * Open an input stream for the file.
+     *
+     * @return an open input stream for the file
+     * @throws DocFileIOException if there is a problem opening the stream
+     */
+    public abstract InputStream openInputStream() throws DocFileIOException;
 
     /**
      * Open an output stream for the file.
      * The file must have been created with a location of
      * {@link DocumentationTool.Location#DOCUMENTATION_OUTPUT}
      * and a corresponding relative path.
+     *
+     * @return an open output stream for the file
+     * @throws DocFileIOException if there is a problem opening the stream
+     * @throws UnsupportedEncodingException if the configured encoding is not supported
      */
-    public abstract OutputStream openOutputStream() throws IOException, UnsupportedEncodingException;
+    public abstract OutputStream openOutputStream() throws DocFileIOException, UnsupportedEncodingException;
 
     /**
      * Open an writer for the file, using the encoding (if any) given in the
      * doclet configuration.
      * The file must have been created with a location of
      * {@link DocumentationTool.Location#DOCUMENTATION_OUTPUT} and a corresponding relative path.
+     *
+     * @return an open output stream for the file
+     * @throws DocFileIOException if there is a problem opening the stream
+     * @throws UnsupportedEncodingException if the configured encoding is not supported
      */
-    public abstract Writer openWriter() throws IOException, UnsupportedEncodingException;
+    public abstract Writer openWriter() throws DocFileIOException, UnsupportedEncodingException;
 
     /**
      * Copy the contents of another file directly to this file.
+     *
+     * @param fromFile the file to be copied
+     * @throws DocFileIOException if there is a problem file copying the file
      */
-    public void copyFile(DocFile fromFile) throws IOException {
-        try (OutputStream output = openOutputStream();
-             InputStream input = fromFile.openInputStream()) {
-            byte[] bytearr = new byte[1024];
-            int len;
-            while ((len = input.read(bytearr)) != -1) {
-                output.write(bytearr, 0, len);
+    public void copyFile(DocFile fromFile) throws DocFileIOException {
+        try (OutputStream output = openOutputStream()) {
+            try (InputStream input = fromFile.openInputStream()) {
+                byte[] bytearr = new byte[1024];
+                int len;
+                while ((len = read(fromFile, input, bytearr)) != -1) {
+                    write(this, output, bytearr, len);
+                }
+            } catch (IOException e) {
+                throw new DocFileIOException(fromFile, DocFileIOException.Mode.READ, e);
             }
-        }
-        catch (FileNotFoundException | SecurityException exc) {
+        } catch (IOException e) {
+            throw new DocFileIOException(this, DocFileIOException.Mode.WRITE, e);
         }
     }
 
     /**
      * Copy the contents of a resource file to this file.
+     *
      * @param resource the path of the resource, relative to the package of this class
      * @param overwrite whether or not to overwrite the file if it already exists
      * @param replaceNewLine if false, the file is copied as a binary file;
      *     if true, the file is written line by line, using the platform line
      *     separator
+     *
+     * @throws DocFileIOException if there is a problem while writing the copy
+     * @throws ResourceIOException if there is a problem while reading the resource
      */
-    public void copyResource(DocPath resource, boolean overwrite, boolean replaceNewLine) {
+    public void copyResource(DocPath resource, boolean overwrite, boolean replaceNewLine)
+                throws DocFileIOException, ResourceIOException {
         if (exists() && !overwrite)
             return;
 
@@ -160,30 +177,35 @@
             if (in == null)
                 return;
 
-            try (OutputStream out = openOutputStream()) {
-                if (!replaceNewLine) {
-                    byte[] buf = new byte[2048];
-                    int n;
-                    while ((n = in.read(buf)) > 0)
-                        out.write(buf, 0, n);
+            try {
+                if (replaceNewLine) {
+                    try (BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
+                        try (Writer writer = openWriter()) {
+                            String line;
+                            while ((line = readResourceLine(resource, reader)) != null) {
+                                write(this, writer, line);
+                                write(this, writer, DocletConstants.NL);
+                            }
+                        } catch (IOException e) {
+                            throw new DocFileIOException(this, DocFileIOException.Mode.WRITE, e);
+                        }
+                    }
                 } else {
-                    try (BufferedReader reader = new BufferedReader(new InputStreamReader(in));
-                         BufferedWriter writer = new BufferedWriter(configuration.docencoding == null
-                                                                    ? new OutputStreamWriter(out)
-                                                                    : new OutputStreamWriter(out, configuration.docencoding))) {
-                        String line;
-                        while ((line = reader.readLine()) != null) {
-                            writer.write(line);
-                            writer.write(DocletConstants.NL);
+                    try (OutputStream out = openOutputStream()) {
+                        byte[] buf = new byte[2048];
+                        int n;
+                        while ((n = readResource(resource, in, buf)) > 0) {
+                            write(this, out, buf, n);
                         }
+                    } catch (IOException e) {
+                        throw new DocFileIOException(this, DocFileIOException.Mode.WRITE, e);
                     }
                 }
             } finally {
                 in.close();
             }
         } catch (IOException e) {
-            e.printStackTrace(System.err);
-            throw new DocletAbortException(e);
+            throw new ResourceIOException(resource, e);
         }
     }
 
@@ -214,8 +236,12 @@
     /** Return true if this file is the same as another. */
     public abstract boolean isSameFile(DocFile other);
 
-    /** If the file is a directory, list its contents. */
-    public abstract Iterable<DocFile> list() throws IOException;
+    /** If the file is a directory, list its contents.
+     *
+     * @return the contents of the directory
+     * @throws DocFileIOException if there is a problem while listing the directory
+     */
+    public abstract Iterable<DocFile> list() throws DocFileIOException;
 
     /** Create the file as a directory, including any parent directories. */
     public abstract boolean mkdirs();
@@ -242,4 +268,92 @@
      * {@link DocumentationTool.Location#DOCUMENTATION_OUTPUT} is supported.
      */
     public abstract DocFile resolveAgainst(Location locn);
+
+
+    /**
+     * Reads from an input stream opened from a given file into a given buffer.
+     * If an IOException occurs, it is wrapped in a DocFileIOException.
+     *
+     * @param inFile the file for the stream
+     * @param input the stream
+     * @param buf the buffer
+     * @return the number of bytes read, or -1 if at end of file
+     * @throws DocFileIOException if an exception occurred while reading the stream
+     */
+    private static int read(DocFile inFile, InputStream input, byte[] buf) throws DocFileIOException {
+        try {
+            return input.read(buf);
+        } catch (IOException e) {
+            throw new DocFileIOException(inFile, DocFileIOException.Mode.READ, e);
+        }
+    }
+
+    /**
+     * Writes to an output stream for a given file from a given buffer.
+     * If an IOException occurs, it is wrapped in a DocFileIOException.
+     *
+     * @param outFile the file for the stream
+     * @param out the stream
+     * @param buf the buffer
+     * @throws DocFileIOException if an exception occurred while writing the stream
+     */
+    private static void write(DocFile outFile, OutputStream out, byte[] buf, int len) throws DocFileIOException {
+        try {
+            out.write(buf, 0, len);
+        } catch (IOException e) {
+            throw new DocFileIOException(outFile, DocFileIOException.Mode.WRITE, e);
+        }
+    }
+
+    /**
+     * Writes text to an output stream for a given file from a given buffer.
+     * If an IOException occurs, it is wrapped in a DocFileIOException.
+     *
+     * @param outFile the file for the stream
+     * @param out the stream
+     * @param text the text to be written
+     * @throws DocFileIOException if an exception occurred while writing the stream
+     */
+    private static void write(DocFile outFile, Writer out, String text) throws DocFileIOException {
+        try {
+            out.write(text);
+        } catch (IOException e) {
+            throw new DocFileIOException(outFile, DocFileIOException.Mode.WRITE, e);
+        }
+    }
+
+    /**
+     * Reads from an input stream opened from a given resource into a given buffer.
+     * If an IOException occurs, it is wrapped in a ResourceIOException.
+     *
+     * @param resource the resource for the stream
+     * @param in the stream
+     * @param buf the buffer
+     * @return the number of bytes read, or -1 if at end of file
+     * @throws ResourceIOException if an exception occurred while reading the stream
+     */
+    private static int readResource(DocPath resource, InputStream in, byte[] buf) throws ResourceIOException {
+        try {
+            return in.read(buf);
+        } catch (IOException e) {
+            throw new ResourceIOException(resource, e);
+        }
+    }
+
+    /**
+     * Reads a line of characters from an input stream opened from a given resource.
+     * If an IOException occurs, it is wrapped in a ResourceIOException.
+     *
+     * @param resource the resource for the stream
+     * @param in the stream
+     * @return the line of text, or {@code null} if at end of stream
+     * @throws ResourceIOException if an exception occurred while reading the stream
+     */
+    private static String readResourceLine(DocPath docPath, BufferedReader in) throws ResourceIOException {
+        try {
+            return in.readLine();
+        } catch (IOException e) {
+            throw new ResourceIOException(docPath, e);
+        }
+    }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFileFactory.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFileFactory.java	Fri Aug 26 14:47:52 2016 -0700
@@ -31,6 +31,7 @@
 import javax.tools.StandardLocation;
 
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
 
 /**
  * Factory for DocFile objects.
@@ -45,8 +46,11 @@
     /**
      * Get the appropriate factory, based on the file manager given in the
      * configuration.
+     *
+     * @param configuration the configuration for this doclet
+     * @return the factory associated with this configuration
      */
-    static synchronized DocFileFactory getFactory(Configuration configuration) {
+    public static synchronized DocFileFactory getFactory(Configuration configuration) {
         DocFileFactory f = configuration.docFileFactory;
         if (f == null) {
             JavaFileManager fm = configuration.getFileManager();
@@ -66,6 +70,8 @@
         this.configuration = configuration;
     }
 
+    public abstract void setDestDir(String dir) throws DocletException;
+
     /** Create a DocFile for a directory. */
     abstract DocFile createFileForDirectory(String file);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFileIOException.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.toolkit.util;
+
+import java.io.IOException;
+
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
+
+
+/**
+ * Wraps an IOException and the filename to which it applies.
+ *
+ * <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>
+ *
+ * @apiNote This exception should be thrown by a doclet when an IO exception occurs
+ *  and the file is known that was in use when the exception occurred.
+ */
+public class DocFileIOException extends DocletException {
+    /**
+     * A hint for the type of operation being performed when the exception occurred.
+     *
+     * @apiNote This may be used as a hint when reporting a message to the end user.
+     */
+    public enum Mode {
+        /** The file was being opened for reading, or being read when the exception occurred. */
+        READ,
+        /** The file was being opened for writing, or being written when the exception occurred. */
+        WRITE
+    };
+
+    /**
+     * The file that was in use when the exception occurred.
+     */
+    public final DocFile fileName;
+
+    /**
+     * The mode in which the file was being used when the exception occurred.
+     */
+    public final Mode mode;
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Creates an exception to wrap an IO exception, the file which caused it, and the manner
+     * in which the file was being used.
+     *
+     * @param fileName the file in use when the exception occurred
+     * @param mode the manner in which the file was being used
+     * @param cause the underlying exception
+     */
+    public DocFileIOException(DocFile fileName, Mode mode, IOException cause) {
+        super(mode + ":" + fileName.getPath(), cause);
+        this.fileName = fileName;
+        this.mode = mode;
+    }
+}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocletAbortException.java	Thu Aug 25 02:10:03 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.javadoc.internal.doclets.toolkit.util;
-
-/**
- *  <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 DocletAbortException extends RuntimeException {
-    private static final long serialVersionUID = -9131058909576418984L;
-
-    public DocletAbortException(String message) {
-        super(message);
-    }
-
-    public DocletAbortException(Throwable cause) {
-        super(cause);
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java	Fri Aug 26 14:47:52 2016 -0700
@@ -117,6 +117,7 @@
         /**
          * String representation of "this" with packagename and the path.
          */
+        @Override
         public String toString() {
             return packageName + (relative? " -> " : " => ") + path;
         }
@@ -130,6 +131,7 @@
      * Determine if a element item is externally documented.
      *
      * @param element an Element.
+     * @return true if the element is externally documented
      */
     public boolean isExternal(Element element) {
         if (packageToItemMap == null) {
@@ -176,8 +178,11 @@
      *                   file.
      * @param reporter   The <code>DocErrorReporter</code> used to report errors.
      * @param linkoffline True if -linkoffline is used and false if -link is used.
+     * @return true if successful, false otherwise
+     * @throws DocFileIOException if there is a problem reading a package list file
      */
-    public boolean link(String url, String pkglisturl, Reporter reporter, boolean linkoffline) {
+    public boolean link(String url, String pkglisturl, Reporter reporter, boolean linkoffline)
+                throws DocFileIOException {
         this.linkoffline = linkoffline;
         try {
             url = adjustEndFileSeparator(url);
@@ -251,9 +256,11 @@
      *
      * @param path URL or directory path to the packages.
      * @param pkgListPath Path to the local "package-list" file.
+     * @throws Fault if an error occurs that can be treated as a warning
+     * @throws DocFileIOException if there is a problem opening the package list file
      */
     private void readPackageListFromFile(String path, DocFile pkgListPath)
-            throws Fault {
+            throws Fault, DocFileIOException {
         DocFile file = pkgListPath.resolve(DocPaths.PACKAGE_LIST);
         if (! (file.isAbsolute() || linkoffline)){
             file = file.resolveAgainst(DocumentationTool.Location.DOCUMENTATION_OUTPUT);
@@ -279,35 +286,33 @@
      * @param input    InputStream from the "package-list" file.
      * @param path     URL or the directory path to the packages.
      * @param relative Is path relative?
+     * @throws IOException if there is a problem reading or closing the stream
      */
     private void readPackageList(InputStream input, String path, boolean relative)
                          throws IOException {
-        BufferedReader in = new BufferedReader(new InputStreamReader(input));
-        StringBuilder strbuf = new StringBuilder();
-        try {
+        try (BufferedReader in = new BufferedReader(new InputStreamReader(input))) {
+            StringBuilder strbuf = new StringBuilder();
             int c;
             while ((c = in.read()) >= 0) {
-                char ch = (char)c;
+                char ch = (char) c;
                 if (ch == '\n' || ch == '\r') {
                     if (strbuf.length() > 0) {
                         String packname = strbuf.toString();
-                        String packpath = path +
-                                      packname.replace('.', '/') + '/';
-                        new Item(packname, packpath, relative);
+                        String packpath = path
+                                + packname.replace('.', '/') + '/';
+                        Item ignore = new Item(packname, packpath, relative);
                         strbuf.setLength(0);
                     }
                 } else {
                     strbuf.append(ch);
                 }
             }
-        } finally {
-            input.close();
         }
     }
 
     public boolean isUrl (String urlCandidate) {
         try {
-            new URL(urlCandidate);
+            URL ignore = new URL(urlCandidate);
             //No exception was thrown, so this must really be a URL.
             return true;
         } catch (MalformedURLException e) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/InternalException.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.toolkit.util;
+
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
+
+
+/**
+ * An exception with a user-friendly detail message for an unexpected/internal exception.
+ *
+ * <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 InternalException extends DocletException {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Creates an exception with a user-friendly detail message, and underlying cause.
+     * A stacktrace for the cause may be presented to the user.
+     *
+     * @param message a localized detail message, suitable for direct presentation to the end user
+     * @param cause the underlying cause for the exception
+     */
+    public InternalException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/PackageListWriter.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/PackageListWriter.java	Fri Aug 26 14:47:52 2016 -0700
@@ -26,13 +26,11 @@
 package jdk.javadoc.internal.doclets.toolkit.util;
 
 import java.io.*;
-import java.util.*;
 
 import javax.lang.model.element.PackageElement;
 
 import jdk.javadoc.doclet.DocletEnvironment;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
-import jdk.javadoc.internal.doclets.toolkit.Messages;
 
 
 /**
@@ -45,18 +43,19 @@
  *
  * @author Atul M Dambalkar
  */
-public class PackageListWriter extends PrintWriter {
+public class PackageListWriter {
 
     private final Configuration configuration;
     private final Utils utils;
+    private final DocFile file;
 
     /**
      * Constructor.
      *
      * @param configuration the current configuration of the doclet.
      */
-    public PackageListWriter(Configuration configuration) throws IOException {
-        super(DocFile.createFileForOutput(configuration, DocPaths.PACKAGE_LIST).openWriter());
+    public PackageListWriter(Configuration configuration) {
+        file = DocFile.createFileForOutput(configuration, DocPaths.PACKAGE_LIST);
         this.configuration = configuration;
         this.utils = configuration.utils;
     }
@@ -65,32 +64,25 @@
      * Generate the package index.
      *
      * @param configuration the current configuration of the doclet.
-     * @throws DocletAbortException
+     * @throws DocFileIOException if there is a problem writing the output
      */
-    public static void generate(Configuration configuration) {
-        PackageListWriter packgen;
-        try {
-            packgen = new PackageListWriter(configuration);
-            packgen.generatePackageListFile(configuration.docEnv);
-            packgen.close();
-        } catch (IOException exc) {
-            Messages messages = configuration.getMessages();
-            messages.error("doclet.exception_encountered",
-                exc.toString(), DocPaths.PACKAGE_LIST);
-            throw new DocletAbortException(exc);
+    public static void generate(Configuration configuration) throws DocFileIOException {
+        PackageListWriter packgen = new PackageListWriter(configuration);
+        packgen.generatePackageListFile(configuration.docEnv);
+    }
+
+    protected void generatePackageListFile(DocletEnvironment docEnv) throws DocFileIOException {
+        try (BufferedWriter out = new BufferedWriter(file.openWriter())) {
+            for (PackageElement 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 && utils.isDeprecated(pkg))) {
+                    out.write(pkg.toString());
+                    out.newLine();
+                }
+            }
+        } catch (IOException e) {
+            throw new DocFileIOException(file, DocFileIOException.Mode.WRITE, e);
         }
     }
-
-    protected void generatePackageListFile(DocletEnvironment docEnv) {
-        ArrayList<PackageElement> names = new ArrayList<>();
-        for (PackageElement 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 && utils.isDeprecated(pkg)))
-                names.add(pkg);
-        }
-        names.stream().forEach((name) -> {
-            println(name);
-        });
-    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ResourceIOException.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.toolkit.util;
+
+import java.io.IOException;
+
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
+
+
+/**
+ * Wraps an IOException and the path for the resource to which it applies.
+ *
+ * <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>
+ *
+ * @apiNote This exception should be thrown by a doclet when an IO exception occurs
+ *  and the file is known that was in use when the exception occurred.
+ */
+public class ResourceIOException extends DocletException {
+
+    /**
+     * The resource that was in use when the exception occurred.
+     */
+    public final DocPath resource;
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Creates an exception to wrap an IO exception, the resource which caused it.
+     *
+     * @param resource the resource in use when the exception occurred
+     * @param cause the underlying exception
+     */
+    public ResourceIOException(DocPath resource, IOException cause) {
+        super(resource.getPath(), cause);
+        this.resource = resource;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/SimpleDocletException.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.toolkit.util;
+
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
+
+
+/**
+ * An exception with a user-friendly detail message.
+ *
+ * <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 SimpleDocletException extends DocletException {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Creates an exception with a user-friendly detail message.
+     *
+     * @param message a localized detail message, suitable for direct presentation to the end user
+     */
+    public SimpleDocletException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates an exception with a user-friendly detail message, and underlying cause.
+     * The cause may be used for debugging but in normal use, should not be presented to the user.
+     *
+     * @param message a localized detail message, suitable for direct presentation to the end user
+     * @param cause the underlying cause for the exception
+     */
+    public SimpleDocletException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/StandardDocFileFactory.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/StandardDocFileFactory.java	Fri Aug 26 14:47:52 2016 -0700
@@ -42,6 +42,7 @@
 import java.util.Arrays;
 import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Objects;
 import java.util.Set;
 
 import javax.tools.DocumentationTool;
@@ -72,32 +73,43 @@
         fileManager = (StandardJavaFileManager) configuration.getFileManager();
     }
 
+    @Override
+    public void setDestDir(String destDirName) throws SimpleDocletException {
+        if (destDir != null)
+            throw new AssertionError("destDir already initialized: " + destDir);
+
+        if (!destDirName.isEmpty()
+                || !fileManager.hasLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT)) {
+            try {
+                String dirName = destDirName.isEmpty() ? "." : destDirName;
+                Path dir = Paths.get(dirName);
+                fileManager.setLocationFromPaths(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(dir));
+            } catch (IOException e) {
+                // generic IOException from file manager, setting location, e.g. file not a directory
+                String message = configuration.getResources().getText("doclet.error.initializing.dest.dir", e);
+                throw new SimpleDocletException(message, e);
+            }
+        }
+
+        destDir = fileManager.getLocationAsPaths(DocumentationTool.Location.DOCUMENTATION_OUTPUT).iterator().next();
+    }
+
     private Path getDestDir() {
-        if (destDir == null) {
-            if (!configuration.destDirName.isEmpty()
-                    || !fileManager.hasLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT)) {
-                try {
-                    String dirName = configuration.destDirName.isEmpty() ? "." : configuration.destDirName;
-                    Path dir = Paths.get(dirName);
-                    fileManager.setLocationFromPaths(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(dir));
-                } catch (IOException e) {
-                    throw new DocletAbortException(e);
-                }
-            }
-
-            destDir = fileManager.getLocationAsPaths(DocumentationTool.Location.DOCUMENTATION_OUTPUT).iterator().next();
-        }
+        Objects.requireNonNull(destDir, "destDir not initialized");
         return destDir;
     }
 
+    @Override
     public DocFile createFileForDirectory(String file) {
         return new StandardDocFile(Paths.get(file));
     }
 
+    @Override
     public DocFile createFileForInput(String file) {
         return new StandardDocFile(Paths.get(file));
     }
 
+    @Override
     public DocFile createFileForOutput(DocPath path) {
         return new StandardDocFile(DocumentationTool.Location.DOCUMENTATION_OUTPUT, path);
     }
@@ -125,38 +137,53 @@
     }
 
     class StandardDocFile extends DocFile {
-        private Path file;
+        private final Path file;
 
         /** Create a StandardDocFile for a given file. */
         private StandardDocFile(Path file) {
-            super(configuration);
             this.file = file;
         }
 
         /** Create a StandardDocFile for a given location and relative path. */
         private StandardDocFile(Location location, DocPath path) {
-            super(configuration, location, path);
+            super(location, path);
             Assert.check(location == DocumentationTool.Location.DOCUMENTATION_OUTPUT);
             this.file = newFile(getDestDir(), path.getPath());
         }
 
-        /** Open an input stream for the file. */
-        public InputStream openInputStream() throws IOException {
-            JavaFileObject fo = getJavaFileObjectForInput(file);
-            return new BufferedInputStream(fo.openInputStream());
+        /**
+         * Open an input stream for the file.
+         *
+         * @throws DocFileIOException if there is a problem while opening stream
+         */
+        @Override
+        public InputStream openInputStream() throws DocFileIOException {
+            try {
+                JavaFileObject fo = getJavaFileObjectForInput(file);
+                return new BufferedInputStream(fo.openInputStream());
+            } catch (IOException e) {
+                throw new DocFileIOException(this, DocFileIOException.Mode.READ, e);
+            }
         }
 
         /**
          * Open an output stream for the file.
          * The file must have been created with a location of
          * {@link DocumentationTool.Location#DOCUMENTATION_OUTPUT} and a corresponding relative path.
+         *
+         * @throws DocFileIOException if there is a problem while opening stream
          */
-        public OutputStream openOutputStream() throws IOException, UnsupportedEncodingException {
+        @Override
+        public OutputStream openOutputStream() throws DocFileIOException {
             if (location != DocumentationTool.Location.DOCUMENTATION_OUTPUT)
                 throw new IllegalStateException();
 
-            OutputStream out = getFileObjectForOutput(path).openOutputStream();
-            return new BufferedOutputStream(out);
+            try {
+                OutputStream out = getFileObjectForOutput(path).openOutputStream();
+                return new BufferedOutputStream(out);
+            } catch (IOException e) {
+                throw new DocFileIOException(this, DocFileIOException.Mode.WRITE, e);
+            }
         }
 
         /**
@@ -164,60 +191,77 @@
          * doclet configuration.
          * The file must have been created with a location of
          * {@link DocumentationTool.Location#DOCUMENTATION_OUTPUT} and a corresponding relative path.
+         *
+         * @throws DocFileIOException if there is a problem while opening stream
+         * @throws UnsupportedEncodingException if the configured encoding is not supported
          */
-        public Writer openWriter() throws IOException, UnsupportedEncodingException {
+        @Override
+        public Writer openWriter() throws DocFileIOException, UnsupportedEncodingException {
             if (location != DocumentationTool.Location.DOCUMENTATION_OUTPUT)
                 throw new IllegalStateException();
 
-            OutputStream out = getFileObjectForOutput(path).openOutputStream();
-            if (configuration.docencoding == null) {
-                return new BufferedWriter(new OutputStreamWriter(out));
-            } else {
-                return new BufferedWriter(new OutputStreamWriter(out, configuration.docencoding));
+            try {
+                OutputStream out = getFileObjectForOutput(path).openOutputStream();
+                if (configuration.docencoding == null) {
+                    return new BufferedWriter(new OutputStreamWriter(out));
+                } else {
+                    return new BufferedWriter(new OutputStreamWriter(out, configuration.docencoding));
+                }
+            } catch (IOException e) {
+                throw new DocFileIOException(this, DocFileIOException.Mode.WRITE, e);
             }
         }
 
         /** Return true if the file can be read. */
+        @Override
         public boolean canRead() {
             return Files.isReadable(file);
         }
 
         /** Return true if the file can be written. */
+        @Override
         public boolean canWrite() {
             return Files.isWritable(file);
         }
 
         /** Return true if the file exists. */
+        @Override
         public boolean exists() {
             return Files.exists(file);
         }
 
         /** Return the base name (last component) of the file name. */
+        @Override
         public String getName() {
             return file.getFileName().toString();
         }
 
         /** Return the file system path for this file. */
+        @Override
         public String getPath() {
             return file.toString();
         }
 
         /** Return true is file has an absolute path name. */
+        @Override
         public boolean isAbsolute() {
             return file.isAbsolute();
         }
 
         /** Return true is file identifies a directory. */
+        @Override
         public boolean isDirectory() {
             return Files.isDirectory(file);
         }
 
         /** Return true is file identifies a file. */
+        @Override
         public boolean isFile() {
             return Files.isRegularFile(file);
         }
 
         /** Return true if this file is the same as another. */
+        @Override
         public boolean isSameFile(DocFile other) {
             if (!(other instanceof StandardDocFile))
                 return false;
@@ -230,17 +274,21 @@
         }
 
         /** If the file is a directory, list its contents. */
-        public Iterable<DocFile> list() throws IOException {
-            List<DocFile> files = new ArrayList<DocFile>();
+        @Override
+        public Iterable<DocFile> list() throws DocFileIOException {
+            List<DocFile> files = new ArrayList<>();
             try (DirectoryStream<Path> ds = Files.newDirectoryStream(file)) {
                 for (Path f: ds) {
                     files.add(new StandardDocFile(f));
                 }
+            } catch (IOException e) {
+                throw new DocFileIOException(this, DocFileIOException.Mode.READ, e);
             }
             return files;
         }
 
         /** Create the file as a directory, including any parent directories. */
+        @Override
         public boolean mkdirs() {
             try {
                 Files.createDirectories(file);
@@ -256,6 +304,7 @@
          * If this file has a path set, the new file will have a corresponding
          * new path.
          */
+        @Override
         public DocFile resolve(DocPath p) {
             return resolve(p.getPath());
         }
@@ -266,6 +315,7 @@
          * If this file has a path set, the new file will have a corresponding
          * new path.
          */
+        @Override
         public DocFile resolve(String p) {
             if (location == null && path == null) {
                 return new StandardDocFile(file.resolve(p));
@@ -279,6 +329,7 @@
          * @param locn Currently, only
          * {@link DocumentationTool.Location.DOCUMENTATION_OUTPUT} is supported.
          */
+        @Override
         public DocFile resolveAgainst(Location locn) {
             if (locn != DocumentationTool.Location.DOCUMENTATION_OUTPUT)
                 throw new IllegalArgumentException();
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java	Fri Aug 26 14:47:52 2016 -0700
@@ -25,7 +25,7 @@
 
 package jdk.javadoc.internal.doclets.toolkit.util;
 
-import java.io.*;
+import java.io.IOException;
 import java.lang.annotation.Documented;
 import java.lang.ref.SoftReference;
 import java.text.CollationKey;
@@ -61,6 +61,7 @@
 import javax.lang.model.util.TypeKindVisitor9;
 import javax.lang.model.util.Types;
 import javax.tools.FileObject;
+import javax.tools.JavaFileManager;
 import javax.tools.JavaFileManager.Location;
 import javax.tools.StandardLocation;
 
@@ -74,10 +75,11 @@
 import com.sun.source.util.DocSourcePositions;
 import com.sun.source.util.DocTrees;
 import com.sun.source.util.TreePath;
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
 import jdk.javadoc.internal.doclets.toolkit.CommentUtils.DocCommentDuo;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
+import jdk.javadoc.internal.doclets.toolkit.DocletException;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
+import jdk.javadoc.internal.doclets.toolkit.Resources;
 import jdk.javadoc.internal.doclets.toolkit.WorkArounds;
 
 import static javax.lang.model.element.ElementKind.*;
@@ -85,9 +87,6 @@
 import static javax.lang.model.type.TypeKind.*;
 
 import static com.sun.source.doctree.DocTree.Kind.*;
-
-import jdk.javadoc.internal.doclets.toolkit.Messages;
-
 import static jdk.javadoc.internal.doclets.toolkit.builders.ConstantsSummaryBuilder.MAX_CONSTANT_VALUE_INDEX_LENGTH;
 
 
@@ -268,57 +267,110 @@
     }
 
     /**
+     * Copy doc-files directory and its contents from the source
+     * package directory to the generated documentation directory.
+     * For example, given a package java.lang, this method will copy
+     * the doc-files directory, found in the package directory to the
+     * generated documentation hierarchy.
+     *
+     * @param pe the package containing the doc files to be copied
+     * @throws DocFileIOException if there is a problem while copying
+     *         the documentation files
+     */
+    public void copyDocFiles(PackageElement pe) throws DocFileIOException {
+        Location sourceLoc = getLocationForPackage(pe);
+        copyDirectory(sourceLoc, DocPath.forPackage(pe).resolve(DocPaths.DOC_FILES));
+    }
+
+    /**
      * 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
+     * to the generated documentation directory. For example, given a package
+     * java.lang, this method will copy the entire directory, to the generated
      * documentation hierarchy.
-     * @param pe
+     *
+     * @param pe the package containing the directory to be copied
+     * @param dir the directory to be copied
+     * @throws DocFileIOException if there is a problem while copying
+     *         the documentation files
      */
-    public void copyDocFiles(PackageElement pe) {
-        copyDocFiles(DocPath.forPackage(pe).resolve(DocPaths.DOC_FILES));
+    public void copyDirectory(PackageElement pe, DocPath dir) throws DocFileIOException {
+        copyDirectory(getLocationForPackage(pe), dir);
     }
 
-    public void copyDocFiles(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) {
-                            messages.warning("doclet.Copy_Overwrite_warning",
-                                    srcfile.getPath(), destdir.getPath());
-                        } else {
-                            messages.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(dir.resolve(srcfile.getName()));
-                        }
+    /**
+     * Copy the given directory and its contents from the source
+     * module directory to the generated documentation directory.
+     * For example, given a package java.lang, this method will
+     * copy the entire directory, to the generated documentation
+     * hierarchy.
+     *
+     * @param mdle the module containing the directory to be copied
+     * @param dir the directory to be copied
+     * @throws DocFileIOException if there is a problem while copying
+     *         the documentation files
+     */
+    public void copyDirectory(ModuleElement mdle, DocPath dir) throws DocFileIOException  {
+        copyDirectory(getLocationForModule(mdle), dir);
+    }
+
+    /**
+     * Copy files from a doc path location to the output.
+     *
+     * @param locn the location from which to read files
+     * @param dir the directory to be copied
+     * @throws DocFileIOException if there is a problem
+     *         copying the files
+     */
+    public void copyDirectory(Location locn, DocPath dir)  throws DocFileIOException {
+        boolean first = true;
+        for (DocFile f : DocFile.list(configuration, locn, 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) {
+                        messages.warning("doclet.Copy_Overwrite_warning",
+                                srcfile.getPath(), destdir.getPath());
+                    } else {
+                        messages.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())) {
+                        copyDirectory(locn, dir.resolve(srcfile.getName()));
                     }
                 }
-
-                first = false;
             }
-        } catch (SecurityException | IOException exc) {
-            throw new DocletAbortException(exc);
+
+            first = false;
         }
     }
 
+    protected Location getLocationForPackage(PackageElement pd) {
+        return getLocationForModule(configuration.docEnv.getElementUtils().getModuleOf(pd));
+    }
+
+    protected Location getLocationForModule(ModuleElement mdle) {
+        Location loc = configuration.workArounds.getLocationForModule(mdle);
+        if (loc != null)
+            return loc;
+
+        JavaFileManager fm = configuration.docEnv.getJavaFileManager();
+        return fm.hasLocation(StandardLocation.SOURCE_PATH)
+                ? StandardLocation.SOURCE_PATH
+                : StandardLocation.CLASS_PATH;
+    }
+
     public boolean isAnnotated(TypeMirror e) {
         return !e.getAnnotationMirrors().isEmpty();
     }
@@ -329,17 +381,17 @@
 
     public boolean isAnnotationType(Element e) {
         return new SimpleElementVisitor9<Boolean, Void>() {
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public Boolean visitExecutable(ExecutableElement e, Void p) {
                 return visit(e.getEnclosingElement());
             }
 
-            @Override  @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public Boolean visitUnknown(Element e, Void p) {
                 return false;
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             protected Boolean defaultAction(Element e, Void p) {
                 return e.getKind() == ANNOTATION_TYPE;
             }
@@ -499,34 +551,34 @@
                 }
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public String visitTypeAsInterface(TypeElement e, SortedSet<Modifier> p) {
                 addVisibilityModifier(p);
                 addStatic(p);
                 return finalString("interface");
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public String visitTypeAsEnum(TypeElement e, SortedSet<Modifier> p) {
                 addVisibilityModifier(p);
                 addStatic(p);
                 return finalString("enum");
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public String visitTypeAsAnnotationType(TypeElement e, SortedSet<Modifier> p) {
                 addVisibilityModifier(p);
                 addStatic(p);
                 return finalString("@interface");
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public String visitTypeAsClass(TypeElement e, SortedSet<Modifier> p) {
                 addModifers(p);
                 return finalString("class");
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             protected String defaultAction(Element e, SortedSet<Modifier> p) {
                 addModifers(p);
                 return sb.toString().trim();
@@ -572,19 +624,19 @@
     public boolean isPrimitive(TypeMirror t) {
         return new SimpleTypeVisitor9<Boolean, Void>() {
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public Boolean visitNoType(NoType t, Void p) {
                 return t.getKind() == VOID;
             }
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public Boolean visitPrimitive(PrimitiveType t, Void p) {
                 return true;
             }
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public Boolean visitArray(ArrayType t, Void p) {
                 return visit(t.getComponentType());
             }
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             protected Boolean defaultAction(TypeMirror e, Void p) {
                 return false;
             }
@@ -672,7 +724,7 @@
         return new SimpleTypeVisitor9<StringBuilder, Void>() {
             final StringBuilder sb = new StringBuilder();
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public StringBuilder visitArray(ArrayType t, Void p) {
                 TypeMirror componentType = t.getComponentType();
                 visit(componentType);
@@ -680,7 +732,7 @@
                 return sb;
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public StringBuilder visitDeclared(DeclaredType t, Void p) {
                 Element e = t.asElement();
                 sb.append(qualifiedName ? getFullyQualifiedName(e) : getSimpleName(e));
@@ -701,14 +753,14 @@
                 return sb;
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public StringBuilder visitTypeVariable(javax.lang.model.type.TypeVariable t, Void p) {
                 Element e = t.asElement();
                 sb.append(qualifiedName ? getFullyQualifiedName(e, false) : getSimpleName(e));
                 return sb;
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public StringBuilder visitWildcard(javax.lang.model.type.WildcardType t, Void p) {
                 sb.append("?");
                 TypeMirror upperBound = t.getExtendsBound();
@@ -724,7 +776,7 @@
                 return sb;
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             protected StringBuilder defaultAction(TypeMirror e, Void p) {
                 return sb.append(e);
             }
@@ -1122,17 +1174,17 @@
     public TypeElement asTypeElement(TypeMirror t) {
         return new SimpleTypeVisitor9<TypeElement, Void>() {
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public TypeElement visitDeclared(DeclaredType t, Void p) {
                 return (TypeElement) t.asElement();
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public TypeElement visitArray(ArrayType t, Void p) {
                 return visit(t.getComponentType());
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public TypeElement visitTypeVariable(javax.lang.model.type.TypeVariable t, Void p) {
                /*
                 * TODO: Check with JJG.
@@ -1145,17 +1197,17 @@
                 return visit(typeUtils.erasure(t));
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public TypeElement visitWildcard(javax.lang.model.type.WildcardType t, Void p) {
                 return visit(typeUtils.erasure(t));
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public TypeElement visitError(ErrorType t, Void p) {
                 return (TypeElement)t.asElement();
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             protected TypeElement defaultAction(TypeMirror e, Void p) {
                 return super.defaultAction(e, p);
             }
@@ -1179,13 +1231,13 @@
     public String getDimension(TypeMirror t) {
         return new SimpleTypeVisitor9<String, Void>() {
             StringBuilder dimension = new StringBuilder("");
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public String visitArray(ArrayType t, Void p) {
                 dimension.append("[]");
                 return visit(t.getComponentType());
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             protected String defaultAction(TypeMirror e, Void p) {
                 return dimension.toString();
             }
@@ -1290,12 +1342,12 @@
     public String getTypeName(TypeMirror t, boolean fullyQualified) {
         return new SimpleTypeVisitor9<String, Void>() {
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public String visitArray(ArrayType t, Void p) {
                 return visit(t.getComponentType());
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public String visitDeclared(DeclaredType t, Void p) {
                 TypeElement te = asTypeElement(t);
                 return fullyQualified
@@ -1303,27 +1355,27 @@
                         : getSimpleName(te);
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public String visitExecutable(ExecutableType t, Void p) {
                 return t.toString();
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public String visitPrimitive(PrimitiveType t, Void p) {
                 return t.toString();
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public String visitTypeVariable(javax.lang.model.type.TypeVariable t, Void p) {
                 return getSimpleName(t.asElement());
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public String visitWildcard(javax.lang.model.type.WildcardType t, Void p) {
                 return t.toString();
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             protected String defaultAction(TypeMirror e, Void p) {
                 return e.toString();
             }
@@ -1567,45 +1619,6 @@
         return secondaryCollator.compare(s1, s2);
     }
 
-    public void copyDocFiles(Configuration configuration, Location locn, DocPath dir) {
-        try {
-            boolean first = true;
-            for (DocFile f : DocFile.list(configuration, locn, 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) {
-                            messages.warning("doclet.Copy_Overwrite_warning",
-                                    srcfile.getPath(), destdir.getPath());
-                        } else {
-                            messages.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, locn, dir.resolve(srcfile.getName()));
-                        }
-                    }
-                }
-
-                first = false;
-            }
-        } catch (SecurityException | IOException exc) {
-            throw new DocletAbortException(exc);
-        }
-    }
-
     private static class DocCollator {
         private final Map<String, CollationKey> keys;
         private final Collator instance;
@@ -1825,22 +1838,22 @@
      */
     public String getQualifiedTypeName(TypeMirror t) {
         return new SimpleTypeVisitor9<String, Void>() {
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public String visitDeclared(DeclaredType t, Void p) {
                 return getFullyQualifiedName(t.asElement());
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public String visitArray(ArrayType t, Void p) {
                return visit(t.getComponentType());
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public String visitPrimitive(PrimitiveType t, Void p) {
                 return t.toString();
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public String visitTypeVariable(javax.lang.model.type.TypeVariable t, Void p) {
                 // The knee jerk reaction is to do this but don't!, as we would like
                 // it to be compatible with the old world, now if we decide to do so
@@ -1849,7 +1862,7 @@
                 return t.toString();
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             protected String defaultAction(TypeMirror e, Void p) {
                 throw new UnsupportedOperationException("should not happen");
             }
@@ -1870,19 +1883,16 @@
     public String getFullyQualifiedName(Element e, final boolean outer) {
         return new SimpleElementVisitor9<String, Void>() {
             @Override
-            @DefinedBy(Api.LANGUAGE_MODEL)
             public String visitPackage(PackageElement e, Void p) {
                 return e.getQualifiedName().toString();
             }
 
             @Override
-            @DefinedBy(Api.LANGUAGE_MODEL)
             public String visitType(TypeElement e, Void p) {
                 return e.getQualifiedName().toString();
             }
 
             @Override
-            @DefinedBy(Api.LANGUAGE_MODEL)
             protected String defaultAction(Element e, Void p) {
                 return outer ? visit(e.getEnclosingElement()) : e.getSimpleName().toString();
             }
@@ -1987,15 +1997,15 @@
         private String getTypeCode(TypeMirror t) {
             return new SimpleTypeVisitor9<String, Void>() {
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public String visitPrimitive(PrimitiveType t, Void p) {
                     return "P";
                 }
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public String visitArray(ArrayType t, Void p) {
                     return visit(t.getComponentType());
                 }
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 protected String defaultAction(TypeMirror e, Void p) {
                     return "R";
                 }
@@ -2034,12 +2044,12 @@
         }
         boolean hasParameters(Element e) {
             return new SimpleElementVisitor9<Boolean, Void>() {
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public Boolean visitExecutable(ExecutableElement e, Void p) {
                     return true;
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 protected Boolean defaultAction(Element e, Void p) {
                     return false;
                 }
@@ -2057,29 +2067,29 @@
          */
         private String getFullyQualifiedName(Element e) {
             return new SimpleElementVisitor9<String, Void>() {
-                @Override  @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public String visitModule(ModuleElement e, Void p) {
                     return e.getQualifiedName().toString();
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public String visitPackage(PackageElement e, Void p) {
                     return e.getQualifiedName().toString();
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public String visitExecutable(ExecutableElement e, Void p) {
                     // For backward compatibility
                     return getFullyQualifiedName(e.getEnclosingElement())
                             + "." + e.getSimpleName().toString();
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public String visitType(TypeElement e, Void p) {
                     return e.getQualifiedName().toString();
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 protected String defaultAction(Element e, Void p) {
                     return getEnclosingTypeElement(e).getQualifiedName().toString()
                             + "." + e.getSimpleName().toString();
@@ -2319,13 +2329,13 @@
             return elements;
         return new SimpleElementVisitor9<List<Element>, Void>() {
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             public List<Element> visitPackage(PackageElement e, Void p) {
                 recursiveGetItems(elements, e, filter, select);
                 return elements;
             }
 
-            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+            @Override
             protected List<Element> defaultAction(Element e0, Void p) {
                 return getItems0(e0, filter, select);
             }
@@ -2387,12 +2397,12 @@
     private String getSimpleName0(Element e) {
         if (snvisitor == null) {
             snvisitor = new SimpleElementVisitor9<String, Void>() {
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public String visitModule(ModuleElement e, Void p) {
                     return e.getSimpleName().toString();
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public String visitType(TypeElement e, Void p) {
                     StringBuilder sb = new StringBuilder(e.getSimpleName());
                     Element enclosed = e.getEnclosingElement();
@@ -2404,7 +2414,7 @@
                     return sb.toString();
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public String visitExecutable(ExecutableElement e, Void p) {
                     if (e.getKind() == CONSTRUCTOR || e.getKind() == STATIC_INIT) {
                         return e.getEnclosingElement().getSimpleName().toString();
@@ -2412,7 +2422,7 @@
                     return e.getSimpleName().toString();
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 protected String defaultAction(Element e, Void p) {
                     return e.getSimpleName().toString();
                 }
@@ -2457,27 +2467,27 @@
                  * and we should fix this by using getConstantValue and the visitor to
                  * address this in the future.
                  */
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public String visitPrimitiveAsBoolean(PrimitiveType t, Object val) {
                     return (int)val == 0 ? "false" : "true";
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public String visitPrimitiveAsDouble(PrimitiveType t, Object val) {
                     return sourceForm(((Double)val), 'd');
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public String visitPrimitiveAsFloat(PrimitiveType t, Object val) {
                     return sourceForm(((Float)val).doubleValue(), 'f');
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public String visitPrimitiveAsLong(PrimitiveType t, Object val) {
                     return val + "L";
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 protected String defaultAction(TypeMirror e, Object val) {
                     if (val == null)
                         return null;
@@ -2570,22 +2580,22 @@
     public boolean isSpecified(Element e) {
         if (specifiedVisitor == null) {
             specifiedVisitor = new SimpleElementVisitor9<Boolean, Void>() {
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public Boolean visitModule(ModuleElement e, Void p) {
                     return configuration.getSpecifiedModules().contains(e);
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public Boolean visitPackage(PackageElement e, Void p) {
                     return configuration.getSpecifiedPackages().contains(e);
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public Boolean visitType(TypeElement e, Void p) {
                     return configuration.getSpecifiedClasses().contains(e);
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 protected Boolean defaultAction(Element e, Void p) {
                     return false;
                 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkFactory.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkFactory.java	Fri Aug 26 14:47:52 2016 -0700
@@ -42,8 +42,6 @@
 import jdk.javadoc.internal.doclets.formats.html.LinkInfoImpl;
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
 
 /**
  * A factory that constructs links from given link information.
@@ -80,14 +78,14 @@
                 Content link = newContent();
 
                 // handles primitives, no types and error types
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 protected Content defaultAction(TypeMirror type, LinkInfo linkInfo) {
                     link.addContent(utils.getTypeName(type, false));
                     return link;
                 }
 
                 int currentDepth = 0;
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public Content visitArray(ArrayType type, LinkInfo linkInfo) {
                     // keep track of the dimension depth and replace the last dimension
                     // specifier with vararags, when the stack is fully unwound.
@@ -109,7 +107,7 @@
                     return link;
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public Content visitWildcard(WildcardType type, LinkInfo linkInfo) {
                     linkInfo.isTypeBound = true;
                     link.addContent("?");
@@ -128,7 +126,7 @@
                     return link;
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public Content visitTypeVariable(TypeVariable type, LinkInfo linkInfo) {
                     link.addContent(getTypeAnnotationLinks(linkInfo));
                     linkInfo.isTypeBound = true;
@@ -169,7 +167,7 @@
                     return link;
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public Content visitDeclared(DeclaredType type, LinkInfo linkInfo) {
                     if (linkInfo.isTypeBound && linkInfo.excludeTypeBoundsLinks) {
                         // Since we are excluding type parameter links, we should not
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ElementsTable.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ElementsTable.java	Fri Aug 26 14:47:52 2016 -0700
@@ -68,8 +68,6 @@
 import com.sun.tools.javac.tree.JCTree.JCClassDecl;
 import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
 import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Name;
 import com.sun.tools.javac.util.Names;
@@ -874,22 +872,22 @@
         if (shouldDocumentVisitor == null) {
             shouldDocumentVisitor = new SimpleElementVisitor9<Boolean, Void>() {
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public Boolean visitType(TypeElement e, Void p) {
                     return shouldDocument((ClassSymbol) e);
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public Boolean visitVariable(VariableElement e, Void p) {
                     return shouldDocument((VarSymbol) e);
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public Boolean visitExecutable(ExecutableElement e, Void p) {
                     return shouldDocument((MethodSymbol) e);
                 }
 
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                @Override
                 public Boolean visitPackage(PackageElement e, Void p) {
                     return accessFilter.checkModifier(e);
                 }
@@ -947,19 +945,19 @@
             includedCache = new LinkedHashSet<>();
         }
 
-        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+        @Override
         public Boolean visitModule(ModuleElement e, Void p) {
             // deduced by specified and/or requires expansion
             return includedModuleElements.contains(e);
         }
 
-        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+        @Override
         public Boolean visitPackage(PackageElement e, Void p) {
             // deduced by specified or downward expansions
             return includedPackageElements.contains(e);
         }
 
-        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+        @Override
         public Boolean visitType(TypeElement e, Void p) {
             if (includedTypeElements.contains(e)) {
                 return true;
@@ -988,7 +986,7 @@
         }
 
         // members
-        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+        @Override
         public Boolean defaultAction(Element e, Void p) {
             if (includedCache.contains(e))
                 return true;
@@ -1006,7 +1004,7 @@
             return false;
         }
 
-        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+        @Override
         public Boolean visitUnknown(Element e, Void p) {
             throw new AssertionError("unknown element: " + e);
         }
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java	Fri Aug 26 14:47:52 2016 -0700
@@ -68,8 +68,6 @@
 import javax.tools.StandardLocation;
 
 import com.sun.tools.classfile.*;
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
 
 /**
  *  "Main" class for javap, normally accessed from the command line
@@ -411,7 +409,6 @@
     private DiagnosticListener<JavaFileObject> getDiagnosticListenerForWriter(Writer w) {
         final PrintWriter pw = getPrintWriterForWriter(w);
         return new DiagnosticListener<JavaFileObject> () {
-            @DefinedBy(Api.COMPILER)
             public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
                 switch (diagnostic.getKind()) {
                     case ERROR:
@@ -727,67 +724,54 @@
                 final URLConnection conn = url.openConnection();
                 conn.setUseCaches(false);
                 return new JavaFileObject() {
-                    @DefinedBy(Api.COMPILER)
                     public Kind getKind() {
                         return JavaFileObject.Kind.CLASS;
                     }
 
-                    @DefinedBy(Api.COMPILER)
                     public boolean isNameCompatible(String simpleName, Kind kind) {
                         throw new UnsupportedOperationException();
                     }
 
-                    @DefinedBy(Api.COMPILER)
                     public NestingKind getNestingKind() {
                         throw new UnsupportedOperationException();
                     }
 
-                    @DefinedBy(Api.COMPILER)
                     public Modifier getAccessLevel() {
                         throw new UnsupportedOperationException();
                     }
 
-                    @DefinedBy(Api.COMPILER)
                     public URI toUri() {
                         return uri;
                     }
 
-                    @DefinedBy(Api.COMPILER)
                     public String getName() {
                         return uri.toString();
                     }
 
-                    @DefinedBy(Api.COMPILER)
                     public InputStream openInputStream() throws IOException {
                         return conn.getInputStream();
                     }
 
-                    @DefinedBy(Api.COMPILER)
                     public OutputStream openOutputStream() throws IOException {
                         throw new UnsupportedOperationException();
                     }
 
-                    @DefinedBy(Api.COMPILER)
                     public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
                         throw new UnsupportedOperationException();
                     }
 
-                    @DefinedBy(Api.COMPILER)
                     public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
                         throw new UnsupportedOperationException();
                     }
 
-                    @DefinedBy(Api.COMPILER)
                     public Writer openWriter() throws IOException {
                         throw new UnsupportedOperationException();
                     }
 
-                    @DefinedBy(Api.COMPILER)
                     public long getLastModified() {
                         return conn.getLastModified();
                     }
 
-                    @DefinedBy(Api.COMPILER)
                     public boolean delete() {
                         throw new UnsupportedOperationException();
                     }
@@ -1015,47 +999,38 @@
     private Diagnostic<JavaFileObject> createDiagnostic(
             final Diagnostic.Kind kind, final String key, final Object... args) {
         return new Diagnostic<JavaFileObject>() {
-            @DefinedBy(Api.COMPILER)
             public Kind getKind() {
                 return kind;
             }
 
-            @DefinedBy(Api.COMPILER)
             public JavaFileObject getSource() {
                 return null;
             }
 
-            @DefinedBy(Api.COMPILER)
             public long getPosition() {
                 return Diagnostic.NOPOS;
             }
 
-            @DefinedBy(Api.COMPILER)
             public long getStartPosition() {
                 return Diagnostic.NOPOS;
             }
 
-            @DefinedBy(Api.COMPILER)
             public long getEndPosition() {
                 return Diagnostic.NOPOS;
             }
 
-            @DefinedBy(Api.COMPILER)
             public long getLineNumber() {
                 return Diagnostic.NOPOS;
             }
 
-            @DefinedBy(Api.COMPILER)
             public long getColumnNumber() {
                 return Diagnostic.NOPOS;
             }
 
-            @DefinedBy(Api.COMPILER)
             public String getCode() {
                 return key;
             }
 
-            @DefinedBy(Api.COMPILER)
             public String getMessage(Locale locale) {
                 return JavapTask.this.getMessage(locale, key, args);
             }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/CSV.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.jdeprscan;
+
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Utility class for manipulating comma-separated-value (CSV) data.
+ */
+public class CSV {
+    static String quote(String input) {
+        String result;
+        boolean needQuote = input.contains(",");
+
+        if (input.contains("\"")) {
+            needQuote = true;
+            result = input.replace("\"", "\"\"");
+        } else {
+            result = input;
+        }
+
+        if (needQuote) {
+            return "\"" + result + "\"";
+        } else {
+            return result;
+        }
+    }
+
+    /**
+     * Writes the objects' string representations to the output as a line of CSV.
+     * The objects are converted to String, quoted if necessary, joined with commas,
+     * and are written to the output followed by the line separator string.
+     *
+     * @param out the output destination
+     * @param objs the objects to write
+     */
+    public static void write(PrintStream out, Object... objs) {
+        out.println(Arrays.stream(objs)
+                          .map(Object::toString)
+                          .map(CSV::quote)
+                          .collect(Collectors.joining(",")));
+    }
+
+    /**
+     * The CSV parser state.
+     */
+    enum State {
+        START_FIELD, // the start of a field
+        IN_FIELD,    // within an unquoted field
+        IN_QFIELD,   // within a quoted field
+        END_QFIELD   // after the end of a quoted field
+    }
+
+    /**
+     * Splits an input line into a list of strings, handling quoting.
+     *
+     * @param input the input line
+     * @return the resulting list of strings
+     */
+    public static List<String> split(String input) {
+        List<String> result = new ArrayList<>();
+        StringBuilder cur = new StringBuilder();
+        State state = State.START_FIELD;
+
+        for (int i = 0; i < input.length(); i++) {
+            char ch = input.charAt(i);
+            switch (ch) {
+                case ',':
+                    switch (state) {
+                        case IN_QFIELD:
+                            cur.append(',');
+                            break;
+                        default:
+                            result.add(cur.toString());
+                            cur.setLength(0);
+                            state = State.START_FIELD;
+                            break;
+                    }
+                    break;
+                case '"':
+                    switch (state) {
+                        case START_FIELD:
+                            state = State.IN_QFIELD;
+                            break;
+                        case IN_QFIELD:
+                            state = State.END_QFIELD;
+                            break;
+                        case IN_FIELD:
+                            throw new CSVParseException("unexpected quote", input, i);
+                        case END_QFIELD:
+                            cur.append('"');
+                            state = State.IN_QFIELD;
+                            break;
+                    }
+                    break;
+                default:
+                    switch (state) {
+                        case START_FIELD:
+                            state = State.IN_FIELD;
+                            break;
+                        case IN_FIELD:
+                        case IN_QFIELD:
+                            break;
+                        case END_QFIELD:
+                            throw new CSVParseException("extra character after quoted string",
+                                                        input, i);
+                    }
+                    cur.append(ch);
+                    break;
+            }
+        }
+
+        if (state == State.IN_QFIELD) {
+            throw new CSVParseException("unclosed quote", input, input.length());
+        }
+
+        result.add(cur.toString());
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/CSVParseException.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.jdeprscan;
+
+/**
+ * Exception representing an error encountered during CSV parsing.
+ */
+public class CSVParseException extends IllegalArgumentException {
+    private static final long serialVersionUID = 6822670269555409371L;
+    final String input;
+    final int index;
+
+    public CSVParseException(String msg, String input, int index) {
+        super(msg);
+        this.input = input;
+        this.index = index;
+    }
+
+    public String getInput() { return input; }
+
+    public int getIndex() { return index; }
+
+    /**
+     * Returns a string describing the parse error.
+     *
+     * @return a string describing the parse error
+     */
+    @Override
+    public String getMessage() {
+        return super.getMessage() + " at index " + index + ": " + input;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/DeprDB.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.jdeprscan;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Formatter;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+import javax.lang.model.element.ElementKind;
+
+/**
+ * A database of deprecations (APIs declared to be deprecated),
+ * loaded from a JDK or from a class library.
+ */
+public class DeprDB {
+    /**
+     * Deprecated types.
+     * A map from deprecated type names to DeprData values.
+     * Types include classes, interfaces, enums, and annotation types.
+     */
+    final Map<String, DeprData> types = new HashMap<>();
+
+    /**
+     * Deprecated methods. Key is type name, value is map from method
+     * signatures in the form "methodname(parms)ret" to DeprData value.
+     */
+    final Map<String, Map<String, DeprData>> methods = new HashMap<>();
+
+    /**
+     * Deprecated fields. Key is type name, value is map from field name
+     * to forRemoval value.
+     */
+    final Map<String, Map<String, DeprData>> fields = new HashMap<>();
+
+    /**
+     * Set of valid ElementKind strings.
+     */
+    static final Set<String> validElementKinds =
+        Set.of(Arrays.stream(ElementKind.values())
+                     .map(ElementKind::toString)
+                     .toArray(String[]::new));
+
+
+    private DeprDB() { }
+
+    public static List<DeprData> loadFromFile(String filename) throws IOException {
+        List<DeprData> list = new ArrayList<>();
+
+        exit:
+        try (final BufferedReader br = Files.newBufferedReader(Paths.get(filename))) {
+            String line = br.readLine();
+            if (line == null || !line.equals("#jdepr1")) {
+                System.out.printf("ERROR: invalid first line %s%n", line);
+                break exit;
+            }
+            while ((line = br.readLine()) != null) {
+                if (line.startsWith("#")) {
+                    continue;
+                }
+                List<String> tokens = CSV.split(line);
+                if (tokens.size() != 5) {
+                    System.out.printf("ERROR: %s%n", line);
+                    continue;
+                }
+                // kind,typeName,descOrName,since,forRemoval
+                String kindStr = tokens.get(0);
+                String type = tokens.get(1);
+                String detail = tokens.get(2);
+                String since = tokens.get(3);
+                boolean forRemoval = Boolean.parseBoolean(tokens.get(4));
+                ElementKind kind;
+
+                if (validElementKinds.contains(kindStr)) {
+                    kind = ElementKind.valueOf(kindStr);
+                } else {
+                    System.out.printf("ERROR: invalid element kind %s%n", kindStr);
+                    continue;
+                }
+
+                DeprData data = new DeprData(kind, /*TypeElement*/null, type, detail, since, forRemoval);
+                list.add(data);
+            }
+        }
+        return list;
+    }
+
+    public static DeprDB loadFromList(List<DeprData> deprList) {
+        DeprDB db = new DeprDB();
+
+        for (DeprData dd : deprList) {
+            switch (dd.kind) {
+                case CLASS:
+                case INTERFACE:
+                case ENUM:
+                case ANNOTATION_TYPE:
+                    db.types.put(dd.typeName, dd);
+                    break;
+                case METHOD:
+                case CONSTRUCTOR:
+                    db.methods.computeIfAbsent(dd.typeName, k -> new HashMap<>())
+                              .put(dd.nameSig, dd);
+                    break;
+                case ENUM_CONSTANT:
+                case FIELD:
+                    db.fields.computeIfAbsent(dd.typeName, k -> new HashMap<>())
+                             .put(dd.nameSig, dd);
+                    break;
+            }
+        }
+
+        return db;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        Formatter f = new Formatter(sb, Locale.US);
+        f.format("=== Types ===%n");
+        f.format("%s%n", types.toString());
+        f.format("=== Methods ===%n");
+        f.format("%s%n", methods.toString());
+        f.format("=== Fields ===%n");
+        f.format("%s%n", fields.toString());
+        return sb.toString();
+    }
+
+    public DeprData getTypeDeprecated(String typeName) {
+        return types.get(typeName);
+    }
+
+    public DeprData getMethodDeprecated(String typeName, String methodName, String type) {
+        Map<String, DeprData> m = methods.get(typeName);
+        if (m == null) {
+            return null;
+        }
+        return m.get(methodName + type);
+    }
+
+    public DeprData getFieldDeprecated(String typeName, String fieldName) {
+        Map<String, DeprData> f = fields.get(typeName);
+        if (f == null) {
+            return null;
+        }
+        return f.get(fieldName);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/DeprData.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.jdeprscan;
+
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.element.TypeElement;
+
+/**
+ * A simple data class that contains language model data (TypeElement, etc.)
+ * about a deprecated API.
+ */
+public class DeprData {
+    final ElementKind kind;
+    final TypeElement type; // null if data loaded from file
+    final String typeName;
+    final String nameSig;
+    final String since;
+    final boolean forRemoval;
+
+    public DeprData(ElementKind kind, TypeElement type, String typeName, String nameSig,
+                    String since, boolean forRemoval) {
+        this.kind = kind;
+        this.type = type;
+        this.typeName = typeName;
+        this.nameSig = nameSig;
+        this.since = since;
+        this.forRemoval = forRemoval;
+    }
+
+    public boolean isForRemoval() {
+        return forRemoval;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("DeprData(%s,%s,%s,%s,%s,%s)",
+                             kind, type, typeName, nameSig, since, forRemoval);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/LoadProc.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.jdeprscan;
+
+import java.lang.annotation.IncompleteAnnotationException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.Messager;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.ArrayType;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.ExecutableType;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.Elements;
+
+import javax.tools.Diagnostic;
+
+import static javax.lang.model.SourceVersion.RELEASE_9;
+
+/**
+ * Annotation processor for the Deprecation Scanner tool.
+ * Examines APIs for deprecated elements and records information
+ *
+ */
+@SupportedAnnotationTypes("java.lang.Deprecated")
+@SupportedSourceVersion(RELEASE_9)
+public class LoadProc extends AbstractProcessor {
+    Elements elements;
+    Messager messager;
+    final List<DeprData> deprList = new ArrayList<>();
+
+    public LoadProc() {
+    }
+
+    @Override
+    public void init(ProcessingEnvironment pe) {
+        super.init(pe);
+        elements = pe.getElementUtils();
+        messager = pe.getMessager();
+    }
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        if (roundEnv.processingOver()) {
+            return false;
+        }
+
+        // Assume annotations contains only @Deprecated.
+        // Note: no way to get deprecated packages, since
+        // @Deprecated is ignored in package-info.java files.
+
+        Set<? extends Element> set = roundEnv.getElementsAnnotatedWith(Deprecated.class);
+        for (Element e : set) {
+            ElementKind kind = e.getKind();
+            Deprecated depr = e.getAnnotation(Deprecated.class);
+            switch (kind) {
+                case CLASS:
+                case INTERFACE:
+                case ENUM:
+                case ANNOTATION_TYPE:
+                    addType(kind, (TypeElement)e, depr);
+                    break;
+                case CONSTRUCTOR:
+                case ENUM_CONSTANT:
+                case FIELD:
+                case METHOD:
+                    Element encl = e.getEnclosingElement();
+                    ElementKind enclKind = encl.getKind();
+                    switch (enclKind) {
+                        case CLASS:
+                        case INTERFACE:
+                        case ENUM:
+                        case ANNOTATION_TYPE:
+                            String detail = getDetail(e);
+                            addMember(kind, (TypeElement)encl, detail, depr);
+                            break;
+                        default:
+                            messager.printMessage(Diagnostic.Kind.WARNING,
+                                "element " + e +
+                                " within unknown enclosing element " + encl +
+                                " of kind " + enclKind, e);
+                            break;
+                    }
+                    break;
+                default:
+                    messager.printMessage(Diagnostic.Kind.WARNING,
+                        "unknown element " + e +
+                        " of kind " + kind +
+                        " within " + e.getEnclosingElement(), e);
+                    break;
+            }
+        }
+        return true;
+    }
+
+    public List<DeprData> getDeprecations() {
+        return deprList;
+    }
+
+    String getDetail(Element e) {
+        if (e.getKind().isField()) {
+            return e.getSimpleName().toString();
+        } else {
+            // method or constructor
+            ExecutableElement ee = (ExecutableElement) e;
+            String ret;
+            ret = desc(ee.getReturnType());
+            List<? extends TypeMirror> parameterTypes = ((ExecutableType)ee.asType()).getParameterTypes();
+            String parms = parameterTypes.stream()
+                                .map(this::desc)
+                                .collect(Collectors.joining());
+            return ee.getSimpleName().toString() + "(" + parms + ")" + ret;
+        }
+    }
+
+    String desc(TypeMirror tm) {
+        switch (tm.getKind()) {
+            case BOOLEAN:
+                return "Z";
+            case BYTE:
+                return "B";
+            case SHORT:
+                return "S";
+            case CHAR:
+                return "C";
+            case INT:
+                return "I";
+            case LONG:
+                return "J";
+            case FLOAT:
+                return "F";
+            case DOUBLE:
+                return "D";
+            case VOID:
+                return "V";
+            case DECLARED:
+                String s =
+                    ((TypeElement)((DeclaredType)tm).asElement()).getQualifiedName().toString();
+                s = s.replace('.', '/');
+                return "L" + s + ";";
+            case ARRAY:
+                return "[" + desc(((ArrayType)tm).getComponentType());
+            default:
+                return tm.getKind().toString();
+        }
+    }
+
+    void addType(ElementKind kind, TypeElement type, Deprecated dep) {
+        addData(kind, type, "", dep);
+    }
+
+    void addMember(ElementKind kind, TypeElement type, String nameSig, Deprecated dep) {
+        addData(kind, type, nameSig, dep);
+    }
+
+    void addData(ElementKind kind, TypeElement type, String nameSig, Deprecated dep) {
+        String typeName = elements.getBinaryName(type).toString().replace('.', '/');
+
+        String since = "";
+        try {
+            since = dep.since();
+        } catch (IncompleteAnnotationException ignore) { }
+
+        boolean forRemoval = false;
+        try {
+            forRemoval = dep.forRemoval();
+        } catch (IncompleteAnnotationException ignore) { }
+
+        deprList.add(new DeprData(kind, type, typeName, nameSig, since, forRemoval));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,717 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.jdeprscan;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.net.URI;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.Queue;
+import java.util.stream.Stream;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticListener;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+
+import com.sun.tools.javac.file.JavacFileManager;
+
+import com.sun.tools.jdeprscan.scan.Scan;
+
+import static java.util.stream.Collectors.*;
+
+import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.TypeElement;
+
+/**
+ * Deprecation Scanner tool. Loads API deprecation information from the
+ * JDK image, or optionally, from a jar file or class hierarchy. Then scans
+ * a class library for usages of those APIs.
+ *
+ * TODO:
+ *  - audit error handling throughout, but mainly in scan package
+ *  - handling of covariant overrides
+ *  - handling of override of method found in multiple superinterfaces
+ *  - convert type/method/field output to Java source like syntax, e.g.
+ *      instead of java/lang/Runtime.runFinalizersOnExit(Z)V
+ *      print void java.lang.Runtime.runFinalizersOnExit(boolean)
+ *  - more example output in man page
+ *  - more rigorous GNU style option parsing; use joptsimple?
+ *
+ * FUTURES:
+ *  - add module support: -addmods, -modulepath, module arg
+ *  - load deprecation declarations from a designated class library instead
+ *    of the JDK
+ *  - load deprecation declarations from a module
+ *  - scan a module (but a modular jar can be treated just a like an ordinary jar)
+ *  - multi-version jar
+ */
+public class Main implements DiagnosticListener<JavaFileObject> {
+    public static Main instance;
+
+    final PrintStream out;
+    final PrintStream err;
+    final List<File> bootClassPath = new ArrayList<>();
+    final List<File> classPath = new ArrayList<>();
+    final List<File> systemModules = new ArrayList<>();
+    final List<String> options = new ArrayList<>();
+    final List<String> comments = new ArrayList<>();
+
+    // Valid releases need to match what the compiler supports.
+    // Keep these updated manually until there's a compiler API
+    // that allows querying of supported releases.
+    final Set<String> releasesWithoutForRemoval = Set.of("6", "7", "8");
+    final Set<String> releasesWithForRemoval = Set.of("9");
+
+    final Set<String> validReleases;
+    {
+        Set<String> temp = new HashSet<>(releasesWithoutForRemoval);
+        temp.addAll(releasesWithForRemoval);
+        validReleases = Set.of(temp.toArray(new String[0]));
+    }
+
+    boolean verbose = false;
+    boolean forRemoval = false;
+
+    final JavaCompiler compiler;
+    final StandardJavaFileManager fm;
+
+    List<DeprData> deprList; // non-null after successful load phase
+
+    /**
+     * Processes a collection of class names. Names should fully qualified
+     * names in the form "pkg.pkg.pkg.classname".
+     *
+     * @param classNames collection of fully qualified classnames to process
+     * @return true for success, false for failure
+     * @throws IOException if an I/O error occurs
+     */
+    boolean doClassNames(Collection<String> classNames) throws IOException {
+        if (verbose) {
+            out.println("List of classes to process:");
+            classNames.forEach(out::println);
+            out.println("End of class list.");
+        }
+
+        // TODO: not sure this is necessary...
+        if (fm instanceof JavacFileManager) {
+            ((JavacFileManager)fm).setSymbolFileEnabled(false);
+        }
+
+        fm.setLocation(StandardLocation.CLASS_PATH, classPath);
+        if (!bootClassPath.isEmpty()) {
+            fm.setLocation(StandardLocation.PLATFORM_CLASS_PATH, bootClassPath);
+        }
+
+        if (!systemModules.isEmpty()) {
+            fm.setLocation(StandardLocation.SYSTEM_MODULES, systemModules);
+        }
+
+        LoadProc proc = new LoadProc();
+        JavaCompiler.CompilationTask task =
+            compiler.getTask(null, fm, this, options, classNames, null);
+        task.setProcessors(List.of(proc));
+        boolean r = task.call();
+        if (r) {
+            if (forRemoval) {
+                deprList = proc.getDeprecations().stream()
+                               .filter(DeprData::isForRemoval)
+                               .collect(toList());
+            } else {
+                deprList = proc.getDeprecations();
+            }
+        }
+        return r;
+    }
+
+    /**
+     * Processes a stream of filenames (strings). The strings are in the
+     * form pkg/pkg/pkg/classname.class relative to the root of a package
+     * hierarchy.
+     *
+     * @param filenames a Stream of filenames to process
+     * @return true for success, false for failure
+     * @throws IOException if an I/O error occurs
+     */
+    boolean doFileNames(Stream<String> filenames) throws IOException {
+        return doClassNames(
+            filenames.filter(name -> name.endsWith(".class"))
+                     .filter(name -> !name.endsWith("package-info.class"))
+                     .filter(name -> !name.endsWith("module-info.class"))
+                     .map(s -> s.replaceAll("\\.class$", ""))
+                     .map(s -> s.replace('/', '.'))
+                     .collect(toList()));
+    }
+
+    /**
+     * Replaces all but the first occurrence of '/' with '.'. Assumes
+     * that the name is in the format module/pkg/pkg/classname.class.
+     * That is, the name should contain at least one '/' character
+     * separating the module name from the package-class name.
+     *
+     * @param filename the input filename
+     * @return the modular classname
+     */
+    String convertModularFileName(String filename) {
+        int slash = filename.indexOf('/');
+        return filename.substring(0, slash)
+               + "/"
+               + filename.substring(slash+1).replace('/', '.');
+    }
+
+    /**
+     * Processes a stream of filenames (strings) including a module prefix.
+     * The strings are in the form module/pkg/pkg/pkg/classname.class relative
+     * to the root of a directory containing modules. The strings are processed
+     * into module-qualified class names of the form
+     * "module/pkg.pkg.pkg.classname".
+     *
+     * @param filenames a Stream of filenames to process
+     * @return true for success, false for failure
+     * @throws IOException if an I/O error occurs
+     */
+    boolean doModularFileNames(Stream<String> filenames) throws IOException {
+        return doClassNames(
+            filenames.filter(name -> name.endsWith(".class"))
+                     .filter(name -> !name.endsWith("package-info.class"))
+                     .filter(name -> !name.endsWith("module-info.class"))
+                     .map(s -> s.replaceAll("\\.class$", ""))
+                     .map(this::convertModularFileName)
+                     .collect(toList()));
+    }
+
+    /**
+     * Processes named class files in the given directory. The directory
+     * should be the root of a package hierarchy. If classNames is
+     * empty, walks the directory hierarchy to find all classes.
+     *
+     * @param dirname the name of the directory to process
+     * @param classNames the names of classes to process
+     * @return true for success, false for failure
+     * @throws IOException if an I/O error occurs
+     */
+    boolean processDirectory(String dirname, Collection<String> classNames) throws IOException {
+        if (!Files.isDirectory(Paths.get(dirname))) {
+            err.printf("%s: not a directory%n", dirname);
+            return false;
+        }
+
+        classPath.add(0, new File(dirname));
+
+        if (classNames.isEmpty()) {
+            Path base = Paths.get(dirname);
+            int baseCount = base.getNameCount();
+            try (Stream<Path> paths = Files.walk(base)) {
+                Stream<String> files =
+                    paths.filter(p -> p.getNameCount() > baseCount)
+                         .map(p -> p.subpath(baseCount, p.getNameCount()))
+                         .map(Path::toString);
+                return doFileNames(files);
+            }
+        } else {
+            return doClassNames(classNames);
+        }
+    }
+
+    /**
+     * Processes all class files in the given jar file.
+     *
+     * @param jarname the name of the jar file to process
+     * @return true for success, false for failure
+     * @throws IOException if an I/O error occurs
+     */
+    boolean doJarFile(String jarname) throws IOException {
+        try (JarFile jf = new JarFile(jarname)) {
+            Stream<String> files =
+                jf.stream()
+                  .map(JarEntry::getName);
+            return doFileNames(files);
+        }
+    }
+
+    /**
+     * Processes named class files from the given jar file,
+     * or all classes if classNames is empty.
+     *
+     * @param jarname the name of the jar file to process
+     * @param classNames the names of classes to process
+     * @return true for success, false for failure
+     * @throws IOException if an I/O error occurs
+     */
+    boolean processJarFile(String jarname, Collection<String> classNames) throws IOException {
+        classPath.add(0, new File(jarname));
+
+        if (classNames.isEmpty()) {
+            return doJarFile(jarname);
+        } else {
+            return doClassNames(classNames);
+        }
+    }
+
+    /**
+     * Processes named class files from rt.jar of a JDK version 7 or 8.
+     * If classNames is empty, processes all classes.
+     *
+     * @param jdkHome the path to the "home" of the JDK to process
+     * @param classNames the names of classes to process
+     * @return true for success, false for failure
+     * @throws IOException if an I/O error occurs
+     */
+    boolean processOldJdk(String jdkHome, Collection<String> classNames) throws IOException {
+        String RTJAR = jdkHome + "/jre/lib/rt.jar";
+        String CSJAR = jdkHome + "/jre/lib/charsets.jar";
+
+        bootClassPath.add(0, new File(RTJAR));
+        bootClassPath.add(1, new File(CSJAR));
+        options.add("-source");
+        options.add("8");
+
+        if (classNames.isEmpty()) {
+            return doJarFile(RTJAR);
+        } else {
+            return doClassNames(classNames);
+        }
+    }
+
+    /**
+     * Processes listed classes given a JDK 9 home.
+     */
+    boolean processJdk9(String jdkHome, Collection<String> classes) throws IOException {
+        systemModules.add(new File(jdkHome));
+        return doClassNames(classes);
+    }
+
+    /**
+     * Processes the class files from the currently running JDK,
+     * using the jrt: filesystem.
+     *
+     * @return true for success, false for failure
+     * @throws IOException if an I/O error occurs
+     */
+    boolean processSelf(Collection<String> classes) throws IOException {
+        options.add("-addmods");
+        options.add("java.se.ee,jdk.xml.bind"); // TODO why jdk.xml.bind?
+
+        if (classes.isEmpty()) {
+            Path modules = FileSystems.getFileSystem(URI.create("jrt:/"))
+                                      .getPath("/modules");
+
+            // names are /modules/<modulename>/pkg/.../Classname.class
+            try (Stream<Path> paths = Files.walk(modules)) {
+                Stream<String> files =
+                    paths.filter(p -> p.getNameCount() > 2)
+                         .map(p -> p.subpath(1, p.getNameCount()))
+                         .map(Path::toString);
+                return doModularFileNames(files);
+            }
+        } else {
+            return doClassNames(classes);
+        }
+    }
+
+    /**
+     * Process classes from a particular JDK release, using only information
+     * in this JDK.
+     *
+     * @param release "6", "7", "8", or "9"
+     * @param classes collection of classes to process, may be empty
+     * @return success value
+     */
+    boolean processRelease(String release, Collection<String> classes) throws IOException {
+        options.addAll(List.of("-release", release));
+
+        if (release.equals("9")) {
+            List<String> rootMods = List.of("java.se", "java.se.ee");
+            TraverseProc proc = new TraverseProc(rootMods);
+            JavaCompiler.CompilationTask task =
+                compiler.getTask(null, fm, this,
+                                 // options
+                                 List.of("-addmods", String.join(",", rootMods)),
+                                 // classes
+                                 List.of("java.lang.Object"),
+                                 null);
+            task.setProcessors(List.of(proc));
+            if (!task.call()) {
+                return false;
+            }
+            Map<PackageElement, List<TypeElement>> types = proc.getPublicTypes();
+            options.add("-addmods");
+            options.add(String.join(",", rootMods));
+            return doClassNames(
+                types.values().stream()
+                     .flatMap(List::stream)
+                     .map(TypeElement::toString)
+                     .collect(toList()));
+        } else {
+            // TODO: kind of a hack...
+            // Create a throwaway compilation task with options "-release N"
+            // which has the side effect of setting the file manager's
+            // PLATFORM_CLASS_PATH to the right value.
+            JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+            StandardJavaFileManager fm =
+                compiler.getStandardFileManager(this, null, StandardCharsets.UTF_8);
+            JavaCompiler.CompilationTask task =
+                compiler.getTask(null, fm, this, List.of("-release", release), null, null);
+            List<Path> paths = new ArrayList<>();
+            for (Path p : fm.getLocationAsPaths(StandardLocation.PLATFORM_CLASS_PATH)) {
+                try (Stream<Path> str = Files.walk(p)) {
+                    str.forEachOrdered(paths::add);
+                }
+            }
+
+            options.add("-Xlint:-options");
+
+            return doClassNames(
+                paths.stream()
+                     .filter(path -> path.toString().endsWith(".sig"))
+                     .map(path -> path.subpath(1, path.getNameCount()))
+                     .map(Path::toString)
+                     .map(s -> s.replaceAll("\\.sig$", ""))
+                     .map(s -> s.replace('/', '.'))
+                     .collect(toList()));
+        }
+    }
+
+    /**
+     * Prints a usage message to the err stream.
+     */
+    void usage() {
+
+    }
+
+    /**
+     * An enum denoting the mode in which the tool is running.
+     * Different modes correspond to the different process* methods.
+     * The exception is UNKNOWN, which indicates that a mode wasn't
+     * specified on the command line, which is an error.
+     */
+    static enum LoadMode {
+        CLASSES, DIR, JAR, OLD_JDK, JDK9, SELF, RELEASE, LOAD_CSV
+    }
+
+    static enum ScanMode {
+        ARGS, LIST, PRINT_CSV
+    }
+
+    /**
+     * A checked exception that's thrown if a command-line syntax error
+     * is detected.
+     */
+    static class UsageException extends Exception {
+        private static final long serialVersionUID = 3611828659572908743L;
+    }
+
+    /**
+     * Convenience method to throw UsageException if a condition is false.
+     *
+     * @param cond the condition that's required to be true
+     * @throws UsageException
+     */
+    void require(boolean cond) throws UsageException {
+        if (!cond) {
+            throw new UsageException();
+        }
+    }
+
+    /**
+     * Constructs an instance of the finder tool.
+     *
+     * @param out the stream to which the tool's output is sent
+     * @param err the stream to which error messages are sent
+     */
+    Main(PrintStream out, PrintStream err) {
+        this.out = out;
+        this.err = err;
+        compiler = ToolProvider.getSystemJavaCompiler();
+        fm = compiler.getStandardFileManager(this, null, StandardCharsets.UTF_8);
+    }
+
+    /**
+     * Prints the diagnostic to the err stream.
+     *
+     * Specified by the DiagnosticListener interface.
+     *
+     * @param diagnostic the tool diagnostic to print
+     */
+    @Override
+    public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+        err.println(diagnostic);
+    }
+
+    /**
+     * Parses arguments and performs the requested processing.
+     *
+     * @param argArray command-line arguments
+     * @return true on success, false on error
+     */
+    boolean run(String... argArray) {
+        Queue<String> args = new ArrayDeque<>(Arrays.asList(argArray));
+        LoadMode loadMode = LoadMode.RELEASE;
+        ScanMode scanMode = ScanMode.ARGS;
+        String dir = null;
+        String jar = null;
+        String jdkHome = null;
+        String release = "9";
+        List<String> loadClasses = new ArrayList<>();
+        String csvFile = null;
+
+        try {
+            while (!args.isEmpty()) {
+                String a = args.element();
+                if (a.startsWith("-")) {
+                    args.remove();
+                    switch (a) {
+                        case "--class-path":
+                        case "-cp":
+                            classPath.clear();
+                            Arrays.stream(args.remove().split(File.pathSeparator))
+                                  .map(File::new)
+                                  .forEachOrdered(classPath::add);
+                            break;
+                        case "--for-removal":
+                            forRemoval = true;
+                            break;
+                        case "--full-version":
+                            out.println(System.getProperty("java.vm.version"));
+                            return false;
+                        case "--help":
+                        case "-h":
+                            out.println(Messages.get("main.usage"));
+                            out.println();
+                            out.println(Messages.get("main.help"));
+                            return false;
+                        case "-l":
+                        case "--list":
+                            require(scanMode == ScanMode.ARGS);
+                            scanMode = ScanMode.LIST;
+                            break;
+                        case "--release":
+                            loadMode = LoadMode.RELEASE;
+                            release = args.remove();
+                            if (!validReleases.contains(release)) {
+                                throw new UsageException();
+                            }
+                            break;
+                        case "-v":
+                        case "--verbose":
+                            verbose = true;
+                            break;
+                        case "--version":
+                            out.println(System.getProperty("java.version"));
+                            return false;
+                        case "--Xcompiler-arg":
+                            options.add(args.remove());
+                            break;
+                        case "--Xcsv-comment":
+                            comments.add(args.remove());
+                            break;
+                        case "--Xhelp":
+                            out.println(Messages.get("main.xhelp"));
+                            return false;
+                        case "--Xload-class":
+                            loadMode = LoadMode.CLASSES;
+                            loadClasses.add(args.remove());
+                            break;
+                        case "--Xload-csv":
+                            loadMode = LoadMode.LOAD_CSV;
+                            csvFile = args.remove();
+                            break;
+                        case "--Xload-dir":
+                            loadMode = LoadMode.DIR;
+                            dir = args.remove();
+                            break;
+                        case "--Xload-jar":
+                            loadMode = LoadMode.JAR;
+                            jar = args.remove();
+                            break;
+                        case "--Xload-jdk9":
+                            loadMode = LoadMode.JDK9;
+                            jdkHome = args.remove();
+                            break;
+                        case "--Xload-old-jdk":
+                            loadMode = LoadMode.OLD_JDK;
+                            jdkHome = args.remove();
+                            break;
+                        case "--Xload-self":
+                            loadMode = LoadMode.SELF;
+                            break;
+                        case "--Xprint-csv":
+                            require(scanMode == ScanMode.ARGS);
+                            scanMode = ScanMode.PRINT_CSV;
+                            break;
+                        default:
+                            throw new UsageException();
+                    }
+                } else {
+                    break;
+                }
+            }
+
+            if ((scanMode == ScanMode.ARGS) == args.isEmpty()) {
+                throw new UsageException();
+            }
+
+            if (    forRemoval && loadMode == LoadMode.RELEASE &&
+                    releasesWithoutForRemoval.contains(release)) {
+                throw new UsageException();
+            }
+
+            boolean success = false;
+
+            switch (loadMode) {
+                case CLASSES:
+                    success = doClassNames(loadClasses);
+                    break;
+                case DIR:
+                    success = processDirectory(dir, loadClasses);
+                    break;
+                case JAR:
+                    success = processJarFile(jar, loadClasses);
+                    break;
+                case JDK9:
+                    require(!args.isEmpty());
+                    success = processJdk9(jdkHome, loadClasses);
+                    break;
+                case LOAD_CSV:
+                    deprList = DeprDB.loadFromFile(csvFile);
+                    success = true;
+                    break;
+                case OLD_JDK:
+                    success = processOldJdk(jdkHome, loadClasses);
+                    break;
+                case RELEASE:
+                    success = processRelease(release, loadClasses);
+                    break;
+                case SELF:
+                    success = processSelf(loadClasses);
+                    break;
+                default:
+                    throw new UsageException();
+            }
+
+            if (!success) {
+                return false;
+            }
+        } catch (NoSuchElementException | UsageException ex) {
+            err.println(Messages.get("main.usage"));
+            return false;
+        } catch (IOException ioe) {
+            if (verbose) {
+                ioe.printStackTrace(err);
+            } else {
+                err.println(ioe);
+            }
+            return false;
+        }
+
+        // now the scanning phase
+
+        switch (scanMode) {
+            case LIST:
+                for (DeprData dd : deprList) {
+                    if (!forRemoval || dd.isForRemoval()) {
+                        out.println(Pretty.print(dd));
+                    }
+                }
+                break;
+            case PRINT_CSV:
+                out.println("#jdepr1");
+                comments.forEach(s -> out.println("# " + s));
+                for (DeprData dd : deprList) {
+                    CSV.write(out, dd.kind, dd.typeName, dd.nameSig, dd.since, dd.forRemoval);
+                }
+                break;
+            case ARGS:
+                DeprDB db = DeprDB.loadFromList(deprList);
+                List<String> cp = classPath.stream()
+                                           .map(File::toString)
+                                           .collect(toList());
+                Scan scan = new Scan(out, err, cp, db, verbose);
+
+                for (String a : args) {
+                    boolean success;
+
+                    if (a.endsWith(".jar")) {
+                        success = scan.scanJar(a);
+                    } else if (Files.isDirectory(Paths.get(a))) {
+                        success = scan.scanDir(a);
+                    } else {
+                        success = scan.processClassName(a.replace('.', '/'));
+                    }
+
+                    if (!success) {
+                        return false;
+                    }
+                }
+                break;
+        }
+
+        return true;
+    }
+
+    /**
+     * Programmatic main entry point: initializes the tool instance to
+     * use stdout and stderr; runs the tool, passing command-line args;
+     * returns an exit status.
+     *
+     * @return true on success, false otherwise
+     */
+    public static boolean call(PrintStream out, PrintStream err, String... args) {
+        try {
+            instance = new Main(out, err);
+            return instance.run(args);
+        } finally {
+            instance = null;
+        }
+    }
+
+    /**
+     * Calls the main entry point and exits the JVM with an exit
+     * status determined by the return status.
+     */
+    public static void main(String[] args) {
+        System.exit(call(System.out, System.err, args) ? 0 : 1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Messages.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.jdeprscan;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Message handling class for localization.
+ */
+public class Messages {
+    static final ResourceBundle bundle;
+
+    static {
+        Locale locale = Locale.getDefault();
+        try {
+            bundle = ResourceBundle.getBundle("com.sun.tools.jdeprscan.resources.jdeprscan", locale);
+        } catch (MissingResourceException e) {
+            throw new InternalError("Cannot find jdeps resource bundle for locale " + locale, e);
+        }
+    }
+
+    public static String get(String key, Object... args) {
+        try {
+            return MessageFormat.format(bundle.getString(key), args);
+        } catch (MissingResourceException e) {
+            throw new InternalError("Missing message: " + key, e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Pretty.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,274 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.jdeprscan;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Utility class for pretty-printing various bits of API syntax.
+ */
+public class Pretty {
+    /**
+     * Converts deprecation information into an {@code @Deprecated} annotation.
+     * The output is minimized: an empty since string is omitted, a forRemoval
+     * value of false is omitted; and if both are omitted, the trailing parentheses
+     * are also omitted.
+     *
+     * @param since the since value
+     * @param forRemoval the forRemoval value
+     * @return string containing an annotation
+     */
+    static String depr(String since, boolean forRemoval) {
+        String d = "@Deprecated";
+
+        if (since.isEmpty() && !forRemoval) {
+            return d;
+        }
+
+        StringBuilder sb = new StringBuilder(d).append('(');
+
+        if (!since.isEmpty()) {
+            sb.append("since=\"")
+              .append(since.replace("\"", "\\\""))
+              .append('"');
+        }
+
+        if (forRemoval) {
+            if (!since.isEmpty()) {
+                sb.append(", ");
+            }
+            sb.append("forRemoval=true");
+        }
+
+        sb.append(')');
+
+        return sb.toString();
+    }
+
+    /**
+     * Converts a slash-$ style name into a dot-separated name.
+     *
+     * @param n the input name
+     * @return the result name
+     */
+    static String unslashify(String n) {
+        return n.replace("/", ".")
+                .replace("$", ".");
+    }
+
+    /**
+     * Converts a type descriptor to a readable string.
+     *
+     * @param desc the input descriptor
+     * @return the result string
+     */
+    static String desc(String desc) {
+        return desc(desc, new int[] { 0 });
+    }
+
+    /**
+     * Converts one type descriptor to a readable string, starting
+     * from position {@code pos_inout[0]}, and updating it to the
+     * location following the descriptor just parsed. A type descriptor
+     * mostly corresponds to a FieldType in JVMS 4.3.2. It can be one of a
+     * BaseType (a single character denoting a primitive, plus void),
+     * an object type ("Lname;"), or an array type (one more more '[' followed
+     * by a base or object type).
+     *
+     * @param desc a string possibly containing several descriptors
+     * @param pos_inout on input, the start position; on return, the position
+     *                  following the just-parsed descriptor
+     * @return the result string
+     */
+    static String desc(String desc, int[] pos_inout) {
+        int dims = 0;
+        int pos = pos_inout[0];
+        final int len = desc.length();
+
+        while (pos < len && desc.charAt(pos) == '[') {
+            pos++;
+            dims++;
+        }
+
+        String name;
+
+        if (pos >= len) {
+            return null;
+        }
+
+        char c = desc.charAt(pos++);
+        switch (c) {
+            case 'Z':
+                name = "boolean";
+                break;
+            case 'B':
+                name = "byte";
+                break;
+            case 'S':
+                name = "short";
+                break;
+            case 'C':
+                name = "char";
+                break;
+            case 'I':
+                name = "int";
+                break;
+            case 'J':
+                name = "long";
+                break;
+            case 'F':
+                name = "float";
+                break;
+            case 'D':
+                name = "double";
+                break;
+            case 'V':
+                name = "void";
+                break;
+            case 'L':
+                int semi = desc.indexOf(';', pos);
+                if (semi == -1) {
+                    return null;
+                }
+                name = unslashify(desc.substring(pos, semi));
+                pos = semi + 1;
+                break;
+            default:
+                return null;
+        }
+
+        StringBuilder sb = new StringBuilder(name);
+        for (int i = 0; i < dims; i++) {
+            sb.append("[]");
+        }
+        pos_inout[0] = pos;
+        return sb.toString();
+    }
+
+    /**
+     * Converts a series of type descriptors into a comma-separated,
+     * readable string. This is used for the parameter types of a
+     * method descriptor.
+     *
+     * @param types the parameter types
+     * @return the readable string
+     */
+    static String parms(String types) {
+        int[] pos = new int[] { 0 };
+        StringBuilder sb = new StringBuilder();
+
+        boolean first = true;
+
+        String t;
+
+        while ((t = desc(types, pos)) != null) {
+            if (first) {
+                first = false;
+            } else {
+                sb.append(',');
+            }
+            sb.append(t);
+        }
+
+        return sb.toString();
+    }
+
+    /**
+     * Pattern for matching a method descriptor. Match results can
+     * be retrieved from named capture groups as follows: "name(params)return".
+     */
+    static final Pattern DESC_PAT = Pattern.compile("(?<name>.*)\\((?<args>.*)\\)(?<return>.*)");
+
+    /**
+     * Pretty-prints the data contained in the given DeprData object.
+     *
+     * @param dd the deprecation data object
+     * @return the formatted string
+     */
+    public static String print(DeprData dd) {
+        StringBuilder sb = new StringBuilder();
+        sb.append(depr(dd.since, dd.forRemoval))
+          .append(' ');
+
+        switch (dd.kind) {
+            case ANNOTATION_TYPE:
+                sb.append("@interface ");
+                sb.append(unslashify(dd.typeName));
+                break;
+            case CLASS:
+                sb.append("class ");
+                sb.append(unslashify(dd.typeName));
+                break;
+            case ENUM:
+                sb.append("enum ");
+                sb.append(unslashify(dd.typeName));
+                break;
+            case INTERFACE:
+                sb.append("interface ");
+                sb.append(unslashify(dd.typeName));
+                break;
+
+            case ENUM_CONSTANT:
+            case FIELD:
+                sb.append(unslashify(dd.typeName))
+                  .append('.')
+                  .append(dd.nameSig);
+                break;
+            case CONSTRUCTOR:
+                Matcher cons = DESC_PAT.matcher(dd.nameSig);
+                sb.append(unslashify(dd.typeName));
+                if (cons.matches()) {
+                    sb.append('(')
+                      .append(parms(cons.group("args")))
+                      .append(')');
+                } else {
+                    sb.append('.')
+                      .append(dd.nameSig);
+                }
+                break;
+            case METHOD:
+                Matcher meth = DESC_PAT.matcher(dd.nameSig);
+                if (meth.matches()) {
+                    sb.append(desc(meth.group("return")))
+                      .append(' ')
+                      .append(unslashify(dd.typeName))
+                      .append('.')
+                      .append(meth.group("name"))
+                      .append('(')
+                      .append(parms(meth.group("args")))
+                      .append(')');
+                } else {
+                    sb.append(unslashify(dd.typeName))
+                      .append('.')
+                      .append(dd.nameSig);
+                }
+                break;
+        }
+
+        return sb.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/TraverseProc.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.jdeprscan;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.Messager;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+
+import javax.lang.model.element.ModuleElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.util.Elements;
+
+import static javax.lang.model.SourceVersion.RELEASE_9;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.PackageElement;
+import javax.tools.Diagnostic;
+
+@SupportedSourceVersion(RELEASE_9)
+@SupportedAnnotationTypes("*")
+public class TraverseProc extends AbstractProcessor {
+    Elements elements;
+    Messager messager;
+    final List<String> moduleRoots;
+    Map<PackageElement, List<TypeElement>> publicTypes;
+
+    TraverseProc(List<String> roots) {
+        moduleRoots = roots;
+    }
+
+    @Override
+    public void init(ProcessingEnvironment pe) {
+        super.init(pe);
+        elements = pe.getElementUtils();
+        messager = pe.getMessager();
+    }
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        if (roundEnv.processingOver()) {
+            return false;
+        }
+
+        Set<ModuleElement> modules = new HashSet<>();
+        for (String mname : moduleRoots) {
+            ModuleElement me = elements.getModuleElement(mname);
+            if (me == null) {
+                messager.printMessage(Diagnostic.Kind.ERROR,
+                                      String.format("module %s not found%n", mname));
+            } else {
+                modules.addAll(findModules(me));
+            }
+        }
+
+        Set<PackageElement> packages = findPackages(modules);
+
+        publicTypes = findPublicTypes(packages);
+
+        return true;
+    }
+
+    void printPublicTypes() {
+        printPublicTypes(publicTypes);
+    }
+
+    public Map<PackageElement, List<TypeElement>> getPublicTypes() {
+        return publicTypes;
+    }
+
+    void printPublicTypes(Map<PackageElement, List<TypeElement>> types) {
+        System.out.println("All public types:");
+        types.entrySet().stream()
+             .sorted(Comparator.comparing(e -> e.getKey().toString()))
+             .forEach(e -> {
+                 System.out.println("  " + e.getKey());
+                 e.getValue().stream()
+                         .sorted(Comparator.comparing(TypeElement::toString))
+                         .forEach(t -> System.out.println("    " + t));
+             });
+        System.out.println();
+        System.out.flush();
+    }
+
+    Set<ModuleElement> findModules(ModuleElement root) {
+        return findModules0(root, new HashSet<>(), 0);
+    }
+
+    Set<ModuleElement> findModules0(ModuleElement m, Set<ModuleElement> set, int nesting) {
+        set.add(m);
+        for (ModuleElement.Directive dir : m.getDirectives()) {
+            if (dir.getKind() == ModuleElement.DirectiveKind.REQUIRES) {
+                ModuleElement.RequiresDirective req = (ModuleElement.RequiresDirective)dir;
+                findModules0(req.getDependency(), set, nesting + 1);
+            }
+        }
+        return set;
+    }
+
+    Set<PackageElement> findPackages(Collection<ModuleElement> mods) {
+        Set<PackageElement> set = new HashSet<>();
+        for (ModuleElement m : mods) {
+            for (ModuleElement.Directive dir : m.getDirectives()) {
+                if (dir.getKind() == ModuleElement.DirectiveKind.EXPORTS) {
+                    ModuleElement.ExportsDirective exp = (ModuleElement.ExportsDirective)dir;
+                    if (exp.getTargetModules() == null) {
+                        set.add(exp.getPackage());
+                    }
+                }
+            }
+        }
+        return set;
+    }
+
+    Map<PackageElement, List<TypeElement>> findPublicTypes(Collection<PackageElement> pkgs) {
+        Map<PackageElement, List<TypeElement>> map = new HashMap<>();
+        for (PackageElement pkg : pkgs) {
+            List<TypeElement> enclosed = new ArrayList<>();
+            for (Element e : pkg.getEnclosedElements()) {
+                addPublicTypes(enclosed, e);
+            }
+            map.put(pkg, enclosed);
+        }
+        return map;
+    }
+
+    void addPublicTypes(List<TypeElement> list, Element e) {
+        ElementKind kind = e.getKind();
+        if ((kind.isClass() || kind.isInterface())
+                && e.getModifiers().contains(Modifier.PUBLIC)) {
+            list.add((TypeElement)e);
+            for (Element enc : e.getEnclosedElements()) {
+                addPublicTypes(list, enc);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/internals.md	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,215 @@
+<!--
+
+Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation.  Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+
+-->
+
+
+JDeprScan Internals
+-----
+
+**EXPERIMENTAL OPTIONS**
+
+    --Xload-class CLASSNAME
+
+        Loads deprecation data from the class named CLASSNAME instead of from
+        the JDK image.
+
+    --Xload-csv CVSFILE
+
+        Loads deprecation data from file CSVFILE.
+
+    --Xload-dir DIR
+
+        Loads deprecation data from the class hierarchy rooted
+        at the directory named DIR.
+
+    --Xload-jar JARFILE
+
+        Loads deprecation data from the classes contained in the
+        jar file named JARFILE.
+
+    --Xload-jdk9 JAVA_HOME
+
+        Loads deprecation data from a modular JDK whose home
+        directory is at JAVA_HOME. This essentially adds the given
+        path to the system-modules location.
+
+    --Xload-old-jdk JAVA_HOME
+
+        Loads deprecation data from an old (non-modular) JDK whose
+        home directory is at JAVA_HOME. This essentially scans the
+        rt.jar file from that JDK.
+
+    --Xload-self
+
+        Loads deprecation data from the running JDK image by
+        traversing the entire jrt: filesystem. This differs from
+        -release 9, which traverses modules, packages, and classes by
+        starting from a set of root modules and using javax.lang.model
+        mechanisms (as opposed to filesystem mechanisms) for
+        traversing contained elements recursively.
+
+    --Xcompiler-arg ARG
+
+        Adds ARG to the list of arguments passed to the compiler.
+
+    --Xcsv-comment COMMENT
+
+        Adds a comment line containing COMMENT to the top of the CSV
+        that is emitted.  Valid only when --Xprint-csv is
+        specified. More than one --Xcsv-comment option is permitted,
+        which will cause a corresponding number of comment lines to be
+        emitted to the CSV file.
+
+    --Xprint-csv
+
+        Prints out the loaded deprecation information in CSV format
+        to standard output. In this mode, no scanning is done, so
+        there must not be any additional directory, jar, or classname
+        arguments.
+
+**CSV FILE SYNTAX**
+
+The `-Xprint-csv` option causes **jdeprscan** to emit the loaded
+deprecation data in CSV (comma-separated value) format.  The general
+syntax of CSV is documented in [RFC 4180][RFC] with supplemental
+information in a [Wikipedia article][wiki].
+
+The file is encoded in UTF-8.
+
+The file consists of a series of lines. Any of the standard line
+separators CR (U+000D), LF (U+000A), or a CR immediately followed by
+LF, are supported. Newlines are only supported between records and
+are not supported within field values.
+
+Comment lines start with a `#` (U+0023) character in the first
+column. The entire line is ignored up until the next line separator
+sequence.
+
+Each line is divided into fields separated by the comma `,` (U+002C)
+character.  Horizontal whitespace is not treated specially; that is,
+it is considered part of a field's value. An empty line is considered
+to have one field which is the empty string.
+
+A field value that contains a comma or a quote quotation mark `"`
+(U+0022) must be surrounded by quotation marks. The surrounding
+quotation marks are not considered part of the field value. Any
+quotation marks that are part of a field value must be repeated in
+addition to being surrounded by quotation marks.
+
+It is a syntax error if a quotation mark appears within an unquoted field;
+if a quoted field isn't immediately followed by a comma or line
+separator; or if a quoted field is left unclosed at the end of the line.
+
+For example, a record with the following four fields:
+
+1. abcd
+2. ef,gh
+3. ij"kl
+4. mnop
+
+would be encoded as follows:
+
+        abcd,"ef,gh","ij""kl",mnop
+
+**CSV FILE DATA**
+
+The first line of output must be the following:
+
+        #jdepr1
+
+This is strictly a comment line, but it serves as a file
+identifier. The "1" indicates version 1 of this file.
+
+Zero or more comment lines follow, containing text that is specified
+by the `-Xcsv-comment` options.
+
+Subsequent non-comment lines must have the following five fields:
+
+        kind,typeName,descOrName,since,forRemoval
+
+Fields are defined as follows:
+
+ * _kind_ - one of CONSTRUCTOR, FIELD, METHOD, ENUM\_CONSTANT,
+   CLASS, INTERFACE, ENUM, or ANNOTATION\_TYPE. These correspond to
+   enumeration constants from the `javax.lang.model.element.ElementKind`
+   enum.
+
+ * _typeName_ - the fully qualified name of the type (if *kind* is
+   CLASS, INTERFACE, ENUM, or ANNOTATION\_TYPE) or of the enclosing
+   type (if _kind_ is CONSTRUCTOR, FIELD, METHOD, or
+   ENUM\_CONSTANT). This value is a _binary name_ [JLS 13.1][jls131]
+   using a slash character `/` (U+002F) to separate package and
+   top-level name components, and a dollar sign `$` (U+0024) to
+   separate nested name components. For example, the `Thread.State`
+   enum that appears in Java SE would have the following typeName:
+
+            java/lang/Thread$State
+
+ * _descOrName_ - if _kind_ is METHOD or CONSTRUCTOR, this is the method's
+   or constructor's descriptor [JVMS 4.3.3][jvms433]; if _kind_ is FIELD or
+   ENUM\_CONSTANT, this is its name; otherwise this field is empty.
+   A method's descriptor includes its name, parameter types, and return
+   type. For example, the method
+
+           public void String.getBytes(int srcBegin,
+                                       int srcEnd,
+                                       byte[] dst,
+                                       int dstBegin)
+
+   has the descriptor
+
+           getBytes(II[BI)V
+
+ * _since_ - the value of the `since` element of the `@Deprecated`
+   annotation, or empty if this element is not present.
+
+ * _forRemoval_ - the value of the `forRemoval` element of the
+   `@Deprecated` annotation, a boolean, either "true" or "false".
+
+Note that the _since_ field can have arbitrary text (excluding
+line separators) and is thus subject to quoting.
+
+**EXAMPLE OUTPUT**
+
+Given the following method declaration and annotation from the
+`java.lang.Runtime` class,
+
+            @Deprecated(since="1.2",
+                        forRemoval=true)
+            public static void runFinalizersOnExit(boolean value)
+
+the following line will be emitted from **jdeprscan -Xprint-csv**:
+
+            METHOD,java/lang/Runtime,runFinalizersOnExit(Z)V,1.2,true
+
+
+[RFC]: https://www.ietf.org/rfc/rfc4180.txt
+
+[wiki]: https://en.wikipedia.org/wiki/Comma-separated_values
+
+[jls131]: http://docs.oracle.com/javase/specs/jls/se8/html/jls-13.html#jls-13.1
+
+[jvms433]: http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.3.3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/readme.md	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,180 @@
+<!--
+
+Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation.  Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+
+-->
+
+
+JDeprScan Tool Command Reference
+-----
+
+**NAME**
+
+        jdeprscan - Java deprecation scanner
+
+**SYNOPSIS**
+
+        jdeprscan [options] {dir | jar | class} ...
+
+**OPTIONS**
+
+        -cp PATH
+        --class-path PATH
+
+            Sets the classpath to PATH.
+
+        --for-removal
+
+            Limit reporting to deprecations whose forRemoval element
+            is true.
+
+        --full-version
+
+            Prints the full version string of the tool and exits.
+
+        -h
+        --help
+
+            Prints a help message and exits.
+
+        -l
+        --list
+
+            Prints out the set of deprecated APIs.
+
+        --release 6|7|8|9
+
+            Specifies the Java SE release that is the source of
+            the list of deprecated APIs. If no --release option is
+            provided, the latest release is used.
+
+        -v
+        --verbose
+
+            Enables additional output.
+
+        --version
+
+            Prints the version string of the tool and exits.
+
+**DESCRIPTION**
+
+**jdeprscan** scans a class library for uses of deprecated APIs.
+**jdeprscan** processes one or more arguments, which can be any
+combination of a directory, a jar file, or a class name.
+
+A directory argument must specify a path to a directory hierarchy that
+reflects the Java package hierarchy of the classes it contains.
+**jdeprscan** will scan each class found in the directory hierarchy
+and report information about how those classes use deprecated APIs.
+
+Given a jar file, **jdeprscan** will scan the classes found within
+that jar file and report information about how those classes use
+deprecated APIs.
+
+Given a class name, **jdeprscan** will search for that class on the
+classpath, scan that class, and report information about how that
+class uses deprecated APIs. The class name must use the fully
+qualified binary name of the class, as described in the
+[Java Language Specification, section 13.1][jls131]. This form uses
+the '$' character instead of '.' as the separator for nested class names.
+For example, the `Thread.State` enum would be specified using the string
+
+        java.lang.Thread$State
+
+The `--class-path` and `-cp` options specify the classpath used for
+class searching. The classpath is used for classes named on the
+command line, as well as for dependencies of the classes in jar file
+or directory hierarchy to be scanned.
+
+The `--for-removal` option limits output to uses of deprecated APIs
+whose `@Deprecated` annotation includes the `forRemoval` element with
+the value `true`. Note: the `forRemoval` attribute of the
+`@Deprecated` annotation did not exist prior to Java SE 9, so this
+option cannot be used with a release value of 6, 7, or 8.
+
+The `--release` option specifies the Java SE specification version
+that determines the set of deprecated APIs for which scanning is
+done. This is useful if a deprecation report is desired that lists
+uses of deprecated APIs as of a particular release in the past. If no
+`--release` option is given, the latest release is used.
+
+The `--list` and `-l` options will list the known set of deprecated
+APIs instead of doing any scanning. Since no scanning is done,
+no directory, jar, or class arguments should be provided. The set
+of deprecated APIs listed is affected by the `--release` and the
+`--for-removal` options.
+
+
+**EXAMPLE OUTPUT**
+
+The output is a report that lists program elements that use deprecated
+APIs. Output is subject to change.
+
+Consider the following declarations from Java SE 9:
+
+        // java.lang.Boolean
+
+        @Deprecated(since="9")
+        public Boolean(boolean value)
+
+        // java.lang.Runtime
+
+        @Deprecated(since="1.2", forRemoval=true)
+        public static void runFinalizersOnExit(boolean value)
+
+Running **jdeprscan** over a class that calls these methods will result
+in output something like the following:
+
+        class Example uses method java/lang/Boolean.<init>(Z)V deprecated
+        class Example uses method java/lang/Runtime.runFinalizersOnExit(Z)V deprecated for removal
+
+Running **jdeprscan** with the `--list` option will result in output
+including something like the following:
+
+        ...
+        @Deprecated(since="9") java.lang.Boolean(boolean)
+        @Deprecated(since="1.2", forRemoval=true) void java.lang.Runtime.runFinalizersOnExit(boolean)
+        ...
+
+**NOTES**
+
+The **jdeprscan** tool operates by opening Java class files and
+reading their structures directly, particularly the constant
+pool. Because of this, **jdeprscan** can tell _that_ a deprecated API
+is used, but it often cannot tell _where_ in the class that API is
+used.
+
+The **jdeprscan** tool doesn't follow the same set of rules for
+emitting warnings as specified for Java compilers in [JLS section
+9.6.4.6][jls9646]. In particular, **jdeprscan** does not respond to
+the `@SuppressWarnings` annotation, as that is significant only in
+source code, not in class files. In addition, **jdeprscan** emits
+warnings even if the usage is within the API element that is
+deprecated and when the use and declaration are within the same
+outermost class.
+
+[jls9646]: http://docs.oracle.com/javase/specs/jls/se8/html/jls-9.html#jls-9.6.4.6
+
+[jls131]: http://docs.oracle.com/javase/specs/jls/se8/html/jls-13.html#jls-13.1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/resources/jdeprscan.properties	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,96 @@
+main.usage=\
+Usage: jdeprscan [options] '{dir|jar|class}' ...\n\
+\n\
+options:\n\
+\  -cp  --class-path PATH\n\
+\       --for-removal\n\
+\       --full-version\n\
+\  -h   --help\n\
+\  -l   --list\n\
+\       --release 6|7|8|9\n\
+\  -v   --verbose\n\
+\       --version
+
+main.help=\
+Scans each argument for usages of deprecated APIs. An argument\n\
+may be a directory specifying the root of a package hierarchy,\n\
+a JAR file, or a class name. The class name must be specified\n\
+using a fully qualified class name using the $ separator character\n\
+for nested classes, for example,\n\
+\n\
+\    java.lang.Thread$State\n\
+\n\
+The --class-path (-cp) option provides a search path for resolution\n\
+of dependent classes.\n\
+\n\
+The --for-removal option limits scanning or listing to APIs that are\n\
+deprecated for removal. Cannot be used with a release value of 6, 7, or 8.\n\
+\n\
+The --full-version option prints out the full version string of the tool.\n\
+\n\
+The --help option prints out a full help message.\n\
+\n\
+The --list (-l) option prints out the set of deprecated APIs. No scanning is done,\n\
+so no directory, jar, or class arguments should be provided.\n\
+\n\
+The --release option specifies the Java SE release that provides the set\n\
+of deprecated APIs for scanning.\n\
+\n\
+The --verbose (-v) option enables additional message output during processing.\n\
+\n\
+The --version option prints out the abbreviated version string of the tool.
+
+main.xhelp=\
+Unsupported options:\n\
+\n\
+\  --Xload-class CLASS\n\
+\      Loads deprecation information from the named class.\n\
+\  --Xload-csv CSVFILE\n\
+\      Loads deprecation information from the named CSV file.\n\
+\  --Xload-dir DIR\n\
+\      Loads deprecation information from the class hierarchy\n\
+\      at the named directory.\n\
+\  --Xload-jar JARFILE\n\
+\      Loads deprecation information from the named JAR file.\n\
+\  --Xload-jdk9 JAVA_HOME\n\
+\      Loads deprecation information from the JDK located at\n\
+\      JAVA_HOME, which must be a modular JDK.\n\
+\  --Xload-old-jdk JAVA_HOME\n\
+\      Loads deprecation information from the JDK located at\n\
+\      JAVA_HOME, which must not be a modular JDK. Instead, the\n\
+\      named JDK must be a "classic" JDK with an rt.jar file.\n\
+\  --Xload-self\n\
+\      Loads deprecation information by traversing the jrt:\n\
+\      filesystem of the running JDK image.\n\
+\  --Xcompiler-arg ARG\n\
+\      Adds ARG to the list of compiler arguments.\n\
+\  --Xcsv-comment COMMENT\n\
+\      Adds COMMENT as a comment line to the output CSV file.\n\
+\      Only effective if -Xprint-csv is also supplied.\n\
+\  --Xhelp\n\
+\      Prints this message.\n\
+\  --Xprint-csv\n\
+\      Prints a CSV file containing the loaded deprecation information\n\
+\      instead of scanning any classes or JAR files.
+
+error.prefix=Error:
+
+scan.process.class=Processing class {0}...
+
+scan.dep.normal=deprecated
+scan.dep.removal=deprecated FOR REMOVAL
+
+scan.out.extends={0} {1} extends class {2} {3}
+scan.out.implements={0} {1} implements interface {2} {3}
+scan.out.usestype={0} {1} uses type {2} {3}
+scan.out.usesmethodintype={0} {1} uses method in type {2} {3}
+scan.out.usesmethod={0} {1} uses method {2} {3} {4} {5}
+scan.out.usesintfmethodintype={0} {1} uses interface method in type {2} {3}
+scan.out.usesintfmethod={0} {1} uses interface method {2} {3} {4} {5}
+scan.out.usesfieldintype={0} {1} uses field in type {2} {3}
+scan.out.usesfield={0} {1} uses field {2} {3} {4}
+scan.out.usesfieldoftype={0} {1} uses field of type {2} {3} {4} {5}
+scan.out.hasfield={0} {1} has field {2} of type {3} {4}
+scan.out.methodparmtype={0} {1} method {2} has parameter type {3} {4}
+scan.out.methodrettype={0} {1} method {2} has return type {3} {4}
+scan.out.methodoverride={0} {1} overrides method {2} {3} {4} {5}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/CPEntries.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.jdeprscan.scan;
+
+import java.util.ArrayList;
+import java.util.Formatter;
+import java.util.List;
+import java.util.Locale;
+
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPool;
+
+import static com.sun.tools.classfile.ConstantPool.CPInfo;
+
+/**
+ * A container for selected constant pool entries. There are currently
+ * lists that contain the following types of CP entries:
+ *
+ *  - CONSTANT_Class_info
+ *  - CONSTANT_Fieldref_info
+ *  - CONSTANT_Methodref_info
+ *  - CONSTANT_InterfaceMethodref_info
+ */
+class CPEntries {
+    final List<ConstantPool.CONSTANT_Class_info> classes = new ArrayList<>();
+    final List<ConstantPool.CONSTANT_Fieldref_info> fieldRefs = new ArrayList<>();
+    final List<ConstantPool.CONSTANT_Methodref_info> methodRefs = new ArrayList<>();
+    final List<ConstantPool.CONSTANT_InterfaceMethodref_info> intfMethodRefs = new ArrayList<>();
+
+    public static CPEntries loadFrom(ClassFile cf) {
+        CPEntries entries = new CPEntries();
+        for (CPInfo cpi : cf.constant_pool.entries()) {
+            cpi.accept(new CPSelector(), entries);
+        }
+        return entries;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        Formatter f = new Formatter(sb, Locale.getDefault());
+        f.format("Classes:%n");
+        f.format("%s%n", classes);
+        f.format("FieldRefs:%n");
+        f.format("%s%n", fieldRefs);
+        f.format("MethodRefs:%n");
+        f.format("%s%n", methodRefs);
+        f.format("InterfaceMethodRefs:%n");
+        f.format("%s%n", intfMethodRefs);
+        f.flush();
+        return sb.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/CPSelector.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.jdeprscan.scan;
+
+import com.sun.tools.classfile.ConstantPool;
+
+/**
+ * A visitor that selects constant pool entries by type and adds
+ * them to the given CPEntries object.
+ */
+class CPSelector implements ConstantPool.Visitor<Void,CPEntries> {
+    @Override
+    public Void visitClass(ConstantPool.CONSTANT_Class_info info, CPEntries p) {
+        p.classes.add(info);
+        return null;
+    }
+
+    @Override
+    public Void visitDouble(ConstantPool.CONSTANT_Double_info info, CPEntries p) {
+        return null;
+    }
+
+    @Override
+    public Void visitFieldref(ConstantPool.CONSTANT_Fieldref_info info, CPEntries p) {
+        p.fieldRefs.add(info);
+        return null;
+    }
+
+    @Override
+    public Void visitFloat(ConstantPool.CONSTANT_Float_info info, CPEntries p) {
+        return null;
+    }
+
+    @Override
+    public Void visitInteger(ConstantPool.CONSTANT_Integer_info info, CPEntries p) {
+        return null;
+    }
+
+    @Override
+    public Void visitInterfaceMethodref(ConstantPool.CONSTANT_InterfaceMethodref_info info, CPEntries p) {
+        p.intfMethodRefs.add(info);
+        return null;
+    }
+
+    @Override
+    public Void visitInvokeDynamic(ConstantPool.CONSTANT_InvokeDynamic_info info, CPEntries p) {
+        return null;
+    }
+
+    @Override
+    public Void visitLong(ConstantPool.CONSTANT_Long_info info, CPEntries p) {
+        return null;
+    }
+
+    @Override
+    public Void visitNameAndType(ConstantPool.CONSTANT_NameAndType_info info, CPEntries p) {
+        return null;
+    }
+
+    @Override
+    public Void visitMethodref(ConstantPool.CONSTANT_Methodref_info info, CPEntries p) {
+        p.methodRefs.add(info);
+        return null;
+    }
+
+    @Override
+    public Void visitMethodHandle(ConstantPool.CONSTANT_MethodHandle_info info, CPEntries p) {
+        return null;
+    }
+
+    @Override
+    public Void visitMethodType(ConstantPool.CONSTANT_MethodType_info info, CPEntries p) {
+        return null;
+    }
+
+    @Override
+    public Void visitString(ConstantPool.CONSTANT_String_info info, CPEntries p) {
+        return null;
+    }
+
+    @Override
+    public Void visitUtf8(ConstantPool.CONSTANT_Utf8_info info, CPEntries p) {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/ClassFinder.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.jdeprscan.scan;
+
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPoolException;
+
+import java.io.IOException;
+import java.net.URI;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.stream.Stream;
+
+/**
+ * A simple search path for classes.
+ */
+public class ClassFinder {
+    final List<PathEntry> list = new ArrayList<>();
+    final boolean verbose;
+
+    public ClassFinder(boolean verbose) {
+        this.verbose = verbose;
+    }
+
+    /**
+     * Adds a directory to this finder's search path, ignoring errors.
+     *
+     * @param dirName the directory to add
+     */
+    public void addDir(String dirName) {
+        Path dir = Paths.get(dirName);
+
+        if (Files.isDirectory(dir)) {
+            list.add(new DirPathEntry(dir));
+        }
+    }
+
+    /**
+     * Adds a jar file to this finder's search path, ignoring errors.
+     *
+     * @param jarName the jar file name to add
+     */
+    public void addJar(String jarName) {
+        try {
+            list.add(new JarPathEntry(new JarFile(jarName)));
+        } catch (IOException ignore) { }
+    }
+
+    /**
+     * Adds the JRT filesystem to this finder's search path.
+     */
+    public void addJrt() {
+        list.add(new JrtPathEntry());
+    }
+
+    /**
+     * Searches the class path for a class with the given name,
+     * returning a ClassFile for it. Returns null if not found.
+     *
+     * @param className the class to search for
+     * @return a ClassFile instance, or null if not found
+     */
+    public ClassFile find(String className) {
+        for (PathEntry pe : list) {
+            ClassFile cf = pe.find(className);
+            if (cf != null) {
+                return cf;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * An entry in this finder's class path.
+     */
+    interface PathEntry {
+        /**
+         * Returns a ClassFile instance corresponding to this name,
+         * or null if it's not present in this entry.
+         *
+         * @param className the class to search for
+         * @return a ClassFile instance, or null if not found
+         */
+        ClassFile find(String className);
+    }
+
+    /**
+     * An entry that represents a jar file.
+     */
+    class JarPathEntry implements PathEntry {
+        final JarFile jarFile;
+
+        JarPathEntry(JarFile jf) {
+            jarFile = jf;
+        }
+
+        @Override
+        public ClassFile find(String className) {
+            JarEntry entry = jarFile.getJarEntry(className + ".class");
+            if (entry == null) {
+                return null;
+            }
+            try {
+                return ClassFile.read(jarFile.getInputStream(entry));
+            } catch (IOException | ConstantPoolException ex) {
+                if (verbose) {
+                    ex.printStackTrace();
+                }
+            }
+            return null;
+        }
+    }
+
+    /**
+     * An entry that represents a directory containing a class hierarchy.
+     */
+    class DirPathEntry implements PathEntry {
+        final Path dir;
+
+        DirPathEntry(Path dir) {
+            this.dir = dir;
+        }
+
+        @Override
+        public ClassFile find(String className) {
+            Path classFileName = dir.resolve(className + ".class");
+            try {
+                return ClassFile.read(classFileName);
+            } catch (NoSuchFileException nsfe) {
+                // not found, return silently
+            } catch (IOException | ConstantPoolException ex) {
+                if (verbose) {
+                    ex.printStackTrace();
+                }
+            }
+            return null;
+        }
+    }
+
+    /**
+     * An entry that represents the JRT filesystem in the running image.
+     *
+     * JRT filesystem structure is:
+     *     /packages/<dotted-pkgname>/<modlink>
+     * where modlink is a symbolic link to /modules/<modname> which is
+     * the top of the usual package-class hierarchy
+     */
+    class JrtPathEntry implements PathEntry {
+        final FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+
+        @Override
+        public ClassFile find(String className) {
+            int end = className.lastIndexOf('/');
+            if (end < 0) {
+                return null;
+            }
+            String pkg = "/packages/" + className.substring(0, end)
+                                                 .replace('/', '.');
+            try (Stream<Path> mods = Files.list(fs.getPath(pkg))) {
+                Optional<Path> opath =
+                    mods.map(path -> path.resolve(className + ".class"))
+                        .filter(Files::exists)
+                        .findFirst();
+                if (opath.isPresent()) {
+                    return ClassFile.read(opath.get());
+                } else {
+                    return null;
+                }
+            } catch (NoSuchFileException nsfe) {
+                // not found, return silently
+            } catch (IOException | ConstantPoolException ex) {
+                if (verbose) {
+                    ex.printStackTrace();
+                }
+            }
+            return null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/MethodSig.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.jdeprscan.scan;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Represents a method's signature, that is, its parameter types
+ * and its return type.
+ */
+public class MethodSig {
+    final List<String> parameters;
+    final String returnType;
+
+    /**
+     * Parses the method descriptor and returns a MethodSig instance.
+     *
+     * @param desc the descriptor to parse
+     * @return the new MethodSig instance
+     */
+    public static MethodSig fromDesc(String desc) {
+        return parse(desc, 0, desc.length());
+    }
+
+    /**
+     * Returns this method's return type.
+     *
+     * @return the return type
+     */
+    public String getReturnType() {
+        return returnType;
+    }
+
+    /**
+     * Returns a list of parameters of this method.
+     *
+     * @return the parameter list
+     */
+    public List<String> getParameters() {
+        return parameters;
+    }
+
+    /**
+     * Returns a string describing this method.
+     *
+     * @return the string description
+     */
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("parameters");
+        if (parameters.isEmpty()) {
+            sb.append(" none");
+        } else {
+            int i = 0;
+            for (String p : parameters) {
+                sb.append(String.format(" %d=%s", i++, p));
+            }
+        }
+        sb.append(String.format(" return %s", returnType));
+        return sb.toString();
+    }
+
+    private MethodSig(List<String> parameters, String returnType) {
+        this.parameters = Collections.unmodifiableList(parameters);
+        this.returnType = returnType;
+    }
+
+    private static IllegalArgumentException ex(String desc, int pos) {
+        return new IllegalArgumentException(String.format(
+            "illegal descriptor \"%s\" at position %d", desc, pos));
+    }
+
+    private static MethodSig parse(String desc, int start, int end)
+            throws IllegalArgumentException {
+        int p = start;
+        int dims = 0;
+        boolean inReturnType = false;
+        String returnType = null;
+        List<String> parameters = new ArrayList<>();
+
+        while (p < end) {
+            String type;
+            char ch;
+            switch (ch = desc.charAt(p)) {
+                case '(':
+                    p++;
+                    continue;
+
+                case ')':
+                    p++;
+                    inReturnType = true;
+                    continue;
+
+                case '[':
+                    p++;
+                    dims++;
+                    continue;
+
+                case 'B': // byte
+                case 'C': // char
+                case 'D': // double
+                case 'F': // float
+                case 'I': // int
+                case 'J': // long
+                case 'S': // short
+                case 'Z': // boolean
+                case 'V': // void
+                    type = Character.toString(ch);
+                    p++;
+                    break;
+
+                case 'L':
+                    int sep = desc.indexOf(';', p);
+                    if (sep == -1 || sep >= end)
+                        throw ex(desc, p);
+                    type = desc.substring(p, ++sep);
+                    p = sep;
+                    break;
+
+                default:
+                    throw ex(desc, p);
+            }
+
+            StringBuilder sb = new StringBuilder();
+            for ( ; dims > 0; dims-- )
+                sb.append("[");
+            sb.append(type);
+            if (inReturnType) {
+                returnType = sb.toString();
+            } else {
+                parameters.add(sb.toString());
+            }
+        }
+
+        if (returnType == null) {
+            throw ex(desc, end);
+        }
+
+        return new MethodSig(parameters, returnType);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,614 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.jdeprscan.scan;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayDeque;
+import java.util.Deque;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import com.sun.tools.classfile.*;
+import com.sun.tools.jdeprscan.DeprData;
+import com.sun.tools.jdeprscan.DeprDB;
+import com.sun.tools.jdeprscan.Messages;
+
+import static com.sun.tools.classfile.AccessFlags.*;
+import static com.sun.tools.classfile.ConstantPool.*;
+
+/**
+ * An object that represents the scanning phase of deprecation usage checking.
+ * Given a deprecation database, scans the targeted directory hierarchy, jar
+ * file, or individual class for uses of deprecated APIs.
+ */
+public class Scan {
+    final PrintStream out;
+    final PrintStream err;
+    final List<String> classPath;
+    final DeprDB db;
+    final boolean verbose;
+
+    final ClassFinder finder;
+    boolean error = false;
+
+    public Scan(PrintStream out,
+                PrintStream err,
+                List<String> classPath,
+                DeprDB db,
+                boolean verbose) {
+        this.out = out;
+        this.err = err;
+        this.classPath = classPath;
+        this.db = db;
+        this.verbose = verbose;
+
+        ClassFinder f = new ClassFinder(verbose);
+
+        // TODO: this isn't quite right. If we've specified a release other than the current
+        // one, we should instead add a reference to the symbol file for that release instead
+        // of the current image. The problems are a) it's unclear how to get from a release
+        // to paths that reference the symbol files, as this might be internal to the file
+        // manager; and b) the symbol file includes .sig files, not class files, which ClassFile
+        // might not be able to handle.
+        f.addJrt();
+
+        for (String name : classPath) {
+            if (name.endsWith(".jar")) {
+                f.addJar(name);
+            } else {
+                f.addDir(name);
+            }
+        }
+
+        finder = f;
+    }
+
+    Pattern typePattern = Pattern.compile("\\[*L(.*);");
+
+    // "flattens" an array type name to its component type
+    // and a reference type "Lpkg/pkg/pkg/name;" to its base name
+    // "pkg/pkg/pkg/name".
+    // TODO: deal with primitive types
+    String flatten(String typeName) {
+        Matcher matcher = typePattern.matcher(typeName);
+        if (matcher.matches()) {
+            return matcher.group(1);
+        } else {
+            return typeName;
+        }
+    }
+
+    String typeKind(ClassFile cf) {
+        AccessFlags flags = cf.access_flags;
+        if (flags.is(ACC_ENUM)) {
+            return "enum";
+        } else if (flags.is(ACC_ANNOTATION)) {
+            return "@interface";
+        } else if (flags.is(ACC_INTERFACE)) {
+            return "interface";
+        } else {
+            return "class";
+        }
+    }
+
+    void printType(String key, ClassFile cf, String cname, boolean forRemoval)
+            throws ConstantPoolException {
+        String dep = Messages.get(forRemoval ? "scan.dep.removal" : "scan.dep.normal");
+        out.println(Messages.get(key, typeKind(cf), cf.getName(), cname, dep));
+    }
+
+    void printMethod(String key, ClassFile cf, String cname, String mname, String rtype,
+                     boolean forRemoval) throws ConstantPoolException {
+        String dep = Messages.get(forRemoval ? "scan.dep.removal" : "scan.dep.normal");
+        out.println(Messages.get(key, typeKind(cf), cf.getName(), cname, mname, rtype, dep));
+    }
+
+    void printField(String key, ClassFile cf, String cname, String fname,
+                     boolean forRemoval) throws ConstantPoolException {
+        String dep = Messages.get(forRemoval ? "scan.dep.removal" : "scan.dep.normal");
+        out.println(Messages.get(key, typeKind(cf), cf.getName(), cname, fname, dep));
+    }
+
+    void printFieldType(String key, ClassFile cf, String cname, String fname, String type,
+                     boolean forRemoval) throws ConstantPoolException {
+        String dep = Messages.get(forRemoval ? "scan.dep.removal" : "scan.dep.normal");
+        out.println(Messages.get(key, typeKind(cf), cf.getName(), cname, fname, type, dep));
+    }
+
+    void printHasField(ClassFile cf, String fname, String type, boolean forRemoval)
+            throws ConstantPoolException {
+        String dep = Messages.get(forRemoval ? "scan.dep.removal" : "scan.dep.normal");
+        out.println(Messages.get("scan.out.hasfield", typeKind(cf), cf.getName(), fname, type, dep));
+    }
+
+    void printHasMethodParmType(ClassFile cf, String mname, String parmType, boolean forRemoval)
+            throws ConstantPoolException {
+        String dep = Messages.get(forRemoval ? "scan.dep.removal" : "scan.dep.normal");
+        out.println(Messages.get("scan.out.methodparmtype", typeKind(cf), cf.getName(), mname, parmType, dep));
+    }
+
+    void printHasMethodRetType(ClassFile cf, String mname, String retType, boolean forRemoval)
+            throws ConstantPoolException {
+        String dep = Messages.get(forRemoval ? "scan.dep.removal" : "scan.dep.normal");
+        out.println(Messages.get("scan.out.methodrettype", typeKind(cf), cf.getName(), mname, retType, dep));
+    }
+
+    void printHasOverriddenMethod(ClassFile cf, String overridden, String mname, String desc, boolean forRemoval)
+            throws ConstantPoolException {
+        String dep = Messages.get(forRemoval ? "scan.dep.removal" : "scan.dep.normal");
+        out.println(Messages.get("scan.out.methodoverride", typeKind(cf), cf.getName(), overridden,
+                                 mname, desc, dep));
+    }
+
+    // format should not have a newline
+    void err(String format, Object... args) {
+        error = true;
+        err.print("error: ");
+        err.printf(format, args);
+        err.println();
+    }
+
+    void printException(Exception ex) {
+        err.print(Messages.get("error.prefix"));
+        err.print(" ");
+        if (verbose) {
+            ex.printStackTrace(err);
+        } else {
+            err.print(ex);
+        }
+    }
+
+    /**
+     * Checks whether a member (method or field) is present in a class.
+     * The checkMethod parameter determines whether this checks for a method
+     * or for a field.
+     *
+     * @param targetClass the ClassFile of the class to search
+     * @param targetName the method or field's name
+     * @param targetDesc the methods descriptor (ignored if checkMethod is false)
+     * @param checkMethod true if checking for method, false if checking for field
+     * @return boolean indicating whether the member is present
+     * @throws ConstantPoolException if a constant pool entry cannot be found
+     */
+    boolean isMemberPresent(ClassFile targetClass,
+                            String targetName,
+                            String targetDesc,
+                            boolean checkMethod)
+            throws ConstantPoolException {
+        if (checkMethod) {
+            for (Method m : targetClass.methods) {
+                String mname = m.getName(targetClass.constant_pool);
+                String mdesc = targetClass.constant_pool.getUTF8Value(m.descriptor.index);
+                if (targetName.equals(mname) && targetDesc.equals(mdesc)) {
+                    return true;
+                }
+            }
+        } else {
+            for (Field f : targetClass.fields) {
+                String fname = f.getName(targetClass.constant_pool);
+                if (targetName.equals(fname)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Adds all interfaces from this class to the deque of interfaces.
+     *
+     * @param intfs the deque of interfaces
+     * @param cf the ClassFile of this class
+     * @throws ConstantPoolException if a constant pool entry cannot be found
+     */
+    void addInterfaces(Deque<String> intfs, ClassFile cf)
+            throws ConstantPoolException {
+        int count = cf.interfaces.length;
+        for (int i = 0; i < count; i++) {
+            intfs.addLast(cf.getInterfaceName(i));
+        }
+    }
+
+    /**
+     * Resolves a member by searching this class and all its superclasses and
+     * implemented interfaces.
+     *
+     * TODO: handles a few too many cases; needs cleanup.
+     *
+     * TODO: refine error handling
+     *
+     * @param cf the ClassFile of this class
+     * @param startClassName the name of the class at which to start searching
+     * @param findName the member name to search for
+     * @param findDesc the method descriptor to search for (ignored for fields)
+     * @param resolveMethod true if resolving a method, false if resolving a field
+     * @param checkStartClass true if the start class should be searched, false if
+     *                        it should be skipped
+     * @return the name of the class where the member resolved, or null
+     * @throws ConstantPoolException if a constant pool entry cannot be found
+     */
+    String resolveMember(
+            ClassFile cf, String startClassName, String findName, String findDesc,
+            boolean resolveMethod, boolean checkStartClass)
+            throws ConstantPoolException {
+        ClassFile startClass;
+
+        if (cf.getName().equals(startClassName)) {
+            startClass = cf;
+        } else {
+            startClass = finder.find(startClassName);
+            if (startClass == null) {
+                err("can't find class %s", startClassName);
+                return startClassName;
+            }
+        }
+
+        // follow super_class until it's 0, meaning we've reached Object
+        // accumulate interfaces of superclasses as we go along
+
+        ClassFile curClass = startClass;
+        Deque<String> intfs = new ArrayDeque<>();
+        while (true) {
+            if ((checkStartClass || curClass != startClass) &&
+                    isMemberPresent(curClass, findName, findDesc, resolveMethod)) {
+                break;
+            }
+
+            if (curClass.super_class == 0) { // reached Object
+                curClass = null;
+                break;
+            }
+
+            String superName = curClass.getSuperclassName();
+            curClass = finder.find(superName);
+            if (curClass == null) {
+                err("can't find class %s", superName);
+                break;
+            }
+            addInterfaces(intfs, curClass);
+        }
+
+        // search interfaces: add all interfaces and superinterfaces to queue
+        // search until it's empty
+
+        if (curClass == null) {
+            addInterfaces(intfs, startClass);
+            while (intfs.size() > 0) {
+                String intf = intfs.removeFirst();
+                curClass = finder.find(intf);
+                if (curClass == null) {
+                    err("can't find interface %s", intf);
+                    break;
+                }
+
+                if (isMemberPresent(curClass, findName, findDesc, resolveMethod)) {
+                    break;
+                }
+
+                addInterfaces(intfs, curClass);
+            }
+        }
+
+        if (curClass == null) {
+            if (checkStartClass) {
+                err("can't resolve methodref %s %s %s",
+                    startClassName, findName, findDesc);
+                return startClassName;
+            } else {
+                // TODO: refactor this
+                // checkStartClass == false means we're checking for overrides
+                // so not being able to resolve a method simply means there's
+                // no overriding, which isn't an error
+                return null;
+            }
+        } else {
+            String foundClassName = curClass.getName();
+            return foundClassName;
+        }
+    }
+
+    /**
+     * Checks the superclass of this class.
+     *
+     * @param cf the ClassFile of this class
+     * @throws ConstantPoolException if a constant pool entry cannot be found
+     */
+    void checkSuper(ClassFile cf) throws ConstantPoolException {
+        String sname = cf.getSuperclassName();
+        DeprData dd = db.getTypeDeprecated(sname);
+        if (dd != null) {
+            printType("scan.out.extends", cf, sname, dd.isForRemoval());
+        }
+    }
+
+    /**
+     * Checks the interfaces of this class.
+     *
+     * @param cf the ClassFile of this class
+     * @throws ConstantPoolException if a constant pool entry cannot be found
+     */
+    void checkInterfaces(ClassFile cf) throws ConstantPoolException {
+        int ni = cf.interfaces.length;
+        for (int i = 0; i < ni; i++) {
+            String iname = cf.getInterfaceName(i);
+            DeprData dd = db.getTypeDeprecated(iname);
+            if (dd != null) {
+                printType("scan.out.implements", cf, iname, dd.isForRemoval());
+            }
+        }
+    }
+
+    /**
+     * Checks types referred to from the constant pool.
+     *
+     * @param cf the ClassFile of this class
+     * @param entries constant pool entries collected from this class
+     * @throws ConstantPoolException if a constant pool entry cannot be found
+     */
+    void checkTypes(ClassFile cf, CPEntries entries) throws ConstantPoolException {
+        for (ConstantPool.CONSTANT_Class_info ci : entries.classes) {
+            String typeName = ci.getName();
+            DeprData dd = db.getTypeDeprecated(flatten(typeName));
+            if (dd != null) {
+                printType("scan.out.usestype", cf, typeName, dd.isForRemoval());
+            }
+        }
+    }
+
+    /**
+     * Checks methods referred to from the constant pool.
+     *
+     * @param cf the ClassFile of this class
+     * @param nti the NameAndType_info from a MethodRef or InterfaceMethodRef entry
+     * @param clname the class name
+     * @param typeKey key for the type message
+     * @param methKey key for the method message
+     * @throws ConstantPoolException if a constant pool entry cannot be found
+     */
+    void checkMethodRef(ClassFile cf,
+                        CONSTANT_NameAndType_info nti,
+                        String clname,
+                        String typeKey,
+                        String methKey) throws ConstantPoolException {
+        DeprData dd = db.getTypeDeprecated(flatten(clname));
+        if (dd != null) {
+            printType(typeKey, cf, clname, dd.isForRemoval());
+        }
+
+        String name = nti.getName();
+        String type = nti.getType();
+        clname = resolveMember(cf, flatten(clname), name, type, true, true);
+        dd = db.getMethodDeprecated(clname, name, type);
+        if (dd != null) {
+            printMethod(methKey, cf, clname, name, type, dd.isForRemoval());
+        }
+    }
+
+    /**
+     * Checks fields referred to from the constant pool.
+     *
+     * @param cf the ClassFile of this class
+     * @throws ConstantPoolException if a constant pool entry cannot be found
+     */
+    void checkFieldRef(ClassFile cf,
+                       ConstantPool.CONSTANT_Fieldref_info fri) throws ConstantPoolException {
+        CONSTANT_NameAndType_info nti = fri.getNameAndTypeInfo();
+        String clname = fri.getClassName();
+        String name = nti.getName();
+        String type = nti.getType();
+        DeprData dd = db.getTypeDeprecated(clname);
+
+        if (dd != null) {
+            printType("scan.out.usesfieldintype", cf, clname, dd.isForRemoval());
+        }
+
+        clname = resolveMember(cf, flatten(clname), name, type, false, true);
+        dd = db.getFieldDeprecated(clname, name);
+        if (dd != null) {
+            printField("scan.out.usesfield", cf, clname, name, dd.isForRemoval());
+        }
+
+        dd = db.getTypeDeprecated(flatten(type));
+        if (dd != null) {
+            printFieldType("scan.out.usesfieldoftype", cf, clname, name, type, dd.isForRemoval());
+        }
+    }
+
+    /**
+     * Checks the fields declared in this class.
+     *
+     * @param cf the ClassFile of this class
+     * @throws ConstantPoolException if a constant pool entry cannot be found
+     */
+    void checkFields(ClassFile cf) throws ConstantPoolException {
+        for (Field f : cf.fields) {
+            String type = cf.constant_pool.getUTF8Value(f.descriptor.index);
+            DeprData dd = db.getTypeDeprecated(flatten(type));
+            if (dd != null) {
+                printHasField(cf, f.getName(cf.constant_pool), type, dd.isForRemoval());
+            }
+        }
+    }
+
+    /**
+     * Checks the methods declared in this class.
+     *
+     * @param cf the ClassFile object of this class
+     * @throws ConstantPoolException if a constant pool entry cannot be found
+     */
+    void checkMethods(ClassFile cf) throws ConstantPoolException {
+        for (Method m : cf.methods) {
+            String mname = m.getName(cf.constant_pool);
+            String desc = cf.constant_pool.getUTF8Value(m.descriptor.index);
+            MethodSig sig = MethodSig.fromDesc(desc);
+            DeprData dd;
+
+            for (String parm : sig.getParameters()) {
+                dd = db.getTypeDeprecated(flatten(parm));
+                if (dd != null) {
+                    printHasMethodParmType(cf, mname, parm, dd.isForRemoval());
+                }
+            }
+
+            String ret = sig.getReturnType();
+            dd = db.getTypeDeprecated(flatten(ret));
+            if (dd != null) {
+                printHasMethodRetType(cf, mname, ret, dd.isForRemoval());
+            }
+
+            // check overrides
+            String overridden = resolveMember(cf, cf.getName(), mname, desc, true, false);
+            if (overridden != null) {
+                dd = db.getMethodDeprecated(overridden, mname, desc);
+                if (dd != null) {
+                    printHasOverriddenMethod(cf, overridden, mname, desc, dd.isForRemoval());
+                }
+            }
+        }
+    }
+
+    /**
+     * Processes a single class file.
+     *
+     * @param cf the ClassFile of the class
+     * @throws ConstantPoolException if a constant pool entry cannot be found
+     */
+    void processClass(ClassFile cf) throws ConstantPoolException {
+        if (verbose) {
+            out.println(Messages.get("scan.process.class", cf.getName()));
+        }
+
+        CPEntries entries = CPEntries.loadFrom(cf);
+
+        checkSuper(cf);
+        checkInterfaces(cf);
+        checkTypes(cf, entries);
+
+        for (ConstantPool.CONSTANT_Methodref_info mri : entries.methodRefs) {
+            CONSTANT_NameAndType_info nti = mri.getNameAndTypeInfo();
+            String clname = mri.getClassName();
+            checkMethodRef(cf, nti, clname, "scan.out.usesmethodintype", "scan.out.usesmethod");
+        }
+
+        for (ConstantPool.CONSTANT_InterfaceMethodref_info imri : entries.intfMethodRefs) {
+            CONSTANT_NameAndType_info nti = imri.getNameAndTypeInfo();
+            String clname = imri.getClassName();
+            checkMethodRef(cf, nti, clname, "scan.out.usesintfmethodintype", "scan.out.usesintfmethod");
+        }
+
+        for (ConstantPool.CONSTANT_Fieldref_info fri : entries.fieldRefs) {
+            checkFieldRef(cf, fri);
+        }
+
+        checkFields(cf);
+        checkMethods(cf);
+    }
+
+    /**
+     * Scans a jar file for uses of deprecated APIs.
+     *
+     * @param jarname the jar file to process
+     * @return true on success, false on failure
+     */
+    public boolean scanJar(String jarname) {
+        try (JarFile jf = new JarFile(jarname)) {
+            finder.addJar(jarname);
+            Enumeration<JarEntry> entries = jf.entries();
+            while (entries.hasMoreElements()) {
+                JarEntry entry = entries.nextElement();
+                String name = entry.getName();
+                if (name.endsWith(".class")
+                        && !name.endsWith("package-info.class")
+                        && !name.endsWith("module-info.class")) {
+                    processClass(ClassFile.read(jf.getInputStream(entry)));
+                }
+            }
+            return true;
+        } catch (IOException | ConstantPoolException ex) {
+            printException(ex);
+            return false;
+        }
+    }
+
+    /**
+     * Scans class files in the named directory hierarchy for uses of deprecated APIs.
+     *
+     * @param dirname the directory hierarchy to process
+     * @return true on success, false on failure
+     */
+    public boolean scanDir(String dirname) {
+        Path base = Paths.get(dirname);
+        int baseCount = base.getNameCount();
+        finder.addDir(dirname);
+        try (Stream<Path> paths = Files.walk(Paths.get(dirname))) {
+            List<Path> classes =
+                paths.filter(p -> p.getNameCount() > baseCount)
+                     .filter(path -> path.toString().endsWith(".class"))
+                     .filter(path -> !path.toString().endsWith("package-info.class"))
+                     .filter(path -> !path.toString().endsWith("module-info.class"))
+                     .collect(Collectors.toList());
+            for (Path p : classes) {
+                processClass(ClassFile.read(p));
+            }
+            return true;
+        } catch (IOException | ConstantPoolException ex) {
+            printException(ex);
+            return false;
+        }
+    }
+
+    /**
+     * Scans the named class for uses of deprecated APIs.
+     *
+     * @param className the class to scan
+     * @return true on success, false on failure
+     */
+    public boolean processClassName(String className) {
+        try {
+            ClassFile cf = finder.find(className);
+            if (cf == null) {
+                err("can't find class %s", className);
+                return false;
+            } else {
+                processClass(cf);
+                return true;
+            }
+        } catch (ConstantPoolException ex) {
+            printException(ex);
+            return false;
+        }
+    }
+}
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ExternalEditor.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ExternalEditor.java	Fri Aug 26 14:47:52 2016 -0700
@@ -34,6 +34,7 @@
 import java.nio.file.WatchKey;
 import java.nio.file.WatchService;
 import java.util.Arrays;
+import java.util.Scanner;
 import java.util.function.Consumer;
 import java.util.stream.Collectors;
 import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
@@ -46,17 +47,22 @@
 public class ExternalEditor {
     private final Consumer<String> errorHandler;
     private final Consumer<String> saveHandler;
+    private final Consumer<String> printHandler;
     private final IOContext input;
+    private final boolean wait;
 
     private WatchService watcher;
     private Thread watchedThread;
     private Path dir;
     private Path tmpfile;
 
-    ExternalEditor(Consumer<String> errorHandler, Consumer<String> saveHandler, IOContext input) {
+    ExternalEditor(Consumer<String> errorHandler, Consumer<String> saveHandler,
+            IOContext input, boolean wait, Consumer<String> printHandler) {
         this.errorHandler = errorHandler;
         this.saveHandler = saveHandler;
+        this.printHandler = printHandler;
         this.input = input;
+        this.wait = wait;
     }
 
     private void edit(String[] cmd, String initialText) {
@@ -121,7 +127,16 @@
         try {
             input.suspend();
             Process process = pb.start();
-            process.waitFor();
+            // wait to exit edit mode in one of these ways...
+            if (wait) {
+                // -wait option -- ignore process exit, wait for carriage-return
+                Scanner scanner = new Scanner(System.in);
+                printHandler.accept("jshell.msg.press.return.to.leave.edit.mode");
+                scanner.nextLine();
+            } else {
+                // wait for process to exit
+                process.waitFor();
+            }
         } catch (IOException ex) {
             errorHandler.accept("process IO failure: " + ex.getMessage());
         } catch (InterruptedException ex) {
@@ -148,8 +163,8 @@
     }
 
     static void edit(String[] cmd, Consumer<String> errorHandler, String initialText,
-            Consumer<String> saveHandler, IOContext input) {
-        ExternalEditor ed = new ExternalEditor(errorHandler,  saveHandler, input);
+            Consumer<String> saveHandler, IOContext input, boolean wait, Consumer<String> printHandler) {
+        ExternalEditor ed = new ExternalEditor(errorHandler, saveHandler, input, wait, printHandler);
         ed.edit(cmd, initialText);
     }
 }
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Feedback.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Feedback.java	Fri Aug 26 14:47:52 2016 -0700
@@ -147,17 +147,17 @@
     }
 
     {
-        for (FormatCase e : EnumSet.allOf(FormatCase.class))
+        for (FormatCase e : FormatCase.all)
             selectorMap.put(e.name().toLowerCase(Locale.US), e);
-        for (FormatAction e : EnumSet.allOf(FormatAction.class))
+        for (FormatAction e : FormatAction.all)
             selectorMap.put(e.name().toLowerCase(Locale.US), e);
-        for (FormatResolve e : EnumSet.allOf(FormatResolve.class))
+        for (FormatResolve e : FormatResolve.all)
             selectorMap.put(e.name().toLowerCase(Locale.US), e);
-        for (FormatUnresolved e : EnumSet.allOf(FormatUnresolved.class))
+        for (FormatUnresolved e : FormatUnresolved.all)
             selectorMap.put(e.name().toLowerCase(Locale.US), e);
-        for (FormatErrors e : EnumSet.allOf(FormatErrors.class))
+        for (FormatErrors e : FormatErrors.all)
             selectorMap.put(e.name().toLowerCase(Locale.US), e);
-        for (FormatWhen e : EnumSet.allOf(FormatWhen.class))
+        for (FormatWhen e : FormatWhen.all)
             selectorMap.put(e.name().toLowerCase(Locale.US), e);
     }
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Fri Aug 26 14:47:52 2016 -0700
@@ -94,12 +94,16 @@
 import java.util.Spliterators;
 import java.util.function.Function;
 import java.util.function.Supplier;
+import jdk.internal.joptsimple.*;
 import jdk.internal.jshell.tool.Feedback.FormatAction;
 import jdk.internal.jshell.tool.Feedback.FormatCase;
 import jdk.internal.jshell.tool.Feedback.FormatErrors;
 import jdk.internal.jshell.tool.Feedback.FormatResolve;
 import jdk.internal.jshell.tool.Feedback.FormatUnresolved;
 import jdk.internal.jshell.tool.Feedback.FormatWhen;
+import static java.util.Arrays.asList;
+import static java.util.Arrays.stream;
+import static java.util.stream.Collectors.joining;
 import static java.util.stream.Collectors.toList;
 import static jdk.jshell.Snippet.SubKind.VAR_VALUE_SUBKIND;
 import static java.util.stream.Collectors.toMap;
@@ -181,6 +185,7 @@
     private String cmdlineClasspath = null;
     private String startup = null;
     private String[] editor = null;
+    private boolean editorWait = false;
 
     // Commands and snippets which should be replayed
     private List<String> replayableHistory;
@@ -477,6 +482,11 @@
         if (editorString == null || editorString.isEmpty()) {
             editor = null;
         } else {
+            char waitMarker = editorString.charAt(0);
+            if (waitMarker == '-' || waitMarker == '*') {
+                editorWait = waitMarker == '-';
+                editorString = editorString.substring(1);
+            }
             editor = editorString.split(RECORD_SEPARATOR);
         }
 
@@ -515,82 +525,91 @@
      * @return the list of files to be loaded
      */
     private List<String> processCommandArgs(String[] args) {
-        List<String> loadList = new ArrayList<>();
-        Iterator<String> ai = Arrays.asList(args).iterator();
-        while (ai.hasNext()) {
-            String arg = ai.next();
-            if (arg.startsWith("-")) {
-                switch (arg) {
-                    case "-classpath":
-                    case "-cp":
-                        if (cmdlineClasspath != null) {
-                            startmsg("jshell.err.opt.classpath.conflict");
-                            return null;
-                        }
-                        if (ai.hasNext()) {
-                            cmdlineClasspath = ai.next();
-                        } else {
-                            startmsg("jshell.err.opt.classpath.arg");
-                            return null;
-                        }
-                        break;
-                    case "-help":
-                        printUsage();
-                        return null;
-                    case "-version":
-                        cmdout.printf("jshell %s\n", version());
-                        return null;
-                    case "-fullversion":
-                        cmdout.printf("jshell %s\n", fullVersion());
-                        return null;
-                    case "-feedback":
-                        if (ai.hasNext()) {
-                            commandLineFeedbackMode = ai.next();
-                        } else {
-                            startmsg("jshell.err.opt.feedback.arg");
-                            return null;
-                        }
-                        break;
-                    case "-q":
-                        commandLineFeedbackMode = "concise";
-                        break;
-                    case "-qq":
-                        commandLineFeedbackMode = "silent";
-                        break;
-                    case "-v":
-                        commandLineFeedbackMode = "verbose";
-                        break;
-                    case "-startup":
-                        if (startup != null) {
-                            startmsg("jshell.err.opt.startup.one");
-                            return null;
-                        }
-                        startup = readFile(ai.hasNext()? ai.next() : null, "-startup");
-                        if (startup == null) {
-                            return null;
-                        }
-                        break;
-                    case "-nostartup":
-                        if (startup != null) {
-                            startmsg("jshell.err.opt.startup.one");
-                            return null;
-                        }
-                        startup = "";
-                        break;
-                    default:
-                        if (arg.startsWith("-R")) {
-                            remoteVMOptions.add(arg.substring(2));
-                            break;
-                        }
-                        startmsg("jshell.err.opt.unknown", arg);
-                        printUsage();
-                        return null;
-                }
+        OptionParser parser = new OptionParser();
+        OptionSpec<String> cp = parser.accepts("class-path").withRequiredArg();
+        OptionSpec<String> st = parser.accepts("startup").withRequiredArg();
+        parser.acceptsAll(asList("n", "no-startup"));
+        OptionSpec<String> fb = parser.accepts("feedback").withRequiredArg();
+        parser.accepts("q");
+        parser.accepts("s");
+        parser.accepts("v");
+        OptionSpec<String> r = parser.accepts("R").withRequiredArg();
+        parser.acceptsAll(asList("h", "help"));
+        parser.accepts("version");
+        parser.accepts("full-version");
+        NonOptionArgumentSpec<String> loadFileSpec = parser.nonOptions();
+
+        OptionSet options;
+        try {
+            options = parser.parse(args);
+        } catch (OptionException ex) {
+            if (ex.options().isEmpty()) {
+                startmsg("jshell.err.opt.invalid", stream(args).collect(joining(", ")));
             } else {
-                loadList.add(arg);
+                boolean isKnown = parser.recognizedOptions().containsKey(ex.options().iterator().next());
+                startmsg(isKnown
+                        ? "jshell.err.opt.arg"
+                        : "jshell.err.opt.unknown",
+                        ex.options()
+                        .stream()
+                        .collect(joining(", ")));
+            }
+            return null;
+        }
+
+        if (options.has("help")) {
+            printUsage();
+            return null;
+        }
+        if (options.has("version")) {
+            cmdout.printf("jshell %s\n", version());
+            return null;
+        }
+        if (options.has("full-version")) {
+            cmdout.printf("jshell %s\n", fullVersion());
+            return null;
+        }
+        if (options.has(cp)) {
+            List<String> cps = options.valuesOf(cp);
+            if (cps.size() > 1) {
+                startmsg("jshell.err.opt.one", "--class-path");
+                return null;
             }
+            cmdlineClasspath = cps.get(0);
         }
-        return loadList;
+        if (options.has(st)) {
+            List<String> sts = options.valuesOf(st);
+            if (sts.size() != 1 || options.has("no-startup")) {
+                startmsg("jshell.err.opt.startup.one");
+                return null;
+            }
+            startup = readFile(sts.get(0), "--startup");
+            if (startup == null) {
+                return null;
+            }
+        } else if (options.has("no-startup")) {
+            startup = "";
+        }
+        if ((options.valuesOf(fb).size() +
+                 (options.has("q") ? 1 : 0) +
+                 (options.has("s") ? 1 : 0) +
+                 (options.has("v") ? 1 : 0)) > 1) {
+            startmsg("jshell.err.opt.feedback.one");
+            return null;
+        } else if (options.has(fb)) {
+            commandLineFeedbackMode = options.valueOf(fb);
+        } else if (options.has("q")) {
+            commandLineFeedbackMode = "concise";
+        } else if (options.has("s")) {
+            commandLineFeedbackMode = "silent";
+        } else if (options.has("v")) {
+            commandLineFeedbackMode = "verbose";
+        }
+        if (options.has(r)) {
+            remoteVMOptions = options.valuesOf(r);
+        }
+
+        return options.valuesOf(loadFileSpec);
     }
 
     private void printUsage() {
@@ -686,7 +705,7 @@
         }
         if (commandLineFeedbackMode != null) {
             // The feedback mode to use was specified on the command line, use it
-            if (!feedback.setFeedback(initmh, new ArgTokenizer("-feedback", commandLineFeedbackMode))) {
+            if (!feedback.setFeedback(initmh, new ArgTokenizer("--feedback", commandLineFeedbackMode))) {
                 regenerateOnDeath = false;
             }
             commandLineFeedbackMode = null;
@@ -1247,7 +1266,7 @@
                 // retain editor setting
                 prefs.put(EDITOR_KEY, (editor == null)
                         ? ""
-                        : String.join(RECORD_SEPARATOR, editor));
+                        : (editorWait? "-" : "*") + String.join(RECORD_SEPARATOR, editor));
                 return true;
             case "start": {
                 if (!setStart(cmd, at, false)) {
@@ -1302,7 +1321,7 @@
 
     // The sub-command:  /set editor <editor-command-line>>
     boolean setEditor(ArgTokenizer at, boolean argsRequired) {
-        at.allowedOptions("-default");
+        at.allowedOptions("-default", "-wait");
         String prog = at.next();
         List<String> ed = new ArrayList<>();
         while (at.val() != null) {
@@ -1313,14 +1332,20 @@
             return false;
         }
         boolean defaultOption = at.hasOption("-default");
+        boolean waitOption = at.hasOption("-wait");
         if (prog != null) {
             if (defaultOption) {
                 errormsg("jshell.err.default.option.or.program", at.whole());
                 return false;
             }
             editor = ed.toArray(new String[ed.size()]);
+            editorWait = waitOption;
             fluffmsg("jshell.msg.set.editor.set", prog);
         } else if (defaultOption) {
+            if (waitOption) {
+                errormsg("jshell.err.wait.applies.to.external.editor", at.whole());
+                return false;
+            }
             editor = null;
         } else if (argsRequired) {
             errormsg("jshell.err.set.editor.arg");
@@ -1707,7 +1732,8 @@
                 return false;
             }
         } else {
-            ExternalEditor.edit(editor, errorHandler, src, saveHandler, input);
+            ExternalEditor.edit(editor, errorHandler, src, saveHandler, input,
+                    editorWait, this::hardrb);
         }
         return true;
     }
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Fri Aug 26 14:47:52 2016 -0700
@@ -26,10 +26,11 @@
 jshell.msg.welcome =\
 Welcome to JShell -- Version {0}\n\
 For an introduction type: /help intro\n
-jshell.err.opt.classpath.conflict = Conflicting -classpath option.
-jshell.err.opt.classpath.arg = Argument to -classpath missing.
-jshell.err.opt.feedback.arg = Argument to -feedback missing. Mode required.
-jshell.err.opt.startup.one = Only one -startup or -nostartup option may be used.
+jshell.err.opt.arg = Argument to {0} missing.
+jshell.err.opt.invalid = Invalid options: {0}.
+jshell.err.opt.one = Only one {0} option may be used.
+jshell.err.opt.startup.one = Only one --startup or --no-startup option may be used.
+jshell.err.opt.feedback.one = Only one feedback option (--feedback, -q, -s, or -v) may be used.
 jshell.err.opt.unknown = Unknown option: {0}
 
 jshell.msg.terminated =\
@@ -55,6 +56,8 @@
 jshell.msg.set.editor.set = Editor set to: {0}
 jshell.err.cant.launch.editor = Cannot launch editor -- unexpected exception: {0}
 jshell.msg.try.set.editor = Try /set editor to use external editor.
+jshell.msg.press.return.to.leave.edit.mode = Press return to leave edit mode.
+jshell.err.wait.applies.to.external.editor = -wait applies to external editors, cannot be used with -default
 
 jshell.msg.try.command.without.args = Try ''{0}'' without arguments.
 jshell.msg.no.active = There are no active definitions.
@@ -148,22 +151,21 @@
 help.usage = \
 Usage:   jshell <options> <load files>\n\
 where possible options include:\n\
-\    -classpath <path>    Specify where to find user class files\n\
-\    -cp <path>           Specify where to find user class files\n\
-\    -startup <file>      One run replacement for the start-up definitions\n\
-\    -nostartup           Do not run the start-up definitions\n\
-\    -feedback <mode>     Specify the initial feedback mode. The mode may be\n\
-\                         predefined (silent, concise, normal, or verbose) or\n\
-\                         previously user-defined\n\
-\    -q                   Quiet feedback.  Same as: -feedback concise\n\
-\    -qq                  Really quiet feedback.  Same as: -feedback silent\n\
-\    -v                   Verbose feedback.  Same as: -feedback verbose\n\
-\    -J<flag>             Pass <flag> directly to the runtime system.\n\
-\                         Use one -J for each runtime flag or flag argument\n\
-\    -R<flag>             Pass <flag> to the remote runtime system.\n\
-\                         Use one -R for each remote flag or flag argument\n\
-\    -help                Print this synopsis of standard options\n\
-\    -version             Version information\n
+\    --class-path <path>   Specify where to find user class files\n\
+\    --startup <file>      One run replacement for the start-up definitions\n\
+\    --no-startup          Do not run the start-up definitions\n\
+\    --feedback <mode>     Specify the initial feedback mode. The mode may be\n\
+\                           predefined (silent, concise, normal, or verbose) or\n\
+\                           previously user-defined\n\
+\    -q                    Quiet feedback.  Same as: --feedback concise\n\
+\    -s                    Really quiet feedback.  Same as: --feedback silent\n\
+\    -v                    Verbose feedback.  Same as: --feedback verbose\n\
+\    -J<flag>              Pass <flag> directly to the runtime system.\n\
+\                            Use one -J for each runtime flag or flag argument\n\
+\    -R<flag>              Pass <flag> to the remote runtime system.\n\
+\                            Use one -R for each remote flag or flag argument\n\
+\    --help                Print this synopsis of standard options\n\
+\    --version             Version information\n
 
 help.list.summary = list the source you have typed
 help.list.args = [<name or id>|-all|-start]
@@ -358,7 +360,7 @@
 the external editor to use, the start-up definitions to use, a new feedback mode,\n\
 the command prompt, the feedback mode to use, or the format of output.\n\
 \n\
-/set editor <command> <optional-arg>...\n\t\
+/set editor [-wait] <command> <optional-arg>...\n\t\
      Specify the command to launch for the /edit command.\n\t\
      The <command> is an operating system dependent string.\n\n\
 /set start <file>\n\t\
@@ -602,12 +604,19 @@
 help.set.editor =\
 Specify the command to launch for the /edit command.\n\
 \n\t\
-/set editor <command>|-default\n\
+/set editor [-wait] <command>|-default\n\
 \n\
 The <command> is an operating system dependent string.\n\
-The <command> may include space-separated arguments (such as flags)\n\
-When /edit is used, the temporary file to edit will be appended as the last argument.\n\
-If instead the -default option is specified, the built-in default editor will be used.
+The <command> may include space-separated arguments (such as flags)\n\n\
+If the -default option is specified, the built-in default editor will be used.\n\n\
+Otherwise an external editor should be specified in <command>. When <command>\n\
+is used, the temporary file to edit will be appended as the last argument.\n\
+Normally, edit mode will last until the external editor exits. Some external editors\n\
+will exit immediately (for example, if the edit window exists) either external editor\n\
+flags should be used to prevent immediate exit, or the -wait option should be used to\n\
+prompt the user to indicate when edit mode should end.\n\n\
+Note: while in edit mode no command inputs are seen.  After leaving edit mode changes\n\
+to the edited snippets are not seen.
 
 help.set.start =\
 Set the start-up configuration -- a sequence of snippets and commands read at start-up.\n\
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/MemoryFileManager.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/MemoryFileManager.java	Fri Aug 26 14:47:52 2016 -0700
@@ -52,8 +52,6 @@
 import javax.tools.StandardJavaFileManager;
 import javax.tools.StandardLocation;
 
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
 
 import static jdk.internal.jshell.debug.InternalDebugControl.DBG_FMGR;
 
@@ -71,8 +69,6 @@
 
     private ClassFileCreationListener classListener = null;
 
-    private final ClassLoader loader = new REPLClassLoader();
-
     private final JShell proc;
 
     // Upcoming Jigsaw
@@ -105,7 +101,7 @@
             return origin;
         }
 
-        @Override @DefinedBy(Api.COMPILER)
+        @Override
         public CharSequence getCharContent(boolean ignoreEncodingErrors) {
             return src;
         }
@@ -148,7 +144,7 @@
             }
         }
 
-        @Override @DefinedBy(Api.COMPILER)
+        @Override
         public String getName() {
             return className;
         }
@@ -157,32 +153,17 @@
          * Will provide the compiler with an output stream that leads to our
          * byte array.
          */
-        @Override @DefinedBy(Api.COMPILER)
+        @Override
         public OutputStream openOutputStream() throws IOException {
             return bos;
         }
 
-        @Override @DefinedBy(Api.COMPILER)
+        @Override
         public InputStream openInputStream() throws IOException {
             return new ByteArrayInputStream(getBytes());
         }
     }
 
-    // For restoring process-local execution support
-    class REPLClassLoader extends ClassLoader {
-
-        @Override
-        protected Class<?> findClass(String name) throws ClassNotFoundException {
-            OutputMemoryJavaFileObject fo = classObjects.get(name);
-            proc.debug(DBG_FMGR, "findClass %s = %s\n", name, fo);
-            if (fo == null) {
-                throw new ClassNotFoundException("Not ours");
-            }
-            byte[] b = fo.getBytes();
-            return super.defineClass(name, b, 0, b.length, null);
-        }
-    }
-
     public MemoryFileManager(StandardJavaFileManager standardManager, JShell proc) {
         this.stdFileManager = standardManager;
         this.proc = proc;
@@ -199,39 +180,11 @@
         }
     }
 
-    // For restoring process-local execution support
-    public Class<?> findGeneratedClass(String genClassFullName) throws ClassNotFoundException {
-        for (OutputMemoryJavaFileObject co : generatedClasses()) {
-            if (co.className.equals(genClassFullName)) {
-                Class<?> klass = loadClass(co.className);
-                proc.debug(DBG_FMGR, "Loaded %s\n", klass);
-                return klass;
-            }
-        }
-        return null;
-    }
-
-    // For restoring process-local execution support
-    public byte[] findGeneratedBytes(String genClassFullName) throws ClassNotFoundException {
-        for (OutputMemoryJavaFileObject co : generatedClasses()) {
-            if (co.className.equals(genClassFullName)) {
-                return co.getBytes();
-            }
-        }
-        return null;
-    }
-
-    // For restoring process-local execution support
-    public Class<?> loadClass(String name) throws ClassNotFoundException {
-        return getClassLoader(null).loadClass(name);
-    }
-
     public JavaFileObject createSourceFileObject(Object origin, String name, String code) {
         return new SourceMemoryJavaFileObject(origin, name, code);
     }
 
     // Make compatible with Jigsaw
-    @DefinedBy(Api.COMPILER)
     public String inferModuleName(Location location) {
         try {
             if (inferModuleNameMethod == null) {
@@ -250,7 +203,6 @@
     }
 
     // Make compatible with Jigsaw
-    @DefinedBy(Api.COMPILER)
     public Iterable<Set<Location>> listModuleLocations(Location location) throws IOException {
         try {
             if (listModuleLocationsMethod == null) {
@@ -285,10 +237,10 @@
      * @throws IllegalStateException if {@link #close} has been called
      * and this file manager cannot be reopened
      */
-    @Override @DefinedBy(Api.COMPILER)
+    @Override
     public ClassLoader getClassLoader(JavaFileManager.Location location) {
         proc.debug(DBG_FMGR, "getClassLoader: location\n", location);
-        return loader;
+        return stdFileManager.getClassLoader(location);
     }
 
     /**
@@ -311,7 +263,7 @@
      * @throws IllegalStateException if {@link #close} has been called
      * and this file manager cannot be reopened
      */
-    @Override @DefinedBy(Api.COMPILER)
+    @Override
     public Iterable<JavaFileObject> list(JavaFileManager.Location location,
             String packageName,
             Set<JavaFileObject.Kind> kinds,
@@ -368,7 +320,7 @@
      * @throws IllegalStateException if {@link #close} has been called
      * and this file manager cannot be reopened
      */
-    @Override @DefinedBy(Api.COMPILER)
+    @Override
     public String inferBinaryName(JavaFileManager.Location location, JavaFileObject file) {
         if (file instanceof OutputMemoryJavaFileObject) {
             OutputMemoryJavaFileObject ofo = (OutputMemoryJavaFileObject) file;
@@ -392,7 +344,7 @@
      * were created with another file manager and this file manager
      * does not support foreign file objects
      */
-    @Override @DefinedBy(Api.COMPILER)
+    @Override
     public boolean isSameFile(FileObject a, FileObject b) {
         return stdFileManager.isSameFile(b, b);
     }
@@ -405,7 +357,7 @@
      * @return the number of arguments the given option takes or -1 if
      * the option is not supported
      */
-    @Override @DefinedBy(Api.COMPILER)
+    @Override
     public int isSupportedOption(String option) {
         proc.debug(DBG_FMGR, "isSupportedOption: %s\n", option);
         return stdFileManager.isSupportedOption(option);
@@ -425,7 +377,7 @@
      * @throws IllegalStateException if {@link #close} has been called
      * and this file manager cannot be reopened
      */
-    @Override @DefinedBy(Api.COMPILER)
+    @Override
     public boolean handleOption(String current, Iterator<String> remaining) {
         proc.debug(DBG_FMGR, "handleOption: current: %s\n", current +
                 ", remaining: " + remaining);
@@ -438,7 +390,7 @@
      * @param location a location
      * @return true if the location is known
      */
-    @Override @DefinedBy(Api.COMPILER)
+    @Override
     public boolean hasLocation(JavaFileManager.Location location) {
         proc.debug(DBG_FMGR, "hasLocation: location: %s\n", location);
         return stdFileManager.hasLocation(location);
@@ -474,7 +426,7 @@
      * @throws IllegalStateException if {@link #close} has been called
      * and this file manager cannot be reopened
      */
-    @Override @DefinedBy(Api.COMPILER)
+    @Override
     public JavaFileObject getJavaFileForInput(JavaFileManager.Location location,
             String className,
             JavaFileObject.Kind kind)
@@ -514,7 +466,7 @@
      * @throws IllegalStateException {@link #close} has been called
      * and this file manager cannot be reopened
      */
-    @Override @DefinedBy(Api.COMPILER)
+    @Override
     public JavaFileObject getJavaFileForOutput(JavaFileManager.Location location,
             String className, Kind kind, FileObject sibling) throws IOException {
 
@@ -567,7 +519,7 @@
      * @throws IllegalStateException if {@link #close} has been called
      * and this file manager cannot be reopened
      */
-    @Override @DefinedBy(Api.COMPILER)
+    @Override
     public FileObject getFileForInput(JavaFileManager.Location location,
             String packageName,
             String relativeName)
@@ -616,7 +568,7 @@
      * @throws IllegalStateException if {@link #close} has been called
      * and this file manager cannot be reopened
      */
-    @Override @DefinedBy(Api.COMPILER)
+    @Override
     public FileObject getFileForOutput(JavaFileManager.Location location,
             String packageName,
             String relativeName,
@@ -636,7 +588,7 @@
      * @throws IOException if an I/O error occurred
      * @see #close
      */
-    @Override @DefinedBy(Api.COMPILER)
+    @Override
     public void flush() throws IOException {
         // Nothing to flush
     }
@@ -652,7 +604,7 @@
      * @throws IOException if an I/O error occurred
      * @see #flush
      */
-    @Override @DefinedBy(Api.COMPILER)
+    @Override
     public void close() throws IOException {
         // Nothing to close
     }
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java	Fri Aug 26 14:47:52 2016 -0700
@@ -55,8 +55,6 @@
 import com.sun.tools.javac.code.Symtab;
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.code.Type.ClassType;
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.Name;
 import com.sun.tools.javac.util.Names;
 import com.sun.tools.javac.util.Pair;
@@ -534,7 +532,7 @@
         TreePath[] deepest = new TreePath[1];
 
         new TreePathScanner<Void, Void>() {
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public Void scan(Tree tree, Void p) {
                 if (tree == null)
                     return null;
@@ -552,7 +550,7 @@
 
                 return null;
             }
-            @Override @DefinedBy(Api.COMPILER_TREE)
+            @Override
             public Void visitErroneous(ErroneousTree node, Void p) {
                 return scan(node.getErrorTrees(), null);
             }
@@ -1250,7 +1248,7 @@
             Trees trees = Trees.instance(source.fst);
 
             new TreePathScanner<Void, Void>() {
-                @Override @DefinedBy(Api.COMPILER_TREE)
+                @Override
                 public Void visitMethod(MethodTree node, Void p) {
                     Element currentMethod = trees.getElement(getCurrentPath());
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/TreeDependencyScanner.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/TreeDependencyScanner.java	Fri Aug 26 14:47:52 2016 -0700
@@ -34,8 +34,6 @@
 import com.sun.source.tree.Tree;
 import com.sun.source.tree.VariableTree;
 import com.sun.source.util.TreeScanner;
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
@@ -67,7 +65,7 @@
 
     // -- Differentiate declaration references from body references ---
 
-    @Override @DefinedBy(Api.COMPILER_TREE)
+    @Override
     public Void visitClass(ClassTree node, Set<String> p) {
         scan(node.getModifiers(), p);
         scan(node.getTypeParameters(), p);
@@ -77,7 +75,7 @@
         return null;
     }
 
-    @Override @DefinedBy(Api.COMPILER_TREE)
+    @Override
     public Void visitMethod(MethodTree node, Set<String> p) {
         scan(node.getModifiers(), p);
         scan(node.getReturnType(), p);
@@ -90,7 +88,7 @@
         return null;
     }
 
-    @Override @DefinedBy(Api.COMPILER_TREE)
+    @Override
     public Void visitVariable(VariableTree node, Set<String> p) {
         scan(node.getModifiers(), p);
         scan(node.getType(), p);
@@ -101,12 +99,12 @@
 
     // --- Ignore these ---
 
-    @Override @DefinedBy(Api.COMPILER_TREE)
+    @Override
     public Void visitPackage(PackageTree node, Set<String> p) {
         return null;
     }
 
-    @Override @DefinedBy(Api.COMPILER_TREE)
+    @Override
     public Void visitImport(ImportTree node, Set<String> p) {
         return null;
     }
@@ -114,13 +112,13 @@
 
     // -- Actual Symbol names ---
 
-    @Override @DefinedBy(Api.COMPILER_TREE)
+    @Override
     public Void visitMemberSelect(MemberSelectTree node, Set<String> p) {
         add(p, node.getIdentifier());
         return super.visitMemberSelect(node, p);
     }
 
-    @Override @DefinedBy(Api.COMPILER_TREE)
+    @Override
     public Void visitIdentifier(IdentifierTree node, Set<String> p) {
         add(p, node.getName());
         return super.visitIdentifier(node, p);
--- a/langtools/src/jdk.jshell/share/classes/module-info.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/module-info.java	Fri Aug 26 14:47:52 2016 -0700
@@ -34,6 +34,7 @@
     requires java.prefs;
     requires jdk.compiler;
     requires jdk.internal.le;
+    requires jdk.internal.opt;
     requires jdk.jdi;
 
     exports jdk.jshell;
--- a/langtools/test/ProblemList.txt	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/ProblemList.txt	Fri Aug 26 14:47:52 2016 -0700
@@ -30,6 +30,7 @@
 jdk/javadoc/tool/enum/docComments/Main.java                                     8152313    generic-all    convert to doclet test framework
 jdk/javadoc/tool/enum/enumType/Main.java                                        8152313    generic-all    convert to doclet test framework
 jdk/javadoc/tool/varArgs/Main.java                                              8152313    generic-all    convert to doclet test framework
+jdk/javadoc/doclet/testIOException/TestIOException.java                         8164597    windows-all
 
 ###########################################################################
 #
@@ -77,3 +78,9 @@
 #
 # jdeps 
 
+###########################################################################
+#
+# jdeprscan
+
+tools/jdeprscan/tests/jdk/jdeprscan/TestLoad.java                               8164837    windows-all    probably line breaks or encoding
+tools/jdeprscan/tests/jdk/jdeprscan/TestScan.java                               8164837    windows-all    probably line breaks or encoding
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testCopyFiles/TestCopyFiles.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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  8157349
+ * @summary  test copy of doc-files
+ * @library  ../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build    JavadocTester
+ * @run main TestCopyFiles
+ */
+
+public class TestCopyFiles extends JavadocTester {
+
+    public static void main(String... args) throws Exception {
+        TestCopyFiles tester = new TestCopyFiles();
+        tester.runTests();
+    }
+
+    @Test
+    void testDocFilesInModules() {
+        javadoc("-d", "modules-out",
+                "--module-source-path", testSrc("modules"),
+                "--module", "acme.mdle");
+        checkExit(Exit.OK);
+        checkOutput("p/doc-files/inpackage.html", true,
+                "In a named module and named package"
+        );
+    }
+
+    @Test
+    void testDocFilesInPackages() {
+        javadoc("-d", "packages-out",
+                "-sourcepath", testSrc("packages"),
+                "p1");
+        checkExit(Exit.OK);
+        checkOutput("p1/doc-files/inpackage.html", true,
+                "A named package in an unnamed module"
+        );
+    }
+
+    @Test
+    void testDocFilesInUnnamedPackages() {
+        javadoc("-d", "unnamed-out",
+                "-sourcepath", testSrc("unnamed"),
+                testSrc("unnamed/Foo.java")
+        );
+        checkExit(Exit.OK);
+        checkOutput("doc-files/inpackage.html", true,
+                "In an unnamed package"
+        );
+    }
+
+    @Test
+    void testDocFilesInPackagesSource7() {
+        javadoc("-d", "packages-out-src7",
+                "-source", "7",
+                "-sourcepath", testSrc("packages"),
+                "p1");
+        checkExit(Exit.OK);
+        checkOutput("p1/doc-files/inpackage.html", true,
+                "A named package in an unnamed module"
+        );
+    }
+
+    @Test
+    void testDocFilesInPackagesSource7UsingClassPath() {
+        javadoc("-d", "packages-out-src7-cp",
+                "-source", "7",
+                "-classpath", testSrc("packages"),
+                "p1");
+        checkExit(Exit.OK);
+        checkOutput("p1/doc-files/inpackage.html", true,
+                "A named package in an unnamed module"
+        );
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testCopyFiles/modules/acme.mdle/module-info.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /**
+  * A test module.
+  */
+module acme.mdle {
+    exports p;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testCopyFiles/modules/acme.mdle/p/Foo.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+/**
+ * A test class.
+ */
+public class Foo {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testCopyFiles/modules/acme.mdle/p/doc-files/inpackage.html	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,33 @@
+<!--
+Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation.  Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+-->
+
+<html>
+  <head>
+    <title>"Hello World"</title>
+  </head>
+  <body>
+    In a named module and named package 
+  </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testCopyFiles/packages/p1/Foo.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /**
+  * A test class.
+  */
+package p1;
+
+/**
+ * A test class.
+ */
+public class Foo {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testCopyFiles/packages/p1/doc-files/inpackage.html	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,33 @@
+<!--
+Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation.  Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+-->
+
+<html>
+  <head>
+    <title>"Hello World"</title>
+  </head>
+  <body>
+     A named package in an unnamed module.
+  </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testCopyFiles/unnamed/Foo.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /**
+  * A test class.
+  */
+
+/**
+ * A test class.
+ */
+public class Foo {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testCopyFiles/unnamed/doc-files/inpackage.html	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,33 @@
+<!--
+Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation.  Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+-->
+
+<html>
+  <head>
+    <title>"Hello World"</title>
+  </head>
+  <body>
+    In an unnamed package 
+  </body>
+</html>
--- a/langtools/test/jdk/javadoc/doclet/testFramesNoFrames/TestFramesNoFrames.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/jdk/javadoc/doclet/testFramesNoFrames/TestFramesNoFrames.java	Fri Aug 26 14:47:52 2016 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8162353
+ * @bug 8162353 8164747
  * @summary javadoc should provide a way to disable use of frames
  * @library /tools/lib ../lib
  * @modules
@@ -204,7 +204,7 @@
     @Test
     void testModules(Path base, FrameKind fKind, OverviewKind oKind, HtmlKind hKind) throws IOException {
         javadoc(base, fKind, oKind, hKind,
-            "-modulesourcepath", gensrcModules.toString(),
+            "--module-source-path", gensrcModules.toString(),
             "--module", "m1,m2,m3");
 
         new Checker(fKind, oKind, hKind)
@@ -283,6 +283,19 @@
             // this file is only generated when not in frames mode
             checkFiles(!frames,
                     "allclasses.html");
+
+            if (frames) {
+                checkOutput("allclasses-frame.html", true,
+                        classes.stream()
+                            .map(c -> "title=\"class in " + packagePart(c) + "\" target=\"classFrame\">" + classPart(c) + "</a>")
+                            .toArray(String[]::new));
+                checkOutput("allclasses-noframe.html", false,
+                            "target=\"classFrame\">");
+            } else {
+                checkOutput("allclasses.html", false,
+                            "target=\"classFrame\">");
+
+            }
         }
 
         private void checkFrameFiles() {
@@ -367,6 +380,11 @@
                 .count();
         }
 
+        private String classPart(String className) {
+            int lastDot = className.lastIndexOf(".");
+            return className.substring(lastDot + 1);
+        }
+
         private String packagePart(String className) {
             int slash = className.indexOf("/");
             int lastDot = className.lastIndexOf(".");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testIOException/TestIOException.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8164130
+ * @summary test IOException handling
+ * @library ../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build JavadocTester
+ * @run main TestIOException
+ */
+
+import java.io.File;
+import java.io.FileWriter;
+
+public class TestIOException extends JavadocTester {
+
+    public static void main(String... args) throws Exception {
+        TestIOException tester = new TestIOException();
+        tester.runTests();
+    }
+
+    @Test
+    void testReadOnlyDirectory() {
+        File outDir = new File("out1");
+        if (!outDir.mkdir()) {
+            throw new Error("Cannot create directory");
+        }
+        if (!outDir.setReadOnly()) {
+            throw new Error("could not set directory read-only");
+        }
+        if (outDir.canWrite()) {
+            throw new Error("directory is writable");
+        }
+
+        try {
+            javadoc("-d", outDir.toString(),
+                    new File(testSrc, "TestIOException.java").getPath());
+            checkExit(Exit.FAILED);
+            checkOutput(Output.OUT, true,
+                "Destination directory not writable: " + outDir);
+        } finally {
+            outDir.setWritable(true);
+        }
+    }
+
+    @Test
+    void testReadOnlyFile() throws Exception {
+        File outDir = new File("out2");
+        if (!outDir.mkdir()) {
+            throw new Error("Cannot create directory");
+        }
+        File index = new File(outDir, "index.html");
+        try (FileWriter fw = new FileWriter(index)) { }
+        if (!index.setReadOnly()) {
+            throw new Error("could not set index read-only");
+        }
+        if (index.canWrite()) {
+            throw new Error("index is writable");
+        }
+
+        try {
+            setOutputDirectoryCheck(DirectoryCheck.NONE);
+            javadoc("-d", outDir.toString(),
+                    new File(testSrc, "TestIOException.java").getPath());
+
+            checkExit(Exit.FAILED);
+            checkOutput(Output.OUT, true,
+                "Error writing file: " + index);
+        } finally {
+            setOutputDirectoryCheck(DirectoryCheck.EMPTY);
+            index.setWritable(true);
+        }
+    }
+
+    @Test
+    void testReadOnlySubdirectory() throws Exception {
+        // init source file
+        File srcDir = new File("src4");
+        File src_p = new File(srcDir, "p");
+        src_p.mkdirs();
+        File src_p_C = new File(src_p, "C.java");
+        try (FileWriter fw = new FileWriter(src_p_C)) {
+            fw.write("package p; public class C { }");
+        }
+
+        // create an unwritable package output directory
+        File outDir = new File("out3");
+        File pkgOutDir = new File(outDir, "p");
+        if (!pkgOutDir.mkdirs()) {
+            throw new Error("Cannot create directory");
+        }
+        if (!pkgOutDir.setReadOnly()) {
+            throw new Error("could not set directory read-only");
+        }
+        if (pkgOutDir.canWrite()) {
+            throw new Error("directory is writable");
+        }
+
+        // run javadoc and check results
+        try {
+            setOutputDirectoryCheck(DirectoryCheck.NONE);
+            javadoc("-d", outDir.toString(),
+                    src_p_C.getPath());
+            checkExit(Exit.FAILED);
+            checkOutput(Output.OUT, true,
+                "Error writing file: " + new File(pkgOutDir, "C.html"));
+        } finally {
+            setOutputDirectoryCheck(DirectoryCheck.EMPTY);
+            pkgOutDir.setWritable(true);
+        }
+    }
+
+    @Test
+    void testReadOnlyDocFilesDir() throws Exception {
+        // init source files
+        File srcDir = new File("src4");
+        File src_p = new File(srcDir, "p");
+        src_p.mkdirs();
+        File src_p_C = new File(src_p, "C.java");
+        try (FileWriter fw = new FileWriter(src_p_C)) {
+            fw.write("package p; public class C { }");
+        }
+        File src_p_docfiles = new File(src_p, "doc-files");
+        src_p_docfiles.mkdir();
+        try (FileWriter fw = new FileWriter(new File(src_p_docfiles, "info.txt"))) {
+            fw.write("info");
+        }
+
+        // create an unwritable doc-files output directory
+        File outDir = new File("out4");
+        File pkgOutDir = new File(outDir, "p");
+        File docFilesOutDir = new File(pkgOutDir, "doc-files");
+        if (!docFilesOutDir.mkdirs()) {
+            throw new Error("Cannot create directory");
+        }
+        if (!docFilesOutDir.setReadOnly()) {
+            throw new Error("could not set directory read-only");
+        }
+        if (docFilesOutDir.canWrite()) {
+            throw new Error("directory is writable");
+        }
+
+        try {
+            setOutputDirectoryCheck(DirectoryCheck.NONE);
+            javadoc("-d", outDir.toString(),
+                    "-sourcepath", srcDir.getPath(),
+                    "p");
+            checkExit(Exit.FAILED);
+            checkOutput(Output.OUT, true,
+                "Error writing file: " + new File(docFilesOutDir, "info.txt"));
+        } finally {
+            setOutputDirectoryCheck(DirectoryCheck.EMPTY);
+            docFilesOutDir.setWritable(true);
+        }
+    }
+}
+
--- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java	Fri Aug 26 14:47:52 2016 -0700
@@ -160,8 +160,8 @@
     @Test
     void testModuleSummary() {
         javadoc("-d", "out-moduleSummary", "-use",
-                "-modulesourcepath", testSrc,
-                "-addmods", "module1,module2",
+                "--module-source-path", testSrc,
+                "--add-modules", "module1,module2",
                 "testpkgmdl1", "testpkgmdl2", "module2/testpkg2mdl2");
         checkExit(Exit.OK);
         checkModuleSummary();
@@ -174,8 +174,8 @@
     @Test
     void testModuleFilesAndLinks() {
         javadoc("-d", "out-modulelinks",
-                "-modulesourcepath", testSrc,
-                "-addmods", "module1",
+                "--module-source-path", testSrc,
+                "--add-modules", "module1",
                 "testpkgmdl1");
         checkExit(Exit.OK);
         checkModuleFilesAndLinks(true);
--- a/langtools/test/jdk/javadoc/doclet/testTypeAnnotations/typeannos/RepeatedAnnotations.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/jdk/javadoc/doclet/testTypeAnnotations/typeannos/RepeatedAnnotations.java	Fri Aug 26 14:47:52 2016 -0700
@@ -8,7 +8,7 @@
  *
  * 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 RepeatingA PARTICULAR PURPOSE.  See the GNU General Public License
+ * 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).
  *
--- a/langtools/test/jdk/javadoc/tool/modules/FilterOptions.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/jdk/javadoc/tool/modules/FilterOptions.java	Fri Aug 26 14:47:52 2016 -0700
@@ -27,7 +27,6 @@
  * @summary Tests elements filtering options
  * @modules
  *      jdk.javadoc/jdk.javadoc.internal.api
- *      jdk.javadoc/jdk.javadoc.internal.doclets.standard
  *      jdk.javadoc/jdk.javadoc.internal.tool
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
@@ -60,7 +59,7 @@
 
     @Test
     public void testDefault(Path base) throws Exception {
-        execTask("-modulesourcepath", src, "--module", "m1");
+        execTask("--module-source-path", src, "--module", "m1");
 
         checkModulesSpecified("m1");
         checkModulesIncluded("m1");
@@ -70,7 +69,7 @@
 
     @Test
     public void testModuleModeApi(Path base) throws Exception {
-        execTask("-modulesourcepath", src,
+        execTask("--module-source-path", src,
                 "--module", "m1", "--show-module-contents:api");
 
         checkModuleMode("API");
@@ -78,7 +77,7 @@
 
     @Test
     public void testModuleModeAll(Path base) throws Exception {
-        execTask("-modulesourcepath", src,
+        execTask("--module-source-path", src,
                 "--module", "m1", "--show-module-contents:all");
 
         checkModuleMode("ALL");
@@ -86,7 +85,7 @@
 
     @Test
     public void testShowPackagesExported(Path base)  throws Exception {
-        execTask("-modulesourcepath", src,
+        execTask("--module-source-path", src,
                 "--module", "m1",
                 "--show-packages:exported"); // default
 
@@ -98,7 +97,7 @@
 
     @Test
     public void testShowPackagesAll(Path base) throws Exception {
-        execTask("-modulesourcepath", src,
+        execTask("--module-source-path", src,
                 "--module", "m1",
                 "--show-packages:all");
         checkModulesSpecified("m1");
@@ -111,7 +110,7 @@
 
     @Test
     public void testShowTypesPrivate(Path base) throws Exception {
-        execTask("-modulesourcepath", src,
+        execTask("--module-source-path", src,
                 "--module", "m1",
                 "--show-types:private");
 
@@ -128,7 +127,7 @@
 
     @Test
     public void testShowTypesPackage(Path base) throws Exception {
-        execTask("-modulesourcepath", src,
+        execTask("--module-source-path", src,
                 "--module", "m1",
                 "--show-types:package");
 
@@ -144,7 +143,7 @@
 
     @Test
     public void testShowTypesProtected(Path base) throws Exception {
-        execTask("-modulesourcepath", src,
+        execTask("--module-source-path", src,
                 "--module", "m1",
                 "--show-types:protected");
 
@@ -161,7 +160,7 @@
 
     @Test
     public void testShowTypesPublic(Path base) throws Exception {
-        execTask("-modulesourcepath", src,
+        execTask("--module-source-path", src,
                 "--module", "m1",
                 "--show-types:public");
 
@@ -178,7 +177,7 @@
 
     @Test
     public void testShowMembersPrivate(Path base) throws Exception {
-        execTask("-modulesourcepath", src,
+        execTask("--module-source-path", src,
                 "--module", "m1",
                 "--show-members:private");
 
@@ -187,7 +186,7 @@
 
     @Test
     public void testShowMembersPackage(Path base) throws Exception {
-        execTask("-modulesourcepath", src,
+        execTask("--module-source-path", src,
                 "--module", "m1",
                 "--show-members:package");
 
@@ -196,7 +195,7 @@
 
     @Test
     public void testShowMembersProtected(Path base) throws Exception {
-        execTask("-modulesourcepath", src,
+        execTask("--module-source-path", src,
                 "--module", "m1",
                 "--show-members:protected");
 
@@ -205,7 +204,7 @@
 
     @Test
     public void testShowMembersPublic(Path base) throws Exception {
-        execTask("-modulesourcepath", src,
+        execTask("--module-source-path", src,
                 "--module", "m1",
                 "--show-members:public");
 
@@ -214,7 +213,7 @@
 
     @Test
     public void testLegacyPublic(Path base) throws Exception {
-        execTask("-modulesourcepath", src,
+        execTask("--module-source-path", src,
                 "--module", "m1",
                 "-public");
 
@@ -229,7 +228,7 @@
 
     @Test
     public void testLegacyDefault(Path base) throws Exception {
-        execTask("-modulesourcepath", src,
+        execTask("--module-source-path", src,
                 "--module", "m1");
 
         checkModuleMode("API");
@@ -243,7 +242,7 @@
 
     @Test
     public void testLegacyProtected(Path base) throws Exception {
-        execTask("-modulesourcepath", src,
+        execTask("--module-source-path", src,
                 "--module", "m1",
                 "-protected");
 
@@ -258,7 +257,7 @@
 
     @Test
     public void testLegacyPackage(Path base) throws Exception {
-        execTask("-modulesourcepath", src,
+        execTask("--module-source-path", src,
                 "--module", "m1",
                 "-package");
 
@@ -277,7 +276,7 @@
 
     @Test
     public void testLegacyPrivate(Path base) throws Exception {
-        execTask("-modulesourcepath", src,
+        execTask("--module-source-path", src,
                 "--module", "m1",
                 "-private");
 
--- a/langtools/test/jdk/javadoc/tool/modules/Modules.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/jdk/javadoc/tool/modules/Modules.java	Fri Aug 26 14:47:52 2016 -0700
@@ -27,7 +27,6 @@
  * @summary Tests primarily the module graph computations.
  * @modules
  *      jdk.javadoc/jdk.javadoc.internal.api
- *      jdk.javadoc/jdk.javadoc.internal.doclets.standard
  *      jdk.javadoc/jdk.javadoc.internal.tool
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
@@ -58,7 +57,7 @@
                 .classes("package pub; /** Klass A */ public class A {}")
                 .classes("package pro; /** Klass B */ public class B {}")
                 .write(src);
-        execTask("-modulesourcepath", src.toString(),
+        execTask("--module-source-path", src.toString(),
                  "--module", "m1");
         checkModulesSpecified("m1");
         checkPackagesIncluded("pub");
@@ -83,7 +82,7 @@
                 .classes("package m2pub; /** Klass A */ public class A {}")
                 .classes("package m2pro; /** Klass B */ public class B {}")
                 .write(src);
-        execTask("-modulesourcepath", src.toString(),
+        execTask("--module-source-path", src.toString(),
             "--module", "m1,m2");
         checkModulesSpecified("m1", "m2");
         checkPackagesIncluded("m1pub", "m2pub");
@@ -109,7 +108,7 @@
                 .classes("package m2pub; /** Klass A */ public class A {}")
                 .classes("package m2pro; /** Klass B */ public class B {}")
                 .write(src);
-        execTask("-modulesourcepath", src.toString(),
+        execTask("--module-source-path", src.toString(),
             "--module", "m1",
             "--module", "m2");
         checkModulesSpecified("m1", "m2");
@@ -152,7 +151,7 @@
                 .classes("package p; public class Main { openO.O o; openN.N n; openL.L l; }")
                 .write(src);
 
-        execTask("-modulesourcepath", src.toString(),
+        execTask("--module-source-path", src.toString(),
                 "--module", "M");
 
         checkModulesSpecified("M");
@@ -176,7 +175,7 @@
                 .classes("package p; public class Main { openO.O o; openN.N n; openL.L l; }")
                 .write(src);
 
-        execTask("-modulesourcepath", src.toString(),
+        execTask("--module-source-path", src.toString(),
                 "--module", "M",
                 "--expand-requires:public");
 
@@ -201,7 +200,7 @@
                 .classes("package p; public class Main { openO.O o; openN.N n; openL.L l; }")
                 .write(src);
 
-        execTask("-modulesourcepath", src.toString(),
+        execTask("--module-source-path", src.toString(),
                 "--module", "M",
                 "--expand-requires:all");
 
@@ -229,7 +228,7 @@
                 .classes("package p; public class Main { openO.O o; openN.N n; openL.L l; }")
                 .write(src);
 
-        execNegativeTask("-modulesourcepath", src.toString(),
+        execNegativeTask("--module-source-path", src.toString(),
                 "--module", "MIA",
                 "--expand-requires:all");
 
@@ -251,7 +250,7 @@
                 .classes("package p; public class Main { openO.O o; openN.N n; openL.L l; }")
                 .write(src);
 
-        execNegativeTask("-modulesourcepath", src.toString(),
+        execNegativeTask("--module-source-path", src.toString(),
                 "--module", "M,N,L,MIA,O,P",
                 "--expand-requires:all");
 
--- a/langtools/test/jdk/javadoc/tool/modules/PackageOptions.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/jdk/javadoc/tool/modules/PackageOptions.java	Fri Aug 26 14:47:52 2016 -0700
@@ -27,7 +27,6 @@
  * @summary Test modules with packages and subpackages filtering
  * @modules
  *      jdk.javadoc/jdk.javadoc.internal.api
- *      jdk.javadoc/jdk.javadoc.internal.doclets.standard
  *      jdk.javadoc/jdk.javadoc.internal.tool
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
@@ -52,8 +51,8 @@
 
     @Test
     public void testExportedNonQualifiedPackagesLegacyMode(Path base)  throws Exception {
-        execTask("-modulesourcepath", createSources(base.resolve("src")),
-                "-addmods", "m1",
+        execTask("--module-source-path", createSources(base.resolve("src")),
+                "--add-modules", "m1",
                 "m1pub");
 
         checkModulesNotSpecified("m1");
@@ -64,8 +63,8 @@
 
     @Test
     public void testExportedQualifiedPackagesLegacyMode(Path base)  throws Exception {
-        execTask("-modulesourcepath", createSources(base.resolve("src")),
-                "-addmods", "m1",
+        execTask("--module-source-path", createSources(base.resolve("src")),
+                "--add-modules", "m1",
                 "m1/m1pub");
 
         checkModulesNotSpecified("m1");
@@ -76,8 +75,8 @@
 
     @Test
     public void testNonExportedQualifedPackagesLegacyMode(Path base)  throws Exception {
-        execTask("-modulesourcepath", createSources(base.resolve("src")),
-                "-addmods", "m1",
+        execTask("--module-source-path", createSources(base.resolve("src")),
+                "--add-modules", "m1",
                 "m1/m1pro.pro1" /* not exported, therefore qualify with module */);
 
         checkModulesNotSpecified("m1");
@@ -92,8 +91,8 @@
     public void testTypesLegacyMode(Path base) throws Exception {
         Path srcPath = base.resolve("src");
         Path typPath = srcPath.resolve("m1/m1pub/A.java");
-        execTask("-modulesourcepath", createSources(srcPath),
-                "-addmods", "m1",
+        execTask("--module-source-path", createSources(srcPath),
+                "--add-modules", "m1",
                 typPath.toString());
         checkModulesNotSpecified("m1");
         checkModulesIncluded("m1");
@@ -109,8 +108,8 @@
     public void testSubclassedTypesLegacyMode(Path base) throws Exception {
         Path srcPath = base.resolve("src");
         Path typPath = srcPath.resolve("m1/m1pub/B.java");
-        execTask("-modulesourcepath", createSources(srcPath),
-                "-addmods", "m1",
+        execTask("--module-source-path", createSources(srcPath),
+                "--add-modules", "m1",
                 typPath.toString());
         checkModulesNotSpecified("m1");
         checkModulesIncluded("m1");
@@ -124,7 +123,7 @@
 
     @Test
     public void testDefaultPackages(Path base) throws Exception {
-        execTask("-modulesourcepath", createSources(base.resolve("src")),
+        execTask("--module-source-path", createSources(base.resolve("src")),
                 "--module", "m1");
 
         checkModulesSpecified("m1");
@@ -149,20 +148,20 @@
             // I/O error encounted during the iteration
             throw ex.getCause();
         }
-        execTask("-modulesourcepath", src.toString(),
+        execTask("--module-source-path", src.toString(),
                 "-subpackages", "m1/m1pro");
 
         checkPackagesSpecified("m1pro", "m1pro.pro1", "m1pro.pro2");
 
         // empty package directory should cause an error
-        execNegativeTask("-modulesourcepath", src.toString(),
+        execNegativeTask("--module-source-path", src.toString(),
                          "m1/m1pro");
 
     }
 
     @Test
     public void testExportedQualifiedSubpackageWithMultipleModules(Path base) throws Exception {
-        execTask("-modulesourcepath", createSources(base.resolve("src"), 2),
+        execTask("--module-source-path", createSources(base.resolve("src"), 2),
                 "--module", "m1",
                 "-subpackages", "m1/m1pro.pro1:m1/m1pro.pro2:m2/m2pub.pub1");
 
@@ -177,7 +176,7 @@
 
     @Test
     public void testUnexportedUnqualifiedSubpackages(Path base) throws Exception {
-        execNegativeTask("-modulesourcepath", createSources(base.resolve("src")),
+        execNegativeTask("--module-source-path", createSources(base.resolve("src")),
                          "--module", "m1",
                          "-subpackages", "m1pub.pub1:pro");
 
@@ -186,7 +185,7 @@
 
     @Test
     public void testUnexportedQualifiedPackage(Path base) throws Exception {
-        execTask("-modulesourcepath", createSources(base.resolve("src")),
+        execTask("--module-source-path", createSources(base.resolve("src")),
                 "--module", "m1",
                 "m1/m1pro");
 
@@ -201,7 +200,7 @@
 
     @Test
     public void testUnexportedQualifiedSubpackage(Path base) throws Exception {
-        execTask("-modulesourcepath", createSources(base.resolve("src")),
+        execTask("--module-source-path", createSources(base.resolve("src")),
                 "--module", "m1",
                 "-subpackages", "m1/m1pro");
 
@@ -216,7 +215,7 @@
 
     @Test
     public void testUnexportedQualifiedSubpackageExcludeQualified(Path base) throws Exception {
-        execTask("-modulesourcepath", createSources(base.resolve("src")),
+        execTask("--module-source-path", createSources(base.resolve("src")),
                 "--module", "m1",
                 "-subpackages", "m1/m1pro",
                 "-exclude", "m1/m1pro.pro1.pro11:m1/m1pro.pro2.pro21");
@@ -233,7 +232,7 @@
 
     @Test
     public void testUnexportedQualifiedSubpackageExcludeUnqualified(Path base) throws Exception {
-        execTask("-modulesourcepath", createSources(base.resolve("src")),
+        execTask("--module-source-path", createSources(base.resolve("src")),
                 "--module", "m1",
                 "-subpackages", "m1/m1pro",
                 "-exclude", "m1pro.pro1.pro11:m1pro.pro2.pro21");
@@ -250,7 +249,7 @@
 
     @Test
     public void testUnexportedQualifiedSubpackages(Path base) throws Exception {
-        execTask("-modulesourcepath", createSources(base.resolve("src")),
+        execTask("--module-source-path", createSources(base.resolve("src")),
                 "--module", "m1",
                 "-subpackages", "m1/m1pro.pro1:m1/m1pro.pro2");
 
--- a/langtools/test/jdk/jshell/CommandCompletionTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/jdk/jshell/CommandCompletionTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -58,7 +58,7 @@
     }
 
     public void testList() {
-        test(false, new String[] {"-nostartup"},
+        test(false, new String[] {"--no-startup"},
                 a -> assertCompletion(a, "/l|", false, "/list "),
                 a -> assertCompletion(a, "/list |", false, "-all ", "-history ", "-start "),
                 a -> assertCompletion(a, "/list -h|", false, "-history "),
@@ -70,7 +70,7 @@
     }
 
     public void testDrop() {
-        test(false, new String[] {"-nostartup"},
+        test(false, new String[] {"--no-startup"},
                 a -> assertCompletion(a, "/d|", false, "/drop "),
                 a -> assertClass(a, "class cTest {}", "class", "cTest"),
                 a -> assertMethod(a, "int mTest() { return 0; }", "()I", "mTest"),
@@ -81,7 +81,7 @@
     }
 
     public void testEdit() {
-        test(false, new String[]{"-nostartup"},
+        test(false, new String[]{"--no-startup"},
                 a -> assertCompletion(a, "/e|", false, "/edit ", "/exit "),
                 a -> assertCompletion(a, "/ed|", false, "/edit "),
                 a -> assertClass(a, "class cTest {}", "class", "cTest"),
--- a/langtools/test/jdk/jshell/EditorTestBase.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/jdk/jshell/EditorTestBase.java	Fri Aug 26 14:47:52 2016 -0700
@@ -42,7 +42,7 @@
     public abstract void shutdownEditor();
 
     public void testEditor(ReplTest... tests) {
-        testEditor(false, new String[]{"-nostartup"}, tests);
+        testEditor(false, new String[]{"--no-startup"}, tests);
     }
 
     public void testEditor(boolean defaultStartup, String[] args, ReplTest... tests) {
@@ -71,7 +71,7 @@
     @Test
     public void testEditNegative() {
         for (String edit : new String[] {"/ed", "/edit"}) {
-            test(new String[]{"-nostartup"},
+            test(new String[]{"--no-startup"},
                     a -> assertCommandOutputStartsWith(a, edit + " 1",
                             "|  No such snippet: 1"),
                     a -> assertCommandOutputStartsWith(a, edit + " unknown",
--- a/langtools/test/jdk/jshell/ExternalEditorTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/jdk/jshell/ExternalEditorTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -203,7 +203,7 @@
 
     @Test(enabled = false) // TODO 8159229
     public void testRemoveTempFile() {
-        test(new String[]{"-nostartup"},
+        test(new String[]{"--no-startup"},
                 a -> assertCommandCheckOutput(a, "/set editor " + executionScript,
                         assertStartsWith("|  Editor set to: " + executionScript)),
                 a -> assertVariable(a, "int", "a", "0", "0"),
--- a/langtools/test/jdk/jshell/StartOptionTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/jdk/jshell/StartOptionTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -22,7 +22,7 @@
  */
 
 /*
- * @test 8151754 8080883
+ * @test 8151754 8080883 8160089
  * @summary Testing start-up options.
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
@@ -106,53 +106,68 @@
 
     @Test
     public void testUsage() throws Exception {
-        start(s -> {
-            assertTrue(s.split("\n").length >= 7, "Not enough usage lines: " + s);
-            assertTrue(s.startsWith("Usage:   jshell <options>"), "Unexpect usage start: " + s);
-        },  null, "-help");
+        for (String opt : new String[]{"-h", "--help"}) {
+            start(s -> {
+                assertTrue(s.split("\n").length >= 7, "Not enough usage lines: " + s);
+                assertTrue(s.startsWith("Usage:   jshell <options>"), "Unexpect usage start: " + s);
+            }, null, opt);
+        }
     }
 
     @Test
     public void testUnknown() throws Exception {
-        start(s -> {
-            assertTrue(s.split("\n").length >= 7, "Not enough usage lines (unknown): " + s);
-            assertTrue(s.startsWith("Usage:   jshell <options>"), "Unexpect usage start (unknown): " + s);
-        }, s -> assertEquals(s.trim(), "Unknown option: -unknown"), "-unknown");
+        start(s -> { },
+              s -> assertEquals(s.trim(), "Unknown option: u"), "-unknown");
+        start(s -> { },
+              s -> assertEquals(s.trim(), "Unknown option: unknown"), "--unknown");
     }
 
     public void testStartup() throws Exception {
         Compiler compiler = new Compiler();
         Path p = compiler.getPath("file.txt");
         compiler.writeToFile(p);
-        start("", "'-startup' requires a filename argument.", "-startup");
-        start("", "Only one -startup or -nostartup option may be used.", "-startup", p.toString(), "-startup", p.toString());
-        start("", "Only one -startup or -nostartup option may be used.", "-nostartup", "-startup", p.toString());
-        start("", "Only one -startup or -nostartup option may be used.", "-startup", p.toString(), "-nostartup");
-        start("", "Only one -startup or -nostartup option may be used.", "-nostartup", "-nostartup");
-        start("", "Only one -startup or -nostartup option may be used.", "-nostartup", "-startup");
+        start("", "Argument to startup missing.", "--startup");
+        start("", "Only one --startup or --no-startup option may be used.", "--startup", p.toString(), "--startup", p.toString());
+        start("", "Only one --startup or --no-startup option may be used.", "--no-startup", "--startup", p.toString());
+        start("", "Only one --startup or --no-startup option may be used.", "--startup", p.toString(), "--no-startup");
+        start("", "Argument to startup missing.", "--no-startup", "--startup");
     }
 
     public void testStartupUnknown() throws Exception {
-        start("", "File 'UNKNOWN' for '-startup' is not found.", "-startup", "UNKNOWN");
+        start("", "File 'UNKNOWN' for '--startup' is not found.", "--startup", "UNKNOWN");
     }
 
     @Test
     public void testClasspath() throws Exception {
-        for (String cp : new String[] {"-cp", "-classpath"}) {
-            start("", "Conflicting -classpath option.", cp, ".", "-classpath", ".");
-            start("", "Argument to -classpath missing.", cp);
+        for (String cp : new String[] {"--class-path"}) {
+            start("", "Only one --class-path option may be used.", cp, ".", "--class-path", ".");
+            start("", "Argument to class-path missing.", cp);
         }
     }
 
     @Test
+    public void testFeedbackOptionConflict() throws Exception {
+        start("", "Only one feedback option (--feedback, -q, -s, or -v) may be used.",
+                "--feedback", "concise", "--feedback", "verbose");
+        start("", "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "--feedback", "concise", "-s");
+        start("", "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "--feedback", "verbose", "-q");
+        start("", "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "--feedback", "concise", "-v");
+        start("", "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "-v", "--feedback", "concise");
+        start("", "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "-q", "-v");
+        start("", "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "-s", "-v");
+        start("", "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "-v", "-q");
+        start("", "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "-q", "-s");
+    }
+
+    @Test
     public void testNegFeedbackOption() throws Exception {
-        start("", "Argument to -feedback missing. Mode required.", "-feedback");
-        start("", "Does not match any current feedback mode: blorp -- -feedback blorp", "-feedback", "blorp");
+        start("", "Argument to feedback missing.", "--feedback");
+        start("", "Does not match any current feedback mode: blorp -- --feedback blorp", "--feedback", "blorp");
     }
 
     @Test
     public void testVersion() throws Exception {
-        start(s -> assertTrue(s.startsWith("jshell"), "unexpected version: " + s), null, "-version");
+        start(s -> assertTrue(s.startsWith("jshell"), "unexpected version: " + s), null, "--version");
     }
 
     @AfterMethod
--- a/langtools/test/jdk/jshell/ToolBasicTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/jdk/jshell/ToolBasicTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -97,7 +97,7 @@
     public void testInterrupt() {
         ReplTest interrupt = (a) -> assertCommand(a, "\u0003", "");
         for (String s : new String[] { "", "\u0003" }) {
-            test(false, new String[]{"-nostartup"},
+            test(false, new String[]{"--no-startup"},
                     (a) -> assertCommand(a, "int a = 2 +" + s, ""),
                     interrupt,
                     (a) -> assertCommand(a, "int a\u0003", ""),
@@ -190,7 +190,7 @@
     }
 
     public void testRerun() {
-        test(false, new String[] {"-nostartup"},
+        test(false, new String[] {"--no-startup"},
                 (a) -> assertCommand(a, "/0", "|  No such command or snippet id: /0\n|  Type /help for help."),
                 (a) -> assertCommand(a, "/5", "|  No such command or snippet id: /5\n|  Type /help for help.")
         );
@@ -226,7 +226,7 @@
             tests.add((a) -> assertCommandCheckOutput(a, "/-" + (2 * finalI + 1), check));
         }
         tests.add((a) -> assertCommandCheckOutput(a, "/!", assertStartsWith("int a = 0;")));
-        test(false, new String[]{"-nostartup"},
+        test(false, new String[]{"--no-startup"},
                 tests.toArray(new ReplTest[tests.size()]));
     }
 
@@ -243,7 +243,7 @@
         Path startup = compiler.getPath("StartupFileOption/startup.txt");
         compiler.writeToFile(startup, "int assertionCount = 0;\n" + // id: s1
                 "void add(int n) { assertionCount += n; }");
-        test(new String[]{"-startup", startup.toString()},
+        test(new String[]{"--startup", startup.toString()},
                 (a) -> assertCommand(a, "add(1)", ""), // id: 1
                 (a) -> assertCommandCheckOutput(a, "add(ONE)", s -> assertEquals(s.split("\n")[0], "|  Error:")), // id: e1
                 (a) -> assertVariable(a, "int", "ONE", "1", "1"),
@@ -252,7 +252,7 @@
                 assertRerun.apply("/s1").apply("int assertionCount = 0;", 0), assertVariables
         );
 
-        test(false, new String[] {"-nostartup"},
+        test(false, new String[] {"--no-startup"},
                 (a) -> assertCommand(a, "/s1", "|  No such command or snippet id: /s1\n|  Type /help for help."),
                 (a) -> assertCommand(a, "/1", "|  No such command or snippet id: /1\n|  Type /help for help."),
                 (a) -> assertCommand(a, "/e1", "|  No such command or snippet id: /e1\n|  Type /help for help.")
@@ -268,10 +268,7 @@
                 (a) -> assertCommand(a, "/classpath " + classpath, String.format("|  Path '%s' added to classpath", classpath)),
                 (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "A")
         );
-        test(new String[] { "-cp", classpath.toString() },
-                (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "A")
-        );
-        test(new String[] { "-classpath", classpath.toString() },
+        test(new String[] { "--class-path", classpath.toString() },
                 (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "A")
         );
     }
@@ -287,10 +284,7 @@
                 (a) -> assertCommand(a, "/classpath " + jarPath, String.format("|  Path '%s' added to classpath", jarPath)),
                 (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "A")
         );
-        test(new String[] { "-cp", jarPath.toString() },
-                (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "A")
-        );
-        test(new String[] { "-classpath", jarPath.toString() },
+        test(new String[] { "--class-path", jarPath.toString() },
                 (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "A")
         );
     }
@@ -300,10 +294,10 @@
             Compiler compiler = new Compiler();
             Path startup = compiler.getPath("StartupFileOption/startup.txt");
             compiler.writeToFile(startup, "class A { public String toString() { return \"A\"; } }");
-            test(new String[]{"-startup", startup.toString()},
+            test(new String[]{"--startup", startup.toString()},
                     (a) -> evaluateExpression(a, "A", "new A()", "A")
             );
-            test(new String[]{"-nostartup"},
+            test(new String[]{"--no-startup"},
                     (a) -> assertCommandCheckOutput(a, "printf(\"\")", assertStartsWith("|  Error:\n|  cannot find symbol"))
             );
             test(
@@ -550,7 +544,7 @@
     }
 
     public void testHistoryReference() {
-        test(false, new String[]{"-nostartup"},
+        test(false, new String[]{"--no-startup"},
                 a -> assertCommand(a, "System.err.println(1)", "", "", null, "", "1\n"),
                 a -> assertCommand(a, "System.err.println(2)", "", "", null, "", "2\n"),
                 a -> assertCommand(a, "/-2", "System.err.println(1)", "", null, "", "1\n"),
--- a/langtools/test/jdk/jshell/ToolCommandOptionTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/jdk/jshell/ToolCommandOptionTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -23,7 +23,7 @@
 
  /*
  * @test
- * @bug 8157395 8157393 8157517
+ * @bug 8157395 8157393 8157517 8158738
  * @summary Tests of jshell comand options, and undoing operations
  * @modules jdk.jshell/jdk.internal.jshell.tool
  * @build ToolCommandOptionTest ReplToolTesting
@@ -88,7 +88,7 @@
     }
 
     public void dropTest() {
-        test(false, new String[]{"-nostartup"},
+        test(false, new String[]{"--no-startup"},
                 (a) -> assertCommand(a, "int x = 5;",
                         "x ==> 5"),
                 (a) -> assertCommand(a, "x",
@@ -148,6 +148,8 @@
                         "|  Unknown option: -furball -mattress -- /retain editor -furball -mattress"),
                 (a) -> assertCommand(a, "/retain editor -default prog",
                         "|  Specify -default option or program, not both -- /retain editor -default prog"),
+                (a) -> assertCommand(a, "/retain editor -default -wait",
+                        "|  -wait applies to external editors, cannot be used with -default"),
                 (a) -> assertCommand(a, "/retain editor prog",
                         "|  Editor set to: prog"),
                 (a) -> assertCommand(a, "/retain editor prog -default",
--- a/langtools/test/jdk/jshell/ToolLocaleMessageTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/jdk/jshell/ToolLocaleMessageTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -44,7 +44,7 @@
 public class ToolLocaleMessageTest extends ReplToolTesting {
 
     void testLocale(ReplTest... tests) {
-        test(Locale.getDefault(), false, new String[]{"-nostartup"}, "", tests);
+        test(Locale.getDefault(), false, new String[]{"--no-startup"}, "", tests);
     }
 
     void assertCommandOK(boolean after, String cmd, String... contains) {
--- a/langtools/test/jdk/jshell/ToolReloadTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/jdk/jshell/ToolReloadTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -90,7 +90,7 @@
     }
 
     public void testReloadDrop() {
-        test(false, new String[]{"-nostartup"},
+        test(false, new String[]{"--no-startup"},
                 a -> assertVariable(a, "int", "a"),
                 a -> dropVariable(a, "/dr 1", "int a = 0", "|  dropped variable a"),
                 a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
@@ -113,7 +113,7 @@
     }
 
     public void testReloadQuiet() {
-        test(false, new String[]{"-nostartup"},
+        test(false, new String[]{"--no-startup"},
                 a -> assertVariable(a, "int", "a"),
                 a -> dropVariable(a, "/dr 1", "int a = 0", "|  dropped variable a"),
                 a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
@@ -130,7 +130,7 @@
     }
 
     public void testReloadRepeat() {
-        test(false, new String[]{"-nostartup"},
+        test(false, new String[]{"--no-startup"},
                 (a) -> assertVariable(a, "int", "c", "7", "7"),
                 (a) -> assertCommand(a, "++c", null),
                 (a) -> assertCommand(a, "/!", null),
@@ -150,7 +150,7 @@
     }
 
     public void testReloadIgnore() {
-        test(false, new String[]{"-nostartup"},
+        test(false, new String[]{"--no-startup"},
                 (a) -> assertCommand(a, "(-)", null),
                 (a) -> assertCommand(a, "/list", null),
                 (a) -> assertCommand(a, "/history", null),
@@ -201,13 +201,13 @@
     }
 
     public void testReloadExitRestore() {
-        test(false, new String[]{"-nostartup"},
+        test(false, new String[]{"--no-startup"},
                 (a) -> assertVariable(a, "int", "x", "5", "5"),
                 (a) -> assertMethod(a, "int m(int z) { return z * z; }",
                         "(int)int", "m"),
                 (a) -> evaluateExpression(a, "int", "m(x)", "25")
         );
-        test(false, new String[]{"-nostartup"},
+        test(false, new String[]{"--no-startup"},
                 (a) -> assertCommand(a, "/reload -restore",
                         "|  Restarting and restoring from previous state.\n" +
                         "-: int x = 5;\n" +
--- a/langtools/test/jdk/jshell/ToolSimpleTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/jdk/jshell/ToolSimpleTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024
+ * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897
  * @summary Simple jshell tool tests
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
@@ -157,7 +157,6 @@
         );
     }
 
-    @Test(enabled = false) // TODO 8153897
     public void defineUnresolvedVar() {
         test(
                 (a) -> assertCommand(a, "undefined x",
@@ -209,7 +208,7 @@
     }
 
     public void testDrop() {
-        test(false, new String[]{"-nostartup"},
+        test(false, new String[]{"--no-startup"},
                 a -> assertVariable(a, "int", "a"),
                 a -> dropVariable(a, "/drop 1", "int a = 0", "|  dropped variable a"),
                 a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
@@ -223,7 +222,7 @@
                 a -> assertCommandCheckOutput(a, "/types", assertClasses()),
                 a -> assertCommandCheckOutput(a, "/imports", assertImports())
         );
-        test(false, new String[]{"-nostartup"},
+        test(false, new String[]{"--no-startup"},
                 a -> assertVariable(a, "int", "a"),
                 a -> dropVariable(a, "/drop a", "int a = 0", "|  dropped variable a"),
                 a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
@@ -238,7 +237,7 @@
     }
 
     public void testDropNegative() {
-        test(false, new String[]{"-nostartup"},
+        test(false, new String[]{"--no-startup"},
                 a -> assertCommandOutputStartsWith(a, "/drop 0", "|  No such snippet: 0"),
                 a -> assertCommandOutputStartsWith(a, "/drop a", "|  No such snippet: a"),
                 a -> assertCommandCheckOutput(a, "/drop",
@@ -462,20 +461,20 @@
     }
 
     public void testOptionQ() {
-        test(new String[]{"-q", "-nostartup"},
+        test(new String[]{"-q", "--no-startup"},
                 (a) -> assertCommand(a, "1+1", "$1 ==> 2"),
                 (a) -> assertCommand(a, "int x = 5", "")
         );
     }
 
-    public void testOptionQq() {
-        test(new String[]{"-qq", "-nostartup"},
+    public void testOptionS() {
+        test(new String[]{"-s", "--no-startup"},
                 (a) -> assertCommand(a, "1+1", "")
         );
     }
 
     public void testOptionV() {
-        test(new String[]{"-v", "-nostartup"},
+        test(new String[]{"-v", "--no-startup"},
                 (a) -> assertCommand(a, "1+1",
                         "$1 ==> 2\n" +
                         "|  created scratch variable $1 : int")
@@ -483,14 +482,36 @@
     }
 
     public void testOptionFeedback() {
-        test(new String[]{"-feedback", "concise", "-nostartup"},
+        test(new String[]{"--feedback", "concise", "--no-startup"},
                 (a) -> assertCommand(a, "1+1", "$1 ==> 2"),
                 (a) -> assertCommand(a, "int x = 5", "")
         );
     }
 
+    public void testCompoundOptions() {
+        Consumer<String> confirmNoStartup = s -> {
+                    assertEquals(0, Stream.of(s.split("\n"))
+                            .filter(l -> !l.isEmpty())
+                            .count(), "Expected no lines: " + s);
+                };
+        test(new String[]{"-nq"},
+                (a) -> assertCommandCheckOutput(a, "/list -all", confirmNoStartup),
+                (a) -> assertCommand(a, "1+1", "$1 ==> 2"),
+                (a) -> assertCommand(a, "int x = 5", "")
+        );
+        test(new String[]{"-qn"},
+                (a) -> assertCommandCheckOutput(a, "/list -all", confirmNoStartup),
+                (a) -> assertCommand(a, "1+1", "$1 ==> 2"),
+                (a) -> assertCommand(a, "int x = 5", "")
+        );
+        test(new String[]{"-ns"},
+                (a) -> assertCommandCheckOutput(a, "/list -all", confirmNoStartup),
+                (a) -> assertCommand(a, "1+1", "")
+        );
+    }
+
     public void testOptionR() {
-        test(new String[]{"-R-Dthe.sound=blorp", "-nostartup"},
+        test(new String[]{"-R-Dthe.sound=blorp", "--no-startup"},
                 (a) -> assertCommand(a, "System.getProperty(\"the.sound\")",
                         "$1 ==> \"blorp\"")
         );
--- a/langtools/test/tools/javac/InnerClassesAttribute/Test.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/tools/javac/InnerClassesAttribute/Test.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8047338/FilterNonMembersToObtainFunctionDescriptorTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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 8047338
+ * @summary javac is not correctly filtering non-members methods to obtain the function descriptor
+ * @compile FilterNonMembersToObtainFunctionDescriptorTest.java
+ */
+
+public class FilterNonMembersToObtainFunctionDescriptorTest {
+    <V, E extends Exception> V fails(CallableFail<V, E> callable) throws E {
+        return null;
+    }
+
+    <V, E extends Exception> V failsSub(CallableFailSub<V, E> callable) throws E {
+        return null;
+    }
+
+    void m() throws Exception {
+        fails((String s) -> 2);
+        failsSub((String s) -> 2);
+    }
+
+    interface Callable<V> {
+        V callFail(String s) throws Exception;
+    }
+
+    interface CallableFail<V, E extends Exception> extends Callable<V> {
+        @Override
+        V callFail(String s) throws E;
+    }
+
+    interface CallableFailSub<V, E extends Exception> extends CallableFail<V, E> {}
+}
--- a/langtools/test/tools/javac/VersionOpt.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/tools/javac/VersionOpt.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@
         // Test functions by comparing the version string from javac against
         // a "golden" version generated automatically from the underlying JVM.
         // As such, it is only effective in testing the "standard" compiler,
-        // and not any development version being tested via -Xpatch.
+        // and not any development version being tested via --patch-modules.
         // Check the version of the compiler being used, and let the test pass
         // automatically if is is a development version.
         Class<?> javacClass = com.sun.tools.javac.Main.class;
--- a/langtools/test/tools/javac/diags/examples/DirPathElementNotDirectory/modulesourcepath	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/tools/javac/diags/examples/DirPathElementNotDirectory/modulesourcepath	Fri Aug 26 14:47:52 2016 -0700
@@ -21,5 +21,5 @@
  * questions.
  */
 
-// a file to be passed in where a directory is expected (-modulesourcepath option)
+// a file to be passed in where a directory is expected (--module-source-path option)
 // to trigger an error deliberately.
--- a/langtools/test/tools/javac/diags/examples/ModuleNotFoundInModuleSourcePath/ModuleNotFoundInModuleSourcePath.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/tools/javac/diags/examples/ModuleNotFoundInModuleSourcePath/ModuleNotFoundInModuleSourcePath.java	Fri Aug 26 14:47:52 2016 -0700
@@ -22,6 +22,6 @@
  */
 
 // key: compiler.err.module.not.found.in.module.source.path
-// options: -m m1 -modulesourcepath src
+// options: -m m1 --module-source-path src
 
 class ModuleNotFoundInModuleSourcePath {}
--- a/langtools/test/tools/javac/diags/examples/XModuleWithModulePath/XModuleWithModulePath.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/tools/javac/diags/examples/XModuleWithModulePath/XModuleWithModulePath.java	Fri Aug 26 14:47:52 2016 -0700
@@ -22,6 +22,6 @@
  */
 
 // key: compiler.err.xmodule.no.module.sourcepath
-// options: -Xmodule:java.compiler -modulesourcepath src
+// options: -Xmodule:java.compiler --module-source-path src
 
 class XModuleWithModulePath {}
--- a/langtools/test/tools/javac/file/LimitedImage.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/tools/javac/file/LimitedImage.java	Fri Aug 26 14:47:52 2016 -0700
@@ -28,7 +28,7 @@
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
- * @run main/othervm -limitmods jdk.compiler LimitedImage
+ * @run main/othervm --limit-modules jdk.compiler LimitedImage
  */
 
 import java.io.IOException;
@@ -133,4 +133,4 @@
         }
     }
 
-}
\ No newline at end of file
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/8164399/T8164399.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8164399
+ * @summary inference of thrown variable does not work correctly
+ * @compile T8164399.java
+ */
+
+abstract class T8164399 {
+
+    interface ThrowableRunnable<E extends Throwable> {
+       void compute() throws E;
+    }
+
+    public abstract < E extends Exception> void computeException(ThrowableRunnable<E> process) throws E;
+
+
+    public static <T, E extends Throwable> T compute(ThrowableRunnable<E> action) throws E {
+        return null;
+    }
+
+    {
+        computeException(() -> compute(() -> {}));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/8164399/T8164399b.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,21 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8164399
+ * @summary inference of thrown variable does not work correctly
+ * @compile/fail/ref=T8164399b.out -XDrawDiagnostics T8164399b.java
+ */
+class T8164399b<X extends Throwable> {
+    <T extends Throwable> void m(Class<? super T> arg) throws T {}
+    <T extends X> void g() throws T {}
+
+    void test() {
+        m(RuntimeException.class); // ok
+        m(Exception.class); // error
+        m(Throwable.class); // ok
+        m(java.io.Serializable.class); // error
+        m(Object.class); // error
+        m(Runnable.class); // error
+        T8164399b<? super Exception> x = null;
+        x.g(); // expected: ok; actual: error
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/8164399/T8164399b.out	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,2 @@
+T8164399b.java:17:10: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable&java.lang.Runnable
+1 error
--- a/langtools/test/tools/javac/modules/GraphsTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/tools/javac/modules/GraphsTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -194,7 +194,7 @@
                 .write(modSrc);
         String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
-                        "-modulesourcepath", modSrc.toString())
+                        "--module-source-path", modSrc.toString())
                 .outdir(Files.createDirectories(base.resolve("negative")))
                 .files(findJavaFiles(modSrc))
                 .run(Task.Expect.FAIL)
--- a/langtools/test/tools/javac/modules/ModuleSourcePathTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/tools/javac/modules/ModuleSourcePathTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @summary tests for -modulesourcepath
+ * @summary tests for --module-source-path
  * @library /tools/lib
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
--- a/langtools/test/tools/javac/modules/NPEEmptyFileTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/tools/javac/modules/NPEEmptyFileTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @summary NPE while compiling empty javafile with -modulesourcepath option
+ * @summary NPE while compiling empty source file with --module-source-path option
  * @library /tools/lib
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
--- a/langtools/test/tools/javac/modules/SingleModuleModeTest.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/tools/javac/modules/SingleModuleModeTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/modules/T8161501/EmptyClass.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+
+class EmptyClass {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/modules/T8161501/UnnamedModuleUnnamedPackageTest.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8161501
+ * @summary JSR269 jigsaw update: javax.lang.model.element.ModuleElement.getEnclosedElements() on unnamed module with unnamed package
+ * @compile UnnamedModuleUnnamedPackageTest.java
+ * @compile -processor UnnamedModuleUnnamedPackageTest UnnamedModuleUnnamedPackageTest.java EmptyClass.java
+ */
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.*;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+@SupportedAnnotationTypes("*")
+public class UnnamedModuleUnnamedPackageTest extends AbstractProcessor {
+    static final Set<String> expected = new HashSet<>(Arrays.asList("unnamed package", "pkg1"));
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        for (Element e: roundEnv.getRootElements()) {
+            Element m = e.getEnclosingElement();
+            while (!(m instanceof ModuleElement)) {
+                m = m.getEnclosingElement();
+            }
+            Set<String> found = m.getEnclosedElements().stream()
+                .map(p -> ((PackageElement)p).isUnnamed() ?
+                                        "unnamed package" :
+                                        ((PackageElement)p).getQualifiedName().toString())
+                .collect(Collectors.toSet());
+            if (!Objects.equals(expected, found)) {
+                System.err.println("expected: " + expected);
+                System.err.println("found: " + found);
+                throw new AssertionError("unexpected packages found");
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+}
--- a/langtools/test/tools/javac/redefineObject/Object1-test.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/tools/javac/redefineObject/Object1-test.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997,2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/langtools/test/tools/javac/redefineObject/Object2-test.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/tools/javac/redefineObject/Object2-test.java	Fri Aug 26 14:47:52 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997,2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/cases/jdk/deprcases/members/ExampleAnnotation.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.deprcases.members;
+
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+
+@Retention(value=RetentionPolicy.RUNTIME)
+@Target({TYPE, METHOD, FIELD})
+public @interface ExampleAnnotation {
+    String file();
+    @Deprecated String name() default "";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/cases/jdk/deprcases/members/ExampleClass.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.deprcases.members;
+
+public class ExampleClass {
+    public ExampleClass() { }
+
+    @Deprecated
+    public ExampleClass(boolean deprecatedConstructor) { }
+
+    @Deprecated
+    public void method1() { }
+
+    @Deprecated
+    public void method2() { }
+
+    @Deprecated
+    public int field1 = 0;
+
+    @Deprecated
+    public int field2 = 0;
+
+    @Deprecated
+    public static void staticmethod1() { }
+
+    @Deprecated
+    public static int staticfield3 = 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/cases/jdk/deprcases/members/ExampleElements.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.deprcases.members;
+
+public class ExampleElements {
+    @Deprecated
+    Object emptyFalse;
+
+    @Deprecated(since="xyzzy")
+    Object sinceFalse;
+
+    @Deprecated(forRemoval=true)
+    Object emptyTrue;
+
+    @Deprecated(since="plugh", forRemoval=true)
+    Object sinceTrue;
+
+    @Deprecated(since="123,456")
+    Object sinceWithComma;
+
+    @Deprecated(since="7.9 \"pre-beta\" snapshot")
+    Object sinceWithQuote;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/cases/jdk/deprcases/members/ExampleEnum.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.deprcases.members;
+
+public enum ExampleEnum {
+    ONE,
+    TWO {
+        @Override
+        public void deprMethod1() { }
+        @Override @Deprecated
+        public void deprMethod2() { }
+    },
+    @Deprecated THREE,
+    FOUR,
+    @Deprecated FIVE;
+
+    @Deprecated
+    public void deprMethod1() { }
+
+    public void deprMethod2() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/cases/jdk/deprcases/members/ExampleInterface.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.deprcases.members;
+
+public interface ExampleInterface {
+    @Deprecated
+    static final int DEP_FIELD1 = 1;
+
+    @Deprecated
+    static final int DEP_FIELD2 = 2;
+
+    @Deprecated
+    void interfaceMethod1();
+
+    @Deprecated
+    void interfaceMethod2();
+
+    @Deprecated
+    default void defaultMethod() { }
+
+    @Deprecated
+    static void staticmethod2() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/cases/jdk/deprcases/members/ExampleSubclass.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.deprcases.members;
+
+public abstract class ExampleSubclass extends ExampleClass implements ExampleInterface {
+    @Override
+    public void method1() { }
+
+    // hides ExampleClass.field1
+    public Object field1 = null;
+
+    @Override
+    public void interfaceMethod2() {
+    }
+
+    // hides ExampleInterface.DEP_FIELD1
+    public Object DEP_FIELD1 = null;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/cases/jdk/deprcases/types/DeprecatedAnnotation.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.deprcases.types;
+
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+
+@Retention(value=RetentionPolicy.RUNTIME)
+@Target({TYPE, METHOD, FIELD})
+@Deprecated
+public @interface DeprecatedAnnotation {
+    String file() default "x";
+    String value() default "y";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/cases/jdk/deprcases/types/DeprecatedClass.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.deprcases.types;
+
+@Deprecated
+public class DeprecatedClass {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/cases/jdk/deprcases/types/DeprecatedEnum.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.deprcases.types;
+
+@Deprecated
+public enum DeprecatedEnum {
+    FIRST,
+    SECOND,
+    THIRD
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/cases/jdk/deprcases/types/DeprecatedException.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.deprcases.types;
+
+@Deprecated
+public class DeprecatedException extends RuntimeException {
+    private static final long serialVersionUID = 0L;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/cases/jdk/deprcases/types/DeprecatedInterface.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.deprcases.types;
+
+@Deprecated
+public interface DeprecatedInterface {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/tests/jdk/jdeprscan/TestCSV.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Basic tests CSV printing and parsing
+ * @modules jdk.jdeps/com.sun.tools.jdeprscan
+ * @build TestCSV
+ * @run testng jdk.jdeprscan.TestCSV
+ */
+
+package jdk.jdeprscan;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
+
+import java.util.List;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import com.sun.tools.jdeprscan.CSV;
+import com.sun.tools.jdeprscan.CSVParseException;
+
+@Test
+public class TestCSV {
+    static String NL = System.lineSeparator();
+    ByteArrayOutputStream baos;
+    PrintStream out;
+
+    @BeforeMethod
+    public void setup() throws UnsupportedEncodingException {
+        baos = new ByteArrayOutputStream();
+        out = new PrintStream(baos, true, "UTF-8");
+    }
+
+    String result() {
+        out.flush();
+        return new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8);
+    }
+
+    /**
+     * Asserts string equality after checking for and removing a trailing line separator.
+     *
+     * @param expected expected result
+     */
+    void checkString(String expected) {
+        String actual = result();
+        assertTrue(actual.endsWith(NL));
+        assertEquals(actual.substring(0, actual.length() - NL.length()), expected);
+    }
+
+    @DataProvider(name = "csvdata")
+    public Object[][] getCSVData() {
+        return new Object[][] {
+            { "",               List.of("") },
+            { "a",              List.of("a") },
+            { "a,b",            List.of("a", "b") },
+            { "a,b,c",          List.of("a", "b", "c") },
+            { ",a,b",           List.of("", "a", "b") },
+            { "a,b,",           List.of("a", "b", "") },
+            { ",a,b,",          List.of("", "a", "b", "") },
+            { ",a,,b,",         List.of("", "a", "", "b", "") },
+            { ",",              List.of("", "") },
+            { ",,",             List.of("", "", "") },
+            { ",,,",            List.of("", "", "", "") },
+            { " a , b ",        List.of(" a ", " b ") },
+            { "a,\",\",b",      List.of("a", ",", "b") },
+            { "a,\"b\"\"c\",d", List.of("a", "b\"c", "d") },
+            { "a,\"b,c\",d",    List.of("a", "b,c", "d") },
+
+            // from https://en.wikipedia.org/wiki/Comma-separated_values
+            // slightly modified to enable round-tripping
+
+            { "Year,Make,Model,Description,Price",
+                List.of("Year", "Make", "Model", "Description", "Price") },
+            { "1997,Ford,E350,\"ac, abs, moon\",3000.00",
+                List.of("1997", "Ford", "E350", "ac, abs, moon", "3000.00") },
+            { "1999,Chevy,\"Venture \"\"Extended Edition\"\"\",,4900.00",
+                List.of("1999", "Chevy", "Venture \"Extended Edition\"", "", "4900.00") },
+            { "1999,Chevy,\"Venture \"\"Extended Edition, Very Large\"\"\",,5000.00",
+                List.of("1999", "Chevy", "Venture \"Extended Edition, Very Large\"", "", "5000.00") },
+            { "1996,Jeep,Grand Cherokee,\"MUST SELL!\nair, moon roof, loaded\",4799.00",
+                List.of("1996", "Jeep", "Grand Cherokee", "MUST SELL!\nair, moon roof, loaded", "4799.00") }
+        };
+    }
+
+    @Test(dataProvider = "csvdata")
+    public void roundTrip(String input, List<String> parsed) {
+        List<String> actual = CSV.split(input);
+        assertEquals(actual, parsed);
+        CSV.write(out, actual.toArray());
+        checkString(input);
+    }
+
+    // won't round-trip
+    public void testExtraQuote() {
+        assertEquals(CSV.split("a,\"b\",c"), List.of("a", "b", "c"));
+    }
+
+    // won't round-trip
+    public void testEmptyQuote() {
+        assertEquals(CSV.split("a,\"\",b"), List.of("a", "", "b"));
+    }
+
+    @Test(expectedExceptions=CSVParseException.class)
+    public void errorUnexpectedQuote() {
+        CSV.split("ab\"cd");
+    }
+
+    @Test(expectedExceptions=CSVParseException.class)
+    public void errorCharacterAfterQuote() {
+        CSV.split("a,\"b\"c,d");
+    }
+
+    @Test(expectedExceptions=CSVParseException.class)
+    public void errorUnclosedQuote() {
+        CSV.split("a,\"b");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/tests/jdk/jdeprscan/TestLoad.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Test of jdeprscan tool loading and printing to aCSV file.
+ * @modules jdk.jdeps/com.sun.tools.jdeprscan
+ * @library ../../../cases
+ * @build jdk.deprcases.members.* jdk.deprcases.types.*
+ * @build jdk.jdeprscan.TestLoad
+ * @run testng jdk.jdeprscan.TestLoad
+ */
+
+package jdk.jdeprscan;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import com.sun.tools.jdeprscan.Main;
+
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertEquals;
+
+
+public class TestLoad {
+    static final String UTF8 = "UTF-8";
+    static final String EXPECTED = "TestLoadExpected.csv";
+
+    @Test
+    public void test1() throws IOException, UnsupportedEncodingException {
+        String testclasses = System.getProperty("test.classes");
+        String deprcases = testclasses + "/../../../cases";
+        boolean rval;
+
+        System.out.println("test.src = " + System.getProperty("test.src"));
+        ByteArrayOutputStream bout = new ByteArrayOutputStream();
+        ByteArrayOutputStream berr = new ByteArrayOutputStream();
+
+        try (PrintStream prout = new PrintStream(bout, true, UTF8);
+             PrintStream prerr = new PrintStream(berr, true, UTF8)) {
+            System.out.println("Calling JDeprScan --Xprint-csv --Xload-dir " + deprcases);
+            rval = Main.call(prout, prerr, "--Xprint-csv", "--Xload-dir", deprcases);
+            System.out.println("JDeprScan returns " + rval);
+        }
+
+        System.out.println("----- stdout");
+        new ByteArrayInputStream(bout.toByteArray()).transferTo(System.out);
+        System.out.println("----- end stdout");
+        System.out.println("----- stderr");
+        new ByteArrayInputStream(berr.toByteArray()).transferTo(System.out);
+        System.out.println("----- end stderr");
+
+        List<String> actualList;
+        try (ByteArrayInputStream bais = new ByteArrayInputStream(bout.toByteArray());
+             InputStreamReader isr = new InputStreamReader(bais);
+             BufferedReader br = new BufferedReader(isr)) {
+            actualList = br.lines().collect(Collectors.toList());
+        }
+
+        Path expfile = Paths.get(System.getProperty("test.src"), EXPECTED);
+        List<String> expectedList = Files.readAllLines(expfile);
+
+        Set<String> actual = new HashSet<>(actualList.subList(1, actualList.size()));
+        Set<String> expected = new HashSet<>(expectedList.subList(1, expectedList.size()));
+
+        Set<String> diff1 = new HashSet<>(actual);
+        diff1.removeAll(expected);
+        Set<String> diff2 = new HashSet<>(expected);
+        diff2.removeAll(actual);
+        if (diff1.size() > 0) {
+            System.out.println("Extra lines in output:");
+            diff1.forEach(System.out::println);
+        }
+
+        if (diff2.size() > 0) {
+            System.out.println("Lines missing from output:");
+            diff2.forEach(System.out::println);
+        }
+
+        assertTrue(rval);
+        assertEquals(berr.toByteArray().length, 0);
+        assertEquals(actual.size(), actualList.size() - 1);
+        assertEquals(diff1.size(), 0);
+        assertEquals(diff2.size(), 0);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/tests/jdk/jdeprscan/TestLoadExpected.csv	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,30 @@
+#jdepr 1
+METHOD,jdk/deprcases/members/ExampleAnnotation,name()Ljava/lang/String;,,false
+FIELD,jdk/deprcases/members/ExampleClass,field1,,false
+FIELD,jdk/deprcases/members/ExampleClass,field2,,false
+FIELD,jdk/deprcases/members/ExampleClass,staticfield3,,false
+CONSTRUCTOR,jdk/deprcases/members/ExampleClass,<init>(Z)V,,false
+METHOD,jdk/deprcases/members/ExampleClass,method1()V,,false
+METHOD,jdk/deprcases/members/ExampleClass,method2()V,,false
+METHOD,jdk/deprcases/members/ExampleClass,staticmethod1()V,,false
+METHOD,jdk/deprcases/members/ExampleEnum$1,deprMethod2()V,,false
+ENUM_CONSTANT,jdk/deprcases/members/ExampleEnum,THREE,,false
+ENUM_CONSTANT,jdk/deprcases/members/ExampleEnum,FIVE,,false
+METHOD,jdk/deprcases/members/ExampleEnum,deprMethod1()V,,false
+FIELD,jdk/deprcases/members/ExampleInterface,DEP_FIELD1,,false
+FIELD,jdk/deprcases/members/ExampleInterface,DEP_FIELD2,,false
+METHOD,jdk/deprcases/members/ExampleInterface,interfaceMethod1()V,,false
+METHOD,jdk/deprcases/members/ExampleInterface,interfaceMethod2()V,,false
+METHOD,jdk/deprcases/members/ExampleInterface,defaultMethod()V,,false
+METHOD,jdk/deprcases/members/ExampleInterface,staticmethod2()V,,false
+ANNOTATION_TYPE,jdk/deprcases/types/DeprecatedAnnotation,,,false
+CLASS,jdk/deprcases/types/DeprecatedClass,,,false
+ENUM,jdk/deprcases/types/DeprecatedEnum,,,false
+CLASS,jdk/deprcases/types/DeprecatedException,,,false
+INTERFACE,jdk/deprcases/types/DeprecatedInterface,,,false
+FIELD,jdk/deprcases/members/ExampleElements,emptyFalse,,false
+FIELD,jdk/deprcases/members/ExampleElements,sinceFalse,xyzzy,false
+FIELD,jdk/deprcases/members/ExampleElements,emptyTrue,,true
+FIELD,jdk/deprcases/members/ExampleElements,sinceTrue,plugh,true
+FIELD,jdk/deprcases/members/ExampleElements,sinceWithComma,"123,456",false
+FIELD,jdk/deprcases/members/ExampleElements,sinceWithQuote,"7.9 ""pre-beta"" snapshot",false
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/tests/jdk/jdeprscan/TestMethodSig.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Simple tests for method signature parsing
+ * @modules jdk.jdeps/com.sun.tools.jdeprscan.scan
+ * @build TestMethodSig
+ * @run testng jdk.jdeprscan.TestMethodSig
+ */
+
+package jdk.jdeprscan;
+
+import org.testng.annotations.Test;
+import static org.testng.Assert.assertEquals;
+import static com.sun.tools.jdeprscan.scan.MethodSig.fromDesc;
+
+public class TestMethodSig {
+    @Test
+    public void testSimple() {
+        assertEquals(fromDesc("(Ljava/rmi/RMISecurityManager;)Ljava/lang/Object;").toString(),
+                     "parameters 0=Ljava/rmi/RMISecurityManager; return Ljava/lang/Object;");
+    }
+
+    @Test
+    public void testMultParamVoidReturn() {
+        assertEquals(fromDesc("([[IZLjava/lang/String;B[J)V").toString(),
+                     "parameters 0=[[I 1=Z 2=Ljava/lang/String; 3=B 4=[J return V");
+    }
+
+    @Test
+    public void testNoParams() {
+        assertEquals(fromDesc("()J").toString(),
+                     "parameters none return J");
+    }
+
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testMissingReturnType() {
+        fromDesc("(ISJZ)");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/tests/jdk/jdeprscan/TestScan.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Basic test of jdeprscan's scanning phase.
+ * @modules jdk.jdeps/com.sun.tools.jdeprscan
+ * @library ../../../cases
+ * @library ../../../usage
+ * @build jdk.deprcases.members.* jdk.deprcases.types.*
+ * @build jdk.deprusage.*
+ * @build jdk.jdeprscan.TestScan
+ * @run testng jdk.jdeprscan.TestScan
+ */
+
+package jdk.jdeprscan;
+
+import com.sun.tools.jdeprscan.Main;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.stream.Collectors;
+import org.testng.Assert;
+
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertTrue;
+
+
+public class TestScan {
+    Set<String> loadExpected() throws IOException {
+        Path expFile = Paths.get(System.getProperty("test.src"), "TestScanExpected.txt");
+        return new HashSet<>(Files.readAllLines(expFile, StandardCharsets.UTF_8));
+    }
+
+    @Test
+    public void testScanAgainstReferenceFile() throws IOException {
+        String testclasses = System.getProperty("test.classes");
+        String deprcases = testclasses + "/../../../cases";
+        String deprusage = testclasses + "/../../../usage";
+
+        Set<String> expected = loadExpected();
+        System.out.println("expected = " + expected);
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (PrintStream out = new PrintStream(baos, false, "UTF-8")) {
+            boolean r = Main.call(out, System.err,
+                "-cp", deprcases, "--Xload-dir", deprcases, deprusage);
+            assertTrue(r);
+        }
+        byte[] bytes = baos.toByteArray();
+
+        System.out.println("--- output ---");
+        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+        bais.transferTo(System.out);
+        System.out.println("--- end output ---");
+
+        Set<String> actual =
+            new BufferedReader(
+                new InputStreamReader(
+                    new ByteArrayInputStream(bytes), StandardCharsets.UTF_8))
+                        .lines()
+                        .map(line -> line.split(" +"))
+                        .map(array -> array[1])
+                        .collect(Collectors.toSet());
+        System.out.println("actual = " + actual);
+
+        Set<String> diff1 = new HashSet<>(expected);
+        diff1.removeAll(actual);
+        Set<String> diff2 = new HashSet<>(actual);
+        diff2.removeAll(expected);
+
+        if (diff1.size() > 0 || diff2.size() > 0) {
+            System.out.println("missing items: " + diff1);
+            System.out.println("extra items: " + diff2);
+        }
+
+        Assert.assertEquals(diff1.size(), 0);
+        Assert.assertEquals(diff2.size(), 0);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/tests/jdk/jdeprscan/TestScanExpected.txt	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,47 @@
+jdk/jdeprusage/UseClass$ArrayCreation
+jdk/jdeprusage/UseClass$ArrayFieldUsage
+jdk/jdeprusage/UseClass$ArrayMethodCall
+jdk/jdeprusage/UseClass$Cast
+jdk/jdeprusage/UseClass$ClassLiteral
+jdk/jdeprusage/UseClass$Construct
+jdk/jdeprusage/UseClass$Extends
+jdk/jdeprusage/UseClass$FieldType
+jdk/jdeprusage/UseClass$InstanceOf
+jdk/jdeprusage/UseClass$MethodParameter
+jdk/jdeprusage/UseClass$MethodReturn
+jdk/jdeprusage/UseEnum$ClassObject
+jdk/jdeprusage/UseEnum$EnumConstant
+jdk/jdeprusage/UseEnum$FieldType
+jdk/jdeprusage/UseEnum$MethodParameter
+jdk/jdeprusage/UseEnum$ReturnValue
+jdk/jdeprusage/UseEnum$ValueOfMethod
+jdk/jdeprusage/UseEnum$ValuesMethod
+jdk/jdeprusage/UseEnumMembers$1
+jdk/jdeprusage/UseEnumMembers$MethodInEnum1
+jdk/jdeprusage/UseEnumMembers$MethodOnConstant1
+jdk/jdeprusage/UseEnumMembers$ReturnValue
+jdk/jdeprusage/UseException$Catch
+jdk/jdeprusage/UseException$Throws
+jdk/jdeprusage/UseField$Direct
+jdk/jdeprusage/UseField$FromSubclass
+jdk/jdeprusage/UseField$Inherited
+jdk/jdeprusage/UseField$StaticField
+jdk/jdeprusage/UseField$SuperFromSubclass
+jdk/jdeprusage/UseInterface$ClassImplements
+jdk/jdeprusage/UseInterface$InterfaceExtends
+jdk/jdeprusage/UseMethod$ClassStatic
+jdk/jdeprusage/UseMethod$Constructor
+jdk/jdeprusage/UseMethod$ConstructorFromSubclass
+jdk/jdeprusage/UseMethod$Direct
+jdk/jdeprusage/UseMethod$Inherited
+jdk/jdeprusage/UseMethod$InheritedDefault
+jdk/jdeprusage/UseMethod$InheritedFromSubclass
+jdk/jdeprusage/UseMethod$InheritedInterface
+jdk/jdeprusage/UseMethod$InheritedInterfaceDefault
+jdk/jdeprusage/UseMethod$InterfaceDefault
+jdk/jdeprusage/UseMethod$InterfaceDirect
+jdk/jdeprusage/UseMethod$InterfaceStatic
+jdk/jdeprusage/UseMethod$OverrideClassMethod
+jdk/jdeprusage/UseMethod$OverrideDefaultMethod
+jdk/jdeprusage/UseMethod$OverrideInterfaceMethod
+jdk/jdeprusage/UseMethod$SuperFromSubclass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/usage/jdk/deprusage/UseAnnotation.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.jdeprusage;
+
+import jdk.deprcases.types.DeprecatedAnnotation;
+
+public class UseAnnotation {
+    @DeprecatedAnnotation
+    static class AnnotatedClass { }
+
+    static class AnnotatedMethod {
+        @DeprecatedAnnotation
+        void foo() { }
+    }
+
+    static class AnnotatedField {
+        @DeprecatedAnnotation
+        int foo = 1;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/usage/jdk/deprusage/UseClass.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.jdeprusage;
+
+import jdk.deprcases.types.DeprecatedClass;
+
+public class UseClass {
+    static class Extends extends DeprecatedClass {
+    }
+
+    static class ClassLiteral {
+        Class<?> clazz = DeprecatedClass.class;
+    }
+
+    static class FieldType {
+        DeprecatedClass obj = null;
+    }
+
+    static class MethodParameter {
+        void foo(DeprecatedClass x) { }
+    }
+
+    static class MethodReturn {
+        DeprecatedClass foo() { return null; }
+    }
+
+    static class ArrayCreation {
+        Object foo() {
+            return new DeprecatedClass[1];
+        }
+    }
+
+    static class ArrayFieldUsage {
+        int foo(Object o) {
+            return ((DeprecatedClass[])o).length;
+        }
+    }
+
+    static class ArrayMethodCall {
+        Object foo(Object o) {
+            return ((DeprecatedClass[])o).clone();
+        }
+    }
+
+    static class InstanceOf {
+        boolean foo(Object o) {
+            return o instanceof DeprecatedClass;
+        }
+    }
+
+    static class Cast {
+        Object foo(Object o) {
+            return (DeprecatedClass)o;
+        }
+    }
+
+    static class Generic<T> {
+        static <U> void g() { }
+    }
+
+    static class ClassTypeArg extends Generic<DeprecatedClass> { }
+
+    static class MethodTypeArg {
+        void foo() {
+            Generic.<DeprecatedClass>g();
+        }
+    }
+
+    static class ConstructorTypeArg {
+        Object foo() {
+            return new Generic<DeprecatedClass>();
+        }
+    }
+
+    static class Construct {
+        Object foo() {
+            return new DeprecatedClass();
+        }
+    }
+
+    static class Local {
+        void foo() {
+            DeprecatedClass obj = null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/usage/jdk/deprusage/UseEnum.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.jdeprusage;
+
+import jdk.deprcases.types.DeprecatedEnum;
+
+public class UseEnum {
+    static class ReturnValue {
+        static DeprecatedEnum returnValue() { return null; }
+    }
+
+    static class MethodParameter {
+        static void methodParameterType(DeprecatedEnum e) { }
+    }
+
+    static class FieldType {
+        static DeprecatedEnum field;
+    }
+
+    static class EnumConstant {
+        static Object field2 = DeprecatedEnum.FIRST;
+    }
+
+    static class ValuesMethod {
+        static Object[] valuesMethod() {
+            return DeprecatedEnum.values();
+        }
+    }
+
+    static class ValueOfMethod {
+        static Object valueOfMethod(String s) {
+            return DeprecatedEnum.valueOf(s);
+        }
+    }
+
+    static class ClassObject {
+        static Object classObject() {
+            return DeprecatedEnum.class;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/usage/jdk/deprusage/UseEnumMembers.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.jdeprusage;
+
+import jdk.deprcases.members.ExampleEnum;
+
+public class UseEnumMembers {
+    static class ReturnValue {
+        static ExampleEnum returnValue() {
+            return ExampleEnum.FIVE;
+        }
+    }
+
+    static class UseInSwitch {
+        // enum switch generates inner class UseEnumMembers$UseInSwitch$1
+        static void useInSwitch(ExampleEnum e) {
+            switch (e) {
+                case ONE:
+                case TWO:
+                case FOUR:
+                    // no deprecation
+                    break;
+                case THREE:
+                    // deprecated
+                    break;
+            }
+        }
+    }
+
+    static class MethodInEnum1 {
+        static void methodInEnum1(ExampleEnum e) {
+            e.deprMethod1();
+        }
+    }
+
+    static class MethodOnConstant1 {
+        static void methodOnConstant1() {
+            // surprising that there is a warning here;
+            // the method deprMethod1 is overridden in TWO
+            ExampleEnum.TWO.deprMethod1();
+        }
+    }
+
+    static void methodInEnum2(ExampleEnum e) {
+        e.deprMethod2();
+    }
+
+    static void methodOnConstant2() {
+        // surprising there is no warning here;
+        // the method is deprecated in TWO
+        ExampleEnum.TWO.deprMethod2();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/usage/jdk/deprusage/UseException.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.jdeprusage;
+
+import jdk.deprcases.types.DeprecatedException;
+
+public class UseException {
+    static class Throws {
+        static void foo() throws DeprecatedException { }
+    }
+
+    static class Catch {
+        void foo() {
+            try {
+                Throws.foo();
+            } catch (DeprecatedException de) { }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/usage/jdk/deprusage/UseField.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.jdeprusage;
+
+import jdk.deprcases.members.ExampleClass;
+import jdk.deprcases.members.ExampleInterface;
+import jdk.deprcases.members.ExampleSubclass;
+
+public class UseField {
+    static class Direct {
+        int f(ExampleClass ec) {
+            return ec.field1;
+        }
+    }
+
+    static class Inherited {
+        int f(ExampleSubclass esc) {
+            return esc.field2;
+        }
+    }
+
+    static class InterfaceInherited {
+        int f(ExampleSubclass esc) {
+            return esc.DEP_FIELD2;
+        }
+    }
+
+    static class InterfaceDirect {
+        int f(ExampleInterface ei) {
+            return ei.DEP_FIELD1;
+        }
+    }
+
+    static class FromSubclass extends ExampleClass {
+        int f() {
+            return field1;
+        }
+    }
+
+    static class SuperFromSubclass extends ExampleClass {
+        int f() {
+            return super.field1;
+        }
+    }
+
+    static class StaticField {
+        int f() {
+            return ExampleClass.staticfield3;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/usage/jdk/deprusage/UseInterface.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.jdeprusage;
+
+import jdk.deprcases.types.DeprecatedInterface;
+
+public class UseInterface {
+    static class ClassImplements implements DeprecatedInterface {
+
+    }
+
+    interface InterfaceExtends extends DeprecatedInterface {
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/usage/jdk/deprusage/UseMethod.java	Fri Aug 26 14:47:52 2016 -0700
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.jdeprusage;
+
+import jdk.deprcases.members.ExampleClass;
+import jdk.deprcases.members.ExampleInterface;
+import jdk.deprcases.members.ExampleSubclass;
+
+public class UseMethod {
+    static class Direct {
+        void m(ExampleClass ec) {
+            ec.method1();
+        }
+    }
+
+    static class Inherited {
+        void m(ExampleSubclass esc) {
+            esc.method2();
+        }
+    }
+
+    static class InheritedDefault {
+        void m(ExampleSubclass esc) {
+            esc.defaultMethod();
+        }
+    }
+
+    static class InterfaceDirect {
+        void m(ExampleInterface ei) {
+            ei.interfaceMethod1();
+        }
+    }
+
+    static class InterfaceDefault {
+        void m(ExampleInterface ei) {
+            ei.defaultMethod();
+        }
+    }
+
+    static class ClassStatic {
+        void m() {
+            ExampleClass.staticmethod1();
+        }
+    }
+
+    static class InterfaceStatic {
+        void m() {
+            ExampleInterface.staticmethod2();
+        }
+    }
+
+    static class SuperFromSubclass extends ExampleClass {
+        void m() {
+            super.method1();
+        }
+    }
+
+    static class InheritedFromSubclass extends ExampleClass {
+        void m() {
+            method1();
+        }
+    }
+
+    static class Constructor {
+        Object m() {
+            return new ExampleClass(true);
+        }
+    }
+
+    static class ConstructorFromSubclass extends ExampleClass {
+        public ConstructorFromSubclass() {
+            super(true);
+        }
+    }
+
+    abstract static class InheritedInterfaceDefault extends ExampleSubclass {
+        void m() {
+            defaultMethod();
+        }
+    }
+
+    abstract static class InheritedInterface extends ExampleSubclass {
+        void m() {
+            interfaceMethod1();
+        }
+    }
+
+    static class OverrideClassMethod extends ExampleClass {
+        @Override
+        public void method1() { }
+    }
+
+    abstract static class OverrideInterfaceMethod implements ExampleInterface {
+        @Override
+        public void interfaceMethod1() { }
+    }
+
+    abstract static class OverrideDefaultMethod implements ExampleInterface {
+        @Override
+        public void defaultMethod() { }
+    }
+}
--- a/langtools/test/tools/jdeps/jdkinternals/RemovedJDKInternals.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/tools/jdeps/jdkinternals/RemovedJDKInternals.java	Fri Aug 26 14:47:52 2016 -0700
@@ -73,7 +73,7 @@
         // patch jdk.unsupported and set -cp to codec types
         assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "p"),
                                          CLASSES_DIR,
-                                         "-Xpatch:jdk.unsupported=" + patchDir,
+                                         "--patch-module", "jdk.unsupported=" + patchDir,
                                          "-cp", codecDest.toString()));
     }
 
--- a/langtools/test/tools/jdeps/lib/CompilerUtils.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/langtools/test/tools/jdeps/lib/CompilerUtils.java	Fri Aug 26 14:47:52 2016 -0700
@@ -100,7 +100,7 @@
         }
 
         Stream<String> opts = Arrays.stream(new String[] {
-            "-modulesourcepath", source.toString(), "-m", moduleName
+            "--module-source-path", source.toString(), "-m", moduleName
         });
         List<String> javacOpts = Stream.concat(opts, Arrays.stream(options))
                                         .collect(Collectors.toList());
--- a/nashorn/.hgtags	Thu Aug 25 02:10:03 2016 -0700
+++ b/nashorn/.hgtags	Fri Aug 26 14:47:52 2016 -0700
@@ -366,3 +366,4 @@
 0de67a63e2c73781ecf5979a2f3aa9619a445c37 jdk-9+130
 ee77c6b3713ab293e027ac3ea1cc16f86dac535f jdk-9+131
 55a75af751dfe44039baef2b762ee7347021025b jdk-9+132
+3a924b820d02b108cf57b51e145b5150d1eedcca jdk-9+133
--- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Main.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Main.java	Fri Aug 26 14:47:52 2016 -0700
@@ -172,7 +172,7 @@
                 final Consumer<String> evaluator = str -> {
                     // could be called from different thread (GUI), we need to handle Context set/reset
                     final Global _oldGlobal = Context.getGlobal();
-                    final boolean _globalChanged = (oldGlobal != global);
+                    final boolean _globalChanged = (_oldGlobal != global);
                     if (_globalChanged) {
                         Context.setGlobal(global);
                     }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesCalculator.java	Thu Aug 25 02:10:03 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesCalculator.java	Fri Aug 26 14:47:52 2016 -0700
@@ -79,7 +79,7 @@
 
     @Override
     public boolean enterPropertyNode(final PropertyNode propertyNode) {
-        if(propertyNode.getKeyName().equals(ScriptObject.PROTO_PROPERTY_NAME)) {
+        if(ScriptObject.PROTO_PROPERTY_NAME.equals(propertyNode.getKeyName())) {
             tagNeverOptimistic(propertyNode.getValue());
         }
         return super.enterPropertyNode(propertyNode);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties	Thu Aug 25 02:10:03 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties	Fri Aug 26 14:47:52 2016 -0700
@@ -173,3 +173,20 @@
 String.prototype.toLocaleUpperCase=returns a new string representing the calling string value converted to upper case according to any locale specific case mappings
 
 String.prototype.trim=returns a new string representing the calling string with white space removed from both ends
+
+Boolean.prototype.toString=returns string representation of specified Boolean object
+
+Boolean.prototype.valueOf=returns the primitive value of the specified Boolean object
+
+Number.prototype.toString=returns string representation of specified object in the specified radix
+
+Number.prototype.toLocaleString=returns a string with a language sensitive representation of this number
+
+Number.prototype.valueOf=returns the primitive value of the specified object
+
+Number.prototype.toFixed=returns a string representing the number in decimal fixed-point notation
+
+Number.prototype.toExponential=returns a string representing the number in decimal exponential notation
+
+Number.prototype.toPrecision=returns a string representing the number to a specified precision in fixed-point or exponential notation
+