Merge
authordlong
Fri, 09 Jan 2015 13:28:02 -0500
changeset 28490 39f2d17d9be3
parent 28489 f395f4b55ea1 (current diff)
parent 28398 43839f0cb0e8 (diff)
child 28491 fa9243da0080
Merge
hotspot/test/gc/g1/TestEagerReclaimHumongousRegions2.java
hotspot/test/gc/g1/TestG1TraceReclaimDeadHumongousObjectsAtYoungGC.java
jdk/src/java.base/share/classes/sun/nio/fs/AbstractPath.java
jdk/test/javax/swing/JComboBox/ConsumedEscTest/ConsumedEscTest.java
langtools/test/tools/sjavac/SJavac.java
--- a/.hgtags	Fri Jan 09 05:45:13 2015 -0800
+++ b/.hgtags	Fri Jan 09 13:28:02 2015 -0500
@@ -285,3 +285,5 @@
 82f4cb44b2d7af2352f48568a64b7b6a5ae960cd jdk9-b40
 9fffb959eb4197ff806e4ac12244761815b4deee jdk9-b41
 3107be2ba9c6e208a0b86bc7100a141abbc5b5fb jdk9-b42
+6494b13f88a867026ee316b444d9a4fa589dd6bd jdk9-b43
+abbfccd659b91a7bb815d5e36fed635dcdd40f31 jdk9-b44
--- a/.hgtags-top-repo	Fri Jan 09 05:45:13 2015 -0800
+++ b/.hgtags-top-repo	Fri Jan 09 13:28:02 2015 -0500
@@ -285,3 +285,5 @@
 cf136458ee747e151a27aa9ea0c1492ea55ef3e7 jdk9-b40
 67395f7ca2db3b52e3a62a84888487de5cb9210a jdk9-b41
 f7c11da0b0481d49cc7a65a453336c108191e821 jdk9-b42
+02ee8c65622e8bd97496d584e22fc7dcf0edc4ae jdk9-b43
+8994f5d87b3bb5e8d317d4e8ccb326da1a73684a jdk9-b44
--- a/common/autoconf/generated-configure.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/common/autoconf/generated-configure.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -4329,7 +4329,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1418036274
+DATE_WHEN_GENERATED=1418395009
 
 ###############################################################################
 #
@@ -13965,7 +13965,8 @@
 
   # ZERO_ARCHDEF is used to enable architecture-specific code
   case "${OPENJDK_TARGET_CPU}" in
-    ppc*)    ZERO_ARCHDEF=PPC   ;;
+    ppc)     ZERO_ARCHDEF=PPC32 ;;
+    ppc64)   ZERO_ARCHDEF=PPC64 ;;
     s390*)   ZERO_ARCHDEF=S390  ;;
     sparc*)  ZERO_ARCHDEF=SPARC ;;
     x86_64*) ZERO_ARCHDEF=AMD64 ;;
--- a/common/autoconf/platform.m4	Fri Jan 09 05:45:13 2015 -0800
+++ b/common/autoconf/platform.m4	Fri Jan 09 13:28:02 2015 -0500
@@ -367,7 +367,8 @@
 
   # ZERO_ARCHDEF is used to enable architecture-specific code
   case "${OPENJDK_TARGET_CPU}" in
-    ppc*)    ZERO_ARCHDEF=PPC   ;;
+    ppc)     ZERO_ARCHDEF=PPC32 ;;
+    ppc64)   ZERO_ARCHDEF=PPC64 ;;
     s390*)   ZERO_ARCHDEF=S390  ;;
     sparc*)  ZERO_ARCHDEF=SPARC ;;
     x86_64*) ZERO_ARCHDEF=AMD64 ;;
--- a/common/bin/hgforest.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/common/bin/hgforest.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -106,12 +106,15 @@
   echo "# Mercurial command: ${command}" > ${status_output}
 fi
 
-
-# capture command options and arguments (if any)
-command_args="${@:-}"
+# At this point all command options and args are in "$@".
+# Always use "$@" (within double quotes) to avoid breaking
+# args with spaces into separate args.
 
 if [ ${vflag} = "true" ] ; then
-  echo "# Mercurial command arguments: ${command_args}" > ${status_output}
+  echo "# Mercurial command argument count: $#" > ${status_output}
+  for cmdarg in "$@" ; do
+    echo "# Mercurial command argument: ${cmdarg}" > ${status_output}
+  done
 fi
 
 # Clean out the temporary directory that stores the pid files.
@@ -205,13 +208,14 @@
 
   pull_default_tail=`echo ${pull_default} | sed -e 's@^.*://[^/]*/\(.*\)@\1@'`
 
-  if [ -n "${command_args}" ] ; then
+  if [ $# -gt 0 ] ; then
     # if there is an "extra sources" path then reparent "extra" repos to that path
     if [ "x${pull_default}" = "x${pull_default_tail}" ] ; then
       echo "ERROR: Need initial clone from non-local source" > ${status_output}
       exit 1
     fi
-    pull_extra="${command_args}/${pull_default_tail}"
+    # assume that "extra sources" path is the first arg
+    pull_extra="${1}/${pull_default_tail}"
 
     # determine which extra subrepos need to be cloned.
     for i in ${subrepos_extra} ; do
@@ -356,8 +360,8 @@
           (PYTHONUNBUFFERED=true hg${global_opts} clone ${clone_newrepo} ${i}; echo "$?" > ${tmp}/${repopidfile}.pid.rc ) 2>&1 &
         else
           # run the command.
-          echo "cd ${i} && hg${global_opts} ${command} ${command_args}" > ${status_output}
-          cd ${i} && (PYTHONUNBUFFERED=true hg${global_opts} ${command} ${command_args}; echo "$?" > ${tmp}/${repopidfile}.pid.rc ) 2>&1 &
+          echo "cd ${i} && hg${global_opts} ${command} ${@}" > ${status_output}
+          cd ${i} && (PYTHONUNBUFFERED=true hg${global_opts} ${command} "${@}"; echo "$?" > ${tmp}/${repopidfile}.pid.rc ) 2>&1 &
         fi
 
         echo $! > ${tmp}/${repopidfile}.pid
--- a/corba/.hgtags	Fri Jan 09 05:45:13 2015 -0800
+++ b/corba/.hgtags	Fri Jan 09 13:28:02 2015 -0500
@@ -285,3 +285,5 @@
 e27c725d6c9d155667b35255f442d4ceb8c3c084 jdk9-b40
 1908b886ba1eda46fa725cf1160fe5d30fd1a7e5 jdk9-b41
 078bb11af876fe528d4b516f33ad4dd9bb60549e jdk9-b42
+9645e35616b60c5c07b4fdf11a132afc8081dfa8 jdk9-b43
+1f57bd728c9e6865ccb9d43ccd80a1c11230a32f jdk9-b44
--- a/hotspot/.hgtags	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/.hgtags	Fri Jan 09 13:28:02 2015 -0500
@@ -445,3 +445,5 @@
 6b09b3193d731e3288e2a240c504a20d0a06c766 jdk9-b40
 1d29b13e8a515a7ea3b882f140576d5d675bc11f jdk9-b41
 38cb4fbd47e3472bd1b5ebac83bda96fe4869c4f jdk9-b42
+65a9747147b8090037541040ba67156ec914db6a jdk9-b43
+43a44b56dca61a4d766a20f0528fdd8b5ceff873 jdk9-b44
--- a/hotspot/agent/make/Makefile	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/agent/make/Makefile	Fri Jan 09 13:28:02 2015 -0500
@@ -58,15 +58,19 @@
 sun.jvm.hotspot.debugger.dummy \
 sun.jvm.hotspot.debugger.linux \
 sun.jvm.hotspot.debugger.linux.amd64 \
+sun.jvm.hotspot.debugger.linux.ppc64 \
 sun.jvm.hotspot.debugger.linux.x86 \
 sun.jvm.hotspot.debugger.posix \
 sun.jvm.hotspot.debugger.posix.elf \
+sun.jvm.hotspot.debugger.ppc64 \
 sun.jvm.hotspot.debugger.proc \
 sun.jvm.hotspot.debugger.proc.amd64 \
+sun.jvm.hotspot.debugger.proc.ppc64 \
 sun.jvm.hotspot.debugger.proc.sparc \
 sun.jvm.hotspot.debugger.proc.x86 \
 sun.jvm.hotspot.debugger.remote \
 sun.jvm.hotspot.debugger.remote.amd64 \
+sun.jvm.hotspot.debugger.remote.ppc64 \
 sun.jvm.hotspot.debugger.remote.sparc \
 sun.jvm.hotspot.debugger.remote.x86 \
 sun.jvm.hotspot.debugger.sparc \
@@ -93,9 +97,11 @@
 sun.jvm.hotspot.runtime.bsd_x86 \
 sun.jvm.hotspot.runtime.linux \
 sun.jvm.hotspot.runtime.linux_amd64 \
+sun.jvm.hotspot.runtime.linux_ppc64 \
 sun.jvm.hotspot.runtime.linux_sparc \
 sun.jvm.hotspot.runtime.linux_x86 \
 sun.jvm.hotspot.runtime.posix \
+sun.jvm.hotspot.runtime.ppc64 \
 sun.jvm.hotspot.runtime.solaris_amd64 \
 sun.jvm.hotspot.runtime.solaris_sparc \
 sun.jvm.hotspot.runtime.solaris_x86 \
@@ -142,15 +148,19 @@
 sun/jvm/hotspot/debugger/cdbg/basic/x86/*.java \
 sun/jvm/hotspot/debugger/dummy/*.java \
 sun/jvm/hotspot/debugger/linux/*.java \
+sun/jvm/hotspot/debugger/linux/ppc64/*.java \
 sun/jvm/hotspot/debugger/linux/x86/*.java \
 sun/jvm/hotspot/debugger/posix/*.java \
 sun/jvm/hotspot/debugger/posix/elf/*.java \
+sun/jvm/hotspot/debugger/ppc64/*.java \
 sun/jvm/hotspot/debugger/proc/*.java \
 sun/jvm/hotspot/debugger/proc/amd64/*.java \
+sun/jvm/hotspot/debugger/proc/ppc64/*.java \
 sun/jvm/hotspot/debugger/proc/sparc/*.java \
 sun/jvm/hotspot/debugger/proc/x86/*.java \
 sun/jvm/hotspot/debugger/remote/*.java \
 sun/jvm/hotspot/debugger/remote/amd64/*.java \
+sun/jvm/hotspot/debugger/remote/ppc64/*.java \
 sun/jvm/hotspot/debugger/remote/sparc/*.java \
 sun/jvm/hotspot/debugger/remote/x86/*.java \
 sun/jvm/hotspot/debugger/sparc/*.java \
@@ -174,9 +184,11 @@
 sun/jvm/hotspot/runtime/bsd_x86/*.java \
 sun/jvm/hotspot/runtime/linux/*.java \
 sun/jvm/hotspot/runtime/linux_amd64/*.java \
+sun/jvm/hotspot/runtime/linux_ppc64/*.java \
 sun/jvm/hotspot/runtime/linux_sparc/*.java \
 sun/jvm/hotspot/runtime/linux_x86/*.java \
 sun/jvm/hotspot/runtime/posix/*.java \
+sun/jvm/hotspot/runtime/ppc64/*.java \
 sun/jvm/hotspot/runtime/solaris_amd64/*.java \
 sun/jvm/hotspot/runtime/solaris_sparc/*.java \
 sun/jvm/hotspot/runtime/solaris_x86/*.java \
--- a/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c	Fri Jan 09 13:28:02 2015 -0500
@@ -49,6 +49,10 @@
 #include "sun_jvm_hotspot_debugger_sparc_SPARCThreadContext.h"
 #endif
 
+#ifdef ppc64
+#include "sun_jvm_hotspot_debugger_ppc64_PPC64ThreadContext.h"
+#endif
+
 static jfieldID p_ps_prochandle_ID = 0;
 static jfieldID threadList_ID = 0;
 static jfieldID loadObjectList_ID = 0;
@@ -341,7 +345,7 @@
   return (err == PS_OK)? array : 0;
 }
 
-#if defined(i386) || defined(amd64) || defined(sparc) || defined(sparcv9)
+#if defined(i386) || defined(amd64) || defined(sparc) || defined(sparcv9) | defined(ppc64)
 JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_getThreadIntegerRegisterSet0
   (JNIEnv *env, jobject this_obj, jint lwp_id) {
 
@@ -366,6 +370,10 @@
 #if defined(sparc) || defined(sparcv9)
 #define NPRGREG sun_jvm_hotspot_debugger_sparc_SPARCThreadContext_NPRGREG
 #endif
+#ifdef ppc64
+#define NPRGREG sun_jvm_hotspot_debugger_ppc64_PPC64ThreadContext_NPRGREG
+#endif
+
 
   array = (*env)->NewLongArray(env, NPRGREG);
   CHECK_EXCEPTION_(0);
@@ -458,6 +466,45 @@
   regs[REG_INDEX(R_O7)]  = gregs.u_regs[14];
 #endif /* sparc */
 
+#ifdef ppc64
+#define REG_INDEX(reg) sun_jvm_hotspot_debugger_ppc64_PPC64ThreadContext_##reg
+
+  regs[REG_INDEX(LR)] = gregs.link;
+  regs[REG_INDEX(NIP)] = gregs.nip;
+  regs[REG_INDEX(R0)]  = gregs.gpr[0];
+  regs[REG_INDEX(R1)]  = gregs.gpr[1];
+  regs[REG_INDEX(R2)]  = gregs.gpr[2];
+  regs[REG_INDEX(R3)]  = gregs.gpr[3];
+  regs[REG_INDEX(R4)]  = gregs.gpr[4];
+  regs[REG_INDEX(R5)]  = gregs.gpr[5];
+  regs[REG_INDEX(R6)]  = gregs.gpr[6];
+  regs[REG_INDEX(R7)]  = gregs.gpr[7];
+  regs[REG_INDEX(R8)]  = gregs.gpr[8];
+  regs[REG_INDEX(R9)]  = gregs.gpr[9];
+  regs[REG_INDEX(R10)] = gregs.gpr[10];
+  regs[REG_INDEX(R11)] = gregs.gpr[11];
+  regs[REG_INDEX(R12)] = gregs.gpr[12];
+  regs[REG_INDEX(R13)] = gregs.gpr[13];
+  regs[REG_INDEX(R14)] = gregs.gpr[14];
+  regs[REG_INDEX(R15)] = gregs.gpr[15];
+  regs[REG_INDEX(R16)] = gregs.gpr[16];
+  regs[REG_INDEX(R17)] = gregs.gpr[17];
+  regs[REG_INDEX(R18)] = gregs.gpr[18];
+  regs[REG_INDEX(R19)] = gregs.gpr[19];
+  regs[REG_INDEX(R20)] = gregs.gpr[20];
+  regs[REG_INDEX(R21)] = gregs.gpr[21];
+  regs[REG_INDEX(R22)] = gregs.gpr[22];
+  regs[REG_INDEX(R23)] = gregs.gpr[23];
+  regs[REG_INDEX(R24)] = gregs.gpr[24];
+  regs[REG_INDEX(R25)] = gregs.gpr[25];
+  regs[REG_INDEX(R26)] = gregs.gpr[26];
+  regs[REG_INDEX(R27)] = gregs.gpr[27];
+  regs[REG_INDEX(R28)] = gregs.gpr[28];
+  regs[REG_INDEX(R29)] = gregs.gpr[29];
+  regs[REG_INDEX(R30)] = gregs.gpr[30];
+  regs[REG_INDEX(R31)] = gregs.gpr[31];
+
+#endif
 
   (*env)->ReleaseLongArrayElements(env, array, regs, JNI_COMMIT);
   return array;
--- a/hotspot/agent/src/os/linux/symtab.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/agent/src/os/linux/symtab.c	Fri Jan 09 13:28:02 2015 -0500
@@ -325,6 +325,12 @@
 
   // Reading of elf header
   struct elf_section *scn_cache = NULL;
+#if defined(ppc64) && !defined(ABI_ELFv2)
+  // Only big endian ppc64 (i.e. ABI_ELFv1) has 'official procedure descriptors' in ELF files
+  // see: http://refspecs.linuxfoundation.org/LSB_3.1.1/LSB-Core-PPC64/LSB-Core-PPC64/specialsections.html
+  struct elf_section *opd_sect = NULL;
+  ELF_SHDR *opd = NULL;
+#endif
   int cnt = 0;
   ELF_SHDR* shbuf = NULL;
   ELF_SHDR* cursct = NULL;
@@ -368,6 +374,14 @@
     cursct++;
   }
 
+#if defined(ppc64) && !defined(ABI_ELFv2)
+  opd_sect = find_section_by_name(".opd", fd, &ehdr, scn_cache);
+  if (opd_sect != NULL && opd_sect->c_data != NULL && opd_sect->c_shdr != NULL) {
+    // plausibility check
+    opd = opd_sect->c_shdr;
+  }
+#endif
+
   for (cnt = 1; cnt < ehdr.e_shnum; cnt++) {
     ELF_SHDR *shdr = scn_cache[cnt].c_shdr;
 
@@ -412,6 +426,7 @@
       // copy symbols info our symtab and enter them info the hash table
       for (j = 0; j < n; j++, syms++) {
         ENTRY item, *ret;
+        uintptr_t sym_value;
         char *sym_name = symtab->strs + syms->st_name;
 
         // skip non-object and non-function symbols
@@ -422,9 +437,19 @@
         if (*sym_name == '\0' || syms->st_shndx == SHN_UNDEF) continue;
 
         symtab->symbols[j].name   = sym_name;
-        symtab->symbols[j].offset = syms->st_value - baseaddr;
         symtab->symbols[j].size   = syms->st_size;
+        sym_value = syms->st_value;
 
+#if defined(ppc64) && !defined(ABI_ELFv2)
+        // see hotspot/src/share/vm/utilities/elfFuncDescTable.hpp for a detailed description
+        // of why we have to go this extra way via the '.opd' section on big endian ppc64
+        if (opd != NULL && *sym_name != '.' &&
+            (opd->sh_addr <= sym_value && sym_value <= opd->sh_addr + opd->sh_size)) {
+          sym_value = ((ELF_ADDR*)opd_sect->c_data)[(sym_value - opd->sh_addr) / sizeof(ELF_ADDR*)];
+        }
+#endif
+
+        symtab->symbols[j].offset = sym_value - baseaddr;
         item.key = sym_name;
         item.data = (void *)&(symtab->symbols[j]);
 
@@ -433,9 +458,17 @@
     }
   }
 
+#if defined(ppc64) && !defined(ABI_ELFv2)
+  // On Linux/PPC64 the debuginfo files contain an empty function descriptor
+  // section (i.e. '.opd' section) which makes the resolution of symbols
+  // with the above algorithm impossible (we would need the have both, the
+  // .opd section from the library and the symbol table from the debuginfo
+  // file which doesn't match with the current workflow.)
+  goto quit;
+#endif
+
   // Look for a separate debuginfo file.
   if (try_debuginfo) {
-
     // We prefer a debug symtab to an object's own symtab, so look in
     // the debuginfo file.  We stash a copy of the old symtab in case
     // there is no debuginfo.
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionPPC64.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionPPC64.java	Fri Jan 09 13:28:02 2015 -0500
@@ -34,6 +34,6 @@
   }
 
   public boolean isBigEndian() {
-    return true;
+    return "big".equals(System.getProperty("sun.cpu.endian"));
   }
 }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java	Fri Jan 09 13:28:02 2015 -0500
@@ -26,14 +26,17 @@
 
 import java.io.*;
 import java.util.*;
+
 import sun.jvm.hotspot.debugger.*;
 import sun.jvm.hotspot.debugger.cdbg.*;
 import sun.jvm.hotspot.debugger.x86.*;
 import sun.jvm.hotspot.debugger.amd64.*;
 import sun.jvm.hotspot.debugger.sparc.*;
+import sun.jvm.hotspot.debugger.ppc64.*;
 import sun.jvm.hotspot.debugger.linux.x86.*;
 import sun.jvm.hotspot.debugger.linux.amd64.*;
 import sun.jvm.hotspot.debugger.linux.sparc.*;
+import sun.jvm.hotspot.debugger.linux.ppc64.*;
 import sun.jvm.hotspot.utilities.*;
 
 class LinuxCDebugger implements CDebugger {
@@ -96,7 +99,14 @@
        Address pc  = context.getRegisterAsAddress(SPARCThreadContext.R_O7);
        if (pc == null) return null;
        return new LinuxSPARCCFrame(dbg, sp, pc, LinuxDebuggerLocal.getAddressSize());
-    } else {
+    }  else if (cpu.equals("ppc64")) {
+        PPC64ThreadContext context = (PPC64ThreadContext) thread.getContext();
+        Address sp = context.getRegisterAsAddress(PPC64ThreadContext.SP);
+        if (sp == null) return null;
+        Address pc  = context.getRegisterAsAddress(PPC64ThreadContext.PC);
+        if (pc == null) return null;
+        return new LinuxPPC64CFrame(dbg, sp, pc, LinuxDebuggerLocal.getAddressSize());
+     } else {
        // Runtime exception thrown by LinuxThreadContextFactory if unknown cpu
        ThreadContext context = (ThreadContext) thread.getContext();
        return context.getTopFrame(dbg);
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThreadContextFactory.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThreadContextFactory.java	Fri Jan 09 13:28:02 2015 -0500
@@ -29,6 +29,7 @@
 import sun.jvm.hotspot.debugger.linux.amd64.*;
 import sun.jvm.hotspot.debugger.linux.ia64.*;
 import sun.jvm.hotspot.debugger.linux.x86.*;
+import sun.jvm.hotspot.debugger.linux.ppc64.*;
 import sun.jvm.hotspot.debugger.linux.sparc.*;
 
 class LinuxThreadContextFactory {
@@ -42,6 +43,8 @@
          return new LinuxIA64ThreadContext(dbg);
       } else if (cpu.equals("sparc")) {
          return new LinuxSPARCThreadContext(dbg);
+      }  else if (cpu.equals("ppc64")) {
+          return new LinuxPPC64ThreadContext(dbg);
       } else  {
         try {
           Class tcc = Class.forName("sun.jvm.hotspot.debugger.linux." +
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/ppc64/LinuxPPC64CFrame.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.debugger.linux.ppc64;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.debugger.ppc64.*;
+import sun.jvm.hotspot.debugger.linux.*;
+import sun.jvm.hotspot.debugger.cdbg.*;
+import sun.jvm.hotspot.debugger.cdbg.basic.*;
+
+final public class LinuxPPC64CFrame extends BasicCFrame {
+  // package/class internals only
+
+  public LinuxPPC64CFrame(LinuxDebugger dbg, Address sp, Address pc, int address_size) {
+    super(dbg.getCDebugger());
+    this.sp = sp;
+    this.pc = pc;
+    this.dbg = dbg;
+    this.address_size = address_size;
+  }
+
+  // override base class impl to avoid ELF parsing
+  public ClosestSymbol closestSymbolToPC() {
+    // try native lookup in debugger.
+    return dbg.lookup(dbg.getAddressValue(pc()));
+  }
+
+  public Address pc() {
+    return pc;
+  }
+
+  public Address localVariableBase() {
+    return sp;
+  }
+
+  public CFrame sender(ThreadProxy thread) {
+    if (sp == null) {
+      return null;
+    }
+
+    Address nextSP = sp.getAddressAt(0);
+    if (nextSP == null) {
+      return null;
+    }
+    Address nextPC  = sp.getAddressAt(2 * address_size);
+    if (nextPC == null) {
+      return null;
+    }
+    return new LinuxPPC64CFrame(dbg, nextSP, nextPC, address_size);
+  }
+
+  public static int PPC64_STACK_BIAS = 0;
+  private static int address_size;
+  private Address pc;
+  private Address sp;
+  private LinuxDebugger dbg;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/ppc64/LinuxPPC64ThreadContext.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.debugger.linux.ppc64;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.debugger.ppc64.*;
+import sun.jvm.hotspot.debugger.linux.*;
+
+public class LinuxPPC64ThreadContext extends PPC64ThreadContext {
+  private LinuxDebugger debugger;
+
+  public LinuxPPC64ThreadContext(LinuxDebugger debugger) {
+    super();
+    this.debugger = debugger;
+  }
+
+  public void setRegisterAsAddress(int index, Address value) {
+    setRegister(index, debugger.getAddressValue(value));
+  }
+
+  public Address getRegisterAsAddress(int index) {
+    return debugger.newAddress(getRegister(index));
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/ppc64/PPC64ThreadContext.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.debugger.ppc64;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.debugger.cdbg.*;
+
+/** Specifies the thread context on ppc64 platforms; only a sub-portion
+ * of the context is guaranteed to be present on all operating
+ * systems. */
+
+public abstract class PPC64ThreadContext implements ThreadContext {
+
+  // NOTE: The indices for the various registers must be maintained as
+  // listed across various operating systems. However, only a small
+  // subset of the registers' values are guaranteed to be present (and
+  // must be present for the SA's stack walking to work).
+
+  public static final int R31 = 0;
+  public static final int R30 = 1;
+  public static final int R29 = 2;
+  public static final int R28 = 3;
+  public static final int R27 = 4;
+  public static final int R26 = 5;
+  public static final int R25 = 6;
+  public static final int R24 = 7;
+  public static final int R23 = 8;
+  public static final int R22 = 9;
+  public static final int R21 = 10;
+  public static final int R20 = 11;
+  public static final int R19 = 12;
+  public static final int R18 = 13;
+  public static final int R17 = 14;
+  public static final int R16 = 15;
+  public static final int R15 = 16;
+  public static final int R14 = 17;
+  public static final int R13 = 18;
+  public static final int R12 = 19;
+  public static final int R11 = 20;
+  public static final int R10 = 21;
+  public static final int R9 = 22;
+  public static final int R8 = 23;
+  public static final int R7 = 24;
+  public static final int R6 = 25;
+  public static final int R5 = 26;
+  public static final int R4 = 27;
+  public static final int R3 = 28;
+  public static final int R2 = 29;
+  public static final int R1 = 30;
+  public static final int R0 = 31;
+  public static final int NIP = 32;
+  public static final int LR = 33;
+
+  public static final int NPRGREG = 34;
+
+  private static final String[] regNames = {
+    "r31", "r30", "r29", "r28", "r27", "r26", "r25", "r24",
+    "r23", "r22", "r21", "r20", "r19", "r18", "r17", "r16",
+    "r15", "r14", "r13", "r12", "r11", "r10", "r9",  "r8",
+    "r7",  "r6",  "r5",  "r4",  "r3",   "r2", "r1",  "r0",
+    "nip", "link"
+  };
+
+  public static final int PC = NIP;
+  public static final int SP = R1;
+
+  private long[] data;
+
+  public PPC64ThreadContext() {
+    data = new long[NPRGREG];
+  }
+
+  public int getNumRegisters() {
+    return NPRGREG;
+  }
+
+  public String getRegisterName(int index) {
+    return regNames[index];
+  }
+
+  public void setRegister(int index, long value) {
+    data[index] = value;
+  }
+
+  public long getRegister(int index) {
+    return data[index];
+  }
+
+  public CFrame getTopFrame(Debugger dbg) {
+    return null;
+  }
+
+  /** This can't be implemented in this class since we would have to
+   * tie the implementation to, for example, the debugging system */
+  public abstract void setRegisterAsAddress(int index, Address value);
+
+  /** This can't be implemented in this class since we would have to
+   * tie the implementation to, for example, the debugging system */
+  public abstract Address getRegisterAsAddress(int index);
+
+}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,9 @@
 import sun.jvm.hotspot.debugger.cdbg.*;
 import sun.jvm.hotspot.debugger.proc.amd64.*;
 import sun.jvm.hotspot.debugger.proc.sparc.*;
+import sun.jvm.hotspot.debugger.proc.ppc64.*;
 import sun.jvm.hotspot.debugger.proc.x86.*;
+import sun.jvm.hotspot.debugger.ppc64.*;
 import sun.jvm.hotspot.debugger.amd64.*;
 import sun.jvm.hotspot.debugger.sparc.*;
 import sun.jvm.hotspot.debugger.x86.*;
@@ -86,6 +88,10 @@
             threadFactory = new ProcAMD64ThreadFactory(this);
             pcRegIndex = AMD64ThreadContext.RIP;
             fpRegIndex = AMD64ThreadContext.RBP;
+        } else if (cpu.equals("ppc64")) {
+            threadFactory = new ProcPPC64ThreadFactory(this);
+            pcRegIndex = PPC64ThreadContext.PC;
+            fpRegIndex = PPC64ThreadContext.SP;
         } else {
           try {
             Class tfc = Class.forName("sun.jvm.hotspot.debugger.proc." +
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ppc64/ProcPPC64Thread.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.debugger.proc.ppc64;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.debugger.ppc64.*;
+import sun.jvm.hotspot.debugger.proc.*;
+import sun.jvm.hotspot.utilities.*;
+
+public class ProcPPC64Thread implements ThreadProxy {
+  private ProcDebugger debugger;
+  private int id;
+
+  public ProcPPC64Thread(ProcDebugger debugger, Address addr) {
+    this.debugger = debugger;
+
+    // FIXME: the size here should be configurable. However, making it
+    // so would produce a dependency on the "types" package from the
+    // debugger package, which is not desired.
+    this.id = (int) addr.getCIntegerAt(0, 4, true);
+  }
+
+  public ProcPPC64Thread(ProcDebugger debugger, long id) {
+    this.debugger = debugger;
+    this.id = (int) id;
+  }
+
+  public ThreadContext getContext() throws IllegalThreadStateException {
+    ProcPPC64ThreadContext context = new ProcPPC64ThreadContext(debugger);
+    long[] regs = debugger.getThreadIntegerRegisterSet(id);
+    if (Assert.ASSERTS_ENABLED) {
+      Assert.that(regs.length <= PPC64ThreadContext.NPRGREG, "size of register set is greater than " + PPC64ThreadContext.NPRGREG);
+    }
+    for (int i = 0; i < regs.length; i++) {
+      context.setRegister(i, regs[i]);
+    }
+    return context;
+  }
+
+  public boolean canSetContext() throws DebuggerException {
+    return false;
+  }
+
+  public void setContext(ThreadContext context)
+    throws IllegalThreadStateException, DebuggerException {
+    throw new DebuggerException("Unimplemented");
+  }
+
+  public String toString() {
+    return "t@" + id;
+  }
+
+  public boolean equals(Object obj) {
+    if ((obj == null) || !(obj instanceof ProcPPC64Thread)) {
+      return false;
+    }
+
+    return (((ProcPPC64Thread) obj).id == id);
+  }
+
+  public int hashCode() {
+    return id;
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ppc64/ProcPPC64ThreadContext.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.debugger.proc.ppc64;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.debugger.ppc64.*;
+import sun.jvm.hotspot.debugger.proc.*;
+
+public class ProcPPC64ThreadContext extends PPC64ThreadContext {
+  private ProcDebugger debugger;
+
+  public ProcPPC64ThreadContext(ProcDebugger debugger) {
+    super();
+    this.debugger = debugger;
+  }
+
+  public void setRegisterAsAddress(int index, Address value) {
+    setRegister(index, debugger.getAddressValue(value));
+  }
+
+  public Address getRegisterAsAddress(int index) {
+    return debugger.newAddress(getRegister(index));
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ppc64/ProcPPC64ThreadFactory.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.debugger.proc.ppc64;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.debugger.proc.*;
+
+public class ProcPPC64ThreadFactory implements ProcThreadFactory {
+  private ProcDebugger debugger;
+
+  public ProcPPC64ThreadFactory(ProcDebugger debugger) {
+    this.debugger = debugger;
+  }
+
+  public ThreadProxy createThreadWrapper(Address threadIdentifierAddr) {
+    return new ProcPPC64Thread(debugger, threadIdentifierAddr);
+  }
+
+  public ThreadProxy createThreadWrapper(long id) {
+    return new ProcPPC64Thread(debugger, id);
+  }
+}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java	Fri Jan 09 13:28:02 2015 -0500
@@ -33,6 +33,7 @@
 import sun.jvm.hotspot.debugger.remote.sparc.*;
 import sun.jvm.hotspot.debugger.remote.x86.*;
 import sun.jvm.hotspot.debugger.remote.amd64.*;
+import sun.jvm.hotspot.debugger.remote.ppc64.*;
 
 /** An implementation of Debugger which wraps a
     RemoteDebugger, providing remote debugging via RMI.
@@ -70,6 +71,11 @@
         cachePageSize = 4096;
         cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize);
         unalignedAccessesOkay = true;
+      } else if (cpu.equals("ppc64")) {
+        threadFactory = new RemotePPC64ThreadFactory(this);
+        cachePageSize = 4096;
+        cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize);
+        unalignedAccessesOkay = true;
       } else {
         try {
           Class tf = Class.forName("sun.jvm.hotspot.debugger.remote." +
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/ppc64/RemotePPC64Thread.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.debugger.remote.ppc64;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.debugger.ppc64.*;
+import sun.jvm.hotspot.debugger.remote.*;
+import sun.jvm.hotspot.utilities.*;
+
+public class RemotePPC64Thread extends RemoteThread  {
+  public RemotePPC64Thread(RemoteDebuggerClient debugger, Address addr) {
+    super(debugger, addr);
+  }
+
+  public RemotePPC64Thread(RemoteDebuggerClient debugger, long id) {
+    super(debugger, id);
+  }
+
+  public ThreadContext getContext() throws IllegalThreadStateException {
+    RemotePPC64ThreadContext context = new RemotePPC64ThreadContext(debugger);
+    long[] regs = (addr != null)? debugger.getThreadIntegerRegisterSet(addr) :
+                                  debugger.getThreadIntegerRegisterSet(id);
+    if (Assert.ASSERTS_ENABLED) {
+      Assert.that(regs.length == PPC64ThreadContext.NPRGREG, "size of register set must match");
+    }
+    for (int i = 0; i < regs.length; i++) {
+      context.setRegister(i, regs[i]);
+    }
+    return context;
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/ppc64/RemotePPC64ThreadContext.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.debugger.remote.ppc64;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.debugger.ppc64.*;
+import sun.jvm.hotspot.debugger.remote.*;
+
+public class RemotePPC64ThreadContext extends PPC64ThreadContext {
+  private RemoteDebuggerClient debugger;
+
+  public RemotePPC64ThreadContext(RemoteDebuggerClient debugger) {
+    super();
+    this.debugger = debugger;
+  }
+
+  /** This can't be implemented in this class since we would have to
+      tie the implementation to, for example, the debugging system */
+  public void setRegisterAsAddress(int index, Address value) {
+    setRegister(index, debugger.getAddressValue(value));
+  }
+
+  /** This can't be implemented in this class since we would have to
+      tie the implementation to, for example, the debugging system */
+  public Address getRegisterAsAddress(int index) {
+    return debugger.newAddress(getRegister(index));
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/ppc64/RemotePPC64ThreadFactory.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.debugger.remote.ppc64;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.debugger.remote.*;
+
+public class RemotePPC64ThreadFactory implements RemoteThreadFactory {
+  private RemoteDebuggerClient debugger;
+
+  public RemotePPC64ThreadFactory(RemoteDebuggerClient debugger) {
+    this.debugger = debugger;
+  }
+
+  public ThreadProxy createThreadWrapper(Address threadIdentifierAddr) {
+    return new RemotePPC64Thread(debugger, threadIdentifierAddr);
+  }
+
+  public ThreadProxy createThreadWrapper(long id) {
+    return new RemotePPC64Thread(debugger, id);
+  }
+}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java	Fri Jan 09 13:28:02 2015 -0500
@@ -25,6 +25,7 @@
 package sun.jvm.hotspot.runtime;
 
 import java.util.*;
+
 import sun.jvm.hotspot.debugger.*;
 import sun.jvm.hotspot.types.*;
 import sun.jvm.hotspot.runtime.solaris_sparc.SolarisSPARCJavaThreadPDAccess;
@@ -34,6 +35,7 @@
 import sun.jvm.hotspot.runtime.win32_x86.Win32X86JavaThreadPDAccess;
 import sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaThreadPDAccess;
 import sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess;
+import sun.jvm.hotspot.runtime.linux_ppc64.LinuxPPC64JavaThreadPDAccess;
 import sun.jvm.hotspot.runtime.linux_sparc.LinuxSPARCJavaThreadPDAccess;
 import sun.jvm.hotspot.runtime.bsd_x86.BsdX86JavaThreadPDAccess;
 import sun.jvm.hotspot.runtime.bsd_amd64.BsdAMD64JavaThreadPDAccess;
@@ -87,6 +89,8 @@
                 access = new LinuxAMD64JavaThreadPDAccess();
             } else if (cpu.equals("sparc")) {
                 access = new LinuxSPARCJavaThreadPDAccess();
+            } else if (cpu.equals("ppc64")) {
+                access = new LinuxPPC64JavaThreadPDAccess();
             } else {
               try {
                 access = (JavaThreadPDAccess)
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VFrame.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VFrame.java	Fri Jan 09 13:28:02 2015 -0500
@@ -78,7 +78,7 @@
         }
 
         if (f.isRuntimeFrame()) {
-          // This is a conversion frame. Skip this frame and try again.
+          // This is a conversion frame or a Stub routine. Skip this frame and try again.
           RegisterMap tempMap = regMap.copy();
           Frame s = f.sender(tempMap);
           return newVFrame(s, tempMap, thread, unsafe, false);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_ppc64/LinuxPPC64JavaThreadPDAccess.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.runtime.linux_ppc64;
+
+import java.io.*;
+import java.util.*;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.debugger.ppc64.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.runtime.ppc64.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+public class LinuxPPC64JavaThreadPDAccess implements JavaThreadPDAccess {
+  private static AddressField  osThreadField;
+
+  // Field from OSThread
+  private static CIntegerField osThreadThreadIDField;
+
+  // This is currently unneeded but is being kept in case we change
+  // the currentFrameGuess algorithm
+  private static final long GUESS_SCAN_RANGE = 128 * 1024;
+
+  static {
+    VM.registerVMInitializedObserver(new Observer() {
+        public void update(Observable o, Object data) {
+          initialize(VM.getVM().getTypeDataBase());
+        }
+      });
+  }
+
+  private static synchronized void initialize(TypeDataBase db) {
+    Type type = db.lookupType("JavaThread");
+    osThreadField = type.getAddressField("_osthread");
+
+    Type osThreadType = db.lookupType("OSThread");
+    osThreadThreadIDField = osThreadType.getCIntegerField("_thread_id");
+  }
+
+  public Address getLastJavaFP(Address addr) {
+    return null;
+  }
+
+  public Address getLastJavaPC(Address addr) {
+    return null;
+  }
+
+  public Address getBaseOfStackPointer(Address addr) {
+    return null;
+  }
+
+  public Frame getLastFramePD(JavaThread thread, Address addr) {
+    Address fp = thread.getLastJavaFP();
+    if (fp == null) {
+      return null; // no information
+    }
+    return new PPC64Frame(thread.getLastJavaSP(), fp);
+  }
+
+  public RegisterMap newRegisterMap(JavaThread thread, boolean updateMap) {
+    return new PPC64RegisterMap(thread, updateMap);
+  }
+
+  public Frame getCurrentFrameGuess(JavaThread thread, Address addr) {
+    ThreadProxy t = getThreadProxy(addr);
+    PPC64ThreadContext context = (PPC64ThreadContext) t.getContext();
+    PPC64CurrentFrameGuess guesser = new PPC64CurrentFrameGuess(context, thread);
+    if (!guesser.run(GUESS_SCAN_RANGE)) {
+      return null;
+    }
+    if (guesser.getPC() == null) {
+      return new PPC64Frame(guesser.getSP(), guesser.getFP());
+    } else {
+      return new PPC64Frame(guesser.getSP(), guesser.getFP(), guesser.getPC());
+    }
+  }
+
+  public void printThreadIDOn(Address addr, PrintStream tty) {
+    tty.print(getThreadProxy(addr));
+  }
+
+  public void printInfoOn(Address threadAddr, PrintStream tty) {
+    tty.print("Thread id: ");
+    printThreadIDOn(threadAddr, tty);
+    // tty.println("\nPostJavaState: " + getPostJavaState(threadAddr));
+  }
+
+  public Address getLastSP(Address addr) {
+    ThreadProxy t = getThreadProxy(addr);
+    PPC64ThreadContext context = (PPC64ThreadContext) t.getContext();
+    return context.getRegisterAsAddress(PPC64ThreadContext.SP);
+  }
+
+  public Address getLastFP(Address addr) {
+    return getLastSP(addr).getAddressAt(0);
+  }
+
+  public ThreadProxy getThreadProxy(Address addr) {
+    // Addr is the address of the JavaThread.
+    // Fetch the OSThread (for now and for simplicity, not making a
+    // separate "OSThread" class in this package)
+    Address osThreadAddr = osThreadField.getValue(addr);
+    // Get the address of the _thread_id from the OSThread
+    Address threadIdAddr = osThreadAddr.addOffsetTo(osThreadThreadIDField.getOffset());
+
+    JVMDebugger debugger = VM.getVM().getDebugger();
+    return debugger.getThreadForIdentifierAddress(threadIdAddr);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64CurrentFrameGuess.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.runtime.ppc64;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.debugger.ppc64.*;
+import sun.jvm.hotspot.code.*;
+import sun.jvm.hotspot.interpreter.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.runtime.ppc64.*;
+
+/** <P> Should be able to be used on all ppc64 platforms we support
+    (Linux/ppc64) to implement JavaThread's "currentFrameGuess()"
+    functionality. Input is a PPC64ThreadContext; output is SP, FP,
+    and PC for an PPC64Frame. Instantiation of the PPC64Frame is left
+    to the caller, since we may need to subclass PPC64Frame to support
+    signal handler frames on Unix platforms. </P>
+ */
+
+public class PPC64CurrentFrameGuess {
+  private PPC64ThreadContext context;
+  private JavaThread       thread;
+  private Address          spFound;
+  private Address          fpFound;
+  private Address          pcFound;
+
+  private static final boolean DEBUG;
+  static {
+    DEBUG = System.getProperty("sun.jvm.hotspot.runtime.ppc64.PPC64Frame.DEBUG") != null;
+  }
+
+  public PPC64CurrentFrameGuess(PPC64ThreadContext context,
+                              JavaThread thread) {
+    this.context = context;
+    this.thread  = thread;
+  }
+
+  /** Returns false if not able to find a frame within a reasonable range. */
+  public boolean run(long regionInBytesToSearch) {
+    Address sp = context.getRegisterAsAddress(PPC64ThreadContext.SP);
+    Address pc = context.getRegisterAsAddress(PPC64ThreadContext.PC);
+    if (sp == null) {
+      // Bail out if no last java frame either
+      if (thread.getLastJavaSP() != null) {
+        Address javaSP = thread.getLastJavaSP();
+        Address javaFP = javaSP.getAddressAt(0);
+        setValues(javaSP, javaFP, null);
+        return true;
+      }
+      return false;
+    }
+    /* There is no frame pointer per se for the ppc64 architecture.  To mirror
+     * the behavior of the VM frame manager, we set fp to be the caller's (i.e., "sender's")
+     * stack pointer, which is the back chain value contained in our sp.
+     */
+    Address fp = sp.getAddressAt(0);
+    setValues(null, null, null); // Assume we're not going to find anything
+
+    VM vm = VM.getVM();
+    if (vm.isJavaPCDbg(pc)) {
+      if (vm.isClientCompiler()) {
+        // Topmost frame is a Java frame.
+        if (DEBUG) {
+          System.out.println("CurrentFrameGuess: choosing compiler frame: sp = " +
+                             sp + ", fp = " + fp + ", pc = " + pc);
+        }
+        setValues(sp, fp, pc);
+        return true;
+      } else {
+        if (vm.getInterpreter().contains(pc)) {
+          if (DEBUG) {
+            System.out.println("CurrentFrameGuess: choosing interpreter frame: sp = " +
+                               sp + ", fp = " + fp + ", pc = " + pc);
+          }
+          setValues(sp, fp, pc);
+          return true;
+        }
+
+        // This algorithm takes the current PC as a given and tries to
+        // find the correct corresponding SP by walking up the stack
+        // and repeatedly performing stackwalks (very inefficient).
+        for (long offset = 0;
+             offset < regionInBytesToSearch;
+             offset += vm.getAddressSize()) {
+          try {
+            Address curSP = sp.addOffsetTo(offset);
+            fp = curSP.getAddressAt(0);
+            Frame frame = new PPC64Frame(curSP, fp, pc);
+            RegisterMap map = thread.newRegisterMap(false);
+            while (frame != null) {
+              if (frame.isEntryFrame() && frame.entryFrameIsFirst()) {
+                // We were able to traverse all the way to the
+                // bottommost Java frame.
+                // This sp looks good. Keep it.
+                if (DEBUG) {
+                  System.out.println("CurrentFrameGuess: Choosing sp = " + curSP + ", pc = " + pc);
+                }
+                setValues(curSP, fp, pc);
+                return true;
+              }
+              frame = frame.sender(map);
+            }
+          } catch (Exception e) {
+            if (DEBUG) {
+              System.out.println("CurrentFrameGuess: Exception " + e + " at offset " + offset);
+            }
+            // Bad SP. Try another.
+          }
+        }
+
+        // Were not able to find a plausible SP to go with this PC.
+        // Bail out.
+        return false;
+
+      }
+    } else {
+      // If the current program counter was not known to us as a Java
+      // PC, we currently assume that we are in the run-time system
+      // and attempt to look to thread-local storage for saved java SP.
+      // Note that if this is null (because we were, in fact,
+      // in Java code, i.e., vtable stubs or similar, and the SA
+      // didn't have enough insight into the target VM to understand
+      // that) then we are going to lose the entire stack trace for
+      // the thread, which is sub-optimal. FIXME.
+
+      if (thread.getLastJavaSP() == null) {
+        if (DEBUG) {
+          System.out.println("CurrentFrameGuess: last java sp is null");
+        }
+        return false; // No known Java frames on stack
+      }
+
+      Address javaSP = thread.getLastJavaSP();
+      Address javaFP = javaSP.getAddressAt(0);
+      Address javaPC = thread.getLastJavaPC();
+      if (DEBUG) {
+        System.out.println("CurrentFrameGuess: choosing last Java frame: sp = " +
+                           javaSP + ", fp = " + javaFP + ", pc = " + javaPC);
+      }
+      setValues(javaSP, javaFP, javaPC);
+      return true;
+    }
+  }
+
+  public Address getSP() { return spFound; }
+  public Address getFP() { return fpFound; }
+  /** May be null if getting values from thread-local storage; take
+      care to call the correct PPC64Frame constructor to recover this if
+      necessary */
+  public Address getPC() { return pcFound; }
+
+  private void setValues(Address sp, Address fp, Address pc) {
+    spFound = sp;
+    fpFound = fp;
+    pcFound = pc;
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64Frame.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,513 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.runtime.ppc64;
+
+import java.util.*;
+import sun.jvm.hotspot.code.*;
+import sun.jvm.hotspot.compiler.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.oops.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+/** Specialization of and implementation of abstract methods of the
+    Frame class for the ppc64 family of CPUs. */
+
+public class PPC64Frame extends Frame {
+  private static final boolean DEBUG;
+  static {
+    DEBUG = System.getProperty("sun.jvm.hotspot.runtime.ppc64.PPC64Frame.DEBUG") != null;
+  }
+
+  // All frames
+  private static final int SENDER_SP_OFFSET           =  0;
+
+  // Interpreter frames
+  private static final int INTERPRETER_FRAME_MIRROR_OFFSET = -3; // for native calls only
+  private static final int INTERPRETER_FRAME_SENDER_SP_OFFSET = -4;
+  private static final int INTERPRETER_FRAME_LAST_SP_OFFSET = INTERPRETER_FRAME_SENDER_SP_OFFSET - 1;
+  private static final int INTERPRETER_FRAME_MDX_OFFSET = INTERPRETER_FRAME_LAST_SP_OFFSET -1;
+  private static final int INTERPRETER_FRAME_ESP_OFFSET = INTERPRETER_FRAME_MDX_OFFSET - 1;
+  private static final int INTERPRETER_FRAME_BCX_OFFSET = INTERPRETER_FRAME_ESP_OFFSET - 1;
+  private static final int INTERPRETER_FRAME_CACHE_OFFSET =INTERPRETER_FRAME_BCX_OFFSET - 1;
+  private static final int INTERPRETER_FRAME_MONITORS_OFFSET = INTERPRETER_FRAME_CACHE_OFFSET - 1;
+  private static final int INTERPRETER_FRAME_LOCALS_OFFSET = INTERPRETER_FRAME_MONITORS_OFFSET - 1;
+  private static final int INTERPRETER_FRAME_METHOD_OFFSET = INTERPRETER_FRAME_LOCALS_OFFSET - 1;
+  private static final int INTERPRETER_FRAME_INITIAL_SP_OFFSET = INTERPRETER_FRAME_BCX_OFFSET - 1; // FIXME: probably wrong, but unused anyway
+  private static final int INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET = INTERPRETER_FRAME_INITIAL_SP_OFFSET;
+  private static final int INTERPRETER_FRAME_MONITOR_BLOCK_BOTTOM_OFFSET = INTERPRETER_FRAME_INITIAL_SP_OFFSET;
+
+  // Entry frames
+  private static int ENTRY_FRAME_CALL_WRAPPER_OFFSET;
+
+  // Native frames
+  private static int NATIVE_FRAME_INITIAL_PARAM_OFFSET;
+
+
+  static {
+    VM.registerVMInitializedObserver(new Observer() {
+      public void update(Observable o, Object data) {
+        initialize(VM.getVM().getTypeDataBase());
+      }
+    });
+  }
+
+  private static synchronized void initialize(TypeDataBase db) {
+    int abi_minframe_size = db.lookupIntConstant("frame::abi_minframe_size").intValue();
+    int entry_frame_locals_size = db.lookupIntConstant("frame::entry_frame_locals_size").intValue();
+    int wordLength = (int) VM.getVM().getAddressSize();
+    NATIVE_FRAME_INITIAL_PARAM_OFFSET = -abi_minframe_size/wordLength;
+    ENTRY_FRAME_CALL_WRAPPER_OFFSET = -entry_frame_locals_size/wordLength;
+  }
+
+
+  // an additional field beyond sp and pc:
+  Address raw_fp; // frame pointer
+  private Address raw_unextendedSP;
+
+  private PPC64Frame() {
+  }
+
+  private void adjustForDeopt() {
+    if ( pc != null) {
+      // Look for a deopt pc and if it is deopted convert to original pc
+      CodeBlob cb = VM.getVM().getCodeCache().findBlob(pc);
+      if (cb != null && cb.isJavaMethod()) {
+        NMethod nm = (NMethod) cb;
+        if (pc.equals(nm.deoptHandlerBegin())) {
+          if (Assert.ASSERTS_ENABLED) {
+            Assert.that(this.getUnextendedSP() != null, "null SP in Java frame");
+          }
+          // adjust pc if frame is deoptimized.
+          pc = this.getUnextendedSP().getAddressAt(nm.origPCOffset());
+          deoptimized = true;
+        }
+      }
+    }
+  }
+
+  public PPC64Frame(Address raw_sp, Address raw_fp, Address pc) {
+    this.raw_sp = raw_sp;
+    this.raw_unextendedSP = raw_sp;
+    if (raw_fp == null) {
+      this.raw_fp = raw_sp.getAddressAt(0);
+    } else {
+      this.raw_fp = raw_fp;
+    }
+    if (pc == null) {
+      this.pc = raw_sp.getAddressAt(2 * VM.getVM().getAddressSize());
+    } else {
+      this.pc = pc;
+    }
+    adjustUnextendedSP();
+
+    // Frame must be fully constructed before this call
+    adjustForDeopt();
+
+    if (DEBUG) {
+      System.out.println("PPC64Frame(sp, fp, pc): " + this);
+      dumpStack();
+    }
+  }
+
+  public PPC64Frame(Address raw_sp, Address raw_fp) {
+    this.raw_sp = raw_sp;
+    this.raw_unextendedSP = raw_sp;
+    if (raw_fp == null) {
+      this.raw_fp = raw_sp.getAddressAt(0);
+    } else {
+      this.raw_fp = raw_fp;
+    }
+    this.pc = raw_sp.getAddressAt(2 * VM.getVM().getAddressSize());
+    adjustUnextendedSP();
+
+    // Frame must be fully constructed before this call
+    adjustForDeopt();
+
+    if (DEBUG) {
+      System.out.println("PPC64Frame(sp, fp): " + this);
+      dumpStack();
+    }
+  }
+
+  public PPC64Frame(Address raw_sp, Address raw_unextendedSp, Address raw_fp, Address pc) {
+    this.raw_sp = raw_sp;
+    this.raw_unextendedSP = raw_unextendedSp;
+    if (raw_fp == null) {
+      this.raw_fp = raw_sp.getAddressAt(0);
+    } else {
+      this.raw_fp = raw_fp;
+    }
+    if (pc == null) {
+      this.pc = raw_sp.getAddressAt(2 * VM.getVM().getAddressSize());
+    } else {
+      this.pc = pc;
+    }
+    adjustUnextendedSP();
+
+    // Frame must be fully constructed before this call
+    adjustForDeopt();
+
+    if (DEBUG) {
+      System.out.println("PPC64Frame(sp, unextendedSP, fp, pc): " + this);
+      dumpStack();
+    }
+
+  }
+
+  public Object clone() {
+    PPC64Frame frame = new PPC64Frame();
+    frame.raw_sp = raw_sp;
+    frame.raw_unextendedSP = raw_unextendedSP;
+    frame.raw_fp = raw_fp;
+    frame.pc = pc;
+    frame.deoptimized = deoptimized;
+    return frame;
+  }
+
+  public boolean equals(Object arg) {
+    if (arg == null) {
+      return false;
+    }
+
+    if (!(arg instanceof PPC64Frame)) {
+      return false;
+    }
+
+    PPC64Frame other = (PPC64Frame) arg;
+
+    return (AddressOps.equal(getSP(), other.getSP()) &&
+        AddressOps.equal(getUnextendedSP(), other.getUnextendedSP()) &&
+        AddressOps.equal(getFP(), other.getFP()) &&
+        AddressOps.equal(getPC(), other.getPC()));
+  }
+
+  public int hashCode() {
+    if (raw_sp == null) {
+      return 0;
+    }
+
+    return raw_sp.hashCode();
+  }
+
+  public String toString() {
+    return "sp: " + (getSP() == null ? "null" : getSP().toString()) +
+        ", unextendedSP: " + (getUnextendedSP() == null ? "null" : getUnextendedSP().toString()) +
+        ", fp: " + (getFP() == null ? "null" : getFP().toString()) +
+        ", pc: " + (pc == null ? "null" : pc.toString());
+  }
+
+  // accessors for the instance variables
+  public Address getFP() { return raw_fp; }
+  public Address getSP() { return raw_sp; }
+  public Address getID() { return raw_sp; }
+
+  // FIXME: not implemented yet (should be done for Solaris/PPC64)
+  public boolean isSignalHandlerFrameDbg() { return false; }
+  public int     getSignalNumberDbg()      { return 0;     }
+  public String  getSignalNameDbg()        { return null;  }
+
+  public boolean isInterpretedFrameValid() {
+    if (Assert.ASSERTS_ENABLED) {
+      Assert.that(isInterpretedFrame(), "Not an interpreted frame");
+    }
+
+    // These are reasonable sanity checks
+    if (getFP() == null || getFP().andWithMask(0x3) != null) {
+      return false;
+    }
+
+    if (getSP() == null || getSP().andWithMask(0x3) != null) {
+      return false;
+    }
+
+    // These are hacks to keep us out of trouble.
+    // The problem with these is that they mask other problems
+    if (getFP().lessThanOrEqual(getSP())) {
+      // this attempts to deal with unsigned comparison above
+      return false;
+    }
+
+    if (getFP().minus(getSP()) > 4096 * VM.getVM().getAddressSize()) {
+      // stack frames shouldn't be large.
+      return false;
+    }
+
+    return true;
+  }
+
+  // FIXME: not applicable in current system
+  //  void    patch_pc(Thread* thread, address pc);
+
+  public Frame sender(RegisterMap regMap, CodeBlob cb) {
+    PPC64RegisterMap map = (PPC64RegisterMap) regMap;
+
+    if (Assert.ASSERTS_ENABLED) {
+      Assert.that(map != null, "map must be set");
+    }
+
+    // Default is we done have to follow them. The sender_for_xxx will
+    // update it accordingly
+    map.setIncludeArgumentOops(false);
+
+    if (isEntryFrame()) return senderForEntryFrame(map);
+    if (isInterpretedFrame()) return senderForInterpreterFrame(map);
+
+    if(cb == null) {
+      cb = VM.getVM().getCodeCache().findBlob(getPC());
+    } else {
+      if (Assert.ASSERTS_ENABLED) {
+        Assert.that(cb.equals(VM.getVM().getCodeCache().findBlob(getPC())), "Must be the same");
+      }
+    }
+
+    if (cb != null) {
+      return senderForCompiledFrame(map, cb);
+    }
+
+    // Must be native-compiled frame, i.e. the marshaling code for native
+    // methods that exists in the core system.
+    return new PPC64Frame(getSenderSP(), getLink(), getSenderPC());
+  }
+
+  private Frame senderForEntryFrame(PPC64RegisterMap map) {
+    if (DEBUG) {
+      System.out.println("senderForEntryFrame");
+    }
+    if (Assert.ASSERTS_ENABLED) {
+      Assert.that(map != null, "map must be set");
+    }
+    // Java frame called from C; skip all C frames and return top C
+    // frame of that chunk as the sender
+    PPC64JavaCallWrapper jcw = (PPC64JavaCallWrapper) getEntryFrameCallWrapper();
+    if (Assert.ASSERTS_ENABLED) {
+      Assert.that(!entryFrameIsFirst(), "next Java fp must be non zero");
+      Assert.that(jcw.getLastJavaSP().greaterThan(getSP()), "must be above this frame on stack");
+    }
+    PPC64Frame fr;
+    if (jcw.getLastJavaPC() != null) {
+      fr = new PPC64Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP(), jcw.getLastJavaPC());
+    } else {
+      fr = new PPC64Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP());
+    }
+    map.clear();
+    if (Assert.ASSERTS_ENABLED) {
+      Assert.that(map.getIncludeArgumentOops(), "should be set by clear");
+    }
+    return fr;
+  }
+
+  //------------------------------------------------------------------------------
+  // frame::adjust_unextended_sp
+  private void adjustUnextendedSP() {
+    raw_unextendedSP = getFP();
+  }
+  private Frame senderForInterpreterFrame(PPC64RegisterMap map) {
+    if (DEBUG) {
+      System.out.println("senderForInterpreterFrame");
+    }
+    Address unextendedSP = addressOfStackSlot(INTERPRETER_FRAME_SENDER_SP_OFFSET).getAddressAt(0);
+    Address sp = getSenderSP();
+
+    return new PPC64Frame(sp, unextendedSP, getLink(), getSenderPC());
+  }
+
+
+  private Frame senderForCompiledFrame(PPC64RegisterMap map, CodeBlob cb) {
+    if (DEBUG) {
+      System.out.println("senderForCompiledFrame");
+    }
+
+    //
+    // NOTE: some of this code is (unfortunately) duplicated in PPC64CurrentFrameGuess
+    //
+
+    if (Assert.ASSERTS_ENABLED) {
+      Assert.that(map != null, "map must be set");
+    }
+
+    // frame owned by optimizing compiler
+    if (Assert.ASSERTS_ENABLED) {
+      Assert.that(cb.getFrameSize() >= 0, "must have non-zero frame size");
+    }
+    Address senderSP = getSenderSP();
+
+    Address senderPC = getSenderPC();
+
+    if (map.getUpdateMap()) {
+      // Tell GC to use argument oopmaps for some runtime stubs that need it.
+      // For C1, the runtime stub might not have oop maps, so set this flag
+      // outside of update_register_map.
+      map.setIncludeArgumentOops(cb.callerMustGCArguments());
+
+      if (cb.getOopMaps() != null) {
+        OopMapSet.updateRegisterMap(this, cb, map, true);
+      }
+    }
+
+    return new PPC64Frame(senderSP, getLink(), senderPC);
+  }
+
+  protected boolean hasSenderPD() {
+    // FIXME
+    return true;
+  }
+
+  public long frameSize() {
+    return (getSenderSP().minus(getSP()) / VM.getVM().getAddressSize());
+  }
+
+  public Address getLink() {
+    return getSenderSP().getAddressAt(0);
+  }
+
+  public Address getUnextendedSP() { return raw_unextendedSP; }
+
+  // Return address:
+  public Address getSenderPC()     { return getSenderSP().getAddressAt(2 * VM.getVM().getAddressSize()); }
+
+  // return address of param, zero origin index.
+  // MPJ note:   Appears to be unused.
+  public Address getNativeParamAddr(int idx) {
+    return null;
+    // return addressOfStackSlot(NATIVE_FRAME_INITIAL_PARAM_OFFSET + idx);
+  }
+
+  public Address getSenderSP()     { return getFP(); }
+  public Address addressOfInterpreterFrameLocals() {
+    return addressOfStackSlot(INTERPRETER_FRAME_LOCALS_OFFSET);
+  }
+
+  private Address addressOfInterpreterFrameBCX() {
+    return addressOfStackSlot(INTERPRETER_FRAME_BCX_OFFSET);
+  }
+
+  public int getInterpreterFrameBCI() {
+    // FIXME: this is not atomic with respect to GC and is unsuitable
+    // for use in a non-debugging, or reflective, system. Need to
+    // figure out how to express this.
+    Address bcp = addressOfInterpreterFrameBCX().getAddressAt(0);
+    Address methodHandle = addressOfInterpreterFrameMethod().getAddressAt(0);
+    Method method = (Method)Metadata.instantiateWrapperFor(methodHandle);
+    return bcpToBci(bcp, method);
+  }
+
+  public Address addressOfInterpreterFrameMDX() {
+    return addressOfStackSlot(INTERPRETER_FRAME_MDX_OFFSET);
+  }
+
+  // FIXME
+  //inline int frame::interpreter_frame_monitor_size() {
+  //  return BasicObjectLock::size();
+  //}
+
+  // expression stack
+  // (the max_stack arguments are used by the GC; see class FrameClosure)
+
+  public Address addressOfInterpreterFrameExpressionStack() {
+    Address monitorEnd = interpreterFrameMonitorEnd().address();
+    return monitorEnd.addOffsetTo(-1 * VM.getVM().getAddressSize());
+  }
+
+  public int getInterpreterFrameExpressionStackDirection() { return -1; }
+
+  // top of expression stack
+  public Address addressOfInterpreterFrameTOS() {
+    return getSP();
+  }
+
+  /** Expression stack from top down */
+  public Address addressOfInterpreterFrameTOSAt(int slot) {
+    return addressOfInterpreterFrameTOS().addOffsetTo(slot * VM.getVM().getAddressSize());
+  }
+
+  public Address getInterpreterFrameSenderSP() {
+    if (Assert.ASSERTS_ENABLED) {
+      Assert.that(isInterpretedFrame(), "interpreted frame expected");
+    }
+    return addressOfStackSlot(INTERPRETER_FRAME_SENDER_SP_OFFSET).getAddressAt(0);
+  }
+
+  // Monitors
+  public BasicObjectLock interpreterFrameMonitorBegin() {
+    return new BasicObjectLock(addressOfStackSlot(INTERPRETER_FRAME_MONITOR_BLOCK_BOTTOM_OFFSET));
+  }
+
+  public BasicObjectLock interpreterFrameMonitorEnd() {
+    Address result = addressOfStackSlot(INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET).getAddressAt(0);
+    if (Assert.ASSERTS_ENABLED) {
+      // make sure the pointer points inside the frame
+      Assert.that(AddressOps.gt(getFP(), result), "result must <  than frame pointer");
+      Assert.that(AddressOps.lte(getSP(), result), "result must >= than stack pointer");
+    }
+    return new BasicObjectLock(result);
+  }
+
+  public int interpreterFrameMonitorSize() {
+    return BasicObjectLock.size();
+  }
+
+  // Method
+  public Address addressOfInterpreterFrameMethod() {
+    return addressOfStackSlot(INTERPRETER_FRAME_METHOD_OFFSET);
+  }
+
+  // Constant pool cache
+  public Address addressOfInterpreterFrameCPCache() {
+    return addressOfStackSlot(INTERPRETER_FRAME_CACHE_OFFSET);
+  }
+
+  // Entry frames
+  public JavaCallWrapper getEntryFrameCallWrapper() {
+    return new PPC64JavaCallWrapper(addressOfStackSlot(ENTRY_FRAME_CALL_WRAPPER_OFFSET).getAddressAt(0));
+  }
+
+  protected Address addressOfSavedOopResult() {
+    // offset is 2 for compiler2 and 3 for compiler1
+    return getSP().addOffsetTo((VM.getVM().isClientCompiler() ? 2 : 3) *
+        VM.getVM().getAddressSize());
+  }
+
+  protected Address addressOfSavedReceiver() {
+    return getSP().addOffsetTo(-4 * VM.getVM().getAddressSize());
+  }
+
+  private void dumpStack() {
+    if (getFP() != null) {
+      for (Address addr = getSP().addOffsetTo(-5 * VM.getVM().getAddressSize());
+          AddressOps.lte(addr, getFP().addOffsetTo(5 * VM.getVM().getAddressSize()));
+          addr = addr.addOffsetTo(VM.getVM().getAddressSize())) {
+        System.out.println(addr + ": " + addr.getAddressAt(0));
+      }
+    } else {
+      for (Address addr = getSP().addOffsetTo(-5 * VM.getVM().getAddressSize());
+          AddressOps.lte(addr, getSP().addOffsetTo(20 * VM.getVM().getAddressSize()));
+          addr = addr.addOffsetTo(VM.getVM().getAddressSize())) {
+        System.out.println(addr + ": " + addr.getAddressAt(0));
+      }
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64JavaCallWrapper.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.runtime.ppc64;
+
+import java.util.*;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.runtime.*;
+
+public class PPC64JavaCallWrapper extends JavaCallWrapper {
+
+  public PPC64JavaCallWrapper(Address addr) {
+    super(addr);
+  }
+
+  public Address getLastJavaFP() {
+    return null;
+  }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64RegisterMap.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 20014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.runtime.ppc64;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+
+public class PPC64RegisterMap extends RegisterMap {
+
+  /** This is the only public constructor */
+  public PPC64RegisterMap(JavaThread thread, boolean updateMap) {
+    super(thread, updateMap);
+  }
+
+  protected PPC64RegisterMap(RegisterMap map) {
+    super(map);
+  }
+
+  public Object clone() {
+    PPC64RegisterMap retval = new PPC64RegisterMap(this);
+    return retval;
+  }
+
+  // no PD state to clear or copy:
+  protected void clearPD() {}
+  protected void initializePD() {}
+  protected void initializeFromPD(RegisterMap map) {}
+  protected Address getLocationPD(VMReg reg) { return null; }
+}
--- a/hotspot/make/aix/makefiles/ppc64.make	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/make/aix/makefiles/ppc64.make	Fri Jan 09 13:28:02 2015 -0500
@@ -46,7 +46,9 @@
 #  - 1540-1090 (I) The destructor of "..." might not be called.
 #  - 1500-010: (W) WARNING in ...: Infinite loop.  Program may not stop.
 #    There are several infinite loops in the vm, suppress.
-CFLAGS += -qsuppress=1540-1090 -qsuppress=1500-010
+#  - 1540-1639 (I) The behavior of long type bit fields has changed ...
+#                  ... long type bit fields now default to long, not int.
+CFLAGS += -qsuppress=1540-1090 -qsuppress=1500-010 -qsuppress=1540-1639
 
 # Suppress 
 #  - 540-1088 (W) The exception specification is being ignored.
--- a/hotspot/make/aix/makefiles/xlc.make	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/make/aix/makefiles/xlc.make	Fri Jan 09 13:28:02 2015 -0500
@@ -124,7 +124,7 @@
 # MAPFLAG = -Xlinker --version-script=FILENAME
 
 # Build shared library
-SHARED_FLAG = -q64 -b64 -bexpall -G -bnoentry -qmkshrobj -brtl -bnolibpath
+SHARED_FLAG = -q64 -b64 -bexpall -G -bnoentry -qmkshrobj -brtl -bnolibpath -bernotok
 
 #------------------------------------------------------------------------
 # Debug flags
--- a/hotspot/make/linux/makefiles/sa.make	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/make/linux/makefiles/sa.make	Fri Jan 09 13:28:02 2015 -0500
@@ -109,6 +109,7 @@
 	$(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext
 	$(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext
 	$(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.sparc.SPARCThreadContext
+	$(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.ppc64.PPC64ThreadContext
 	$(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.asm.Disassembler
 
 clean:
--- a/hotspot/make/sa.files	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/make/sa.files	Fri Jan 09 13:28:02 2015 -0500
@@ -51,16 +51,20 @@
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/dummy/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/amd64/*.java \
+$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/ppc64/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/x86/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/sparc/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/posix/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/posix/elf/*.java \
+$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/ppc64/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/proc/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/proc/amd64/*.java \
+$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/proc/ppc64/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/proc/sparc/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/proc/x86/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/remote/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/remote/amd64/*.java \
+$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/remote/ppc64/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/remote/sparc/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/remote/x86/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/sparc/*.java \
@@ -90,12 +94,14 @@
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux_amd64/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux_x86/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux_sparc/*.java \
+$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux_ppc64/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/posix/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/solaris_amd64/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/solaris_sparc/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/solaris_x86/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/sparc/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/x86/*.java \
+$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/ppc64/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/tools/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/tools/jcore/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/tools/soql/*.java \
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -786,17 +786,12 @@
   MetadataOnStackMark md_on_stack(has_redefined_a_class);
 
   if (has_redefined_a_class) {
-    // purge_previous_versions also cleans weak method links. Because
-    // one method's MDO can reference another method from another
-    // class loader, we need to first clean weak method links for all
-    // class loaders here. Below, we can then free redefined methods
-    // for all class loaders.
     for (ClassLoaderData* data = _head; data != NULL; data = data->next()) {
       data->classes_do(InstanceKlass::purge_previous_versions);
     }
   }
 
-  // Need to purge the previous version before deallocating.
+  // Should purge the previous version before deallocating.
   free_deallocate_lists();
 }
 
@@ -834,8 +829,6 @@
 
 void ClassLoaderDataGraph::free_deallocate_lists() {
   for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
-    // We need to keep this data until InstanceKlass::purge_previous_version has been
-    // called on all alive classes. See the comment in ClassLoaderDataGraph::clean_metaspaces.
     cld->free_deallocate_list();
   }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/classfile/compactHashtable.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,417 @@
+/*
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "classfile/javaClasses.hpp"
+#include "memory/metaspaceShared.hpp"
+#include "utilities/numberSeq.hpp"
+#include <sys/stat.h>
+
+/////////////////////////////////////////////////////
+//
+// The compact hash table writer implementations
+//
+CompactHashtableWriter::CompactHashtableWriter(const char* table_name,
+                                               int num_entries,
+                                               CompactHashtableStats* stats) {
+  assert(DumpSharedSpaces, "dump-time only");
+  _table_name = table_name;
+  _num_entries = num_entries;
+  _num_buckets = number_of_buckets(_num_entries);
+  _buckets = NEW_C_HEAP_ARRAY(Entry*, _num_buckets, mtSymbol);
+  memset(_buckets, 0, sizeof(Entry*) * _num_buckets);
+
+  /* bucket sizes table */
+  _bucket_sizes = NEW_C_HEAP_ARRAY(juint, _num_buckets, mtSymbol);
+  memset(_bucket_sizes, 0, sizeof(juint) * _num_buckets);
+
+  stats->hashentry_count = _num_entries;
+  // Compact buckets' entries will have only the 4-byte offset, but
+  // we don't know how many there will be at this point. So use a
+  // conservative estimate here. The size is adjusted later when we
+  // write out the buckets.
+  stats->hashentry_bytes = _num_entries * 8;
+  stats->bucket_count    = _num_buckets;
+  stats->bucket_bytes    = (_num_buckets + 1) * (sizeof(juint));
+  _stats = stats;
+
+  // See compactHashtable.hpp for table layout
+  _required_bytes = sizeof(juint) * 2; // _base_address, written as 2 juints
+  _required_bytes+= sizeof(juint) +    // num_entries
+                    sizeof(juint) +    // num_buckets
+                    stats->hashentry_bytes +
+                    stats->bucket_bytes;
+}
+
+CompactHashtableWriter::~CompactHashtableWriter() {
+  for (int index = 0; index < _num_buckets; index++) {
+    Entry* next = NULL;
+    for (Entry* tent = _buckets[index]; tent; tent = next) {
+      next = tent->next();
+      delete tent;
+    }
+  }
+
+  FREE_C_HEAP_ARRAY(juint, _bucket_sizes);
+  FREE_C_HEAP_ARRAY(Entry*, _buckets);
+}
+
+// Calculate the number of buckets in the temporary hash table
+int CompactHashtableWriter::number_of_buckets(int num_entries) {
+  const int buksize = (int)SharedSymbolTableBucketSize;
+  int num_buckets = (num_entries + buksize - 1) / buksize;
+  num_buckets = (num_buckets + 1) & (~0x01);
+
+  return num_buckets;
+}
+
+// Add a symbol entry to the temporary hash table
+void CompactHashtableWriter::add(unsigned int hash, Entry* entry) {
+  int index = hash % _num_buckets;
+  entry->set_next(_buckets[index]);
+  _buckets[index] = entry;
+  _bucket_sizes[index] ++;
+}
+
+// Write the compact table's bucket infos
+juint* CompactHashtableWriter::dump_table(juint* p, juint** first_bucket,
+                                          NumberSeq* summary) {
+  int index;
+  juint* compact_table = p;
+  // Find the start of the buckets, skip the compact_bucket_infos table
+  // and the table end offset.
+  juint offset = _num_buckets + 1;
+  *first_bucket = compact_table + offset;
+
+  for (index = 0; index < _num_buckets; index++) {
+    int bucket_size = _bucket_sizes[index];
+    if (bucket_size == 1) {
+      // bucket with one entry is compacted and only has the symbol offset
+      compact_table[index] = BUCKET_INFO(offset, COMPACT_BUCKET_TYPE);
+      offset += bucket_size; // each entry contains symbol offset only
+    } else {
+      // regular bucket, each entry is a symbol (hash, offset) pair
+      compact_table[index] = BUCKET_INFO(offset, REGULAR_BUCKET_TYPE);
+      offset += bucket_size * 2; // each hash entry is 2 juints
+    }
+    if (offset & ~BUCKET_OFFSET_MASK) {
+      vm_exit_during_initialization("CompactHashtableWriter::dump_table: Overflow! "
+                                    "Too many symbols.");
+    }
+    summary->add(bucket_size);
+  }
+  // Mark the end of the table
+  compact_table[_num_buckets] = BUCKET_INFO(offset, TABLEEND_BUCKET_TYPE);
+
+  return compact_table;
+}
+
+// Write the compact table's entries
+juint* CompactHashtableWriter::dump_buckets(juint* compact_table, juint* p,
+                                            NumberSeq* summary) {
+  uintx base_address = uintx(MetaspaceShared::shared_rs()->base());
+  uintx max_delta    = uintx(MetaspaceShared::shared_rs()->size());
+  assert(max_delta <= 0x7fffffff, "range check");
+  int num_compact_buckets = 0;
+
+  assert(p != NULL, "sanity");
+  for (int index = 0; index < _num_buckets; index++) {
+    juint count = 0;
+    int bucket_size = _bucket_sizes[index];
+    int bucket_type = BUCKET_TYPE(compact_table[index]);
+
+    if (bucket_size == 1) {
+      assert(bucket_type == COMPACT_BUCKET_TYPE, "Bad bucket type");
+      num_compact_buckets ++;
+    }
+    for (Entry* tent = _buckets[index]; tent;
+         tent = tent->next()) {
+      if (bucket_type == REGULAR_BUCKET_TYPE) {
+        *p++ = juint(tent->hash()); // write symbol hash
+      }
+      uintx deltax = uintx(tent->value()) - base_address;
+      assert(deltax < max_delta, "range check");
+      juint delta = juint(deltax);
+      *p++ = delta; // write symbol offset
+      count ++;
+    }
+    assert(count == _bucket_sizes[index], "sanity");
+  }
+
+  // Adjust the hashentry_bytes in CompactHashtableStats. Each compact
+  // bucket saves 4-byte.
+  _stats->hashentry_bytes -= num_compact_buckets * 4;
+
+  return p;
+}
+
+// Write the compact table
+void CompactHashtableWriter::dump(char** top, char* end) {
+  NumberSeq summary;
+  char* old_top = *top;
+  juint* p = (juint*)(*top);
+
+  uintx base_address = uintx(MetaspaceShared::shared_rs()->base());
+
+  *p++ = high(base_address);
+  *p++ = low (base_address); // base address
+  *p++ = _num_entries;  // number of entries in the table
+  *p++ = _num_buckets;  // number of buckets in the table
+
+  juint* first_bucket = NULL;
+  juint* compact_table = dump_table(p, &first_bucket, &summary);
+  juint* bucket_end = dump_buckets(compact_table, first_bucket, &summary);
+
+  assert(bucket_end <= (juint*)end, "cannot write past end");
+  *top = (char*)bucket_end;
+
+  if (PrintSharedSpaces) {
+    double avg_cost = 0.0;
+    if (_num_entries > 0) {
+      avg_cost = double(_required_bytes)/double(_num_entries);
+    }
+    tty->print_cr("Shared %s table stats -------- base: " PTR_FORMAT, _table_name, (intptr_t)base_address);
+    tty->print_cr("Number of entries       : %9d", _num_entries);
+    tty->print_cr("Total bytes used        : %9d", (int)((*top) - old_top));
+    tty->print_cr("Average bytes per entry : %9.3f", avg_cost);
+    tty->print_cr("Average bucket size     : %9.3f", summary.avg());
+    tty->print_cr("Variance of bucket size : %9.3f", summary.variance());
+    tty->print_cr("Std. dev. of bucket size: %9.3f", summary.sd());
+    tty->print_cr("Maximum bucket size     : %9d", (int)summary.maximum());
+  }
+}
+
+/////////////////////////////////////////////////////////////
+//
+// The CompactHashtable implementation
+//
+template <class T, class N> const char* CompactHashtable<T, N>::init(const char* buffer) {
+  assert(!DumpSharedSpaces, "run-time only");
+  juint*p = (juint*)buffer;
+  juint upper = *p++;
+  juint lower = *p++;
+  _base_address = uintx(jlong_from(upper, lower));
+  _entry_count = *p++;
+  _bucket_count = *p++;
+  _buckets = p;
+  _table_end_offset = BUCKET_OFFSET(p[_bucket_count]); // located at the end of the bucket_info table
+
+  juint *end = _buckets + _table_end_offset;
+  return (const char*)end;
+}
+
+// Explicitly instantiate these types
+template class CompactHashtable<Symbol*, char>;
+
+#ifndef O_BINARY       // if defined (Win32) use binary files.
+#define O_BINARY 0     // otherwise do nothing.
+#endif
+
+////////////////////////////////////////////////////////
+//
+// HashtableTextDump
+//
+HashtableTextDump::HashtableTextDump(const char* filename) : _fd(-1) {
+  struct stat st;
+  if (os::stat(filename, &st) != 0) {
+    quit("Unable to get hashtable dump file size", filename);
+  }
+  _size = st.st_size;
+  _fd = open(filename, O_RDONLY | O_BINARY, 0);
+  if (_fd < 0) {
+    quit("Unable to open hashtable dump file", filename);
+  }
+  _base = os::map_memory(_fd, filename, 0, NULL, _size, true, false);
+  if (_base == NULL) {
+    quit("Unable to map hashtable dump file", filename);
+  }
+  _p = _base;
+  _end = _base + st.st_size;
+  _filename = filename;
+}
+
+HashtableTextDump::~HashtableTextDump() {
+  os::unmap_memory((char*)_base, _size);
+  if (_fd >= 0) {
+    close(_fd);
+  }
+}
+
+void HashtableTextDump::quit(const char* err, const char* msg) {
+  vm_exit_during_initialization(err, msg);
+}
+
+void HashtableTextDump::corrupted(const char *p) {
+  char info[60];
+  sprintf(info, "corrupted at pos %d", (int)(p - _base));
+  quit(info, _filename);
+}
+
+bool HashtableTextDump::skip_newline() {
+  if (_p[0] == '\r' && _p[1] == '\n') {
+    _p += 2;
+  } else if (_p[0] == '\n') {
+    _p += 1;
+  } else {
+    corrupted(_p);
+  }
+  return true;
+}
+
+int HashtableTextDump::skip(char must_be_char) {
+  corrupted_if(remain() < 1);
+  corrupted_if(*_p++ != must_be_char);
+  return 0;
+}
+
+void HashtableTextDump::skip_past(char c) {
+  for (;;) {
+    corrupted_if(remain() < 1);
+    if (*_p++ == c) {
+      return;
+    }
+  }
+}
+
+void HashtableTextDump::check_version(const char* ver) {
+  int len = (int)strlen(ver);
+  corrupted_if(remain() < len);
+  if (strncmp(_p, ver, len) != 0) {
+    quit("wrong version of hashtable dump file", _filename);
+  }
+  _p += len;
+  skip_newline();
+}
+
+
+int HashtableTextDump::scan_prefix() {
+  // Expect /[0-9]+: /
+  int utf8_length = get_num(':');
+  if (*_p != ' ') {
+    corrupted(_p);
+  }
+  _p++;
+  return utf8_length;
+}
+
+int HashtableTextDump::scan_prefix2() {
+  // Expect /[0-9]+ (-|)[0-9]+: /
+  int utf8_length = get_num(' ');
+  if (*_p == '-') {
+    _p++;
+  }
+  (void)get_num(':');
+  if (*_p != ' ') {
+    corrupted(_p);
+  }
+  _p++;
+  return utf8_length;
+}
+
+jchar HashtableTextDump::unescape(const char* from, const char* end, int count) {
+  jchar value = 0;
+
+  corrupted_if(from + count > end);
+
+  for (int i=0; i<count; i++) {
+    char c = *from++;
+    switch (c) {
+    case '0': case '1': case '2': case '3': case '4':
+    case '5': case '6': case '7': case '8': case '9':
+      value = (value << 4) + c - '0';
+      break;
+    case 'a': case 'b': case 'c':
+    case 'd': case 'e': case 'f':
+      value = (value << 4) + 10 + c - 'a';
+      break;
+    case 'A': case 'B': case 'C':
+    case 'D': case 'E': case 'F':
+      value = (value << 4) + 10 + c - 'A';
+      break;
+    default:
+      ShouldNotReachHere();
+    }
+  }
+  return value;
+}
+
+void HashtableTextDump::get_utf8(char* utf8_buffer, int utf8_length) {
+  // cache in local vars
+  const char* from = _p;
+  const char* end = _end;
+  char* to = utf8_buffer;
+  int n = utf8_length;
+
+  for (; n > 0 && from < end; n--) {
+    if (*from != '\\') {
+      *to++ = *from++;
+    } else {
+      corrupted_if(from + 2 > end);
+      char c = from[1];
+      from += 2;
+      switch (c) {
+      case 'x':
+        {
+          jchar value = unescape(from, end, 2);
+          from += 2;
+          assert(value <= 0xff, "sanity");
+          *to++ = (char)(value & 0xff);
+        }
+        break;
+      case 't':  *to++ = '\t'; break;
+      case 'n':  *to++ = '\n'; break;
+      case 'r':  *to++ = '\r'; break;
+      case '\\': *to++ = '\\'; break;
+      default:
+        ShouldNotReachHere();
+      }
+    }
+  }
+  corrupted_if(n > 0); // expected more chars but file has ended
+  _p = from;
+  skip_newline();
+}
+
+// NOTE: the content is NOT the same as
+// UTF8::as_quoted_ascii(const char* utf8_str, int utf8_length, char* buf, int buflen).
+// We want to escape \r\n\t so that output [1] is more readable; [2] can be more easily
+// parsed by scripts; [3] quickly processed by HashtableTextDump::get_utf8()
+void HashtableTextDump::put_utf8(outputStream* st, const char* utf8_string, int utf8_length) {
+  const char *c = utf8_string;
+  const char *end = c + utf8_length;
+  for (; c < end; c++) {
+    switch (*c) {
+    case '\t': st->print("\\t"); break;
+    case '\r': st->print("\\r"); break;
+    case '\n': st->print("\\n"); break;
+    case '\\': st->print("\\\\"); break;
+    default:
+      if (isprint(*c)) {
+        st->print("%c", *c);
+      } else {
+        st->print("\\x%02x", ((unsigned int)*c) & 0xff);
+      }
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/classfile/compactHashtable.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,405 @@
+/*
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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_CLASSFILE_COMPACTHASHTABLE_HPP
+#define SHARE_VM_CLASSFILE_COMPACTHASHTABLE_HPP
+
+#include "classfile/stringTable.hpp"
+#include "classfile/symbolTable.hpp"
+#include "memory/allocation.inline.hpp"
+#include "oops/symbol.hpp"
+#include "services/diagnosticCommand.hpp"
+#include "utilities/hashtable.hpp"
+
+class NumberSeq;
+
+// Stats for symbol tables in the CDS archive
+class CompactHashtableStats VALUE_OBJ_CLASS_SPEC {
+public:
+  int hashentry_count;
+  int hashentry_bytes;
+  int bucket_count;
+  int bucket_bytes;
+};
+
+/////////////////////////////////////////////////////////////////////////
+//
+// The compact hash table writer. Used at dump time for writing out
+// the compact table to the shared archive.
+//
+// At dump time, the CompactHashtableWriter obtains all entries from the
+// symbol table and adds them to a new temporary hash table. The hash
+// table size (number of buckets) is calculated using
+// '(num_entries + bucket_size - 1) / bucket_size'. The default bucket
+// size is 4 and can be changed by -XX:SharedSymbolTableBucketSize option.
+// 4 is chosen because it produces smaller sized bucket on average for
+// faster lookup. It also has relatively small number of empty buckets and
+// good distribution of the entries.
+//
+// We use a simple hash function (symbol_hash % num_bucket) for the table.
+// The new table is compacted when written out. Please see comments
+// above the CompactHashtable class for the table layout detail. The bucket
+// offsets are written to the archive as part of the compact table. The
+// bucket offset is encoded in the low 30-bit (0-29) and the bucket type
+// (regular or compact) are encoded in bit[31, 30]. For buckets with more
+// than one entry, both symbol hash and symbol offset are written to the
+// table. For buckets with only one entry, only the symbol offset is written
+// to the table and the buckets are tagged as compact in their type bits.
+// Buckets without entry are skipped from the table. Their offsets are
+// still written out for faster lookup.
+//
+class CompactHashtableWriter: public StackObj {
+public:
+  class Entry: public CHeapObj<mtSymbol> {
+    Entry* _next;
+    unsigned int _hash;
+    void* _literal;
+
+  public:
+    Entry(unsigned int hash, Symbol *symbol) : _next(NULL), _hash(hash), _literal(symbol) {}
+
+    void *value() {
+      return _literal;
+    }
+    Symbol *symbol() {
+      return (Symbol*)_literal;
+    }
+    unsigned int hash() {
+      return _hash;
+    }
+    Entry *next()           {return _next;}
+    void set_next(Entry *p) {_next = p;}
+  }; // class CompactHashtableWriter::Entry
+
+private:
+  static int number_of_buckets(int num_entries);
+
+  const char* _table_name;
+  int _num_entries;
+  int _num_buckets;
+  juint* _bucket_sizes;
+  Entry** _buckets;
+  int _required_bytes;
+  CompactHashtableStats* _stats;
+
+public:
+  // This is called at dump-time only
+  CompactHashtableWriter(const char* table_name, int num_entries, CompactHashtableStats* stats);
+  ~CompactHashtableWriter();
+
+  int get_required_bytes() {
+    return _required_bytes;
+  }
+
+  void add(unsigned int hash, Symbol* symbol) {
+    add(hash, new Entry(hash, symbol));
+  }
+
+private:
+  void add(unsigned int hash, Entry* entry);
+  juint* dump_table(juint* p, juint** first_bucket, NumberSeq* summary);
+  juint* dump_buckets(juint* table, juint* p, NumberSeq* summary);
+
+public:
+  void dump(char** top, char* end);
+};
+
+#define REGULAR_BUCKET_TYPE       0
+#define COMPACT_BUCKET_TYPE       1
+#define TABLEEND_BUCKET_TYPE      3
+#define BUCKET_OFFSET_MASK        0x3FFFFFFF
+#define BUCKET_OFFSET(info)       ((info) & BUCKET_OFFSET_MASK)
+#define BUCKET_TYPE_SHIFT         30
+#define BUCKET_TYPE(info)         (((info) & ~BUCKET_OFFSET_MASK) >> BUCKET_TYPE_SHIFT)
+#define BUCKET_INFO(offset, type) (((type) << BUCKET_TYPE_SHIFT) | ((offset) & BUCKET_OFFSET_MASK))
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// CompactHashtable is used to stored the CDS archive's symbol table. Used
+// at runtime only to access the compact table from the archive.
+//
+// Because these tables are read-only (no entries can be added/deleted) at run-time
+// and tend to have large number of entries, we try to minimize the footprint
+// cost per entry.
+//
+// Layout of compact symbol table in the shared archive:
+//
+//   uintx base_address;
+//   juint num_symbols;
+//   juint num_buckets;
+//   juint bucket_infos[num_buckets+1]; // bit[31,30]: type; bit[29-0]: offset
+//   juint table[]
+//
+// -----------------------------------
+// | base_address  | num_symbols     |
+// |---------------------------------|
+// | num_buckets   | bucket_info0    |
+// |---------------------------------|
+// | bucket_info1  | bucket_info2    |
+// | bucket_info3    ...             |
+// | ....          | table_end_info  |
+// |---------------------------------|
+// | entry0                          |
+// | entry1                          |
+// | entry2                          |
+// |                                 |
+// | ...                             |
+// -----------------------------------
+//
+// The size of the bucket_info table is 'num_buckets + 1'. Each entry of the
+// bucket_info table is a 32-bit encoding of the bucket type and bucket offset,
+// with the type in the left-most 2-bit and offset in the remaining 30-bit.
+// The last entry is a special type. It contains the offset of the last
+// bucket end. We use that information when traversing the compact table.
+//
+// There are two types of buckets, regular buckets and compact buckets. The
+// compact buckets have '01' in their highest 2-bit, and regular buckets have
+// '00' in their highest 2-bit.
+//
+// For normal buckets, each symbol's entry is 8 bytes in the table[]:
+//   juint hash;    /* symbol hash */
+//   juint offset;  /* Symbol* sym = (Symbol*)(base_address + offset) */
+//
+// For compact buckets, each entry has only the 4-byte 'offset' in the table[].
+//
+// See CompactHashtable::lookup() for how the table is searched at runtime.
+// See CompactHashtableWriter::dump() for how the table is written at CDS
+// dump time.
+//
+template <class T, class N> class CompactHashtable VALUE_OBJ_CLASS_SPEC {
+  uintx  _base_address;
+  juint  _entry_count;
+  juint  _bucket_count;
+  juint  _table_end_offset;
+  juint* _buckets;
+
+  inline bool equals(T entry, const char* name, int len) {
+    if (entry->equals(name, len)) {
+      assert(entry->refcount() == -1, "must be shared");
+      return true;
+    } else {
+      return false;
+    }
+  }
+
+public:
+  CompactHashtable() {
+    _entry_count = 0;
+    _bucket_count = 0;
+    _table_end_offset = 0;
+    _buckets = 0;
+  }
+  const char* init(const char *buffer);
+
+  // Lookup an entry from the compact table
+  inline T lookup(const N* name, unsigned int hash, int len) {
+    if (_entry_count > 0) {
+      assert(!DumpSharedSpaces, "run-time only");
+      int index = hash % _bucket_count;
+      juint bucket_info = _buckets[index];
+      juint bucket_offset = BUCKET_OFFSET(bucket_info);
+      int   bucket_type = BUCKET_TYPE(bucket_info);
+      juint* bucket = _buckets + bucket_offset;
+      juint* bucket_end = _buckets;
+
+      if (bucket_type == COMPACT_BUCKET_TYPE) {
+        // the compact bucket has one entry with symbol offset only
+        T entry = (T)((void*)(_base_address + bucket[0]));
+        if (equals(entry, name, len)) {
+          return entry;
+        }
+      } else {
+        // This is a regular bucket, which has more than one
+        // entries. Each entry is a pair of symbol (hash, offset).
+        // Seek until the end of the bucket.
+        bucket_end += BUCKET_OFFSET(_buckets[index + 1]);
+        while (bucket < bucket_end) {
+          unsigned int h = (unsigned int)(bucket[0]);
+          if (h == hash) {
+            juint offset = bucket[1];
+            T entry = (T)((void*)(_base_address + offset));
+            if (equals(entry, name, len)) {
+              return entry;
+            }
+          }
+          bucket += 2;
+        }
+      }
+    }
+    return NULL;
+  }
+};
+
+////////////////////////////////////////////////////////////////////////
+//
+// Read/Write the contents of a hashtable textual dump (created by
+// SymbolTable::dump).
+// Because the dump file may be big (hundred of MB in extreme cases),
+// we use mmap for fast access when reading it.
+//
+class HashtableTextDump VALUE_OBJ_CLASS_SPEC {
+  int _fd;
+  const char* _base;
+  const char* _p;
+  const char* _end;
+  const char* _filename;
+  size_t      _size;
+public:
+  HashtableTextDump(const char* filename);
+  ~HashtableTextDump();
+
+  void quit(const char* err, const char* msg);
+
+  inline int remain() {
+    return (int)(_end - _p);
+  }
+
+  void corrupted(const char *p);
+
+  inline void corrupted_if(bool cond) {
+    if (cond) {
+      corrupted(_p);
+    }
+  }
+
+  bool skip_newline();
+  int skip(char must_be_char);
+  void skip_past(char c);
+  void check_version(const char* ver);
+
+  inline int get_num(char delim) {
+    const char* p   = _p;
+    const char* end = _end;
+    int num = 0;
+
+    while (p < end) {
+      char c = *p ++;
+      if ('0' <= c && c <= '9') {
+        num = num * 10 + (c - '0');
+      } else if (c == delim) {
+        _p = p;
+        return num;
+      } else {
+        corrupted(p-1);
+      }
+    }
+    corrupted(_end);
+    ShouldNotReachHere();
+    return 0;
+  }
+
+  int scan_prefix();
+  int scan_prefix2();
+
+  jchar unescape(const char* from, const char* end, int count);
+  void get_utf8(char* utf8_buffer, int utf8_length);
+  static void put_utf8(outputStream* st, const char* utf8_string, int utf8_length);
+};
+
+///////////////////////////////////////////////////////////////////////
+//
+// jcmd command support for symbol table and string table dumping:
+//   VM.symboltable -verbose: for dumping the symbol table
+//   VM.stringtable -verbose: for dumping the string table
+//
+class VM_DumpHashtable : public VM_Operation {
+private:
+  outputStream* _out;
+  int _which;
+  bool _verbose;
+public:
+  enum {
+    DumpSymbols = 1 << 0,
+    DumpStrings = 1 << 1,
+    DumpSysDict = 1 << 2  // not implemented yet
+  };
+  VM_DumpHashtable(outputStream* out, int which, bool verbose) {
+    _out = out;
+    _which = which;
+    _verbose = verbose;
+  }
+
+  virtual VMOp_Type type() const { return VMOp_DumpHashtable; }
+
+  virtual void doit() {
+    switch (_which) {
+    case DumpSymbols:
+      SymbolTable::dump(_out, _verbose);
+      break;
+    case DumpStrings:
+      StringTable::dump(_out, _verbose);
+      break;
+    default:
+      ShouldNotReachHere();
+    }
+  }
+};
+
+class SymboltableDCmd : public DCmdWithParser {
+protected:
+  DCmdArgument<bool> _verbose;
+public:
+  SymboltableDCmd(outputStream* output, bool heap);
+  static const char* name() {
+    return "VM.symboltable";
+  }
+  static const char* description() {
+    return "Dump symbol table.";
+  }
+  static const char* impact() {
+    return "Medium: Depends on Java content.";
+  }
+  static const JavaPermission permission() {
+    JavaPermission p = {"java.lang.management.ManagementPermission",
+                        "monitor", NULL};
+    return p;
+  }
+  static int num_arguments();
+  virtual void execute(DCmdSource source, TRAPS);
+};
+
+class StringtableDCmd : public DCmdWithParser {
+protected:
+  DCmdArgument<bool> _verbose;
+public:
+  StringtableDCmd(outputStream* output, bool heap);
+  static const char* name() {
+    return "VM.stringtable";
+  }
+  static const char* description() {
+    return "Dump string table.";
+  }
+  static const char* impact() {
+    return "Medium: Depends on Java content.";
+  }
+  static const JavaPermission permission() {
+    JavaPermission p = {"java.lang.management.ManagementPermission",
+                        "monitor", NULL};
+    return p;
+  }
+  static int num_arguments();
+  virtual void execute(DCmdSource source, TRAPS);
+};
+
+#endif // SHARE_VM_CLASSFILE_COMPACTHASHTABLE_HPP
--- a/hotspot/src/share/vm/classfile/stringTable.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/classfile/stringTable.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/altHashing.hpp"
+#include "classfile/compactHashtable.hpp"
 #include "classfile/javaClasses.hpp"
 #include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
@@ -379,8 +380,36 @@
   }
 }
 
-void StringTable::dump(outputStream* st) {
-  the_table()->dump_table(st, "StringTable");
+void StringTable::dump(outputStream* st, bool verbose) {
+  if (!verbose) {
+    the_table()->dump_table(st, "StringTable");
+  } else {
+    Thread* THREAD = Thread::current();
+    st->print_cr("VERSION: 1.1");
+    for (int i = 0; i < the_table()->table_size(); ++i) {
+      HashtableEntry<oop, mtSymbol>* p = the_table()->bucket(i);
+      for ( ; p != NULL; p = p->next()) {
+        oop s = p->literal();
+        typeArrayOop value  = java_lang_String::value(s);
+        int          offset = java_lang_String::offset(s);
+        int          length = java_lang_String::length(s);
+
+        if (length <= 0) {
+          st->print("%d: ", length);
+        } else {
+          ResourceMark rm(THREAD);
+          jchar* chars = (jchar*)value->char_at_addr(offset);
+          int utf8_length = UNICODE::utf8_length(chars, length);
+          char* utf8_string = NEW_RESOURCE_ARRAY(char, utf8_length + 1);
+          UNICODE::convert_to_utf8(chars, length, utf8_string);
+
+          st->print("%d: ", utf8_length);
+          HashtableTextDump::put_utf8(st, utf8_string, utf8_length);
+        }
+        st->cr();
+      }
+    }
+  }
 }
 
 StringTable::VerifyRetTypes StringTable::compare_entries(
@@ -558,3 +587,28 @@
   _needs_rehashing = false;
   _the_table = new_table;
 }
+
+// Utility for dumping strings
+StringtableDCmd::StringtableDCmd(outputStream* output, bool heap) :
+                                 DCmdWithParser(output, heap),
+  _verbose("-verbose", "Dump the content of each string in the table",
+           "BOOLEAN", false, "false") {
+  _dcmdparser.add_dcmd_option(&_verbose);
+}
+
+void StringtableDCmd::execute(DCmdSource source, TRAPS) {
+  VM_DumpHashtable dumper(output(), VM_DumpHashtable::DumpStrings,
+                         _verbose.value());
+  VMThread::execute(&dumper);
+}
+
+int StringtableDCmd::num_arguments() {
+  ResourceMark rm;
+  StringtableDCmd* dcmd = new StringtableDCmd(NULL, false);
+  if (dcmd != NULL) {
+    DCmdMark mark(dcmd);
+    return dcmd->_dcmdparser.num_arguments();
+  } else {
+    return 0;
+  }
+}
--- a/hotspot/src/share/vm/classfile/stringTable.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/classfile/stringTable.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -118,7 +118,7 @@
 
   // Debugging
   static void verify();
-  static void dump(outputStream* st);
+  static void dump(outputStream* st, bool verbose=false);
 
   enum VerifyMesgModes {
     _verify_quietly    = 0,
--- a/hotspot/src/share/vm/classfile/symbolTable.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/classfile/symbolTable.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/altHashing.hpp"
+#include "classfile/compactHashtable.hpp"
 #include "classfile/javaClasses.hpp"
 #include "classfile/symbolTable.hpp"
 #include "classfile/systemDictionary.hpp"
@@ -47,6 +48,9 @@
 // Static arena for symbols that are not deallocated
 Arena* SymbolTable::_arena = NULL;
 bool SymbolTable::_needs_rehashing = false;
+bool SymbolTable::_lookup_shared_first = false;
+
+CompactHashtable<Symbol*, char> SymbolTable::_shared_table;
 
 Symbol* SymbolTable::allocate_symbol(const u1* name, int len, bool c_heap, TRAPS) {
   assert (len <= Symbol::max_length(), "should be checked by caller");
@@ -186,8 +190,8 @@
 
 // Lookup a symbol in a bucket.
 
-Symbol* SymbolTable::lookup(int index, const char* name,
-                              int len, unsigned int hash) {
+Symbol* SymbolTable::lookup_dynamic(int index, const char* name,
+                                    int len, unsigned int hash) {
   int count = 0;
   for (HashtableEntry<Symbol*, mtSymbol>* e = bucket(index); e != NULL; e = e->next()) {
     count++;  // count all entries in this bucket, not just ones with same hash
@@ -207,6 +211,34 @@
   return NULL;
 }
 
+Symbol* SymbolTable::lookup_shared(const char* name,
+                                   int len, unsigned int hash) {
+  return _shared_table.lookup(name, hash, len);
+}
+
+Symbol* SymbolTable::lookup(int index, const char* name,
+                            int len, unsigned int hash) {
+  Symbol* sym;
+  if (_lookup_shared_first) {
+    sym = lookup_shared(name, len, hash);
+    if (sym != NULL) {
+      return sym;
+    }
+    _lookup_shared_first = false;
+    return lookup_dynamic(index, name, len, hash);
+  } else {
+    sym = lookup_dynamic(index, name, len, hash);
+    if (sym != NULL) {
+      return sym;
+    }
+    sym = lookup_shared(name, len, hash);
+    if (sym != NULL) {
+      _lookup_shared_first = true;
+    }
+    return sym;
+  }
+}
+
 // Pick hashing algorithm.
 unsigned int SymbolTable::hash_symbol(const char* s, int len) {
   return use_alternate_hashcode() ?
@@ -483,10 +515,56 @@
   }
 }
 
-void SymbolTable::dump(outputStream* st) {
-  the_table()->dump_table(st, "SymbolTable");
+void SymbolTable::dump(outputStream* st, bool verbose) {
+  if (!verbose) {
+    the_table()->dump_table(st, "SymbolTable");
+  } else {
+    st->print_cr("VERSION: 1.0");
+    for (int i = 0; i < the_table()->table_size(); ++i) {
+      HashtableEntry<Symbol*, mtSymbol>* p = the_table()->bucket(i);
+      for ( ; p != NULL; p = p->next()) {
+        Symbol* s = (Symbol*)(p->literal());
+        const char* utf8_string = (const char*)s->bytes();
+        int utf8_length = s->utf8_length();
+        st->print("%d %d: ", utf8_length, s->refcount());
+        HashtableTextDump::put_utf8(st, utf8_string, utf8_length);
+        st->cr();
+      }
+    }
+  }
 }
 
+bool SymbolTable::copy_compact_table(char** top, char*end) {
+#if INCLUDE_CDS
+  CompactHashtableWriter ch_table("symbol", the_table()->number_of_entries(),
+                                  &MetaspaceShared::stats()->symbol);
+  if (*top + ch_table.get_required_bytes() > end) {
+    // not enough space left
+    return false;
+  }
+
+  for (int i = 0; i < the_table()->table_size(); ++i) {
+    HashtableEntry<Symbol*, mtSymbol>* p = the_table()->bucket(i);
+    for ( ; p != NULL; p = p->next()) {
+      Symbol* s = (Symbol*)(p->literal());
+      unsigned int fixed_hash = hash_symbol((char*)s->bytes(), s->utf8_length());
+      assert(fixed_hash == p->hash(), "must not rehash during dumping");
+      ch_table.add(fixed_hash, s);
+    }
+  }
+
+  char* old_top = *top;
+  ch_table.dump(top, end);
+
+  *top = (char*)align_pointer_up(*top, sizeof(void*));
+#endif
+  return true;
+}
+
+const char* SymbolTable::init_shared_table(const char* buffer) {
+  const char* end = _shared_table.init(buffer);
+  return (const char*)align_pointer_up(end, sizeof(void*));
+}
 
 //---------------------------------------------------------------------------
 // Non-product code
@@ -574,3 +652,29 @@
   }
 }
 #endif // PRODUCT
+
+
+// Utility for dumping symbols
+SymboltableDCmd::SymboltableDCmd(outputStream* output, bool heap) :
+                                 DCmdWithParser(output, heap),
+  _verbose("-verbose", "Dump the content of each symbol in the table",
+           "BOOLEAN", false, "false") {
+  _dcmdparser.add_dcmd_option(&_verbose);
+}
+
+void SymboltableDCmd::execute(DCmdSource source, TRAPS) {
+  VM_DumpHashtable dumper(output(), VM_DumpHashtable::DumpSymbols,
+                         _verbose.value());
+  VMThread::execute(&dumper);
+}
+
+int SymboltableDCmd::num_arguments() {
+  ResourceMark rm;
+  SymboltableDCmd* dcmd = new SymboltableDCmd(NULL, false);
+  if (dcmd != NULL) {
+    DCmdMark mark(dcmd);
+    return dcmd->_dcmdparser.num_arguments();
+  } else {
+    return 0;
+  }
+}
--- a/hotspot/src/share/vm/classfile/symbolTable.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/classfile/symbolTable.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -73,6 +73,8 @@
   operator Symbol*()                             { return _temp; }
 };
 
+template <class T, class N> class CompactHashtable;
+
 class SymbolTable : public RehashableHashtable<Symbol*, mtSymbol> {
   friend class VMStructs;
   friend class ClassFileParser;
@@ -83,11 +85,15 @@
 
   // Set if one bucket is out of balance due to hash algorithm deficiency
   static bool _needs_rehashing;
+  static bool _lookup_shared_first;
 
   // For statistics
   static int _symbols_removed;
   static int _symbols_counted;
 
+  // shared symbol table.
+  static CompactHashtable<Symbol*, char> _shared_table;
+
   Symbol* allocate_symbol(const u1* name, int len, bool c_heap, TRAPS); // Assumes no characters larger than 0x7F
 
   // Adding elements
@@ -106,6 +112,8 @@
     add(loader_data, cp, names_count, name, lengths, cp_indices, hashValues, THREAD);
   }
 
+  static Symbol* lookup_shared(const char* name, int len, unsigned int hash);
+  Symbol* lookup_dynamic(int index, const char* name, int len, unsigned int hash);
   Symbol* lookup(int index, const char* name, int len, unsigned int hash);
 
   SymbolTable()
@@ -144,20 +152,6 @@
     initialize_symbols(symbol_alloc_arena_size);
   }
 
-  static void create_table(HashtableBucket<mtSymbol>* t, int length,
-                           int number_of_entries) {
-    assert(_the_table == NULL, "One symbol table allowed.");
-
-    // If CDS archive used a different symbol table size, use that size instead
-    // which is better than giving an error.
-    SymbolTableSize = length/bucket_size();
-
-    _the_table = new SymbolTable(t, number_of_entries);
-    // if CDS give symbol table a default arena size since most symbols
-    // are already allocated in the shared misc section.
-    initialize_symbols();
-  }
-
   static unsigned int hash_symbol(const char* s, int len);
 
   static Symbol* lookup(const char* name, int len, TRAPS);
@@ -230,18 +224,12 @@
 
   // Debugging
   static void verify();
-  static void dump(outputStream* st);
+  static void dump(outputStream* st, bool verbose=false);
+  static void read(const char* filename, TRAPS);
 
   // Sharing
-  static void copy_buckets(char** top, char*end) {
-    the_table()->Hashtable<Symbol*, mtSymbol>::copy_buckets(top, end);
-  }
-  static void copy_table(char** top, char*end) {
-    the_table()->Hashtable<Symbol*, mtSymbol>::copy_table(top, end);
-  }
-  static void reverse(void* boundary = NULL) {
-    the_table()->Hashtable<Symbol*, mtSymbol>::reverse(boundary);
-  }
+  static bool copy_compact_table(char** top, char* end);
+  static const char* init_shared_table(const char* buffer);
 
   // Rehash the symbol table if it gets out of balance
   static void rehash_table();
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, 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
@@ -32,6 +32,7 @@
 #include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
+#include "code/codeCache.hpp"
 #include "compiler/compileBroker.hpp"
 #include "interpreter/bytecodeStream.hpp"
 #include "interpreter/interpreter.hpp"
@@ -1627,7 +1628,7 @@
   // Note: must be done *after* linking k into the hierarchy (was bug 12/9/97)
   // Also, first reinitialize vtable because it may have gotten out of synch
   // while the new class wasn't connected to the class hierarchy.
-  Universe::flush_dependents_on(k);
+  CodeCache::flush_dependents_on(k);
 }
 
 // ----------------------------------------------------------------------------
--- a/hotspot/src/share/vm/classfile/verifier.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/classfile/verifier.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -2477,8 +2477,7 @@
     // of the current class.
     VerificationType objectref_type = new_class_type;
     if (name_in_supers(ref_class_type.name(), current_class())) {
-      Klass* ref_klass = load_class(
-        ref_class_type.name(), CHECK_VERIFY(this));
+      Klass* ref_klass = load_class(ref_class_type.name(), CHECK);
       Method* m = InstanceKlass::cast(ref_klass)->uncached_lookup_method(
         vmSymbols::object_initializer_name(),
         cp->signature_ref_at(bcs->get_index_u2()),
--- a/hotspot/src/share/vm/code/codeCache.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, 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
@@ -1005,6 +1005,117 @@
   }
 }
 
+// Flushes compiled methods dependent on dependee.
+void CodeCache::flush_dependents_on(instanceKlassHandle dependee) {
+  assert_lock_strong(Compile_lock);
+
+  if (number_of_nmethods_with_dependencies() == 0) return;
+
+  // CodeCache can only be updated by a thread_in_VM and they will all be
+  // stopped during the safepoint so CodeCache will be safe to update without
+  // holding the CodeCache_lock.
+
+  KlassDepChange changes(dependee);
+
+  // Compute the dependent nmethods
+  if (mark_for_deoptimization(changes) > 0) {
+    // At least one nmethod has been marked for deoptimization
+    VM_Deoptimize op;
+    VMThread::execute(&op);
+  }
+}
+
+// Flushes compiled methods dependent on a particular CallSite
+// instance when its target is different than the given MethodHandle.
+void CodeCache::flush_dependents_on(Handle call_site, Handle method_handle) {
+  assert_lock_strong(Compile_lock);
+
+  if (number_of_nmethods_with_dependencies() == 0) return;
+
+  // CodeCache can only be updated by a thread_in_VM and they will all be
+  // stopped during the safepoint so CodeCache will be safe to update without
+  // holding the CodeCache_lock.
+
+  CallSiteDepChange changes(call_site(), method_handle());
+
+  // Compute the dependent nmethods that have a reference to a
+  // CallSite object.  We use InstanceKlass::mark_dependent_nmethod
+  // directly instead of CodeCache::mark_for_deoptimization because we
+  // want dependents on the call site class only not all classes in
+  // the ContextStream.
+  int marked = 0;
+  {
+    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    InstanceKlass* call_site_klass = InstanceKlass::cast(call_site->klass());
+    marked = call_site_klass->mark_dependent_nmethods(changes);
+  }
+  if (marked > 0) {
+    // At least one nmethod has been marked for deoptimization
+    VM_Deoptimize op;
+    VMThread::execute(&op);
+  }
+}
+
+#ifdef HOTSWAP
+// Flushes compiled methods dependent on dependee in the evolutionary sense
+void CodeCache::flush_evol_dependents_on(instanceKlassHandle ev_k_h) {
+  // --- Compile_lock is not held. However we are at a safepoint.
+  assert_locked_or_safepoint(Compile_lock);
+  if (number_of_nmethods_with_dependencies() == 0) return;
+
+  // CodeCache can only be updated by a thread_in_VM and they will all be
+  // stopped during the safepoint so CodeCache will be safe to update without
+  // holding the CodeCache_lock.
+
+  // Compute the dependent nmethods
+  if (mark_for_evol_deoptimization(ev_k_h) > 0) {
+    // At least one nmethod has been marked for deoptimization
+
+    // All this already happens inside a VM_Operation, so we'll do all the work here.
+    // Stuff copied from VM_Deoptimize and modified slightly.
+
+    // We do not want any GCs to happen while we are in the middle of this VM operation
+    ResourceMark rm;
+    DeoptimizationMarker dm;
+
+    // Deoptimize all activations depending on marked nmethods
+    Deoptimization::deoptimize_dependents();
+
+    // Make the dependent methods not entrant (in VM_Deoptimize they are made zombies)
+    make_marked_nmethods_not_entrant();
+  }
+}
+#endif // HOTSWAP
+
+
+// Flushes compiled methods dependent on dependee
+void CodeCache::flush_dependents_on_method(methodHandle m_h) {
+  // --- Compile_lock is not held. However we are at a safepoint.
+  assert_locked_or_safepoint(Compile_lock);
+
+  // CodeCache can only be updated by a thread_in_VM and they will all be
+  // stopped dring the safepoint so CodeCache will be safe to update without
+  // holding the CodeCache_lock.
+
+  // Compute the dependent nmethods
+  if (mark_for_deoptimization(m_h()) > 0) {
+    // At least one nmethod has been marked for deoptimization
+
+    // All this already happens inside a VM_Operation, so we'll do all the work here.
+    // Stuff copied from VM_Deoptimize and modified slightly.
+
+    // We do not want any GCs to happen while we are in the middle of this VM operation
+    ResourceMark rm;
+    DeoptimizationMarker dm;
+
+    // Deoptimize all activations depending on marked nmethods
+    Deoptimization::deoptimize_dependents();
+
+    // Make the dependent methods not entrant (in VM_Deoptimize they are made zombies)
+    make_marked_nmethods_not_entrant();
+  }
+}
+
 void CodeCache::verify() {
   assert_locked_or_safepoint(CodeCache_lock);
   FOR_ALL_HEAPS(heap) {
--- a/hotspot/src/share/vm/code/codeCache.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/code/codeCache.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -209,16 +209,28 @@
   static void verify_icholder_relocations();
 
   // Deoptimization
+ private:
   static int  mark_for_deoptimization(DepChange& changes);
 #ifdef HOTSWAP
   static int  mark_for_evol_deoptimization(instanceKlassHandle dependee);
 #endif // HOTSWAP
 
+ public:
   static void mark_all_nmethods_for_deoptimization();
   static int  mark_for_deoptimization(Method* dependee);
   static void make_marked_nmethods_zombies();
   static void make_marked_nmethods_not_entrant();
 
+  // Flushing and deoptimization
+  static void flush_dependents_on(instanceKlassHandle dependee);
+  static void flush_dependents_on(Handle call_site, Handle method_handle);
+#ifdef HOTSWAP
+  // Flushing and deoptimization in case of evolution
+  static void flush_evol_dependents_on(instanceKlassHandle dependee);
+#endif // HOTSWAP
+  // Support for fullspeed debugging
+  static void flush_dependents_on_method(methodHandle dependee);
+
   // tells how many nmethods have dependencies
   static int number_of_nmethods_with_dependencies();
 
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -2560,12 +2560,12 @@
      x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,   \
      x }
 
-// Initialize with default setting of CMSParPromoteBlocksToClaim, _not_
-// OldPLABSize, whose static default is different; if overridden at the
+// Initialize with default setting for CMS, _not_
+// generic OldPLABSize, whose static default is different; if overridden at the
 // command-line, this will get reinitialized via a call to
 // modify_initialization() below.
 AdaptiveWeightedAverage CFLS_LAB::_blocks_to_claim[]    =
-  VECTOR_257(AdaptiveWeightedAverage(OldPLABWeight, (float)CMSParPromoteBlocksToClaim));
+  VECTOR_257(AdaptiveWeightedAverage(OldPLABWeight, (float)CFLS_LAB::_default_dynamic_old_plab_size));
 size_t CFLS_LAB::_global_num_blocks[]  = VECTOR_257(0);
 uint   CFLS_LAB::_global_num_workers[] = VECTOR_257(0);
 
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -690,6 +690,9 @@
   void get_from_global_pool(size_t word_sz, AdaptiveFreeList<FreeChunk>* fl);
 
 public:
+  static const int _default_dynamic_old_plab_size = 16;
+  static const int _default_static_old_plab_size  = 50;
+
   CFLS_LAB(CompactibleFreeListSpace* cfls);
 
   // Allocate and return a block of the given size, or else return NULL.
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1611,14 +1611,15 @@
 
   // If the collection is being acquired from the background
   // collector, there may be references on the discovered
-  // references lists that have NULL referents (being those
-  // that were concurrently cleared by a mutator) or
-  // that are no longer active (having been enqueued concurrently
-  // by the mutator).
-  // Scrub the list of those references because Mark-Sweep-Compact
-  // code assumes referents are not NULL and that all discovered
-  // Reference objects are active.
-  ref_processor()->clean_up_discovered_references();
+  // references lists.  Abandon those references, since some
+  // of them may have become unreachable after concurrent
+  // discovery; the STW compacting collector will redo discovery
+  // more precisely, without being subject to floating garbage.
+  // Leaving otherwise unreachable references in the discovered
+  // lists would require special handling.
+  ref_processor()->disable_discovery();
+  ref_processor()->abandon_partial_discovery();
+  ref_processor()->verify_no_references_recorded();
 
   if (first_state > Idling) {
     save_heap_summary();
@@ -1684,7 +1685,7 @@
   ReferenceProcessorMTDiscoveryMutator rp_mut_discovery(ref_processor(), false);
 
   ref_processor()->set_enqueuing_is_done(false);
-  ref_processor()->enable_discovery(false /*verify_disabled*/, false /*check_no_refs*/);
+  ref_processor()->enable_discovery();
   ref_processor()->setup_policy(clear_all_soft_refs);
   // If an asynchronous collection finishes, the _modUnionTable is
   // all clear.  If we are assuming the collection from an asynchronous
@@ -3001,7 +3002,7 @@
                     Mutex::_no_safepoint_check_flag);
     checkpointRootsInitialWork();
     // enable ("weak") refs discovery
-    rp->enable_discovery(true /*verify_disabled*/, true /*check_no_refs*/);
+    rp->enable_discovery();
     _collectorState = Marking;
   }
   SpecializationStats::print();
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -971,7 +971,7 @@
   // Start Concurrent Marking weak-reference discovery.
   ReferenceProcessor* rp = g1h->ref_processor_cm();
   // enable ("weak") refs discovery
-  rp->enable_discovery(true /*verify_disabled*/, true /*verify_no_refs*/);
+  rp->enable_discovery();
   rp->setup_policy(false); // snapshot the soft ref policy to be used in this cycle
 
   SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set();
--- a/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -254,25 +254,23 @@
 HeapRegion* SurvivorGCAllocRegion::allocate_new_region(size_t word_size,
                                                        bool force) {
   assert(!force, "not supported for GC alloc regions");
-  return _g1h->new_gc_alloc_region(word_size, count(), GCAllocForSurvived);
+  return _g1h->new_gc_alloc_region(word_size, count(), InCSetState::Young);
 }
 
 void SurvivorGCAllocRegion::retire_region(HeapRegion* alloc_region,
                                           size_t allocated_bytes) {
-  _g1h->retire_gc_alloc_region(alloc_region, allocated_bytes,
-                               GCAllocForSurvived);
+  _g1h->retire_gc_alloc_region(alloc_region, allocated_bytes, InCSetState::Young);
 }
 
 HeapRegion* OldGCAllocRegion::allocate_new_region(size_t word_size,
                                                   bool force) {
   assert(!force, "not supported for GC alloc regions");
-  return _g1h->new_gc_alloc_region(word_size, count(), GCAllocForTenured);
+  return _g1h->new_gc_alloc_region(word_size, count(), InCSetState::Old);
 }
 
 void OldGCAllocRegion::retire_region(HeapRegion* alloc_region,
                                      size_t allocated_bytes) {
-  _g1h->retire_gc_alloc_region(alloc_region, allocated_bytes,
-                               GCAllocForTenured);
+  _g1h->retire_gc_alloc_region(alloc_region, allocated_bytes, InCSetState::Old);
 }
 
 HeapRegion* OldGCAllocRegion::release() {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -99,8 +99,8 @@
   }
 
   if (ResizePLAB) {
-    _g1h->_survivor_plab_stats.adjust_desired_plab_sz(no_of_gc_workers);
-    _g1h->_old_plab_stats.adjust_desired_plab_sz(no_of_gc_workers);
+    _g1h->alloc_buffer_stats(InCSetState::Young)->adjust_desired_plab_sz(no_of_gc_workers);
+    _g1h->alloc_buffer_stats(InCSetState::Old)->adjust_desired_plab_sz(no_of_gc_workers);
   }
 }
 
@@ -113,15 +113,16 @@
 G1ParGCAllocBuffer::G1ParGCAllocBuffer(size_t gclab_word_size) :
   ParGCAllocBuffer(gclab_word_size), _retired(true) { }
 
-HeapWord* G1ParGCAllocator::allocate_slow(GCAllocPurpose purpose, size_t word_sz, AllocationContext_t context) {
-  HeapWord* obj = NULL;
-  size_t gclab_word_size = _g1h->desired_plab_sz(purpose);
+HeapWord* G1ParGCAllocator::allocate_direct_or_new_plab(InCSetState dest,
+                                                        size_t word_sz,
+                                                        AllocationContext_t context) {
+  size_t gclab_word_size = _g1h->desired_plab_sz(dest);
   if (word_sz * 100 < gclab_word_size * ParallelGCBufferWastePct) {
-    G1ParGCAllocBuffer* alloc_buf = alloc_buffer(purpose, context);
+    G1ParGCAllocBuffer* alloc_buf = alloc_buffer(dest, context);
     add_to_alloc_buffer_waste(alloc_buf->words_remaining());
     alloc_buf->retire(false /* end_of_gc */, false /* retain */);
 
-    HeapWord* buf = _g1h->par_allocate_during_gc(purpose, gclab_word_size, context);
+    HeapWord* buf = _g1h->par_allocate_during_gc(dest, gclab_word_size, context);
     if (buf == NULL) {
       return NULL; // Let caller handle allocation failure.
     }
@@ -129,30 +130,33 @@
     alloc_buf->set_word_size(gclab_word_size);
     alloc_buf->set_buf(buf);
 
-    obj = alloc_buf->allocate(word_sz);
+    HeapWord* const obj = alloc_buf->allocate(word_sz);
     assert(obj != NULL, "buffer was definitely big enough...");
+    return obj;
   } else {
-    obj = _g1h->par_allocate_during_gc(purpose, word_sz, context);
+    return _g1h->par_allocate_during_gc(dest, word_sz, context);
   }
-  return obj;
 }
 
 G1DefaultParGCAllocator::G1DefaultParGCAllocator(G1CollectedHeap* g1h) :
-            G1ParGCAllocator(g1h),
-            _surviving_alloc_buffer(g1h->desired_plab_sz(GCAllocForSurvived)),
-            _tenured_alloc_buffer(g1h->desired_plab_sz(GCAllocForTenured)) {
-
-  _alloc_buffers[GCAllocForSurvived] = &_surviving_alloc_buffer;
-  _alloc_buffers[GCAllocForTenured]  = &_tenured_alloc_buffer;
-
+  G1ParGCAllocator(g1h),
+  _surviving_alloc_buffer(g1h->desired_plab_sz(InCSetState::Young)),
+  _tenured_alloc_buffer(g1h->desired_plab_sz(InCSetState::Old)) {
+  for (uint state = 0; state < InCSetState::Num; state++) {
+    _alloc_buffers[state] = NULL;
+  }
+  _alloc_buffers[InCSetState::Young] = &_surviving_alloc_buffer;
+  _alloc_buffers[InCSetState::Old]  = &_tenured_alloc_buffer;
 }
 
 void G1DefaultParGCAllocator::retire_alloc_buffers() {
-  for (int ap = 0; ap < GCAllocPurposeCount; ++ap) {
-    size_t waste = _alloc_buffers[ap]->words_remaining();
-    add_to_alloc_buffer_waste(waste);
-    _alloc_buffers[ap]->flush_stats_and_retire(_g1h->stats_for_purpose((GCAllocPurpose)ap),
-                                               true /* end_of_gc */,
-                                               false /* retain */);
+  for (uint state = 0; state < InCSetState::Num; state++) {
+    G1ParGCAllocBuffer* const buf = _alloc_buffers[state];
+    if (buf != NULL) {
+      add_to_alloc_buffer_waste(buf->words_remaining());
+      buf->flush_stats_and_retire(_g1h->alloc_buffer_stats(state),
+                                  true /* end_of_gc */,
+                                  false /* retain */);
+    }
   }
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -27,14 +27,9 @@
 
 #include "gc_implementation/g1/g1AllocationContext.hpp"
 #include "gc_implementation/g1/g1AllocRegion.hpp"
+#include "gc_implementation/g1/g1InCSetState.hpp"
 #include "gc_implementation/shared/parGCAllocBuffer.hpp"
 
-enum GCAllocPurpose {
-  GCAllocForTenured,
-  GCAllocForSurvived,
-  GCAllocPurposeCount
-};
-
 // Base class for G1 allocators.
 class G1Allocator : public CHeapObj<mtGC> {
   friend class VMStructs;
@@ -178,20 +173,40 @@
 protected:
   G1CollectedHeap* _g1h;
 
+  // The survivor alignment in effect in bytes.
+  // == 0 : don't align survivors
+  // != 0 : align survivors to that alignment
+  // These values were chosen to favor the non-alignment case since some
+  // architectures have a special compare against zero instructions.
+  const uint _survivor_alignment_bytes;
+
   size_t _alloc_buffer_waste;
   size_t _undo_waste;
 
   void add_to_alloc_buffer_waste(size_t waste) { _alloc_buffer_waste += waste; }
   void add_to_undo_waste(size_t waste)         { _undo_waste += waste; }
 
-  HeapWord* allocate_slow(GCAllocPurpose purpose, size_t word_sz, AllocationContext_t context);
+  virtual void retire_alloc_buffers() = 0;
+  virtual G1ParGCAllocBuffer* alloc_buffer(InCSetState dest, AllocationContext_t context) = 0;
 
-  virtual void retire_alloc_buffers() = 0;
-  virtual G1ParGCAllocBuffer* alloc_buffer(GCAllocPurpose purpose, AllocationContext_t context) = 0;
+  // Calculate the survivor space object alignment in bytes. Returns that or 0 if
+  // there are no restrictions on survivor alignment.
+  static uint calc_survivor_alignment_bytes() {
+    assert(SurvivorAlignmentInBytes >= ObjectAlignmentInBytes, "sanity");
+    if (SurvivorAlignmentInBytes == ObjectAlignmentInBytes) {
+      // No need to align objects in the survivors differently, return 0
+      // which means "survivor alignment is not used".
+      return 0;
+    } else {
+      assert(SurvivorAlignmentInBytes > 0, "sanity");
+      return SurvivorAlignmentInBytes;
+    }
+  }
 
 public:
   G1ParGCAllocator(G1CollectedHeap* g1h) :
-    _g1h(g1h), _alloc_buffer_waste(0), _undo_waste(0) {
+    _g1h(g1h), _survivor_alignment_bytes(calc_survivor_alignment_bytes()),
+    _alloc_buffer_waste(0), _undo_waste(0) {
   }
 
   static G1ParGCAllocator* create_allocator(G1CollectedHeap* g1h);
@@ -199,24 +214,40 @@
   size_t alloc_buffer_waste() { return _alloc_buffer_waste; }
   size_t undo_waste() {return _undo_waste; }
 
-  HeapWord* allocate(GCAllocPurpose purpose, size_t word_sz, AllocationContext_t context) {
-    HeapWord* obj = NULL;
-    if (purpose == GCAllocForSurvived) {
-      obj = alloc_buffer(purpose, context)->allocate_aligned(word_sz, SurvivorAlignmentInBytes);
+  // Allocate word_sz words in dest, either directly into the regions or by
+  // allocating a new PLAB. Returns the address of the allocated memory, NULL if
+  // not successful.
+  HeapWord* allocate_direct_or_new_plab(InCSetState dest,
+                                        size_t word_sz,
+                                        AllocationContext_t context);
+
+  // Allocate word_sz words in the PLAB of dest.  Returns the address of the
+  // allocated memory, NULL if not successful.
+  HeapWord* plab_allocate(InCSetState dest,
+                          size_t word_sz,
+                          AllocationContext_t context) {
+    G1ParGCAllocBuffer* buffer = alloc_buffer(dest, context);
+    if (_survivor_alignment_bytes == 0) {
+      return buffer->allocate(word_sz);
     } else {
-      obj = alloc_buffer(purpose, context)->allocate(word_sz);
+      return buffer->allocate_aligned(word_sz, _survivor_alignment_bytes);
     }
+  }
+
+  HeapWord* allocate(InCSetState dest, size_t word_sz,
+                     AllocationContext_t context) {
+    HeapWord* const obj = plab_allocate(dest, word_sz, context);
     if (obj != NULL) {
       return obj;
     }
-    return allocate_slow(purpose, word_sz, context);
+    return allocate_direct_or_new_plab(dest, word_sz, context);
   }
 
-  void undo_allocation(GCAllocPurpose purpose, HeapWord* obj, size_t word_sz, AllocationContext_t context) {
-    if (alloc_buffer(purpose, context)->contains(obj)) {
-      assert(alloc_buffer(purpose, context)->contains(obj + word_sz - 1),
+  void undo_allocation(InCSetState dest, HeapWord* obj, size_t word_sz, AllocationContext_t context) {
+    if (alloc_buffer(dest, context)->contains(obj)) {
+      assert(alloc_buffer(dest, context)->contains(obj + word_sz - 1),
              "should contain whole object");
-      alloc_buffer(purpose, context)->undo_allocation(obj, word_sz);
+      alloc_buffer(dest, context)->undo_allocation(obj, word_sz);
     } else {
       CollectedHeap::fill_with_object(obj, word_sz);
       add_to_undo_waste(word_sz);
@@ -227,13 +258,17 @@
 class G1DefaultParGCAllocator : public G1ParGCAllocator {
   G1ParGCAllocBuffer  _surviving_alloc_buffer;
   G1ParGCAllocBuffer  _tenured_alloc_buffer;
-  G1ParGCAllocBuffer* _alloc_buffers[GCAllocPurposeCount];
+  G1ParGCAllocBuffer* _alloc_buffers[InCSetState::Num];
 
 public:
   G1DefaultParGCAllocator(G1CollectedHeap* g1h);
 
-  virtual G1ParGCAllocBuffer* alloc_buffer(GCAllocPurpose purpose, AllocationContext_t context) {
-    return _alloc_buffers[purpose];
+  virtual G1ParGCAllocBuffer* alloc_buffer(InCSetState dest, AllocationContext_t context) {
+    assert(dest.is_valid(),
+           err_msg("Allocation buffer index out-of-bounds: " CSETSTATE_FORMAT, dest.value()));
+    assert(_alloc_buffers[dest.value()] != NULL,
+           err_msg("Allocation buffer is NULL: " CSETSTATE_FORMAT, dest.value()));
+    return _alloc_buffers[dest.value()];
   }
 
   virtual void retire_alloc_buffers() ;
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1301,7 +1301,7 @@
       // Temporarily clear the STW ref processor's _is_alive_non_header field.
       ReferenceProcessorIsAliveMutator stw_rp_is_alive_null(ref_processor_stw(), NULL);
 
-      ref_processor_stw()->enable_discovery(true /*verify_disabled*/, true /*verify_no_refs*/);
+      ref_processor_stw()->enable_discovery();
       ref_processor_stw()->setup_policy(do_clear_all_soft_refs);
 
       // Do collection work
@@ -1886,13 +1886,12 @@
 
   initialize_reserved_region((HeapWord*)heap_rs.base(), (HeapWord*)(heap_rs.base() + heap_rs.size()));
 
-  // Create the gen rem set (and barrier set) for the entire reserved region.
-  _rem_set = collector_policy()->create_rem_set(reserved_region());
-  set_barrier_set(rem_set()->bs());
-  if (!barrier_set()->is_a(BarrierSet::G1SATBCTLogging)) {
-    vm_exit_during_initialization("G1 requires a G1SATBLoggingCardTableModRefBS");
-    return JNI_ENOMEM;
-  }
+  // Create the barrier set for the entire reserved region.
+  G1SATBCardTableLoggingModRefBS* bs
+    = new G1SATBCardTableLoggingModRefBS(reserved_region());
+  bs->initialize();
+  assert(bs->is_a(BarrierSet::G1SATBCTLogging), "sanity");
+  set_barrier_set(bs);
 
   // Also create a G1 rem set.
   _g1_rem_set = new G1RemSet(this, g1_barrier_set());
@@ -2069,7 +2068,7 @@
 }
 
 void G1CollectedHeap::clear_humongous_is_live_table() {
-  guarantee(G1ReclaimDeadHumongousObjectsAtYoungGC, "Should only be called if true");
+  guarantee(G1EagerReclaimHumongousObjects, "Should only be called if true");
   _humongous_is_live.clear();
 }
 
@@ -3153,8 +3152,6 @@
         failures = true;
       }
     }
-    if (!silent) gclog_or_tty->print("RemSet ");
-    rem_set()->verify();
 
     if (G1StringDedup::is_enabled()) {
       if (!silent) gclog_or_tty->print("StrDedup ");
@@ -3488,8 +3485,24 @@
  private:
   size_t _total_humongous;
   size_t _candidate_humongous;
+
+  DirtyCardQueue _dcq;
+
+  bool humongous_region_is_candidate(uint index) {
+    HeapRegion* region = G1CollectedHeap::heap()->region_at(index);
+    assert(region->is_starts_humongous(), "Must start a humongous object");
+    HeapRegionRemSet* const rset = region->rem_set();
+    bool const allow_stale_refs = G1EagerReclaimHumongousObjectsWithStaleRefs;
+    return !oop(region->bottom())->is_objArray() &&
+           ((allow_stale_refs && rset->occupancy_less_or_equal_than(G1RSetSparseRegionEntries)) ||
+            (!allow_stale_refs && rset->is_empty()));
+  }
+
  public:
-  RegisterHumongousWithInCSetFastTestClosure() : _total_humongous(0), _candidate_humongous(0) {
+  RegisterHumongousWithInCSetFastTestClosure()
+  : _total_humongous(0),
+    _candidate_humongous(0),
+    _dcq(&JavaThread::dirty_card_queue_set()) {
   }
 
   virtual bool doHeapRegion(HeapRegion* r) {
@@ -3499,11 +3512,29 @@
     G1CollectedHeap* g1h = G1CollectedHeap::heap();
 
     uint region_idx = r->hrm_index();
-    bool is_candidate = !g1h->humongous_region_is_always_live(region_idx);
-    // Is_candidate already filters out humongous regions with some remembered set.
-    // This will not lead to humongous object that we mistakenly keep alive because
-    // during young collection the remembered sets will only be added to.
+    bool is_candidate = humongous_region_is_candidate(region_idx);
+    // Is_candidate already filters out humongous object with large remembered sets.
+    // If we have a humongous object with a few remembered sets, we simply flush these
+    // remembered set entries into the DCQS. That will result in automatic
+    // re-evaluation of their remembered set entries during the following evacuation
+    // phase.
     if (is_candidate) {
+      if (!r->rem_set()->is_empty()) {
+        guarantee(r->rem_set()->occupancy_less_or_equal_than(G1RSetSparseRegionEntries),
+                  "Found a not-small remembered set here. This is inconsistent with previous assumptions.");
+        G1SATBCardTableLoggingModRefBS* bs = g1h->g1_barrier_set();
+        HeapRegionRemSetIterator hrrs(r->rem_set());
+        size_t card_index;
+        while (hrrs.has_next(card_index)) {
+          jbyte* card_ptr = (jbyte*)bs->byte_for_index(card_index);
+          if (*card_ptr != CardTableModRefBS::dirty_card_val()) {
+            *card_ptr = CardTableModRefBS::dirty_card_val();
+            _dcq.enqueue(card_ptr);
+          }
+        }
+        r->rem_set()->clear_locked();
+      }
+      assert(r->rem_set()->is_empty(), "At this point any humongous candidate remembered set must be empty.");
       g1h->register_humongous_region_with_in_cset_fast_test(region_idx);
       _candidate_humongous++;
     }
@@ -3514,23 +3545,32 @@
 
   size_t total_humongous() const { return _total_humongous; }
   size_t candidate_humongous() const { return _candidate_humongous; }
+
+  void flush_rem_set_entries() { _dcq.flush(); }
 };
 
 void G1CollectedHeap::register_humongous_regions_with_in_cset_fast_test() {
-  if (!G1ReclaimDeadHumongousObjectsAtYoungGC) {
-    g1_policy()->phase_times()->record_fast_reclaim_humongous_stats(0, 0);
+  if (!G1EagerReclaimHumongousObjects) {
+    g1_policy()->phase_times()->record_fast_reclaim_humongous_stats(0.0, 0, 0);
     return;
   }
+  double time = os::elapsed_counter();
 
   RegisterHumongousWithInCSetFastTestClosure cl;
   heap_region_iterate(&cl);
-  g1_policy()->phase_times()->record_fast_reclaim_humongous_stats(cl.total_humongous(),
+
+  time = ((double)(os::elapsed_counter() - time) / os::elapsed_frequency()) * 1000.0;
+  g1_policy()->phase_times()->record_fast_reclaim_humongous_stats(time,
+                                                                  cl.total_humongous(),
                                                                   cl.candidate_humongous());
   _has_humongous_reclaim_candidates = cl.candidate_humongous() > 0;
 
-  if (_has_humongous_reclaim_candidates || G1TraceReclaimDeadHumongousObjectsAtYoungGC) {
+  if (_has_humongous_reclaim_candidates || G1TraceEagerReclaimHumongousObjects) {
     clear_humongous_is_live_table();
   }
+
+  // Finally flush all remembered set entries to re-check into the global DCQS.
+  cl.flush_rem_set_entries();
 }
 
 void
@@ -3750,8 +3790,7 @@
       // reference processing currently works in G1.
 
       // Enable discovery in the STW reference processor
-      ref_processor_stw()->enable_discovery(true /*verify_disabled*/,
-                                            true /*verify_no_refs*/);
+      ref_processor_stw()->enable_discovery();
 
       {
         // We want to temporarily turn off discovery by the
@@ -3819,6 +3858,8 @@
 
         register_humongous_regions_with_in_cset_fast_test();
 
+        assert(check_cset_fast_test(), "Inconsistency in the InCSetState table.");
+
         _cm->note_start_of_gc();
         // We should not verify the per-thread SATB buffers given that
         // we have not filtered them yet (we'll do so during the
@@ -4048,29 +4089,6 @@
   return true;
 }
 
-size_t G1CollectedHeap::desired_plab_sz(GCAllocPurpose purpose)
-{
-  size_t gclab_word_size;
-  switch (purpose) {
-    case GCAllocForSurvived:
-      gclab_word_size = _survivor_plab_stats.desired_plab_sz();
-      break;
-    case GCAllocForTenured:
-      gclab_word_size = _old_plab_stats.desired_plab_sz();
-      break;
-    default:
-      assert(false, "unknown GCAllocPurpose");
-      gclab_word_size = _old_plab_stats.desired_plab_sz();
-      break;
-  }
-
-  // Prevent humongous PLAB sizes for two reasons:
-  // * PLABs are allocated using a similar paths as oops, but should
-  //   never be in a humongous region
-  // * Allowing humongous PLABs needlessly churns the region free lists
-  return MIN2(_humongous_object_threshold_in_words, gclab_word_size);
-}
-
 void G1CollectedHeap::init_for_evac_failure(OopsInHeapRegionClosure* cl) {
   _drain_in_progress = false;
   set_evac_failure_closure(cl);
@@ -4196,35 +4214,6 @@
   }
 }
 
-HeapWord* G1CollectedHeap::par_allocate_during_gc(GCAllocPurpose purpose,
-                                                  size_t word_size,
-                                                  AllocationContext_t context) {
-  if (purpose == GCAllocForSurvived) {
-    HeapWord* result = survivor_attempt_allocation(word_size, context);
-    if (result != NULL) {
-      return result;
-    } else {
-      // Let's try to allocate in the old gen in case we can fit the
-      // object there.
-      return old_attempt_allocation(word_size, context);
-    }
-  } else {
-    assert(purpose ==  GCAllocForTenured, "sanity");
-    HeapWord* result = old_attempt_allocation(word_size, context);
-    if (result != NULL) {
-      return result;
-    } else {
-      // Let's try to allocate in the survivors in case we can fit the
-      // object there.
-      return survivor_attempt_allocation(word_size, context);
-    }
-  }
-
-  ShouldNotReachHere();
-  // Trying to keep some compilers happy.
-  return NULL;
-}
-
 void G1ParCopyHelper::mark_object(oop obj) {
   assert(!_g1->heap_region_containing(obj)->in_collection_set(), "should not mark objects in the CSet");
 
@@ -4267,15 +4256,14 @@
 
   assert(_worker_id == _par_scan_state->queue_num(), "sanity");
 
-  G1CollectedHeap::in_cset_state_t state = _g1->in_cset_state(obj);
-
-  if (state == G1CollectedHeap::InCSet) {
+  const InCSetState state = _g1->in_cset_state(obj);
+  if (state.is_in_cset()) {
     oop forwardee;
     markOop m = obj->mark();
     if (m->is_marked()) {
       forwardee = (oop) m->decode_pointer();
     } else {
-      forwardee = _par_scan_state->copy_to_survivor_space(obj, m);
+      forwardee = _par_scan_state->copy_to_survivor_space(state, obj, m);
     }
     assert(forwardee != NULL, "forwardee should not be NULL");
     oopDesc::encode_store_heap_oop(p, forwardee);
@@ -4289,7 +4277,7 @@
       do_klass_barrier(p, forwardee);
     }
   } else {
-    if (state == G1CollectedHeap::IsHumongous) {
+    if (state.is_humongous()) {
       _g1->set_humongous_is_live(obj);
     }
     // The object is not in collection set. If we're a root scanning
@@ -4609,7 +4597,7 @@
 G1CollectedHeap::
 g1_process_roots(OopClosure* scan_non_heap_roots,
                  OopClosure* scan_non_heap_weak_roots,
-                 OopsInHeapRegionClosure* scan_rs,
+                 G1ParPushHeapRSClosure* scan_rs,
                  CLDClosure* scan_strong_clds,
                  CLDClosure* scan_weak_clds,
                  CodeBlobClosure* scan_strong_code,
@@ -5145,17 +5133,17 @@
     oop obj = *p;
     assert(obj != NULL, "the caller should have filtered out NULL values");
 
-    G1CollectedHeap::in_cset_state_t cset_state = _g1->in_cset_state(obj);
-    if (cset_state == G1CollectedHeap::InNeither) {
+    const InCSetState cset_state = _g1->in_cset_state(obj);
+    if (!cset_state.is_in_cset_or_humongous()) {
       return;
     }
-    if (cset_state == G1CollectedHeap::InCSet) {
+    if (cset_state.is_in_cset()) {
       assert( obj->is_forwarded(), "invariant" );
       *p = obj->forwardee();
     } else {
       assert(!obj->is_forwarded(), "invariant" );
-      assert(cset_state == G1CollectedHeap::IsHumongous,
-             err_msg("Only allowed InCSet state is IsHumongous, but is %d", cset_state));
+      assert(cset_state.is_humongous(),
+             err_msg("Only allowed InCSet state is IsHumongous, but is %d", cset_state.value()));
       _g1->set_humongous_is_live(obj);
     }
   }
@@ -5640,8 +5628,6 @@
 
   init_for_evac_failure(NULL);
 
-  rem_set()->prepare_for_younger_refs_iterate(true);
-
   assert(dirty_card_queue_set().completed_buffers_num() == 0, "Should be empty");
   double start_par_time_sec = os::elapsedTime();
   double end_par_time_sec;
@@ -5951,6 +5937,70 @@
   heap_region_iterate(&cl);
   guarantee(!cl.failures(), "bitmap verification");
 }
+
+class G1CheckCSetFastTableClosure : public HeapRegionClosure {
+ private:
+  bool _failures;
+ public:
+  G1CheckCSetFastTableClosure() : HeapRegionClosure(), _failures(false) { }
+
+  virtual bool doHeapRegion(HeapRegion* hr) {
+    uint i = hr->hrm_index();
+    InCSetState cset_state = (InCSetState) G1CollectedHeap::heap()->_in_cset_fast_test.get_by_index(i);
+    if (hr->is_humongous()) {
+      if (hr->in_collection_set()) {
+        gclog_or_tty->print_cr("\n## humongous region %u in CSet", i);
+        _failures = true;
+        return true;
+      }
+      if (cset_state.is_in_cset()) {
+        gclog_or_tty->print_cr("\n## inconsistent cset state %d for humongous region %u", cset_state.value(), i);
+        _failures = true;
+        return true;
+      }
+      if (hr->is_continues_humongous() && cset_state.is_humongous()) {
+        gclog_or_tty->print_cr("\n## inconsistent cset state %d for continues humongous region %u", cset_state.value(), i);
+        _failures = true;
+        return true;
+      }
+    } else {
+      if (cset_state.is_humongous()) {
+        gclog_or_tty->print_cr("\n## inconsistent cset state %d for non-humongous region %u", cset_state.value(), i);
+        _failures = true;
+        return true;
+      }
+      if (hr->in_collection_set() != cset_state.is_in_cset()) {
+        gclog_or_tty->print_cr("\n## in CSet %d / cset state %d inconsistency for region %u",
+                               hr->in_collection_set(), cset_state.value(), i);
+        _failures = true;
+        return true;
+      }
+      if (cset_state.is_in_cset()) {
+        if (hr->is_young() != (cset_state.is_young())) {
+          gclog_or_tty->print_cr("\n## is_young %d / cset state %d inconsistency for region %u",
+                                 hr->is_young(), cset_state.value(), i);
+          _failures = true;
+          return true;
+        }
+        if (hr->is_old() != (cset_state.is_old())) {
+          gclog_or_tty->print_cr("\n## is_old %d / cset state %d inconsistency for region %u",
+                                 hr->is_old(), cset_state.value(), i);
+          _failures = true;
+          return true;
+        }
+      }
+    }
+    return false;
+  }
+
+  bool failures() const { return _failures; }
+};
+
+bool G1CollectedHeap::check_cset_fast_test() {
+  G1CheckCSetFastTableClosure cl;
+  _hrm.iterate(&cl);
+  return !cl.failures();
+}
 #endif // PRODUCT
 
 void G1CollectedHeap::cleanUpCardTable() {
@@ -6133,22 +6183,20 @@
     // are completely up-to-date wrt to references to the humongous object.
     //
     // Other implementation considerations:
-    // - never consider object arrays: while they are a valid target, they have not
-    // been observed to be used as temporary objects.
-    // - they would also pose considerable effort for cleaning up the the remembered
-    // sets.
-    // While this cleanup is not strictly necessary to be done (or done instantly),
-    // given that their occurrence is very low, this saves us this additional
-    // complexity.
+    // - never consider object arrays at this time because they would pose
+    // considerable effort for cleaning up the the remembered sets. This is
+    // required because stale remembered sets might reference locations that
+    // are currently allocated into.
     uint region_idx = r->hrm_index();
     if (g1h->humongous_is_live(region_idx) ||
         g1h->humongous_region_is_always_live(region_idx)) {
 
-      if (G1TraceReclaimDeadHumongousObjectsAtYoungGC) {
-        gclog_or_tty->print_cr("Live humongous %d region %d size "SIZE_FORMAT" with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is marked %d live-other %d obj array %d",
-                               r->is_humongous(),
+      if (G1TraceEagerReclaimHumongousObjects) {
+        gclog_or_tty->print_cr("Live humongous region %u size "SIZE_FORMAT" start "PTR_FORMAT" length "UINT32_FORMAT" with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is marked %d live-other %d obj array %d",
                                region_idx,
                                obj->size()*HeapWordSize,
+                               r->bottom(),
+                               r->region_num(),
                                r->rem_set()->occupied(),
                                r->rem_set()->strong_code_roots_list_length(),
                                next_bitmap->isMarked(r->bottom()),
@@ -6164,12 +6212,11 @@
               err_msg("Eagerly reclaiming object arrays is not supported, but the object "PTR_FORMAT" is.",
                       r->bottom()));
 
-    if (G1TraceReclaimDeadHumongousObjectsAtYoungGC) {
-      gclog_or_tty->print_cr("Reclaim humongous region %d size "SIZE_FORMAT" start "PTR_FORMAT" region %d length "UINT32_FORMAT" with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is marked %d live-other %d obj array %d",
-                             r->is_humongous(),
+    if (G1TraceEagerReclaimHumongousObjects) {
+      gclog_or_tty->print_cr("Dead humongous region %u size "SIZE_FORMAT" start "PTR_FORMAT" length "UINT32_FORMAT" with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is marked %d live-other %d obj array %d",
+                             region_idx,
                              obj->size()*HeapWordSize,
                              r->bottom(),
-                             region_idx,
                              r->region_num(),
                              r->rem_set()->occupied(),
                              r->rem_set()->strong_code_roots_list_length(),
@@ -6206,8 +6253,8 @@
 void G1CollectedHeap::eagerly_reclaim_humongous_regions() {
   assert_at_safepoint(true);
 
-  if (!G1ReclaimDeadHumongousObjectsAtYoungGC ||
-      (!_has_humongous_reclaim_candidates && !G1TraceReclaimDeadHumongousObjectsAtYoungGC)) {
+  if (!G1EagerReclaimHumongousObjects ||
+      (!_has_humongous_reclaim_candidates && !G1TraceEagerReclaimHumongousObjects)) {
     g1_policy()->phase_times()->record_fast_reclaim_humongous_time_ms(0.0, 0);
     return;
   }
@@ -6519,20 +6566,20 @@
 
 HeapRegion* G1CollectedHeap::new_gc_alloc_region(size_t word_size,
                                                  uint count,
-                                                 GCAllocPurpose ap) {
+                                                 InCSetState dest) {
   assert(FreeList_lock->owned_by_self(), "pre-condition");
 
-  if (count < g1_policy()->max_regions(ap)) {
-    bool survivor = (ap == GCAllocForSurvived);
+  if (count < g1_policy()->max_regions(dest)) {
+    const bool is_survivor = (dest.is_young());
     HeapRegion* new_alloc_region = new_region(word_size,
-                                              !survivor,
+                                              !is_survivor,
                                               true /* do_expand */);
     if (new_alloc_region != NULL) {
       // We really only need to do this for old regions given that we
       // should never scan survivors. But it doesn't hurt to do it
       // for survivors too.
       new_alloc_region->record_timestamp();
-      if (survivor) {
+      if (is_survivor) {
         new_alloc_region->set_survivor();
         _hr_printer.alloc(new_alloc_region, G1HRPrinter::Survivor);
         check_bitmaps("Survivor Region Allocation", new_alloc_region);
@@ -6544,8 +6591,6 @@
       bool during_im = g1_policy()->during_initial_mark_pause();
       new_alloc_region->note_start_of_copying(during_im);
       return new_alloc_region;
-    } else {
-      g1_policy()->note_alloc_region_limit_reached(ap);
     }
   }
   return NULL;
@@ -6553,11 +6598,11 @@
 
 void G1CollectedHeap::retire_gc_alloc_region(HeapRegion* alloc_region,
                                              size_t allocated_bytes,
-                                             GCAllocPurpose ap) {
+                                             InCSetState dest) {
   bool during_im = g1_policy()->during_initial_mark_pause();
   alloc_region->note_end_of_copying(during_im);
   g1_policy()->record_bytes_copied_during_gc(allocated_bytes);
-  if (ap == GCAllocForSurvived) {
+  if (dest.is_young()) {
     young_list()->add_survivor_region(alloc_region);
   } else {
     _old_set.add(alloc_region);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -32,6 +32,7 @@
 #include "gc_implementation/g1/g1AllocRegion.hpp"
 #include "gc_implementation/g1/g1BiasedArray.hpp"
 #include "gc_implementation/g1/g1HRPrinter.hpp"
+#include "gc_implementation/g1/g1InCSetState.hpp"
 #include "gc_implementation/g1/g1MonitoringSupport.hpp"
 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
 #include "gc_implementation/g1/g1YCTypes.hpp"
@@ -185,34 +186,19 @@
   friend class SurvivorGCAllocRegion;
   friend class OldGCAllocRegion;
   friend class G1Allocator;
-  friend class G1DefaultAllocator;
-  friend class G1ResManAllocator;
 
   // Closures used in implementation.
-  template <G1Barrier barrier, G1Mark do_mark_object>
-  friend class G1ParCopyClosure;
-  friend class G1IsAliveClosure;
-  friend class G1EvacuateFollowersClosure;
   friend class G1ParScanThreadState;
-  friend class G1ParScanClosureSuper;
-  friend class G1ParEvacuateFollowersClosure;
   friend class G1ParTask;
   friend class G1ParGCAllocator;
-  friend class G1DefaultParGCAllocator;
-  friend class G1FreeGarbageRegionClosure;
-  friend class RefineCardTableEntryClosure;
   friend class G1PrepareCompactClosure;
-  friend class RegionSorter;
-  friend class RegionResetter;
-  friend class CountRCClosure;
-  friend class EvacPopObjClosure;
-  friend class G1ParCleanupCTTask;
 
-  friend class G1FreeHumongousRegionClosure;
   // Other related classes.
-  friend class G1MarkSweep;
   friend class HeapRegionClaimer;
 
+  // Testing classes.
+  friend class G1CheckCSetFastTableClosure;
+
 private:
   // The one and only G1CollectedHeap, so static functions can find it.
   static G1CollectedHeap* _g1h;
@@ -547,15 +533,9 @@
   // allocation region, either by picking one or expanding the
   // heap, and then allocate a block of the given size. The block
   // may not be a humongous - it must fit into a single heap region.
-  HeapWord* par_allocate_during_gc(GCAllocPurpose purpose,
-                                   size_t word_size,
-                                   AllocationContext_t context);
-
-  HeapWord* allocate_during_gc_slow(GCAllocPurpose purpose,
-                                    HeapRegion*    alloc_region,
-                                    bool           par,
-                                    size_t         word_size);
-
+  inline HeapWord* par_allocate_during_gc(InCSetState dest,
+                                          size_t word_size,
+                                          AllocationContext_t context);
   // Ensure that no further allocations can happen in "r", bearing in mind
   // that parallel threads might be attempting allocations.
   void par_allocate_remaining_space(HeapRegion* r);
@@ -577,9 +557,9 @@
 
   // For GC alloc regions.
   HeapRegion* new_gc_alloc_region(size_t word_size, uint count,
-                                  GCAllocPurpose ap);
+                                  InCSetState dest);
   void retire_gc_alloc_region(HeapRegion* alloc_region,
-                              size_t allocated_bytes, GCAllocPurpose ap);
+                              size_t allocated_bytes, InCSetState dest);
 
   // - if explicit_gc is true, the GC is for a System.gc() or a heap
   //   inspection request and should collect the entire heap
@@ -640,26 +620,11 @@
   // (Rounds up to a HeapRegion boundary.)
   bool expand(size_t expand_bytes);
 
-  // Returns the PLAB statistics given a purpose.
-  PLABStats* stats_for_purpose(GCAllocPurpose purpose) {
-    PLABStats* stats = NULL;
+  // Returns the PLAB statistics for a given destination.
+  inline PLABStats* alloc_buffer_stats(InCSetState dest);
 
-    switch (purpose) {
-    case GCAllocForSurvived:
-      stats = &_survivor_plab_stats;
-      break;
-    case GCAllocForTenured:
-      stats = &_old_plab_stats;
-      break;
-    default:
-      assert(false, "unrecognized GCAllocPurpose");
-    }
-
-    return stats;
-  }
-
-  // Determines PLAB size for a particular allocation purpose.
-  size_t desired_plab_sz(GCAllocPurpose purpose);
+  // Determines PLAB size for a given destination.
+  inline size_t desired_plab_sz(InCSetState dest);
 
   inline AllocationContextStats& allocation_context_stats();
 
@@ -676,6 +641,9 @@
   // Returns whether the given region (which must be a humongous (start) region)
   // is to be considered conservatively live regardless of any other conditions.
   bool humongous_region_is_always_live(uint index);
+  // Returns whether the given region (which must be a humongous (start) region)
+  // is considered a candidate for eager reclamation.
+  bool humongous_region_is_candidate(uint index);
   // Register the given region to be part of the collection set.
   inline void register_humongous_region_with_in_cset_fast_test(uint index);
   // Register regions with humongous objects (actually on the start region) in
@@ -683,8 +651,11 @@
   void register_humongous_regions_with_in_cset_fast_test();
   // We register a region with the fast "in collection set" test. We
   // simply set to true the array slot corresponding to this region.
-  void register_region_with_in_cset_fast_test(HeapRegion* r) {
-    _in_cset_fast_test.set_in_cset(r->hrm_index());
+  void register_young_region_with_in_cset_fast_test(HeapRegion* r) {
+    _in_cset_fast_test.set_in_young(r->hrm_index());
+  }
+  void register_old_region_with_in_cset_fast_test(HeapRegion* r) {
+    _in_cset_fast_test.set_in_old(r->hrm_index());
   }
 
   // This is a fast test on whether a reference points into the
@@ -821,7 +792,7 @@
   // In the sequential case this param will be ignored.
   void g1_process_roots(OopClosure* scan_non_heap_roots,
                         OopClosure* scan_non_heap_weak_roots,
-                        OopsInHeapRegionClosure* scan_rs,
+                        G1ParPushHeapRSClosure* scan_rs,
                         CLDClosure* scan_strong_clds,
                         CLDClosure* scan_weak_clds,
                         CodeBlobClosure* scan_strong_code,
@@ -1181,6 +1152,9 @@
   // appropriate error messages and crash.
   void check_bitmaps(const char* caller) PRODUCT_RETURN;
 
+  // Do sanity check on the contents of the in-cset fast test table.
+  bool check_cset_fast_test() PRODUCT_RETURN_( return true; );
+
   // verify_region_sets() performs verification over the region
   // lists. It will be compiled in the product code to be used when
   // necessary (i.e., during heap verification).
@@ -1276,53 +1250,15 @@
 
   inline bool is_in_cset_or_humongous(const oop obj);
 
-  enum in_cset_state_t {
-   InNeither,           // neither in collection set nor humongous
-   InCSet,              // region is in collection set only
-   IsHumongous          // region is a humongous start region
-  };
  private:
-  // Instances of this class are used for quick tests on whether a reference points
-  // into the collection set or is a humongous object (points into a humongous
-  // object).
-  // Each of the array's elements denotes whether the corresponding region is in
-  // the collection set or a humongous region.
-  // We use this to quickly reclaim humongous objects: by making a humongous region
-  // succeed this test, we sort-of add it to the collection set. During the reference
-  // iteration closures, when we see a humongous region, we simply mark it as
-  // referenced, i.e. live.
-  class G1FastCSetBiasedMappedArray : public G1BiasedMappedArray<char> {
-   protected:
-    char default_value() const { return G1CollectedHeap::InNeither; }
-   public:
-    void set_humongous(uintptr_t index) {
-      assert(get_by_index(index) != InCSet, "Should not overwrite InCSet values");
-      set_by_index(index, G1CollectedHeap::IsHumongous);
-    }
-
-    void clear_humongous(uintptr_t index) {
-      set_by_index(index, G1CollectedHeap::InNeither);
-    }
-
-    void set_in_cset(uintptr_t index) {
-      assert(get_by_index(index) != G1CollectedHeap::IsHumongous, "Should not overwrite IsHumongous value");
-      set_by_index(index, G1CollectedHeap::InCSet);
-    }
-
-    bool is_in_cset_or_humongous(HeapWord* addr) const { return get_by_address(addr) != G1CollectedHeap::InNeither; }
-    bool is_in_cset(HeapWord* addr) const { return get_by_address(addr) == G1CollectedHeap::InCSet; }
-    G1CollectedHeap::in_cset_state_t at(HeapWord* addr) const { return (G1CollectedHeap::in_cset_state_t)get_by_address(addr); }
-    void clear() { G1BiasedMappedArray<char>::clear(); }
-  };
-
   // This array is used for a quick test on whether a reference points into
   // the collection set or not. Each of the array's elements denotes whether the
   // corresponding region is in the collection set or not.
-  G1FastCSetBiasedMappedArray _in_cset_fast_test;
+  G1InCSetStateFastTestBiasedMappedArray _in_cset_fast_test;
 
  public:
 
-  inline in_cset_state_t in_cset_state(const oop obj);
+  inline InCSetState in_cset_state(const oop obj);
 
   // Return "TRUE" iff the given object address is in the reserved
   // region of g1.
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -35,6 +35,41 @@
 #include "runtime/orderAccess.inline.hpp"
 #include "utilities/taskqueue.hpp"
 
+PLABStats* G1CollectedHeap::alloc_buffer_stats(InCSetState dest) {
+  switch (dest.value()) {
+    case InCSetState::Young:
+      return &_survivor_plab_stats;
+    case InCSetState::Old:
+      return &_old_plab_stats;
+    default:
+      ShouldNotReachHere();
+      return NULL; // Keep some compilers happy
+  }
+}
+
+size_t G1CollectedHeap::desired_plab_sz(InCSetState dest) {
+  size_t gclab_word_size = alloc_buffer_stats(dest)->desired_plab_sz();
+  // Prevent humongous PLAB sizes for two reasons:
+  // * PLABs are allocated using a similar paths as oops, but should
+  //   never be in a humongous region
+  // * Allowing humongous PLABs needlessly churns the region free lists
+  return MIN2(_humongous_object_threshold_in_words, gclab_word_size);
+}
+
+HeapWord* G1CollectedHeap::par_allocate_during_gc(InCSetState dest,
+                                                  size_t word_size,
+                                                  AllocationContext_t context) {
+  switch (dest.value()) {
+    case InCSetState::Young:
+      return survivor_attempt_allocation(word_size, context);
+    case InCSetState::Old:
+      return old_attempt_allocation(word_size, context);
+    default:
+      ShouldNotReachHere();
+      return NULL; // Keep some compilers happy
+  }
+}
+
 // Inline functions for G1CollectedHeap
 
 inline AllocationContextStats& G1CollectedHeap::allocation_context_stats() {
@@ -203,7 +238,7 @@
   return _in_cset_fast_test.is_in_cset_or_humongous((HeapWord*)obj);
 }
 
-G1CollectedHeap::in_cset_state_t G1CollectedHeap::in_cset_state(const oop obj) {
+InCSetState G1CollectedHeap::in_cset_state(const oop obj) {
   return _in_cset_fast_test.at((HeapWord*)obj);
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1437,18 +1437,6 @@
   return young_list_length < young_list_max_length;
 }
 
-uint G1CollectorPolicy::max_regions(int purpose) {
-  switch (purpose) {
-    case GCAllocForSurvived:
-      return _max_survivor_regions;
-    case GCAllocForTenured:
-      return REGIONS_UNLIMITED;
-    default:
-      ShouldNotReachHere();
-      return REGIONS_UNLIMITED;
-  };
-}
-
 void G1CollectorPolicy::update_max_gc_locker_expansion() {
   uint expansion_region_num = 0;
   if (GCLockerEdenExpansionPercent > 0) {
@@ -1634,7 +1622,7 @@
   hr->set_next_in_collection_set(_collection_set);
   _collection_set = hr;
   _collection_set_bytes_used_before += hr->used();
-  _g1->register_region_with_in_cset_fast_test(hr);
+  _g1->register_old_region_with_in_cset_fast_test(hr);
   size_t rs_length = hr->rem_set()->occupied();
   _recorded_rs_lengths += rs_length;
   _old_cset_region_length += 1;
@@ -1767,7 +1755,7 @@
   hr->set_in_collection_set(true);
   assert( hr->next_in_collection_set() == NULL, "invariant");
 
-  _g1->register_region_with_in_cset_fast_test(hr);
+  _g1->register_young_region_with_in_cset_fast_test(hr);
 }
 
 // Add the region at the RHS of the incremental cset
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -881,28 +881,20 @@
 public:
   uint tenuring_threshold() const { return _tenuring_threshold; }
 
-  inline GCAllocPurpose
-    evacuation_destination(HeapRegion* src_region, uint age, size_t word_sz) {
-      if (age < _tenuring_threshold && src_region->is_young()) {
-        return GCAllocForSurvived;
-      } else {
-        return GCAllocForTenured;
-      }
-  }
-
-  inline bool track_object_age(GCAllocPurpose purpose) {
-    return purpose == GCAllocForSurvived;
-  }
-
   static const uint REGIONS_UNLIMITED = (uint) -1;
 
-  uint max_regions(int purpose);
-
-  // The limit on regions for a particular purpose is reached.
-  void note_alloc_region_limit_reached(int purpose) {
-    if (purpose == GCAllocForSurvived) {
-      _tenuring_threshold = 0;
+  uint max_regions(InCSetState dest) {
+    switch (dest.value()) {
+      case InCSetState::Young:
+        return _max_survivor_regions;
+      case InCSetState::Old:
+        return REGIONS_UNLIMITED;
+      default:
+        assert(false, err_msg("Unknown dest state: " CSETSTATE_FORMAT, dest.value()));
+        break;
     }
+    // keep some compilers happy
+    return 0;
   }
 
   void note_start_adding_survivor_regions() {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -344,11 +344,14 @@
     _last_redirty_logged_cards_time_ms.print(3, "Parallel Redirty");
     _last_redirty_logged_cards_processed_cards.print(3, "Redirtied Cards");
   }
-  if (G1ReclaimDeadHumongousObjectsAtYoungGC) {
-    print_stats(2, "Humongous Reclaim", _cur_fast_reclaim_humongous_time_ms);
+  if (G1EagerReclaimHumongousObjects) {
+    print_stats(2, "Humongous Register", _cur_fast_reclaim_humongous_register_time_ms);
     if (G1Log::finest()) {
       print_stats(3, "Humongous Total", _cur_fast_reclaim_humongous_total);
       print_stats(3, "Humongous Candidate", _cur_fast_reclaim_humongous_candidates);
+    }
+    print_stats(2, "Humongous Reclaim", _cur_fast_reclaim_humongous_time_ms);
+    if (G1Log::finest()) {
       print_stats(3, "Humongous Reclaimed", _cur_fast_reclaim_humongous_reclaimed);
     }
   }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -157,6 +157,7 @@
   double _recorded_non_young_free_cset_time_ms;
 
   double _cur_fast_reclaim_humongous_time_ms;
+  double _cur_fast_reclaim_humongous_register_time_ms;
   size_t _cur_fast_reclaim_humongous_total;
   size_t _cur_fast_reclaim_humongous_candidates;
   size_t _cur_fast_reclaim_humongous_reclaimed;
@@ -283,7 +284,8 @@
     _recorded_non_young_free_cset_time_ms = time_ms;
   }
 
-  void record_fast_reclaim_humongous_stats(size_t total, size_t candidates) {
+  void record_fast_reclaim_humongous_stats(double time_ms, size_t total, size_t candidates) {
+    _cur_fast_reclaim_humongous_register_time_ms = time_ms;
     _cur_fast_reclaim_humongous_total = total;
     _cur_fast_reclaim_humongous_candidates = candidates;
   }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1InCSetState.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1INCSETSTATE_HPP
+#define SHARE_VM_GC_IMPLEMENTATION_G1_G1INCSETSTATE_HPP
+
+#include "gc_implementation/g1/g1BiasedArray.hpp"
+#include "memory/allocation.hpp"
+
+// Per-region state during garbage collection.
+struct InCSetState {
+ public:
+  // We use different types to represent the state value. Particularly SPARC puts
+  // values in structs from "left to right", i.e. MSB to LSB. This results in many
+  // unnecessary shift operations when loading and storing values of this type.
+  // This degrades performance significantly (>10%) on that platform.
+  // Other tested ABIs do not seem to have this problem, and actually tend to
+  // favor smaller types, so we use the smallest usable type there.
+#ifdef SPARC
+  #define CSETSTATE_FORMAT INTPTR_FORMAT
+  typedef intptr_t in_cset_state_t;
+#else
+  #define CSETSTATE_FORMAT "%d"
+  typedef int8_t in_cset_state_t;
+#endif
+ private:
+  in_cset_state_t _value;
+ public:
+  enum {
+    // Selection of the values were driven to micro-optimize the encoding and
+    // frequency of the checks.
+    // The most common check is whether the region is in the collection set or not.
+    // This encoding allows us to use an != 0 check which in some architectures
+    // (x86*) can be encoded slightly more efficently than a normal comparison
+    // against zero.
+    // The same situation occurs when checking whether the region is humongous
+    // or not, which is encoded by values < 0.
+    // The other values are simply encoded in increasing generation order, which
+    // makes getting the next generation fast by a simple increment.
+    Humongous    = -1,    // The region is humongous - note that actually any value < 0 would be possible here.
+    NotInCSet    =  0,    // The region is not in the collection set.
+    Young        =  1,    // The region is in the collection set and a young region.
+    Old          =  2,    // The region is in the collection set and an old region.
+    Num
+  };
+
+  InCSetState(in_cset_state_t value = NotInCSet) : _value(value) {
+    assert(is_valid(), err_msg("Invalid state %d", _value));
+  }
+
+  in_cset_state_t value() const        { return _value; }
+
+  void set_old()                       { _value = Old; }
+
+  bool is_in_cset_or_humongous() const { return _value != NotInCSet; }
+  bool is_in_cset() const              { return _value > NotInCSet; }
+  bool is_humongous() const            { return _value < NotInCSet; }
+  bool is_young() const                { return _value == Young; }
+  bool is_old() const                  { return _value == Old; }
+
+#ifdef ASSERT
+  bool is_default() const              { return !is_in_cset_or_humongous(); }
+  bool is_valid() const                { return (_value >= Humongous) && (_value < Num); }
+  bool is_valid_gen() const            { return (_value >= Young && _value <= Old); }
+#endif
+};
+
+// Instances of this class are used for quick tests on whether a reference points
+// into the collection set and into which generation or is a humongous object
+//
+// Each of the array's elements indicates whether the corresponding region is in
+// the collection set and if so in which generation, or a humongous region.
+//
+// We use this to speed up reference processing during young collection and
+// quickly reclaim humongous objects. For the latter, by making a humongous region
+// succeed this test, we sort-of add it to the collection set. During the reference
+// iteration closures, when we see a humongous region, we then simply mark it as
+// referenced, i.e. live.
+class G1InCSetStateFastTestBiasedMappedArray : public G1BiasedMappedArray<InCSetState> {
+ protected:
+  InCSetState default_value() const { return InCSetState::NotInCSet; }
+ public:
+  void set_humongous(uintptr_t index) {
+    assert(get_by_index(index).is_default(),
+           err_msg("State at index " INTPTR_FORMAT" should be default but is " CSETSTATE_FORMAT, index, get_by_index(index).value()));
+    set_by_index(index, InCSetState::Humongous);
+  }
+
+  void clear_humongous(uintptr_t index) {
+    set_by_index(index, InCSetState::NotInCSet);
+  }
+
+  void set_in_young(uintptr_t index) {
+    assert(get_by_index(index).is_default(),
+           err_msg("State at index " INTPTR_FORMAT" should be default but is " CSETSTATE_FORMAT, index, get_by_index(index).value()));
+    set_by_index(index, InCSetState::Young);
+  }
+
+  void set_in_old(uintptr_t index) {
+    assert(get_by_index(index).is_default(),
+           err_msg("State at index " INTPTR_FORMAT" should be default but is " CSETSTATE_FORMAT, index, get_by_index(index).value()));
+    set_by_index(index, InCSetState::Old);
+  }
+
+  bool is_in_cset_or_humongous(HeapWord* addr) const { return at(addr).is_in_cset_or_humongous(); }
+  bool is_in_cset(HeapWord* addr) const { return at(addr).is_in_cset(); }
+  InCSetState at(HeapWord* addr) const { return get_by_address(addr); }
+  void clear() { G1BiasedMappedArray<InCSetState>::clear(); }
+};
+
+#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1INCSETSTATE_HPP
--- a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -26,6 +26,7 @@
 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1OOPCLOSURES_HPP
 
 #include "memory/iterator.hpp"
+#include "oops/markOop.hpp"
 
 class HeapRegion;
 class G1CollectedHeap;
@@ -239,14 +240,14 @@
   G1CollectedHeap* _g1;
   G1RemSet* _g1_rem_set;
   HeapRegion* _from;
-  OopsInHeapRegionClosure* _push_ref_cl;
+  G1ParPushHeapRSClosure* _push_ref_cl;
   bool _record_refs_into_cset;
   uint _worker_i;
 
 public:
   G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h,
                                 G1RemSet* rs,
-                                OopsInHeapRegionClosure* push_ref_cl,
+                                G1ParPushHeapRSClosure* push_ref_cl,
                                 bool record_refs_into_cset,
                                 uint worker_i = 0);
 
@@ -256,7 +257,8 @@
   }
 
   bool self_forwarded(oop obj) {
-    bool result = (obj->is_forwarded() && (obj->forwardee()== obj));
+    markOop m = obj->mark();
+    bool result = (m->is_marked() && ((oop)m->decode_pointer() == obj));
     return result;
   }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -67,8 +67,8 @@
 
   if (!oopDesc::is_null(heap_oop)) {
     oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
-    G1CollectedHeap::in_cset_state_t state = _g1->in_cset_state(obj);
-    if (state == G1CollectedHeap::InCSet) {
+    const InCSetState state = _g1->in_cset_state(obj);
+    if (state.is_in_cset()) {
       // We're not going to even bother checking whether the object is
       // already forwarded or not, as this usually causes an immediate
       // stall. We'll try to prefetch the object (for write, given that
@@ -87,7 +87,7 @@
 
       _par_scan_state->push_on_queue(p);
     } else {
-      if (state == G1CollectedHeap::IsHumongous) {
+      if (state.is_humongous()) {
         _g1->set_humongous_is_live(obj);
       }
       _par_scan_state->update_rs(_from, p, _worker_id);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -131,6 +131,9 @@
   _committed.set_range(start, start + size_in_pages);
 
   MemRegion result((HeapWord*)page_start(start), byte_size_for_pages(size_in_pages) / HeapWordSize);
+  if (AlwaysPreTouch) {
+    os::pretouch_memory((char*)result.start(), (char*)result.end());
+  }
   return result;
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -38,6 +38,7 @@
     _g1_rem(g1h->g1_rem_set()),
     _hash_seed(17), _queue_num(queue_num),
     _term_attempts(0),
+    _tenuring_threshold(g1h->g1_policy()->tenuring_threshold()),
     _age_table(false), _scanner(g1h, rp),
     _strong_roots_time(0), _term_time(0) {
   _scanner.set_par_scan_thread_state(this);
@@ -59,6 +60,12 @@
 
   _g1_par_allocator = G1ParGCAllocator::create_allocator(_g1h);
 
+  _dest[InCSetState::NotInCSet]    = InCSetState::NotInCSet;
+  // The dest for Young is used when the objects are aged enough to
+  // need to be moved to the next space.
+  _dest[InCSetState::Young]        = InCSetState::Old;
+  _dest[InCSetState::Old]          = InCSetState::Old;
+
   _start = os::elapsedTime();
 }
 
@@ -150,52 +157,94 @@
   } while (!_refs->is_empty());
 }
 
-oop G1ParScanThreadState::copy_to_survivor_space(oop const old,
+HeapWord* G1ParScanThreadState::allocate_in_next_plab(InCSetState const state,
+                                                      InCSetState* dest,
+                                                      size_t word_sz,
+                                                      AllocationContext_t const context) {
+  assert(state.is_in_cset_or_humongous(), err_msg("Unexpected state: " CSETSTATE_FORMAT, state.value()));
+  assert(dest->is_in_cset_or_humongous(), err_msg("Unexpected dest: " CSETSTATE_FORMAT, dest->value()));
+
+  // Right now we only have two types of regions (young / old) so
+  // let's keep the logic here simple. We can generalize it when necessary.
+  if (dest->is_young()) {
+    HeapWord* const obj_ptr = _g1_par_allocator->allocate(InCSetState::Old,
+                                                          word_sz, context);
+    if (obj_ptr == NULL) {
+      return NULL;
+    }
+    // Make sure that we won't attempt to copy any other objects out
+    // of a survivor region (given that apparently we cannot allocate
+    // any new ones) to avoid coming into this slow path.
+    _tenuring_threshold = 0;
+    dest->set_old();
+    return obj_ptr;
+  } else {
+    assert(dest->is_old(), err_msg("Unexpected dest: " CSETSTATE_FORMAT, dest->value()));
+    // no other space to try.
+    return NULL;
+  }
+}
+
+InCSetState G1ParScanThreadState::next_state(InCSetState const state, markOop const m, uint& age) {
+  if (state.is_young()) {
+    age = !m->has_displaced_mark_helper() ? m->age()
+                                          : m->displaced_mark_helper()->age();
+    if (age < _tenuring_threshold) {
+      return state;
+    }
+  }
+  return dest(state);
+}
+
+oop G1ParScanThreadState::copy_to_survivor_space(InCSetState const state,
+                                                 oop const old,
                                                  markOop const old_mark) {
-  size_t word_sz = old->size();
-  HeapRegion* from_region = _g1h->heap_region_containing_raw(old);
+  const size_t word_sz = old->size();
+  HeapRegion* const from_region = _g1h->heap_region_containing_raw(old);
   // +1 to make the -1 indexes valid...
-  int       young_index = from_region->young_index_in_cset()+1;
+  const int young_index = from_region->young_index_in_cset()+1;
   assert( (from_region->is_young() && young_index >  0) ||
          (!from_region->is_young() && young_index == 0), "invariant" );
-  G1CollectorPolicy* g1p = _g1h->g1_policy();
-  uint age = old_mark->has_displaced_mark_helper() ? old_mark->displaced_mark_helper()->age()
-                                                   : old_mark->age();
-  GCAllocPurpose alloc_purpose = g1p->evacuation_destination(from_region, age,
-                                                             word_sz);
-  AllocationContext_t context = from_region->allocation_context();
-  HeapWord* obj_ptr = _g1_par_allocator->allocate(alloc_purpose, word_sz, context);
+  const AllocationContext_t context = from_region->allocation_context();
+
+  uint age = 0;
+  InCSetState dest_state = next_state(state, old_mark, age);
+  HeapWord* obj_ptr = _g1_par_allocator->plab_allocate(dest_state, word_sz, context);
+
+  // PLAB allocations should succeed most of the time, so we'll
+  // normally check against NULL once and that's it.
+  if (obj_ptr == NULL) {
+    obj_ptr = _g1_par_allocator->allocate_direct_or_new_plab(dest_state, word_sz, context);
+    if (obj_ptr == NULL) {
+      obj_ptr = allocate_in_next_plab(state, &dest_state, word_sz, context);
+      if (obj_ptr == NULL) {
+        // This will either forward-to-self, or detect that someone else has
+        // installed a forwarding pointer.
+        return _g1h->handle_evacuation_failure_par(this, old);
+      }
+    }
+  }
+
+  assert(obj_ptr != NULL, "when we get here, allocation should have succeeded");
 #ifndef PRODUCT
   // Should this evacuation fail?
   if (_g1h->evacuation_should_fail()) {
-    if (obj_ptr != NULL) {
-      _g1_par_allocator->undo_allocation(alloc_purpose, obj_ptr, word_sz, context);
-      obj_ptr = NULL;
-    }
+    // Doing this after all the allocation attempts also tests the
+    // undo_allocation() method too.
+    _g1_par_allocator->undo_allocation(dest_state, obj_ptr, word_sz, context);
+    return _g1h->handle_evacuation_failure_par(this, old);
   }
 #endif // !PRODUCT
 
-  if (obj_ptr == NULL) {
-    // This will either forward-to-self, or detect that someone else has
-    // installed a forwarding pointer.
-    return _g1h->handle_evacuation_failure_par(this, old);
-  }
-
-  oop obj = oop(obj_ptr);
-
   // We're going to allocate linearly, so might as well prefetch ahead.
   Prefetch::write(obj_ptr, PrefetchCopyIntervalInBytes);
 
-  oop forward_ptr = old->forward_to_atomic(obj);
+  const oop obj = oop(obj_ptr);
+  const oop forward_ptr = old->forward_to_atomic(obj);
   if (forward_ptr == NULL) {
     Copy::aligned_disjoint_words((HeapWord*) old, obj_ptr, word_sz);
 
-    // alloc_purpose is just a hint to allocate() above, recheck the type of region
-    // we actually allocated from and update alloc_purpose accordingly
-    HeapRegion* to_region = _g1h->heap_region_containing_raw(obj_ptr);
-    alloc_purpose = to_region->is_young() ? GCAllocForSurvived : GCAllocForTenured;
-
-    if (g1p->track_object_age(alloc_purpose)) {
+    if (dest_state.is_young()) {
       if (age < markOopDesc::max_age) {
         age++;
       }
@@ -215,13 +264,19 @@
     }
 
     if (G1StringDedup::is_enabled()) {
-      G1StringDedup::enqueue_from_evacuation(from_region->is_young(),
-                                             to_region->is_young(),
+      const bool is_from_young = state.is_young();
+      const bool is_to_young = dest_state.is_young();
+      assert(is_from_young == _g1h->heap_region_containing_raw(old)->is_young(),
+             "sanity");
+      assert(is_to_young == _g1h->heap_region_containing_raw(obj)->is_young(),
+             "sanity");
+      G1StringDedup::enqueue_from_evacuation(is_from_young,
+                                             is_to_young,
                                              queue_num(),
                                              obj);
     }
 
-    size_t* surv_young_words = surviving_young_words();
+    size_t* const surv_young_words = surviving_young_words();
     surv_young_words[young_index] += word_sz;
 
     if (obj->is_objArray() && arrayOop(obj)->length() >= ParGCArrayScanChunk) {
@@ -232,14 +287,13 @@
       oop* old_p = set_partial_array_mask(old);
       push_on_queue(old_p);
     } else {
-      // No point in using the slower heap_region_containing() method,
-      // given that we know obj is in the heap.
-      _scanner.set_region(_g1h->heap_region_containing_raw(obj));
+      HeapRegion* const to_region = _g1h->heap_region_containing_raw(obj_ptr);
+      _scanner.set_region(to_region);
       obj->oop_iterate_backwards(&_scanner);
     }
+    return obj;
   } else {
-    _g1_par_allocator->undo_allocation(alloc_purpose, obj_ptr, word_sz, context);
-    obj = forward_ptr;
+    _g1_par_allocator->undo_allocation(dest_state, obj_ptr, word_sz, context);
+    return forward_ptr;
   }
-  return obj;
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -46,14 +46,16 @@
   G1SATBCardTableModRefBS* _ct_bs;
   G1RemSet* _g1_rem;
 
-  G1ParGCAllocator*   _g1_par_allocator;
-
-  ageTable            _age_table;
+  G1ParGCAllocator* _g1_par_allocator;
 
-  G1ParScanClosure    _scanner;
+  ageTable          _age_table;
+  InCSetState       _dest[InCSetState::Num];
+  // Local tenuring threshold.
+  uint              _tenuring_threshold;
+  G1ParScanClosure  _scanner;
 
-  size_t           _alloc_buffer_waste;
-  size_t           _undo_waste;
+  size_t            _alloc_buffer_waste;
+  size_t            _undo_waste;
 
   OopsInHeapRegionClosure*      _evac_failure_cl;
 
@@ -82,6 +84,14 @@
   DirtyCardQueue& dirty_card_queue()             { return _dcq;  }
   G1SATBCardTableModRefBS* ctbs()                { return _ct_bs; }
 
+  InCSetState dest(InCSetState original) const {
+    assert(original.is_valid(),
+           err_msg("Original state invalid: " CSETSTATE_FORMAT, original.value()));
+    assert(_dest[original.value()].is_valid_gen(),
+           err_msg("Dest state is invalid: " CSETSTATE_FORMAT, _dest[original.value()].value()));
+    return _dest[original.value()];
+  }
+
  public:
   G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp);
   ~G1ParScanThreadState();
@@ -112,7 +122,6 @@
       }
     }
   }
- public:
 
   void set_evac_failure_closure(OopsInHeapRegionClosure* evac_failure_cl) {
     _evac_failure_cl = evac_failure_cl;
@@ -193,9 +202,20 @@
   template <class T> inline void deal_with_reference(T* ref_to_scan);
 
   inline void dispatch_reference(StarTask ref);
+
+  // Tries to allocate word_sz in the PLAB of the next "generation" after trying to
+  // allocate into dest. State is the original (source) cset state for the object
+  // that is allocated for.
+  // Returns a non-NULL pointer if successful, and updates dest if required.
+  HeapWord* allocate_in_next_plab(InCSetState const state,
+                                  InCSetState* dest,
+                                  size_t word_sz,
+                                  AllocationContext_t const context);
+
+  inline InCSetState next_state(InCSetState const state, markOop const m, uint& age);
  public:
 
-  oop copy_to_survivor_space(oop const obj, markOop const old_mark);
+  oop copy_to_survivor_space(InCSetState const state, oop const obj, markOop const old_mark);
 
   void trim_queue();
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -38,21 +38,21 @@
   // set, due to (benign) races in the claim mechanism during RSet scanning more
   // than one thread might claim the same card. So the same card may be
   // processed multiple times. So redo this check.
-  G1CollectedHeap::in_cset_state_t in_cset_state = _g1h->in_cset_state(obj);
-  if (in_cset_state == G1CollectedHeap::InCSet) {
+  const InCSetState in_cset_state = _g1h->in_cset_state(obj);
+  if (in_cset_state.is_in_cset()) {
     oop forwardee;
     markOop m = obj->mark();
     if (m->is_marked()) {
       forwardee = (oop) m->decode_pointer();
     } else {
-      forwardee = copy_to_survivor_space(obj, m);
+      forwardee = copy_to_survivor_space(in_cset_state, obj, m);
     }
     oopDesc::encode_store_heap_oop(p, forwardee);
-  } else if (in_cset_state == G1CollectedHeap::IsHumongous) {
+  } else if (in_cset_state.is_humongous()) {
     _g1h->set_humongous_is_live(obj);
   } else {
-    assert(in_cset_state == G1CollectedHeap::InNeither,
-           err_msg("In_cset_state must be InNeither here, but is %d", in_cset_state));
+    assert(!in_cset_state.is_in_cset_or_humongous(),
+           err_msg("In_cset_state must be NotInCSet here, but is " CSETSTATE_FORMAT, in_cset_state.value()));
   }
 
   assert(obj != NULL, "Must be");
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -80,7 +80,7 @@
     _prev_period_summary()
 {
   _seq_task = new SubTasksDone(NumSeqTasks);
-  _cset_rs_update_cl = NEW_C_HEAP_ARRAY(OopsInHeapRegionClosure*, n_workers(), mtGC);
+  _cset_rs_update_cl = NEW_C_HEAP_ARRAY(G1ParPushHeapRSClosure*, n_workers(), mtGC);
   for (uint i = 0; i < n_workers(); i++) {
     _cset_rs_update_cl[i] = NULL;
   }
@@ -94,14 +94,14 @@
   for (uint i = 0; i < n_workers(); i++) {
     assert(_cset_rs_update_cl[i] == NULL, "it should be");
   }
-  FREE_C_HEAP_ARRAY(OopsInHeapRegionClosure*, _cset_rs_update_cl);
+  FREE_C_HEAP_ARRAY(G1ParPushHeapRSClosure*, _cset_rs_update_cl);
 }
 
 class ScanRSClosure : public HeapRegionClosure {
   size_t _cards_done, _cards;
   G1CollectedHeap* _g1h;
 
-  OopsInHeapRegionClosure* _oc;
+  G1ParPushHeapRSClosure* _oc;
   CodeBlobClosure* _code_root_cl;
 
   G1BlockOffsetSharedArray* _bot_shared;
@@ -113,7 +113,7 @@
   bool   _try_claimed;
 
 public:
-  ScanRSClosure(OopsInHeapRegionClosure* oc,
+  ScanRSClosure(G1ParPushHeapRSClosure* oc,
                 CodeBlobClosure* code_root_cl,
                 uint worker_i) :
     _oc(oc),
@@ -135,8 +135,7 @@
   void scanCard(size_t index, HeapRegion *r) {
     // Stack allocate the DirtyCardToOopClosure instance
     HeapRegionDCTOC cl(_g1h, r, _oc,
-                       CardTableModRefBS::Precise,
-                       HeapRegionDCTOC::IntoCSFilterKind);
+                       CardTableModRefBS::Precise);
 
     // Set the "from" region in the closure.
     _oc->set_region(r);
@@ -231,7 +230,7 @@
   size_t cards_looked_up() { return _cards;}
 };
 
-void G1RemSet::scanRS(OopsInHeapRegionClosure* oc,
+void G1RemSet::scanRS(G1ParPushHeapRSClosure* oc,
                       CodeBlobClosure* code_root_cl,
                       uint worker_i) {
   double rs_time_start = os::elapsedTime();
@@ -301,7 +300,7 @@
   HeapRegionRemSet::cleanup();
 }
 
-void G1RemSet::oops_into_collection_set_do(OopsInHeapRegionClosure* oc,
+void G1RemSet::oops_into_collection_set_do(G1ParPushHeapRSClosure* oc,
                                            CodeBlobClosure* code_root_cl,
                                            uint worker_i) {
 #if CARD_REPEAT_HISTO
@@ -417,7 +416,7 @@
 G1UpdateRSOrPushRefOopClosure::
 G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h,
                               G1RemSet* rs,
-                              OopsInHeapRegionClosure* push_ref_cl,
+                              G1ParPushHeapRSClosure* push_ref_cl,
                               bool record_refs_into_cset,
                               uint worker_i) :
   _g1(g1h), _g1_rem_set(rs), _from(NULL),
@@ -518,7 +517,7 @@
   ct_freq_note_card(_ct_bs->index_for(start));
 #endif
 
-  OopsInHeapRegionClosure* oops_in_heap_closure = NULL;
+  G1ParPushHeapRSClosure* oops_in_heap_closure = NULL;
   if (check_for_refs_into_cset) {
     // ConcurrentG1RefineThreads have worker numbers larger than what
     // _cset_rs_update_cl[] is set up to handle. But those threads should
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -33,6 +33,7 @@
 class G1CollectedHeap;
 class CardTableModRefBarrierSet;
 class ConcurrentG1Refine;
+class G1ParPushHeapRSClosure;
 
 // A G1RemSet in which each heap region has a rem set that records the
 // external heap references into it.  Uses a mod ref bs to track updates,
@@ -68,7 +69,7 @@
 
   // Used for caching the closure that is responsible for scanning
   // references into the collection set.
-  OopsInHeapRegionClosure** _cset_rs_update_cl;
+  G1ParPushHeapRSClosure** _cset_rs_update_cl;
 
   // Print the given summary info
   virtual void print_summary_info(G1RemSetSummary * summary, const char * header = NULL);
@@ -95,7 +96,7 @@
   // partitioning the work to be done. It should be the same as
   // the "i" passed to the calling thread's work(i) function.
   // In the sequential case this param will be ignored.
-  void oops_into_collection_set_do(OopsInHeapRegionClosure* blk,
+  void oops_into_collection_set_do(G1ParPushHeapRSClosure* blk,
                                    CodeBlobClosure* code_root_cl,
                                    uint worker_i);
 
@@ -107,7 +108,7 @@
   void prepare_for_oops_into_collection_set_do();
   void cleanup_after_oops_into_collection_set_do();
 
-  void scanRS(OopsInHeapRegionClosure* oc,
+  void scanRS(G1ParPushHeapRSClosure* oc,
               CodeBlobClosure* code_root_cl,
               uint worker_i);
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
 #include "runtime/thread.inline.hpp"
 
 G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap) :
-    CardTableModRefBSForCTRS(whole_heap)
+    CardTableModRefBS(whole_heap)
 {
   _kind = G1SATBCT;
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
 // This barrier is specialized to use a logging barrier to support
 // snapshot-at-the-beginning marking.
 
-class G1SATBCardTableModRefBS: public CardTableModRefBSForCTRS {
+class G1SATBCardTableModRefBS: public CardTableModRefBS {
 protected:
   enum G1CardValues {
     g1_young_gen = CT_MR_BS_last_reserved << 1
--- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -270,10 +270,14 @@
   product(uintx, G1MixedGCCountTarget, 8,                                   \
           "The target number of mixed GCs after a marking cycle.")          \
                                                                             \
-  experimental(bool, G1ReclaimDeadHumongousObjectsAtYoungGC, true,          \
+  experimental(bool, G1EagerReclaimHumongousObjects, true,                  \
           "Try to reclaim dead large objects at every young GC.")           \
                                                                             \
-  experimental(bool, G1TraceReclaimDeadHumongousObjectsAtYoungGC, false,    \
+  experimental(bool, G1EagerReclaimHumongousObjectsWithStaleRefs, true,     \
+          "Try to reclaim dead large objects that have a few stale "        \
+          "references at every young GC.")                                  \
+                                                                            \
+  experimental(bool, G1TraceEagerReclaimHumongousObjects, false,            \
           "Print some information about large object liveness "             \
           "at every young GC.")                                             \
                                                                             \
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -48,93 +48,55 @@
 size_t HeapRegion::CardsPerRegion    = 0;
 
 HeapRegionDCTOC::HeapRegionDCTOC(G1CollectedHeap* g1,
-                                 HeapRegion* hr, ExtendedOopClosure* cl,
-                                 CardTableModRefBS::PrecisionStyle precision,
-                                 FilterKind fk) :
+                                 HeapRegion* hr,
+                                 G1ParPushHeapRSClosure* cl,
+                                 CardTableModRefBS::PrecisionStyle precision) :
   DirtyCardToOopClosure(hr, cl, precision, NULL),
-  _hr(hr), _fk(fk), _g1(g1) { }
+  _hr(hr), _rs_scan(cl), _g1(g1) { }
 
 FilterOutOfRegionClosure::FilterOutOfRegionClosure(HeapRegion* r,
                                                    OopClosure* oc) :
   _r_bottom(r->bottom()), _r_end(r->end()), _oc(oc) { }
 
-template<class ClosureType>
-HeapWord* walk_mem_region_loop(ClosureType* cl, G1CollectedHeap* g1h,
-                               HeapRegion* hr,
-                               HeapWord* cur, HeapWord* top) {
-  oop cur_oop = oop(cur);
-  size_t oop_size = hr->block_size(cur);
-  HeapWord* next_obj = cur + oop_size;
-  while (next_obj < top) {
-    // Keep filtering the remembered set.
-    if (!g1h->is_obj_dead(cur_oop, hr)) {
-      // Bottom lies entirely below top, so we can call the
-      // non-memRegion version of oop_iterate below.
-      cur_oop->oop_iterate(cl);
-    }
-    cur = next_obj;
-    cur_oop = oop(cur);
-    oop_size = hr->block_size(cur);
-    next_obj = cur + oop_size;
-  }
-  return cur;
-}
-
 void HeapRegionDCTOC::walk_mem_region(MemRegion mr,
                                       HeapWord* bottom,
                                       HeapWord* top) {
   G1CollectedHeap* g1h = _g1;
   size_t oop_size;
-  ExtendedOopClosure* cl2 = NULL;
-
-  FilterIntoCSClosure intoCSFilt(this, g1h, _cl);
-  FilterOutOfRegionClosure outOfRegionFilt(_hr, _cl);
-
-  switch (_fk) {
-  case NoFilterKind:          cl2 = _cl; break;
-  case IntoCSFilterKind:      cl2 = &intoCSFilt; break;
-  case OutOfRegionFilterKind: cl2 = &outOfRegionFilt; break;
-  default:                    ShouldNotReachHere();
-  }
+  HeapWord* cur = bottom;
 
   // Start filtering what we add to the remembered set. If the object is
   // not considered dead, either because it is marked (in the mark bitmap)
   // or it was allocated after marking finished, then we add it. Otherwise
   // we can safely ignore the object.
-  if (!g1h->is_obj_dead(oop(bottom), _hr)) {
-    oop_size = oop(bottom)->oop_iterate(cl2, mr);
+  if (!g1h->is_obj_dead(oop(cur), _hr)) {
+    oop_size = oop(cur)->oop_iterate(_rs_scan, mr);
   } else {
-    oop_size = _hr->block_size(bottom);
+    oop_size = _hr->block_size(cur);
   }
 
-  bottom += oop_size;
-
-  if (bottom < top) {
-    // We replicate the loop below for several kinds of possible filters.
-    switch (_fk) {
-    case NoFilterKind:
-      bottom = walk_mem_region_loop(_cl, g1h, _hr, bottom, top);
-      break;
+  cur += oop_size;
 
-    case IntoCSFilterKind: {
-      FilterIntoCSClosure filt(this, g1h, _cl);
-      bottom = walk_mem_region_loop(&filt, g1h, _hr, bottom, top);
-      break;
-    }
-
-    case OutOfRegionFilterKind: {
-      FilterOutOfRegionClosure filt(_hr, _cl);
-      bottom = walk_mem_region_loop(&filt, g1h, _hr, bottom, top);
-      break;
-    }
-
-    default:
-      ShouldNotReachHere();
+  if (cur < top) {
+    oop cur_oop = oop(cur);
+    oop_size = _hr->block_size(cur);
+    HeapWord* next_obj = cur + oop_size;
+    while (next_obj < top) {
+      // Keep filtering the remembered set.
+      if (!g1h->is_obj_dead(cur_oop, _hr)) {
+        // Bottom lies entirely below top, so we can call the
+        // non-memRegion version of oop_iterate below.
+        cur_oop->oop_iterate(_rs_scan);
+      }
+      cur = next_obj;
+      cur_oop = oop(cur);
+      oop_size = _hr->block_size(cur);
+      next_obj = cur + oop_size;
     }
 
     // Last object. Need to do dead-obj filtering here too.
-    if (!g1h->is_obj_dead(oop(bottom), _hr)) {
-      oop(bottom)->oop_iterate(cl2, mr);
+    if (!g1h->is_obj_dead(oop(cur), _hr)) {
+      oop(cur)->oop_iterate(_rs_scan, mr);
     }
   }
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -67,17 +67,9 @@
 // sets.
 
 class HeapRegionDCTOC : public DirtyCardToOopClosure {
-public:
-  // Specification of possible DirtyCardToOopClosure filtering.
-  enum FilterKind {
-    NoFilterKind,
-    IntoCSFilterKind,
-    OutOfRegionFilterKind
-  };
-
-protected:
+private:
   HeapRegion* _hr;
-  FilterKind _fk;
+  G1ParPushHeapRSClosure* _rs_scan;
   G1CollectedHeap* _g1;
 
   // Walk the given memory region from bottom to (actual) top
@@ -90,9 +82,9 @@
 
 public:
   HeapRegionDCTOC(G1CollectedHeap* g1,
-                  HeapRegion* hr, ExtendedOopClosure* cl,
-                  CardTableModRefBS::PrecisionStyle precision,
-                  FilterKind fk);
+                  HeapRegion* hr,
+                  G1ParPushHeapRSClosure* cl,
+                  CardTableModRefBS::PrecisionStyle precision);
 };
 
 // The complicating factor is that BlockOffsetTable diverged
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -681,6 +681,18 @@
   clear_fcc();
 }
 
+bool OtherRegionsTable::occupancy_less_or_equal_than(size_t limit) const {
+  if (limit <= (size_t)G1RSetSparseRegionEntries) {
+    return occ_coarse() == 0 && _first_all_fine_prts == NULL && occ_sparse() <= limit;
+  } else {
+    // Current uses of this method may only use values less than G1RSetSparseRegionEntries
+    // for the limit. The solution, comparing against occupied() would be too slow
+    // at this time.
+    Unimplemented();
+    return false;
+  }
+}
+
 bool OtherRegionsTable::is_empty() const {
   return occ_sparse() == 0 && occ_coarse() == 0 && _first_all_fine_prts == NULL;
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -183,6 +183,10 @@
   // Returns whether the remembered set contains the given reference.
   bool contains_reference(OopOrNarrowOopStar from) const;
 
+  // Returns whether this remembered set (and all sub-sets) have an occupancy
+  // that is less or equal than the given occupancy.
+  bool occupancy_less_or_equal_than(size_t limit) const;
+
   // Removes any entries shown by the given bitmaps to contain only dead
   // objects. Not thread safe.
   // Set bits in the bitmaps indicate that the given region or card is live.
@@ -261,6 +265,10 @@
     return (strong_code_roots_list_length() == 0) && _other_regions.is_empty();
   }
 
+  bool occupancy_less_or_equal_than(size_t occ) const {
+    return (strong_code_roots_list_length() == 0) && _other_regions.occupancy_less_or_equal_than(occ);
+  }
+
   size_t occupied() {
     MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag);
     return occupied_locked();
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -195,7 +195,7 @@
 
     COMPILER2_PRESENT(DerivedPointerTable::clear());
 
-    ref_processor()->enable_discovery(true /*verify_disabled*/, true /*verify_no_refs*/);
+    ref_processor()->enable_discovery();
     ref_processor()->setup_policy(clear_all_softrefs);
 
     mark_sweep_phase1(clear_all_softrefs);
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -2069,7 +2069,7 @@
 
     COMPILER2_PRESENT(DerivedPointerTable::clear());
 
-    ref_processor()->enable_discovery(true /*verify_disabled*/, true /*verify_no_refs*/);
+    ref_processor()->enable_discovery();
     ref_processor()->setup_policy(maximum_heap_compaction);
 
     bool marked_for_unloading = false;
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -362,7 +362,7 @@
 
     COMPILER2_PRESENT(DerivedPointerTable::clear());
 
-    reference_processor()->enable_discovery(true /*verify_disabled*/, true /*verify_no_refs*/);
+    reference_processor()->enable_discovery();
     reference_processor()->setup_policy(false);
 
     // We track how much was promoted to the next generation for
--- a/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -63,9 +63,7 @@
 }
 
 void MutableSpace::pretouch_pages(MemRegion mr) {
-  for (volatile char *p = (char*)mr.start(); p < (char*)mr.end(); p += os::vm_page_size()) {
-    char t = *p; *p = t;
-  }
+  os::pretouch_memory((char*)mr.start(), (char*)mr.end());
 }
 
 void MutableSpace::initialize(MemRegion mr,
--- a/hotspot/src/share/vm/memory/cardTableRS.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/memory/cardTableRS.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -33,24 +33,13 @@
 #include "runtime/java.hpp"
 #include "runtime/os.hpp"
 #include "utilities/macros.hpp"
-#if INCLUDE_ALL_GCS
-#include "gc_implementation/g1/concurrentMark.hpp"
-#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
-#endif // INCLUDE_ALL_GCS
 
 CardTableRS::CardTableRS(MemRegion whole_heap) :
   GenRemSet(),
   _cur_youngergen_card_val(youngergenP1_card)
 {
-#if INCLUDE_ALL_GCS
-  if (UseG1GC) {
-      _ct_bs = new G1SATBCardTableLoggingModRefBS(whole_heap);
-  } else {
-    _ct_bs = new CardTableModRefBSForCTRS(whole_heap);
-  }
-#else
+  guarantee(Universe::heap()->kind() == CollectedHeap::GenCollectedHeap, "sanity");
   _ct_bs = new CardTableModRefBSForCTRS(whole_heap);
-#endif
   _ct_bs->initialize();
   set_bs(_ct_bs);
   _last_cur_val_in_gen = NEW_C_HEAP_ARRAY3(jbyte, GenCollectedHeap::max_gens + 1,
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -70,6 +70,7 @@
 
 GenCollectedHeap::GenCollectedHeap(GenCollectorPolicy *policy) :
   SharedHeap(policy),
+  _rem_set(NULL),
   _gen_policy(policy),
   _gen_process_roots_tasks(new SubTasksDone(GCH_PS_NumElements)),
   _full_collections_completed(0)
@@ -465,7 +466,7 @@
           // atomic wrt other collectors in this configuration, we
           // are guaranteed to have empty discovered ref lists.
           if (rp->discovery_is_atomic()) {
-            rp->enable_discovery(true /*verify_disabled*/, true /*verify_no_refs*/);
+            rp->enable_discovery();
             rp->setup_policy(do_clear_all_soft_refs);
           } else {
             // collect() below will enable discovery as appropriate
--- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,6 +66,9 @@
   Generation* _gens[max_gens];
   GenerationSpec** _gen_specs;
 
+  // The singleton Gen Remembered Set.
+  GenRemSet* _rem_set;
+
   // The generational collector policy.
   GenCollectorPolicy* _gen_policy;
 
@@ -383,6 +386,10 @@
     return _n_gens;
   }
 
+  // This function returns the "GenRemSet" object that allows us to scan
+  // generations in a fully generational heap.
+  GenRemSet* rem_set() { return _rem_set; }
+
   // Convenience function to be used in situations where the heap type can be
   // asserted to be this type.
   static GenCollectedHeap* heap();
--- a/hotspot/src/share/vm/memory/genOopClosures.inline.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/memory/genOopClosures.inline.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@
   _gen_boundary = _gen->reserved().start();
   // Barrier set for the heap, must be set after heap is initialized
   if (_rs == NULL) {
-    GenRemSet* rs = SharedHeap::heap()->rem_set();
+    GenRemSet* rs = GenCollectedHeap::heap()->rem_set();
     _rs = (CardTableRS*)rs;
   }
 }
--- a/hotspot/src/share/vm/memory/generation.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/memory/generation.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -297,7 +297,7 @@
 
 void Generation::younger_refs_in_space_iterate(Space* sp,
                                                OopsInGenClosure* cl) {
-  GenRemSet* rs = SharedHeap::heap()->rem_set();
+  GenRemSet* rs = GenCollectedHeap::heap()->rem_set();
   rs->younger_refs_in_space_iterate(sp, cl);
 }
 
--- a/hotspot/src/share/vm/memory/metaspace.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -422,7 +422,7 @@
     bool large_pages = false; // No large pages when dumping the CDS archive.
     char* shared_base = (char*)align_ptr_up((char*)SharedBaseAddress, Metaspace::reserve_alignment());
 
-    _rs = ReservedSpace(bytes, Metaspace::reserve_alignment(), large_pages, shared_base, 0);
+    _rs = ReservedSpace(bytes, Metaspace::reserve_alignment(), large_pages, shared_base);
     if (_rs.is_reserved()) {
       assert(shared_base == 0 || _rs.base() == shared_base, "should match");
     } else {
@@ -3025,7 +3025,7 @@
   ReservedSpace metaspace_rs = ReservedSpace(compressed_class_space_size(),
                                              _reserve_alignment,
                                              large_pages,
-                                             requested_addr, 0);
+                                             requested_addr);
   if (!metaspace_rs.is_reserved()) {
 #if INCLUDE_CDS
     if (UseSharedSpaces) {
@@ -3039,7 +3039,7 @@
              can_use_cds_with_metaspace_addr(addr + increment, cds_base)) {
         addr = addr + increment;
         metaspace_rs = ReservedSpace(compressed_class_space_size(),
-                                     _reserve_alignment, large_pages, addr, 0);
+                                     _reserve_alignment, large_pages, addr);
       }
     }
 #endif
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -48,6 +48,8 @@
 
 ReservedSpace* MetaspaceShared::_shared_rs = NULL;
 
+MetaspaceSharedStats MetaspaceShared::_stats;
+
 bool MetaspaceShared::_link_classes_made_progress;
 bool MetaspaceShared::_check_classes_made_progress;
 bool MetaspaceShared::_has_error_classes;
@@ -259,7 +261,7 @@
 #define SHAREDSPACE_OBJ_TYPES_DO(f) \
   METASPACE_OBJ_TYPES_DO(f) \
   f(SymbolHashentry) \
-  f(SymbolBuckets) \
+  f(SymbolBucket) \
   f(Other)
 
 #define SHAREDSPACE_OBJ_TYPE_DECLARE(name) name ## Type,
@@ -315,18 +317,16 @@
   int other_bytes = md_all + mc_all;
 
   // Calculate size of data that was not allocated by Metaspace::allocate()
-  int symbol_count = _counts[RO][MetaspaceObj::SymbolType];
-  int symhash_bytes = symbol_count * sizeof (HashtableEntry<Symbol*, mtSymbol>);
-  int symbuck_count = SymbolTable::the_table()->table_size();
-  int symbuck_bytes = symbuck_count * sizeof(HashtableBucket<mtSymbol>);
+  MetaspaceSharedStats *stats = MetaspaceShared::stats();
 
-  _counts[RW][SymbolHashentryType] = symbol_count;
-  _bytes [RW][SymbolHashentryType] = symhash_bytes;
-  other_bytes -= symhash_bytes;
+  // symbols
+  _counts[RW][SymbolHashentryType] = stats->symbol.hashentry_count;
+  _bytes [RW][SymbolHashentryType] = stats->symbol.hashentry_bytes;
+  other_bytes -= stats->symbol.hashentry_bytes;
 
-  _counts[RW][SymbolBucketsType] = symbuck_count;
-  _bytes [RW][SymbolBucketsType] = symbuck_bytes;
-  other_bytes -= symbuck_bytes;
+  _counts[RW][SymbolBucketType] = stats->symbol.bucket_count;
+  _bytes [RW][SymbolBucketType] = stats->symbol.bucket_bytes;
+  other_bytes -= stats->symbol.bucket_bytes;
 
   // TODO: count things like dictionary, vtable, etc
   _bytes[RW][OtherType] =  other_bytes;
@@ -424,6 +424,13 @@
 
   VMOp_Type type() const { return VMOp_PopulateDumpSharedSpace; }
   void doit();   // outline because gdb sucks
+
+private:
+  void handle_misc_data_space_failure(bool success) {
+    if (!success) {
+      report_out_of_shared_space(SharedMiscData);
+    }
+  }
 }; // class VM_PopulateDumpSharedSpace
 
 
@@ -517,9 +524,8 @@
   // buckets first [read-write], then copy the linked lists of entries
   // [read-only].
 
-  SymbolTable::reverse(md_top);
   NOT_PRODUCT(SymbolTable::verify());
-  SymbolTable::copy_buckets(&md_top, md_end);
+  handle_misc_data_space_failure(SymbolTable::copy_compact_table(&md_top, md_end));
 
   SystemDictionary::reverse();
   SystemDictionary::copy_buckets(&md_top, md_end);
@@ -528,7 +534,6 @@
   ClassLoader::copy_package_info_buckets(&md_top, md_end);
   ClassLoader::verify();
 
-  SymbolTable::copy_table(&md_top, md_end);
   SystemDictionary::copy_table(&md_top, md_end);
   ClassLoader::verify();
   ClassLoader::copy_package_info_table(&md_top, md_end);
@@ -1000,17 +1005,12 @@
   buffer += sizeof(intptr_t);
   buffer += vtable_size;
 
-  // Create the symbol table using the bucket array at this spot in the
-  // misc data space.  Since the symbol table is often modified, this
-  // region (of mapped pages) will be copy-on-write.
+  // Create the shared symbol table using the bucket array at this spot in the
+  // misc data space. (Todo: move this to read-only space. Currently
+  // this is mapped copy-on-write but will never be written into).
 
-  int symbolTableLen = *(intptr_t*)buffer;
-  buffer += sizeof(intptr_t);
-  int number_of_entries = *(intptr_t*)buffer;
-  buffer += sizeof(intptr_t);
-  SymbolTable::create_table((HashtableBucket<mtSymbol>*)buffer, symbolTableLen,
-                            number_of_entries);
-  buffer += symbolTableLen;
+  buffer = (char*)SymbolTable::init_shared_table(buffer);
+  SymbolTable::create_table();
 
   // Create the shared dictionary using the bucket array at this spot in
   // the misc data space.  Since the shared dictionary table is never
@@ -1019,7 +1019,7 @@
 
   int sharedDictionaryLen = *(intptr_t*)buffer;
   buffer += sizeof(intptr_t);
-  number_of_entries = *(intptr_t*)buffer;
+  int number_of_entries = *(intptr_t*)buffer;
   buffer += sizeof(intptr_t);
   SystemDictionary::set_shared_dictionary((HashtableBucket<mtClass>*)buffer,
                                           sharedDictionaryLen,
@@ -1041,18 +1041,10 @@
   ClassLoader::verify();
 
   // The following data in the shared misc data region are the linked
-  // list elements (HashtableEntry objects) for the symbol table, string
-  // table, and shared dictionary.  The heap objects referred to by the
-  // symbol table, string table, and shared dictionary are permanent and
-  // unmovable.  Since new entries added to the string and symbol tables
-  // are always added at the beginning of the linked lists, THESE LINKED
-  // LIST ELEMENTS ARE READ-ONLY.
+  // list elements (HashtableEntry objects) for the shared dictionary
+  // and package info table.
 
-  int len = *(intptr_t*)buffer; // skip over symbol table entries
-  buffer += sizeof(intptr_t);
-  buffer += len;
-
-  len = *(intptr_t*)buffer;     // skip over shared dictionary entries
+  int len = *(intptr_t*)buffer;     // skip over shared dictionary entries
   buffer += sizeof(intptr_t);
   buffer += len;
 
--- a/hotspot/src/share/vm/memory/metaspaceShared.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/memory/metaspaceShared.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -24,6 +24,7 @@
 #ifndef SHARE_VM_MEMORY_METASPACE_SHARED_HPP
 #define SHARE_VM_MEMORY_METASPACE_SHARED_HPP
 
+#include "classfile/compactHashtable.hpp"
 #include "memory/allocation.hpp"
 #include "memory/memRegion.hpp"
 #include "runtime/virtualspace.hpp"
@@ -45,12 +46,21 @@
 
 class FileMapInfo;
 
+class MetaspaceSharedStats VALUE_OBJ_CLASS_SPEC {
+public:
+  MetaspaceSharedStats() {
+    memset(this, 0, sizeof(*this));
+  }
+  CompactHashtableStats symbol;
+};
+
 // Class Data Sharing Support
 class MetaspaceShared : AllStatic {
 
   // CDS support
   static ReservedSpace* _shared_rs;
   static int _max_alignment;
+  static MetaspaceSharedStats _stats;
   static bool _link_classes_made_progress;
   static bool _check_classes_made_progress;
   static bool _has_error_classes;
@@ -123,6 +133,10 @@
                                       char** mc_top, char* mc_end);
   static void serialize(SerializeClosure* sc);
 
+  static MetaspaceSharedStats* stats() {
+    return &_stats;
+  }
+
   // JVM/TI RedefineClasses() support:
   // Remap the shared readonly space to shared readwrite, private if
   // sharing is enabled. Simply returns true if sharing is not enabled
--- a/hotspot/src/share/vm/memory/referenceProcessor.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/memory/referenceProcessor.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -68,10 +68,10 @@
   _pending_list_uses_discovered_field = JDK_Version::current().pending_list_uses_discovered_field();
 }
 
-void ReferenceProcessor::enable_discovery(bool verify_disabled, bool check_no_refs) {
+void ReferenceProcessor::enable_discovery(bool check_no_refs) {
 #ifdef ASSERT
   // Verify that we're not currently discovering refs
-  assert(!verify_disabled || !_discovering_refs, "nested call?");
+  assert(!_discovering_refs, "nested call?");
 
   if (check_no_refs) {
     // Verify that the discovered lists are empty
@@ -963,52 +963,6 @@
   return total_list_count;
 }
 
-void ReferenceProcessor::clean_up_discovered_references() {
-  // loop over the lists
-  for (uint i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
-    if (TraceReferenceGC && PrintGCDetails && ((i % _max_num_q) == 0)) {
-      gclog_or_tty->print_cr(
-        "\nScrubbing %s discovered list of Null referents",
-        list_name(i));
-    }
-    clean_up_discovered_reflist(_discovered_refs[i]);
-  }
-}
-
-void ReferenceProcessor::clean_up_discovered_reflist(DiscoveredList& refs_list) {
-  assert(!discovery_is_atomic(), "Else why call this method?");
-  DiscoveredListIterator iter(refs_list, NULL, NULL);
-  while (iter.has_next()) {
-    iter.load_ptrs(DEBUG_ONLY(true /* allow_null_referent */));
-    oop next = java_lang_ref_Reference::next(iter.obj());
-    assert(next->is_oop_or_null(), err_msg("Expected an oop or NULL for next field at " PTR_FORMAT, p2i(next)));
-    // If referent has been cleared or Reference is not active,
-    // drop it.
-    if (iter.referent() == NULL || next != NULL) {
-      debug_only(
-        if (PrintGCDetails && TraceReferenceGC) {
-          gclog_or_tty->print_cr("clean_up_discovered_list: Dropping Reference: "
-            INTPTR_FORMAT " with next field: " INTPTR_FORMAT
-            " and referent: " INTPTR_FORMAT,
-            (void *)iter.obj(), (void *)next, (void *)iter.referent());
-        }
-      )
-      // Remove Reference object from list
-      iter.remove();
-      iter.move_to_next();
-    } else {
-      iter.next();
-    }
-  }
-  NOT_PRODUCT(
-    if (PrintGCDetails && TraceReferenceGC) {
-      gclog_or_tty->print(
-        " Removed %d Refs with NULL referents out of %d discovered Refs",
-        iter.removed(), iter.processed());
-    }
-  )
-}
-
 inline DiscoveredList* ReferenceProcessor::get_discovered_list(ReferenceType rt) {
   uint id = 0;
   // Determine the queue index to use for this object.
--- a/hotspot/src/share/vm/memory/referenceProcessor.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/memory/referenceProcessor.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -353,19 +353,6 @@
                                       GCTimer*           gc_timer,
                                       GCId               gc_id);
 
-  // Delete entries in the discovered lists that have
-  // either a null referent or are not active. Such
-  // Reference objects can result from the clearing
-  // or enqueueing of Reference objects concurrent
-  // with their discovery by a (concurrent) collector.
-  // For a definition of "active" see java.lang.ref.Reference;
-  // Refs are born active, become inactive when enqueued,
-  // and never become active again. The state of being
-  // active is encoded as follows: A Ref is active
-  // if and only if its "next" field is NULL.
-  void clean_up_discovered_references();
-  void clean_up_discovered_reflist(DiscoveredList& refs_list);
-
   // Returns the name of the discovered reference list
   // occupying the i / _num_q slot.
   const char* list_name(uint i);
@@ -439,7 +426,7 @@
   void      set_span(MemRegion span) { _span = span; }
 
   // start and stop weak ref discovery
-  void enable_discovery(bool verify_disabled, bool check_no_refs);
+  void enable_discovery(bool check_no_refs = true);
   void disable_discovery()  { _discovering_refs = false; }
   bool discovery_enabled()  { return _discovering_refs;  }
 
@@ -517,7 +504,7 @@
 
   ~NoRefDiscovery() {
     if (_was_discovering_refs) {
-      _rp->enable_discovery(true /*verify_disabled*/, false /*check_no_refs*/);
+      _rp->enable_discovery(false /*check_no_refs*/);
     }
   }
 };
--- a/hotspot/src/share/vm/memory/sharedHeap.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/memory/sharedHeap.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -58,7 +58,6 @@
 SharedHeap::SharedHeap(CollectorPolicy* policy_) :
   CollectedHeap(),
   _collector_policy(policy_),
-  _rem_set(NULL),
   _strong_roots_scope(NULL),
   _strong_roots_parity(0),
   _process_strong_tasks(new SubTasksDone(SH_PS_NumElements)),
--- a/hotspot/src/share/vm/memory/sharedHeap.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/memory/sharedHeap.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -114,10 +114,6 @@
   // set the static pointer "_sh" to that instance.
   static SharedHeap* _sh;
 
-  // and the Gen Remembered Set, at least one good enough to scan the perm
-  // gen.
-  GenRemSet* _rem_set;
-
   // A gc policy, controls global gc resource issues
   CollectorPolicy *_collector_policy;
 
@@ -152,10 +148,6 @@
   // Initialization of ("weak") reference processing support
   virtual void ref_processing_init();
 
-  // This function returns the "GenRemSet" object that allows us to scan
-  // generations in a fully generational heap.
-  GenRemSet* rem_set() { return _rem_set; }
-
   // Iteration functions.
   void oop_iterate(ExtendedOopClosure* cl) = 0;
 
--- a/hotspot/src/share/vm/memory/universe.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/memory/universe.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, 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
@@ -694,103 +694,6 @@
 //     NarrowOopHeapBaseMin + heap_size < 32Gb
 // HeapBased - Use compressed oops with heap base + encoding.
 
-// 4Gb
-static const uint64_t UnscaledOopHeapMax = (uint64_t(max_juint) + 1);
-// 32Gb
-// OopEncodingHeapMax == UnscaledOopHeapMax << LogMinObjAlignmentInBytes;
-
-char* Universe::preferred_heap_base(size_t heap_size, size_t alignment, NARROW_OOP_MODE mode) {
-  assert(is_size_aligned((size_t)OopEncodingHeapMax, alignment), "Must be");
-  assert(is_size_aligned((size_t)UnscaledOopHeapMax, alignment), "Must be");
-  assert(is_size_aligned(heap_size, alignment), "Must be");
-
-  uintx heap_base_min_address_aligned = align_size_up(HeapBaseMinAddress, alignment);
-
-  size_t base = 0;
-#ifdef _LP64
-  if (UseCompressedOops) {
-    assert(mode == UnscaledNarrowOop  ||
-           mode == ZeroBasedNarrowOop ||
-           mode == HeapBasedNarrowOop, "mode is invalid");
-    const size_t total_size = heap_size + heap_base_min_address_aligned;
-    // Return specified base for the first request.
-    if (!FLAG_IS_DEFAULT(HeapBaseMinAddress) && (mode == UnscaledNarrowOop)) {
-      base = heap_base_min_address_aligned;
-
-    // If the total size is small enough to allow UnscaledNarrowOop then
-    // just use UnscaledNarrowOop.
-    } else if ((total_size <= OopEncodingHeapMax) && (mode != HeapBasedNarrowOop)) {
-      if ((total_size <= UnscaledOopHeapMax) && (mode == UnscaledNarrowOop) &&
-          (Universe::narrow_oop_shift() == 0)) {
-        // Use 32-bits oops without encoding and
-        // place heap's top on the 4Gb boundary
-        base = (UnscaledOopHeapMax - heap_size);
-      } else {
-        // Can't reserve with NarrowOopShift == 0
-        Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
-
-        if (mode == UnscaledNarrowOop ||
-            mode == ZeroBasedNarrowOop && total_size <= UnscaledOopHeapMax) {
-
-          // Use zero based compressed oops with encoding and
-          // place heap's top on the 32Gb boundary in case
-          // total_size > 4Gb or failed to reserve below 4Gb.
-          uint64_t heap_top = OopEncodingHeapMax;
-
-          // For small heaps, save some space for compressed class pointer
-          // space so it can be decoded with no base.
-          if (UseCompressedClassPointers && !UseSharedSpaces &&
-              OopEncodingHeapMax <= 32*G) {
-
-            uint64_t class_space = align_size_up(CompressedClassSpaceSize, alignment);
-            assert(is_size_aligned((size_t)OopEncodingHeapMax-class_space,
-                   alignment), "difference must be aligned too");
-            uint64_t new_top = OopEncodingHeapMax-class_space;
-
-            if (total_size <= new_top) {
-              heap_top = new_top;
-            }
-          }
-
-          // Align base to the adjusted top of the heap
-          base = heap_top - heap_size;
-        }
-      }
-    } else {
-      // UnscaledNarrowOop encoding didn't work, and no base was found for ZeroBasedOops or
-      // HeapBasedNarrowOop encoding was requested.  So, can't reserve below 32Gb.
-      Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
-    }
-
-    // Set narrow_oop_base and narrow_oop_use_implicit_null_checks
-    // used in ReservedHeapSpace() constructors.
-    // The final values will be set in initialize_heap() below.
-    if ((base != 0) && ((base + heap_size) <= OopEncodingHeapMax)) {
-      // Use zero based compressed oops
-      Universe::set_narrow_oop_base(NULL);
-      // Don't need guard page for implicit checks in indexed
-      // addressing mode with zero based Compressed Oops.
-      Universe::set_narrow_oop_use_implicit_null_checks(true);
-    } else {
-      // Set to a non-NULL value so the ReservedSpace ctor computes
-      // the correct no-access prefix.
-      // The final value will be set in initialize_heap() below.
-      Universe::set_narrow_oop_base((address)UnscaledOopHeapMax);
-#if defined(_WIN64) || defined(AIX)
-      if (UseLargePages) {
-        // Cannot allocate guard pages for implicit checks in indexed
-        // addressing mode when large pages are specified on windows.
-        Universe::set_narrow_oop_use_implicit_null_checks(false);
-      }
-#endif //  _WIN64
-    }
-  }
-#endif
-
-  assert(is_ptr_aligned((char*)base, alignment), "Must be");
-  return (char*)base; // also return NULL (don't care) for 32-bit VM
-}
-
 jint Universe::initialize_heap() {
 
   if (UseParallelGC) {
@@ -844,30 +747,13 @@
     // See needs_explicit_null_check.
     // Only set the heap base for compressed oops because it indicates
     // compressed oops for pstack code.
-    if (((uint64_t)Universe::heap()->reserved_region().end() > OopEncodingHeapMax)) {
-      // Can't reserve heap below 32Gb.
-      // keep the Universe::narrow_oop_base() set in Universe::reserve_heap()
+    if ((uint64_t)Universe::heap()->reserved_region().end() > UnscaledOopHeapMax) {
+      // Didn't reserve heap below 4Gb.  Must shift.
       Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
-#ifdef AIX
-      // There is no protected page before the heap. This assures all oops
-      // are decoded so that NULL is preserved, so this page will not be accessed.
-      Universe::set_narrow_oop_use_implicit_null_checks(false);
-#endif
-    } else {
+    }
+    if ((uint64_t)Universe::heap()->reserved_region().end() <= OopEncodingHeapMax) {
+      // Did reserve heap below 32Gb. Can use base == 0;
       Universe::set_narrow_oop_base(0);
-#ifdef _WIN64
-      if (!Universe::narrow_oop_use_implicit_null_checks()) {
-        // Don't need guard page for implicit checks in indexed addressing
-        // mode with zero based Compressed Oops.
-        Universe::set_narrow_oop_use_implicit_null_checks(true);
-      }
-#endif //  _WIN64
-      if((uint64_t)Universe::heap()->reserved_region().end() > UnscaledOopHeapMax) {
-        // Can't reserve heap below 4Gb.
-        Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
-      } else {
-        Universe::set_narrow_oop_shift(0);
-      }
     }
 
     Universe::set_narrow_ptrs_base(Universe::narrow_oop_base());
@@ -875,6 +761,11 @@
     if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) {
       Universe::print_compressed_oops_mode();
     }
+
+    // Tell tests in which mode we run.
+    Arguments::PropertyList_add(new SystemProperty("java.vm.compressedOopsMode",
+                                                   narrow_oop_mode_to_string(narrow_oop_mode()),
+                                                   false));
   }
   // Universe::narrow_oop_base() is one page below the heap.
   assert((intptr_t)Universe::narrow_oop_base() <= (intptr_t)(Universe::heap()->base() -
@@ -903,22 +794,27 @@
   tty->print(", Compressed Oops mode: %s", narrow_oop_mode_to_string(narrow_oop_mode()));
 
   if (Universe::narrow_oop_base() != 0) {
-    tty->print(":" PTR_FORMAT, Universe::narrow_oop_base());
+    tty->print(": " PTR_FORMAT, Universe::narrow_oop_base());
   }
 
   if (Universe::narrow_oop_shift() != 0) {
     tty->print(", Oop shift amount: %d", Universe::narrow_oop_shift());
   }
 
+  if (!Universe::narrow_oop_use_implicit_null_checks()) {
+    tty->print(", no protected page in front of the heap");
+  }
+
   tty->cr();
   tty->cr();
 }
 
-// Reserve the Java heap, which is now the same for all GCs.
 ReservedSpace Universe::reserve_heap(size_t heap_size, size_t alignment) {
+
   assert(alignment <= Arguments::conservative_max_heap_alignment(),
       err_msg("actual alignment "SIZE_FORMAT" must be within maximum heap alignment "SIZE_FORMAT,
           alignment, Arguments::conservative_max_heap_alignment()));
+
   size_t total_reserved = align_size_up(heap_size, alignment);
   assert(!UseCompressedOops || (total_reserved <= (OopEncodingHeapMax - os::vm_page_size())),
       "heap size is too big for compressed oops");
@@ -928,46 +824,31 @@
       || UseParallelGC
       || use_large_pages, "Wrong alignment to use large pages");
 
-  char* addr = Universe::preferred_heap_base(total_reserved, alignment, Universe::UnscaledNarrowOop);
-
-  ReservedHeapSpace total_rs(total_reserved, alignment, use_large_pages, addr);
+  // Now create the space.
+  ReservedHeapSpace total_rs(total_reserved, alignment, use_large_pages);
 
-  if (UseCompressedOops) {
-    if (addr != NULL && !total_rs.is_reserved()) {
-      // Failed to reserve at specified address - the requested memory
-      // region is taken already, for example, by 'java' launcher.
-      // Try again to reserver heap higher.
-      addr = Universe::preferred_heap_base(total_reserved, alignment, Universe::ZeroBasedNarrowOop);
-
-      ReservedHeapSpace total_rs0(total_reserved, alignment,
-          use_large_pages, addr);
+  if (total_rs.is_reserved()) {
+    assert((total_reserved == total_rs.size()) && ((uintptr_t)total_rs.base() % alignment == 0),
+           "must be exactly of required size and alignment");
+    // We are good.
 
-      if (addr != NULL && !total_rs0.is_reserved()) {
-        // Failed to reserve at specified address again - give up.
-        addr = Universe::preferred_heap_base(total_reserved, alignment, Universe::HeapBasedNarrowOop);
-        assert(addr == NULL, "");
+    if (UseCompressedOops) {
+      // Universe::initialize_heap() will reset this to NULL if unscaled
+      // or zero-based narrow oops are actually used.
+      // Else heap start and base MUST differ, so that NULL can be encoded nonambigous.
+      Universe::set_narrow_oop_base((address)total_rs.compressed_oop_base());
+    }
 
-        ReservedHeapSpace total_rs1(total_reserved, alignment,
-            use_large_pages, addr);
-        total_rs = total_rs1;
-      } else {
-        total_rs = total_rs0;
-      }
-    }
-  }
-
-  if (!total_rs.is_reserved()) {
-    vm_exit_during_initialization(err_msg("Could not reserve enough space for " SIZE_FORMAT "KB object heap", total_reserved/K));
     return total_rs;
   }
 
-  if (UseCompressedOops) {
-    // Universe::initialize_heap() will reset this to NULL if unscaled
-    // or zero-based narrow oops are actually used.
-    address base = (address)(total_rs.base() - os::vm_page_size());
-    Universe::set_narrow_oop_base(base);
-  }
-  return total_rs;
+  vm_exit_during_initialization(
+    err_msg("Could not reserve enough space for " SIZE_FORMAT "KB object heap",
+            total_reserved/K));
+
+  // satisfy compiler
+  ShouldNotReachHere();
+  return ReservedHeapSpace(0, 0, false);
 }
 
 
@@ -985,6 +866,8 @@
       return "32-bit";
     case ZeroBasedNarrowOop:
       return "Zero based";
+    case DisjointBaseNarrowOop:
+      return "Non-zero disjoint base";
     case HeapBasedNarrowOop:
       return "Non-zero based";
   }
@@ -995,6 +878,10 @@
 
 
 Universe::NARROW_OOP_MODE Universe::narrow_oop_mode() {
+  if (narrow_oop_base_disjoint()) {
+    return DisjointBaseNarrowOop;
+  }
+
   if (narrow_oop_base() != 0) {
     return HeapBasedNarrowOop;
   }
@@ -1176,9 +1063,7 @@
 
   MemoryService::set_universe_heap(Universe::_collectedHeap);
 #if INCLUDE_CDS
-  if (UseSharedSpaces) {
-    SharedClassUtil::initialize(CHECK_false);
-  }
+  SharedClassUtil::initialize(CHECK_false);
 #endif
   return true;
 }
@@ -1189,119 +1074,6 @@
 }
 
 
-// %%% The Universe::flush_foo methods belong in CodeCache.
-
-// Flushes compiled methods dependent on dependee.
-void Universe::flush_dependents_on(instanceKlassHandle dependee) {
-  assert_lock_strong(Compile_lock);
-
-  if (CodeCache::number_of_nmethods_with_dependencies() == 0) return;
-
-  // CodeCache can only be updated by a thread_in_VM and they will all be
-  // stopped during the safepoint so CodeCache will be safe to update without
-  // holding the CodeCache_lock.
-
-  KlassDepChange changes(dependee);
-
-  // Compute the dependent nmethods
-  if (CodeCache::mark_for_deoptimization(changes) > 0) {
-    // At least one nmethod has been marked for deoptimization
-    VM_Deoptimize op;
-    VMThread::execute(&op);
-  }
-}
-
-// Flushes compiled methods dependent on a particular CallSite
-// instance when its target is different than the given MethodHandle.
-void Universe::flush_dependents_on(Handle call_site, Handle method_handle) {
-  assert_lock_strong(Compile_lock);
-
-  if (CodeCache::number_of_nmethods_with_dependencies() == 0) return;
-
-  // CodeCache can only be updated by a thread_in_VM and they will all be
-  // stopped during the safepoint so CodeCache will be safe to update without
-  // holding the CodeCache_lock.
-
-  CallSiteDepChange changes(call_site(), method_handle());
-
-  // Compute the dependent nmethods that have a reference to a
-  // CallSite object.  We use InstanceKlass::mark_dependent_nmethod
-  // directly instead of CodeCache::mark_for_deoptimization because we
-  // want dependents on the call site class only not all classes in
-  // the ContextStream.
-  int marked = 0;
-  {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
-    InstanceKlass* call_site_klass = InstanceKlass::cast(call_site->klass());
-    marked = call_site_klass->mark_dependent_nmethods(changes);
-  }
-  if (marked > 0) {
-    // At least one nmethod has been marked for deoptimization
-    VM_Deoptimize op;
-    VMThread::execute(&op);
-  }
-}
-
-#ifdef HOTSWAP
-// Flushes compiled methods dependent on dependee in the evolutionary sense
-void Universe::flush_evol_dependents_on(instanceKlassHandle ev_k_h) {
-  // --- Compile_lock is not held. However we are at a safepoint.
-  assert_locked_or_safepoint(Compile_lock);
-  if (CodeCache::number_of_nmethods_with_dependencies() == 0) return;
-
-  // CodeCache can only be updated by a thread_in_VM and they will all be
-  // stopped during the safepoint so CodeCache will be safe to update without
-  // holding the CodeCache_lock.
-
-  // Compute the dependent nmethods
-  if (CodeCache::mark_for_evol_deoptimization(ev_k_h) > 0) {
-    // At least one nmethod has been marked for deoptimization
-
-    // All this already happens inside a VM_Operation, so we'll do all the work here.
-    // Stuff copied from VM_Deoptimize and modified slightly.
-
-    // We do not want any GCs to happen while we are in the middle of this VM operation
-    ResourceMark rm;
-    DeoptimizationMarker dm;
-
-    // Deoptimize all activations depending on marked nmethods
-    Deoptimization::deoptimize_dependents();
-
-    // Make the dependent methods not entrant (in VM_Deoptimize they are made zombies)
-    CodeCache::make_marked_nmethods_not_entrant();
-  }
-}
-#endif // HOTSWAP
-
-
-// Flushes compiled methods dependent on dependee
-void Universe::flush_dependents_on_method(methodHandle m_h) {
-  // --- Compile_lock is not held. However we are at a safepoint.
-  assert_locked_or_safepoint(Compile_lock);
-
-  // CodeCache can only be updated by a thread_in_VM and they will all be
-  // stopped dring the safepoint so CodeCache will be safe to update without
-  // holding the CodeCache_lock.
-
-  // Compute the dependent nmethods
-  if (CodeCache::mark_for_deoptimization(m_h()) > 0) {
-    // At least one nmethod has been marked for deoptimization
-
-    // All this already happens inside a VM_Operation, so we'll do all the work here.
-    // Stuff copied from VM_Deoptimize and modified slightly.
-
-    // We do not want any GCs to happen while we are in the middle of this VM operation
-    ResourceMark rm;
-    DeoptimizationMarker dm;
-
-    // Deoptimize all activations depending on marked nmethods
-    Deoptimization::deoptimize_dependents();
-
-    // Make the dependent methods not entrant (in VM_Deoptimize they are made zombies)
-    CodeCache::make_marked_nmethods_not_entrant();
-  }
-}
-
 void Universe::print() {
   print_on(gclog_or_tty);
 }
--- a/hotspot/src/share/vm/memory/universe.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/memory/universe.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -102,8 +102,8 @@
   friend class MarkSweep;
   friend class oopDesc;
   friend class ClassLoader;
-  friend class Arguments;
   friend class SystemDictionary;
+  friend class ReservedHeapSpace;
   friend class VMStructs;
   friend class VM_PopulateDumpSharedSpace;
   friend class Metaspace;
@@ -351,17 +351,40 @@
   //     NarrowOopHeapBaseMin + heap_size < 4Gb
   // 1 - Use zero based compressed oops with encoding when
   //     NarrowOopHeapBaseMin + heap_size < 32Gb
-  // 2 - Use compressed oops with heap base + encoding.
+  // 2 - Use compressed oops with disjoint heap base if
+  //     base is 32G-aligned and base > 0. This allows certain
+  //     optimizations in encoding/decoding.
+  //     Disjoint: Bits used in base are disjoint from bits used
+  //     for oops ==> oop = (cOop << 3) | base.  One can disjoint
+  //     the bits of an oop into base and compressed oop.
+  // 3 - Use compressed oops with heap base + encoding.
   enum NARROW_OOP_MODE {
     UnscaledNarrowOop  = 0,
     ZeroBasedNarrowOop = 1,
-    HeapBasedNarrowOop = 2
+    DisjointBaseNarrowOop = 2,
+    HeapBasedNarrowOop = 3,
+    AnyNarrowOopMode = 4
   };
   static NARROW_OOP_MODE narrow_oop_mode();
   static const char* narrow_oop_mode_to_string(NARROW_OOP_MODE mode);
   static char*    preferred_heap_base(size_t heap_size, size_t alignment, NARROW_OOP_MODE mode);
   static char*    preferred_metaspace_base(size_t heap_size, NARROW_OOP_MODE mode);
-  static address  narrow_oop_base()                       { return  _narrow_oop._base; }
+  static address  narrow_oop_base()                  { return  _narrow_oop._base; }
+  // Test whether bits of addr and possible offsets into the heap overlap.
+  static bool     is_disjoint_heap_base_address(address addr) {
+    return (((uint64_t)(intptr_t)addr) &
+            (((uint64_t)UCONST64(0xFFFFffffFFFFffff)) >> (32-LogMinObjAlignmentInBytes))) == 0;
+  }
+  // Check for disjoint base compressed oops.
+  static bool     narrow_oop_base_disjoint()        {
+    return _narrow_oop._base != NULL && is_disjoint_heap_base_address(_narrow_oop._base);
+  }
+  // Check for real heapbased compressed oops.
+  // We must subtract the base as the bits overlap.
+  // If we negate above function, we also get unscaled and zerobased.
+  static bool     narrow_oop_base_overlaps()          {
+    return _narrow_oop._base != NULL && !is_disjoint_heap_base_address(_narrow_oop._base);
+  }
   static bool  is_narrow_oop_base(void* addr)             { return (narrow_oop_base() == (address)addr); }
   static int      narrow_oop_shift()                      { return  _narrow_oop._shift; }
   static bool     narrow_oop_use_implicit_null_checks()   { return  _narrow_oop._use_implicit_null_checks; }
@@ -461,16 +484,6 @@
   static uintptr_t verify_mark_bits()         PRODUCT_RETURN0;
   static uintptr_t verify_mark_mask()         PRODUCT_RETURN0;
 
-  // Flushing and deoptimization
-  static void flush_dependents_on(instanceKlassHandle dependee);
-  static void flush_dependents_on(Handle call_site, Handle method_handle);
-#ifdef HOTSWAP
-  // Flushing and deoptimization in case of evolution
-  static void flush_evol_dependents_on(instanceKlassHandle dependee);
-#endif // HOTSWAP
-  // Support for fullspeed debugging
-  static void flush_dependents_on_method(methodHandle dependee);
-
   // Compiler support
   static int base_vtable_size()               { return _base_vtable_size; }
 };
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -3543,11 +3543,12 @@
               ("purge: %s(%s): prev method @%d in version @%d is alive",
               method->name()->as_C_string(),
               method->signature()->as_C_string(), j, version));
+#ifdef ASSERT
             if (method->method_data() != NULL) {
-              // Clean out any weak method links for running methods
-              // (also should include not EMCP methods)
-              method->method_data()->clean_weak_method_links();
+              // Verify MethodData for running methods don't refer to old methods.
+              method->method_data()->verify_clean_weak_method_links();
             }
+#endif // ASSERT
           }
         }
       }
@@ -3561,15 +3562,17 @@
       deleted_count));
   }
 
-  // Clean MethodData of this class's methods so they don't refer to
+#ifdef ASSERT
+  // Verify clean MethodData for this class's methods, e.g. they don't refer to
   // old methods that are no longer running.
   Array<Method*>* methods = ik->methods();
   int num_methods = methods->length();
-  for (int index2 = 0; index2 < num_methods; ++index2) {
-    if (methods->at(index2)->method_data() != NULL) {
-      methods->at(index2)->method_data()->clean_weak_method_links();
+  for (int index = 0; index < num_methods; ++index) {
+    if (methods->at(index)->method_data() != NULL) {
+      methods->at(index)->method_data()->verify_clean_weak_method_links();
     }
   }
+#endif // ASSERT
 }
 
 void InstanceKlass::mark_newly_obsolete_methods(Array<Method*>* old_methods,
--- a/hotspot/src/share/vm/oops/klassVtable.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/oops/klassVtable.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, 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
@@ -100,17 +100,21 @@
     vtable_length = Universe::base_vtable_size();
   }
 
-  if (super == NULL && !Universe::is_bootstrapping() &&
-      vtable_length != Universe::base_vtable_size()) {
-    // Someone is attempting to redefine java.lang.Object incorrectly.  The
-    // only way this should happen is from
-    // SystemDictionary::resolve_from_stream(), which will detect this later
-    // and throw a security exception.  So don't assert here to let
-    // the exception occur.
-    vtable_length = Universe::base_vtable_size();
+  if (super == NULL && vtable_length != Universe::base_vtable_size()) {
+    if (Universe::is_bootstrapping()) {
+      // Someone is attempting to override java.lang.Object incorrectly on the
+      // bootclasspath.  The JVM cannot recover from this error including throwing
+      // an exception
+      vm_exit_during_initialization("Incompatible definition of java.lang.Object");
+    } else {
+      // Someone is attempting to redefine java.lang.Object incorrectly.  The
+      // only way this should happen is from
+      // SystemDictionary::resolve_from_stream(), which will detect this later
+      // and throw a security exception.  So don't assert here to let
+      // the exception occur.
+      vtable_length = Universe::base_vtable_size();
+    }
   }
-  assert(super != NULL || vtable_length == Universe::base_vtable_size(),
-         "bad vtable size for class Object");
   assert(vtable_length % vtableEntry::size() == 0, "bad vtable length");
   assert(vtable_length >= Universe::base_vtable_size(), "vtable too small");
 
--- a/hotspot/src/share/vm/oops/method.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/oops/method.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, 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
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "classfile/metadataOnStackMark.hpp"
 #include "classfile/systemDictionary.hpp"
+#include "code/codeCache.hpp"
 #include "code/debugInfoRec.hpp"
 #include "gc_interface/collectedHeap.inline.hpp"
 #include "interpreter/bytecodeStream.hpp"
@@ -1727,7 +1728,7 @@
     // Deoptimize all dependents on this method
     HandleMark hm(thread);
     methodHandle mh(thread, method);
-    Universe::flush_dependents_on_method(mh);
+    CodeCache::flush_dependents_on_method(mh);
   }
 }
 
--- a/hotspot/src/share/vm/oops/methodData.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/oops/methodData.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1283,6 +1283,11 @@
          DataLayout::compute_size_in_bytes(SpeculativeTrapData::static_cell_count()),
          "code needs to be adjusted");
 
+  // Do not create one of these if method has been redefined.
+  if (m != NULL && m->is_old()) {
+    return NULL;
+  }
+
   DataLayout* dp  = extra_data_base();
   DataLayout* end = args_data_limit();
 
@@ -1554,9 +1559,7 @@
 class CleanExtraDataMethodClosure : public CleanExtraDataClosure {
 public:
   CleanExtraDataMethodClosure() {}
-  bool is_live(Method* m) {
-    return !m->is_old() || m->on_stack();
-  }
+  bool is_live(Method* m) { return !m->is_old(); }
 };
 
 
@@ -1658,3 +1661,16 @@
   clean_extra_data(&cl);
   verify_extra_data_clean(&cl);
 }
+
+#ifdef ASSERT
+void MethodData::verify_clean_weak_method_links() {
+  for (ProfileData* data = first_data();
+       is_valid(data);
+       data = next_data(data)) {
+    data->verify_clean_weak_method_links();
+  }
+
+  CleanExtraDataMethodClosure cl;
+  verify_extra_data_clean(&cl);
+}
+#endif // ASSERT
--- a/hotspot/src/share/vm/oops/methodData.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/oops/methodData.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -254,6 +254,7 @@
 
   // Redefinition support
   void clean_weak_method_links();
+  DEBUG_ONLY(void verify_clean_weak_method_links();)
 };
 
 
@@ -511,6 +512,7 @@
 
   // Redefinition support
   virtual void clean_weak_method_links() {}
+  DEBUG_ONLY(virtual void verify_clean_weak_method_links() {})
 
   // CI translation: ProfileData can represent both MethodDataOop data
   // as well as CIMethodData data. This function is provided for translating
@@ -1971,6 +1973,7 @@
   }
 
   void set_method(Method* m) {
+    assert(!m->is_old(), "cannot add old methods");
     set_intptr_at(speculative_trap_method, (intptr_t)m);
   }
 
@@ -2480,6 +2483,7 @@
 
   void clean_method_data(BoolObjectClosure* is_alive);
   void clean_weak_method_links();
+  DEBUG_ONLY(void verify_clean_weak_method_links();)
   Mutex* extra_data_lock() { return &_extra_data_lock; }
 };
 
--- a/hotspot/src/share/vm/opto/matcher.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/opto/matcher.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -433,6 +433,13 @@
   // NullCheck oop_reg
   //
   inline static bool gen_narrow_oop_implicit_null_checks() {
+    // Advice matcher to perform null checks on the narrow oop side.
+    // Implicit checks are not possible on the uncompressed oop side anyway
+    // (at least not for read accesses).
+    // Performs significantly better (especially on Power 6).
+    if (!os::zero_page_read_protected()) {
+      return true;
+    }
     return Universe::narrow_oop_use_implicit_null_checks() &&
            (narrow_oop_use_complex_address() ||
             Universe::narrow_oop_base() != NULL);
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -148,6 +148,10 @@
     _scratch_classes[i] = NULL;
   }
 
+  // Clean out MethodData pointing to old Method*
+  MethodDataCleaner clean_weak_method_links;
+  ClassLoaderDataGraph::classes_do(&clean_weak_method_links);
+
   // Disable any dependent concurrent compilations
   SystemDictionary::notice_modification();
 
@@ -155,8 +159,8 @@
   // See jvmtiExport.hpp for detailed explanation.
   JvmtiExport::set_has_redefined_a_class();
 
-// check_class() is optionally called for product bits, but is
-// always called for non-product bits.
+  // check_class() is optionally called for product bits, but is
+  // always called for non-product bits.
 #ifdef PRODUCT
   if (RC_TRACE_ENABLED(0x00004000)) {
 #endif
@@ -3445,6 +3449,22 @@
   }
 }
 
+// Clean method data for this class
+void VM_RedefineClasses::MethodDataCleaner::do_klass(Klass* k) {
+  if (k->oop_is_instance()) {
+    InstanceKlass *ik = InstanceKlass::cast(k);
+    // Clean MethodData of this class's methods so they don't refer to
+    // old methods that are no longer running.
+    Array<Method*>* methods = ik->methods();
+    int num_methods = methods->length();
+    for (int index = 0; index < num_methods; ++index) {
+      if (methods->at(index)->method_data() != NULL) {
+        methods->at(index)->method_data()->clean_weak_method_links();
+      }
+    }
+  }
+}
+
 void VM_RedefineClasses::update_jmethod_ids() {
   for (int j = 0; j < _matching_methods_length; ++j) {
     Method* old_method = _matching_old_methods[j];
@@ -3746,7 +3766,7 @@
   // All dependencies have been recorded from startup or this is a second or
   // subsequent use of RedefineClasses
   if (JvmtiExport::all_dependencies_are_recorded()) {
-    Universe::flush_evol_dependents_on(k_h);
+    CodeCache::flush_evol_dependents_on(k_h);
   } else {
     CodeCache::mark_all_nmethods_for_deoptimization();
 
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -511,6 +511,12 @@
     void do_klass(Klass* k);
   };
 
+  // Clean MethodData out
+  class MethodDataCleaner : public KlassClosure {
+   public:
+    MethodDataCleaner() {}
+    void do_klass(Klass* k);
+  };
  public:
   VM_RedefineClasses(jint class_count,
                      const jvmtiClassDefinition *class_defs,
--- a/hotspot/src/share/vm/prims/methodHandles.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/stringTable.hpp"
+#include "code/codeCache.hpp"
 #include "compiler/compileBroker.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/oopMapCache.hpp"
@@ -1245,7 +1246,7 @@
   {
     // Walk all nmethods depending on this call site.
     MutexLocker mu(Compile_lock, thread);
-    Universe::flush_dependents_on(call_site, target);
+    CodeCache::flush_dependents_on(call_site, target);
     java_lang_invoke_CallSite::set_target(call_site(), target());
   }
 }
@@ -1257,7 +1258,7 @@
   {
     // Walk all nmethods depending on this call site.
     MutexLocker mu(Compile_lock, thread);
-    Universe::flush_dependents_on(call_site, target);
+    CodeCache::flush_dependents_on(call_site, target);
     java_lang_invoke_CallSite::set_target_volatile(call_site(), target());
   }
 }
--- a/hotspot/src/share/vm/prims/whitebox.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/prims/whitebox.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -176,11 +176,11 @@
 
 WB_ENTRY(void, WB_ReadFromNoaccessArea(JNIEnv* env, jobject o))
   size_t granularity = os::vm_allocation_granularity();
-  ReservedHeapSpace rhs(100 * granularity, granularity, false, NULL);
+  ReservedHeapSpace rhs(100 * granularity, granularity, false);
   VirtualSpace vs;
   vs.initialize(rhs, 50 * granularity);
 
-  //Check if constraints are complied
+  // Check if constraints are complied
   if (!( UseCompressedOops && rhs.base() != NULL &&
          Universe::narrow_oop_base() != NULL &&
          Universe::narrow_oop_use_implicit_null_checks() )) {
@@ -203,7 +203,7 @@
 static jint wb_stress_virtual_space_resize(size_t reserved_space_size,
                                            size_t magnitude, size_t iterations) {
   size_t granularity = os::vm_allocation_granularity();
-  ReservedHeapSpace rhs(reserved_space_size * granularity, granularity, false, NULL);
+  ReservedHeapSpace rhs(reserved_space_size * granularity, granularity, false);
   VirtualSpace vs;
   if (!vs.initialize(rhs, 0)) {
     tty->print_cr("Failed to initialize VirtualSpace. Can't proceed.");
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, 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
@@ -925,9 +925,9 @@
                     "Warning: support for %s was removed in %s\n",
                     fuzzy_matched->_name,
                     version);
-      }
     }
   }
+  }
 
   // allow for commandline "commenting out" options like -XX:#+Verbose
   return arg[0] == '#';
@@ -1382,41 +1382,24 @@
   if (FLAG_IS_DEFAULT(SurvivorRatio) && MaxTenuringThreshold == 0) {
     FLAG_SET_ERGO(uintx, SurvivorRatio, MAX2((uintx)1024, SurvivorRatio));
   }
-  // If OldPLABSize is set and CMSParPromoteBlocksToClaim is not,
-  // set CMSParPromoteBlocksToClaim equal to OldPLABSize.
-  // This is done in order to make ParNew+CMS configuration to work
-  // with YoungPLABSize and OldPLABSize options.
-  // See CR 6362902.
-  if (!FLAG_IS_DEFAULT(OldPLABSize)) {
-    if (FLAG_IS_DEFAULT(CMSParPromoteBlocksToClaim)) {
-      // OldPLABSize is not the default value but CMSParPromoteBlocksToClaim
-      // is.  In this situation let CMSParPromoteBlocksToClaim follow
-      // the value (either from the command line or ergonomics) of
-      // OldPLABSize.  Following OldPLABSize is an ergonomics decision.
-      FLAG_SET_ERGO(uintx, CMSParPromoteBlocksToClaim, OldPLABSize);
+
+  // OldPLABSize is interpreted in CMS as not the size of the PLAB in words,
+  // but rather the number of free blocks of a given size that are used when
+  // replenishing the local per-worker free list caches.
+  if (FLAG_IS_DEFAULT(OldPLABSize)) {
+    if (!FLAG_IS_DEFAULT(ResizeOldPLAB) && !ResizeOldPLAB) {
+      // OldPLAB sizing manually turned off: Use a larger default setting,
+      // unless it was manually specified. This is because a too-low value
+      // will slow down scavenges.
+      FLAG_SET_ERGO(uintx, OldPLABSize, CFLS_LAB::_default_static_old_plab_size); // default value before 6631166
     } else {
-      // OldPLABSize and CMSParPromoteBlocksToClaim are both set.
-      // CMSParPromoteBlocksToClaim is a collector-specific flag, so
-      // we'll let it to take precedence.
-      jio_fprintf(defaultStream::error_stream(),
-                  "Both OldPLABSize and CMSParPromoteBlocksToClaim"
-                  " options are specified for the CMS collector."
-                  " CMSParPromoteBlocksToClaim will take precedence.\n");
+      FLAG_SET_DEFAULT(OldPLABSize, CFLS_LAB::_default_dynamic_old_plab_size); // old CMSParPromoteBlocksToClaim default
     }
   }
-  if (!FLAG_IS_DEFAULT(ResizeOldPLAB) && !ResizeOldPLAB) {
-    // OldPLAB sizing manually turned off: Use a larger default setting,
-    // unless it was manually specified. This is because a too-low value
-    // will slow down scavenges.
-    if (FLAG_IS_DEFAULT(CMSParPromoteBlocksToClaim)) {
-      FLAG_SET_ERGO(uintx, CMSParPromoteBlocksToClaim, 50); // default value before 6631166
-    }
-  }
-  // Overwrite OldPLABSize which is the variable we will internally use everywhere.
-  FLAG_SET_ERGO(uintx, OldPLABSize, CMSParPromoteBlocksToClaim);
+
   // If either of the static initialization defaults have changed, note this
   // modification.
-  if (!FLAG_IS_DEFAULT(CMSParPromoteBlocksToClaim) || !FLAG_IS_DEFAULT(OldPLABWeight)) {
+  if (!FLAG_IS_DEFAULT(OldPLABSize) || !FLAG_IS_DEFAULT(OldPLABWeight)) {
     CFLS_LAB::modify_initialization(OldPLABSize, OldPLABWeight);
   }
   if (PrintGCDetails && Verbose) {
@@ -1539,15 +1522,6 @@
       FLAG_SET_ERGO(bool, UseCompressedOops, true);
     }
 #endif
-#ifdef _WIN64
-    if (UseLargePages && UseCompressedOops) {
-      // Cannot allocate guard pages for implicit checks in indexed addressing
-      // mode, when large pages are specified on windows.
-      // This flag could be switched ON if narrow oop base address is set to 0,
-      // see code in Universe::initialize_heap().
-      Universe::set_narrow_oop_use_implicit_null_checks(false);
-    }
-#endif //  _WIN64
   } else {
     if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) {
       warning("Max heap size too large for Compressed Oops");
@@ -2433,6 +2407,7 @@
 #ifdef COMPILER1
   status = status && verify_min_value(ValueMapInitialSize, 1, "ValueMapInitialSize");
 #endif
+  status = status && verify_min_value(HeapSearchSteps, 1, "HeapSearchSteps");
 
   if (PrintNMTStatistics) {
 #if INCLUDE_NMT
@@ -3225,52 +3200,6 @@
         FLAG_SET_CMDLINE(bool, NeverTenure, false);
         FLAG_SET_CMDLINE(bool, AlwaysTenure, false);
       }
-    } else if (match_option(option, "-XX:+CMSPermGenSweepingEnabled") ||
-               match_option(option, "-XX:-CMSPermGenSweepingEnabled")) {
-      jio_fprintf(defaultStream::error_stream(),
-        "Please use CMSClassUnloadingEnabled in place of "
-        "CMSPermGenSweepingEnabled in the future\n");
-    } else if (match_option(option, "-XX:+UseGCTimeLimit")) {
-      FLAG_SET_CMDLINE(bool, UseGCOverheadLimit, true);
-      jio_fprintf(defaultStream::error_stream(),
-        "Please use -XX:+UseGCOverheadLimit in place of "
-        "-XX:+UseGCTimeLimit in the future\n");
-    } else if (match_option(option, "-XX:-UseGCTimeLimit")) {
-      FLAG_SET_CMDLINE(bool, UseGCOverheadLimit, false);
-      jio_fprintf(defaultStream::error_stream(),
-        "Please use -XX:-UseGCOverheadLimit in place of "
-        "-XX:-UseGCTimeLimit in the future\n");
-    // The TLE options are for compatibility with 1.3 and will be
-    // removed without notice in a future release.  These options
-    // are not to be documented.
-    } else if (match_option(option, "-XX:MaxTLERatio=", &tail)) {
-      // No longer used.
-    } else if (match_option(option, "-XX:+ResizeTLE")) {
-      FLAG_SET_CMDLINE(bool, ResizeTLAB, true);
-    } else if (match_option(option, "-XX:-ResizeTLE")) {
-      FLAG_SET_CMDLINE(bool, ResizeTLAB, false);
-    } else if (match_option(option, "-XX:+PrintTLE")) {
-      FLAG_SET_CMDLINE(bool, PrintTLAB, true);
-    } else if (match_option(option, "-XX:-PrintTLE")) {
-      FLAG_SET_CMDLINE(bool, PrintTLAB, false);
-    } else if (match_option(option, "-XX:TLEFragmentationRatio=", &tail)) {
-      // No longer used.
-    } else if (match_option(option, "-XX:TLESize=", &tail)) {
-      julong long_tlab_size = 0;
-      ArgsRange errcode = parse_memory_size(tail, &long_tlab_size, 1);
-      if (errcode != arg_in_range) {
-        jio_fprintf(defaultStream::error_stream(),
-                    "Invalid TLAB size: %s\n", option->optionString);
-        describe_range_error(errcode);
-        return JNI_EINVAL;
-      }
-      FLAG_SET_CMDLINE(uintx, TLABSize, long_tlab_size);
-    } else if (match_option(option, "-XX:TLEThreadRatio=", &tail)) {
-      // No longer used.
-    } else if (match_option(option, "-XX:+UseTLE")) {
-      FLAG_SET_CMDLINE(bool, UseTLAB, true);
-    } else if (match_option(option, "-XX:-UseTLE")) {
-      FLAG_SET_CMDLINE(bool, UseTLAB, false);
     } else if (match_option(option, "-XX:+DisplayVMOutputToStderr")) {
       FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, false);
       FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, true);
@@ -3294,44 +3223,6 @@
       // disable scavenge before parallel mark-compact
       FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false);
 #endif
-    } else if (match_option(option, "-XX:CMSParPromoteBlocksToClaim=", &tail)) {
-      julong cms_blocks_to_claim = (julong)atol(tail);
-      FLAG_SET_CMDLINE(uintx, CMSParPromoteBlocksToClaim, cms_blocks_to_claim);
-      jio_fprintf(defaultStream::error_stream(),
-        "Please use -XX:OldPLABSize in place of "
-        "-XX:CMSParPromoteBlocksToClaim in the future\n");
-    } else if (match_option(option, "-XX:ParCMSPromoteBlocksToClaim=", &tail)) {
-      julong cms_blocks_to_claim = (julong)atol(tail);
-      FLAG_SET_CMDLINE(uintx, CMSParPromoteBlocksToClaim, cms_blocks_to_claim);
-      jio_fprintf(defaultStream::error_stream(),
-        "Please use -XX:OldPLABSize in place of "
-        "-XX:ParCMSPromoteBlocksToClaim in the future\n");
-    } else if (match_option(option, "-XX:ParallelGCOldGenAllocBufferSize=", &tail)) {
-      julong old_plab_size = 0;
-      ArgsRange errcode = parse_memory_size(tail, &old_plab_size, 1);
-      if (errcode != arg_in_range) {
-        jio_fprintf(defaultStream::error_stream(),
-                    "Invalid old PLAB size: %s\n", option->optionString);
-        describe_range_error(errcode);
-        return JNI_EINVAL;
-      }
-      FLAG_SET_CMDLINE(uintx, OldPLABSize, old_plab_size);
-      jio_fprintf(defaultStream::error_stream(),
-                  "Please use -XX:OldPLABSize in place of "
-                  "-XX:ParallelGCOldGenAllocBufferSize in the future\n");
-    } else if (match_option(option, "-XX:ParallelGCToSpaceAllocBufferSize=", &tail)) {
-      julong young_plab_size = 0;
-      ArgsRange errcode = parse_memory_size(tail, &young_plab_size, 1);
-      if (errcode != arg_in_range) {
-        jio_fprintf(defaultStream::error_stream(),
-                    "Invalid young PLAB size: %s\n", option->optionString);
-        describe_range_error(errcode);
-        return JNI_EINVAL;
-      }
-      FLAG_SET_CMDLINE(uintx, YoungPLABSize, young_plab_size);
-      jio_fprintf(defaultStream::error_stream(),
-                  "Please use -XX:YoungPLABSize in place of "
-                  "-XX:ParallelGCToSpaceAllocBufferSize in the future\n");
     } else if (match_option(option, "-XX:CMSMarkStackSize=", &tail) ||
                match_option(option, "-XX:G1MarkStackSize=", &tail)) {
       julong stack_size = 0;
@@ -3342,6 +3233,9 @@
         describe_range_error(errcode);
         return JNI_EINVAL;
       }
+      jio_fprintf(defaultStream::error_stream(),
+        "Please use -XX:MarkStackSize in place of "
+        "-XX:CMSMarkStackSize or -XX:G1MarkStackSize in the future\n");
       FLAG_SET_CMDLINE(uintx, MarkStackSize, stack_size);
     } else if (match_option(option, "-XX:CMSMarkStackSizeMax=", &tail)) {
       julong max_stack_size = 0;
@@ -3353,6 +3247,9 @@
         describe_range_error(errcode);
         return JNI_EINVAL;
       }
+      jio_fprintf(defaultStream::error_stream(),
+         "Please use -XX:MarkStackSizeMax in place of "
+         "-XX:CMSMarkStackSizeMax in the future\n");
       FLAG_SET_CMDLINE(uintx, MarkStackSizeMax, max_stack_size);
     } else if (match_option(option, "-XX:ParallelMarkingThreads=", &tail) ||
                match_option(option, "-XX:ParallelCMSThreads=", &tail)) {
@@ -3362,6 +3259,9 @@
                     "Invalid concurrent threads: %s\n", option->optionString);
         return JNI_EINVAL;
       }
+      jio_fprintf(defaultStream::error_stream(),
+        "Please use -XX:ConcGCThreads in place of "
+        "-XX:ParallelMarkingThreads or -XX:ParallelCMSThreads in the future\n");
       FLAG_SET_CMDLINE(uintx, ConcGCThreads, conc_threads);
     } else if (match_option(option, "-XX:MaxDirectMemorySize=", &tail)) {
       julong max_direct_memory_size = 0;
@@ -4194,6 +4094,10 @@
   PropertyList_add(plist, new_p);
 }
 
+void Arguments::PropertyList_add(SystemProperty *element) {
+  PropertyList_add(&_system_properties, element);
+}
+
 // This add maintains unique property key in the list.
 void Arguments::PropertyList_unique_add(SystemProperty** plist, const char* k, char* v, jboolean append) {
   if (plist == NULL)
--- a/hotspot/src/share/vm/runtime/arguments.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/runtime/arguments.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, 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
@@ -572,6 +572,7 @@
   static void init_version_specific_system_properties();
 
   // Property List manipulation
+  static void PropertyList_add(SystemProperty *element);
   static void PropertyList_add(SystemProperty** plist, SystemProperty *element);
   static void PropertyList_add(SystemProperty** plist, const char* k, char* v);
   static void PropertyList_unique_add(SystemProperty** plist, const char* k, char* v) {
--- a/hotspot/src/share/vm/runtime/globals.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, 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
@@ -531,6 +531,11 @@
   product_pd(uintx, HeapBaseMinAddress,                                     \
           "OS specific low limit for heap base address")                    \
                                                                             \
+  product(uintx, HeapSearchSteps, 3 PPC64_ONLY(+17),                        \
+          "Heap allocation steps through preferred address regions to find" \
+          " where it can allocate the heap. Number of steps to take per "   \
+          "region.")                                                        \
+                                                                            \
   diagnostic(bool, PrintCompressedOopsMode, false,                          \
           "Print compressed oops base address and encoding mode")           \
                                                                             \
@@ -1472,7 +1477,8 @@
           "Size of young gen promotion LAB's (in HeapWords)")               \
                                                                             \
   product(uintx, OldPLABSize, 1024,                                         \
-          "Size of old gen promotion LAB's (in HeapWords)")                 \
+          "Size of old gen promotion LAB's (in HeapWords), or Number        \
+          of blocks to attempt to claim when refilling CMS LAB's")          \
                                                                             \
   product(uintx, GCTaskTimeStampEntries, 200,                               \
           "Number of time stamp entries per gc worker thread")              \
@@ -1583,14 +1589,10 @@
           "The number of cards in each chunk of the parallel chunks used "  \
           "during card table scanning")                                     \
                                                                             \
-  product(uintx, CMSParPromoteBlocksToClaim, 16,                            \
-          "Number of blocks to attempt to claim when refilling CMS LAB's "  \
-          "for parallel GC")                                                \
-                                                                            \
   product(uintx, OldPLABWeight, 50,                                         \
           "Percentage (0-100) used to weight the current sample when "      \
           "computing exponentially decaying average for resizing "          \
-          "CMSParPromoteBlocksToClaim")                                     \
+          "OldPLABSize")                                                    \
                                                                             \
   product(bool, ResizeOldPLAB, true,                                        \
           "Dynamically resize (old gen) promotion LAB's")                   \
@@ -3782,6 +3784,9 @@
           NOT_LP64(LINUX_ONLY(2*G) NOT_LINUX(0)),                           \
           "Address to allocate shared memory region for class data")        \
                                                                             \
+  product(uintx, SharedSymbolTableBucketSize, 4,                            \
+          "Average number of symbols per bucket in shared table")           \
+                                                                            \
   diagnostic(bool, IgnoreUnverifiableClassesDuringDump, false,              \
           "Do not quit -Xshare:dump even if we encounter unverifiable "     \
           "classes. Just exclude them from the shared dictionary.")         \
--- a/hotspot/src/share/vm/runtime/os.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/runtime/os.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1588,6 +1588,11 @@
   return res;
 }
 
+void os::pretouch_memory(char* start, char* end) {
+  for (volatile char *p = start; p < end; p += os::vm_page_size()) {
+    *p = 0;
+  }
+}
 
 char* os::map_memory(int fd, const char* file_name, size_t file_offset,
                            char *addr, size_t bytes, bool read_only,
--- a/hotspot/src/share/vm/runtime/os.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/runtime/os.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -311,6 +311,12 @@
   static bool   uncommit_memory(char* addr, size_t bytes);
   static bool   release_memory(char* addr, size_t bytes);
 
+  // Touch memory pages that cover the memory range from start to end (exclusive)
+  // to make the OS back the memory range with actual memory.
+  // Current implementation may not touch the last page if unaligned addresses
+  // are passed.
+  static void   pretouch_memory(char* start, char* end);
+
   enum ProtType { MEM_PROT_NONE, MEM_PROT_READ, MEM_PROT_RW, MEM_PROT_RWX };
   static bool   protect_memory(char* addr, size_t bytes, ProtType prot,
                                bool is_committed = true);
--- a/hotspot/src/share/vm/runtime/virtualspace.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/runtime/virtualspace.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, 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
@@ -43,21 +43,19 @@
   // Don't force the alignment to be large page aligned,
   // since that will waste memory.
   size_t alignment = os::vm_allocation_granularity();
-  initialize(size, alignment, large_pages, NULL, 0, false);
+  initialize(size, alignment, large_pages, NULL, false);
 }
 
 ReservedSpace::ReservedSpace(size_t size, size_t alignment,
                              bool large,
-                             char* requested_address,
-                             const size_t noaccess_prefix) {
-  initialize(size+noaccess_prefix, alignment, large, requested_address,
-             noaccess_prefix, false);
+                             char* requested_address) {
+  initialize(size, alignment, large, requested_address, false);
 }
 
 ReservedSpace::ReservedSpace(size_t size, size_t alignment,
                              bool large,
                              bool executable) {
-  initialize(size, alignment, large, NULL, 0, executable);
+  initialize(size, alignment, large, NULL, executable);
 }
 
 // Helper method.
@@ -91,7 +89,6 @@
 
 void ReservedSpace::initialize(size_t size, size_t alignment, bool large,
                                char* requested_address,
-                               const size_t noaccess_prefix,
                                bool executable) {
   const size_t granularity = os::vm_allocation_granularity();
   assert((size & (granularity - 1)) == 0,
@@ -103,10 +100,6 @@
 
   alignment = MAX2(alignment, (size_t)os::vm_page_size());
 
-  // Assert that if noaccess_prefix is used, it is the same as alignment.
-  assert(noaccess_prefix == 0 ||
-         noaccess_prefix == alignment, "noaccess prefix wrong");
-
   _base = NULL;
   _size = 0;
   _special = false;
@@ -122,11 +115,6 @@
   bool special = large && !os::can_commit_large_page_memory();
   char* base = NULL;
 
-  if (requested_address != 0) {
-    requested_address -= noaccess_prefix; // adjust requested address
-    assert(requested_address != NULL, "huge noaccess prefix?");
-  }
-
   if (special) {
 
     base = os::reserve_memory_special(size, alignment, requested_address, executable);
@@ -176,7 +164,7 @@
     if (base == NULL) return;
 
     // Check alignment constraints
-    if ((((size_t)base + noaccess_prefix) & (alignment - 1)) != 0) {
+    if ((((size_t)base) & (alignment - 1)) != 0) {
       // Base not aligned, retry
       if (!os::release_memory(base, size)) fatal("os::release_memory failed");
       // Make sure that size is aligned
@@ -197,16 +185,6 @@
   _base = base;
   _size = size;
   _alignment = alignment;
-  _noaccess_prefix = noaccess_prefix;
-
-  // Assert that if noaccess_prefix is used, it is the same as alignment.
-  assert(noaccess_prefix == 0 ||
-         noaccess_prefix == _alignment, "noaccess prefix wrong");
-
-  assert(markOopDesc::encode_pointer_as_mark(_base)->decode_pointer() == _base,
-         "area must be distinguishable from marks for mark-sweep");
-  assert(markOopDesc::encode_pointer_as_mark(&_base[size])->decode_pointer() == &_base[size],
-         "area must be distinguishable from marks for mark-sweep");
 }
 
 
@@ -276,54 +254,336 @@
     _base = NULL;
     _size = 0;
     _noaccess_prefix = 0;
+    _alignment = 0;
     _special = false;
     _executable = false;
   }
 }
 
-void ReservedSpace::protect_noaccess_prefix(const size_t size) {
-  assert( (_noaccess_prefix != 0) == (UseCompressedOops && _base != NULL &&
-                                      (Universe::narrow_oop_base() != NULL) &&
-                                      Universe::narrow_oop_use_implicit_null_checks()),
-         "noaccess_prefix should be used only with non zero based compressed oops");
+static size_t noaccess_prefix_size(size_t alignment) {
+  return lcm(os::vm_page_size(), alignment);
+}
 
-  // If there is no noaccess prefix, return.
-  if (_noaccess_prefix == 0) return;
+void ReservedHeapSpace::establish_noaccess_prefix() {
+  assert(_alignment >= (size_t)os::vm_page_size(), "must be at least page size big");
+  _noaccess_prefix = noaccess_prefix_size(_alignment);
 
-  assert(_noaccess_prefix >= (size_t)os::vm_page_size(),
-         "must be at least page size big");
-
-  // Protect memory at the base of the allocated region.
-  // If special, the page was committed (only matters on windows)
-  if (!os::protect_memory(_base, _noaccess_prefix, os::MEM_PROT_NONE,
-                          _special)) {
-    fatal("cannot protect protection page");
-  }
-  if (PrintCompressedOopsMode) {
-    tty->cr();
-    tty->print_cr("Protected page at the reserved heap base: " PTR_FORMAT " / " INTX_FORMAT " bytes", _base, _noaccess_prefix);
+  if (base() && base() + _size > (char *)OopEncodingHeapMax) {
+    if (true
+        WIN64_ONLY(&& !UseLargePages)
+        AIX_ONLY(&& os::vm_page_size() != SIZE_64K)) {
+      // Protect memory at the base of the allocated region.
+      // If special, the page was committed (only matters on windows)
+      if (!os::protect_memory(_base, _noaccess_prefix, os::MEM_PROT_NONE, _special)) {
+        fatal("cannot protect protection page");
+      }
+      if (PrintCompressedOopsMode) {
+        tty->cr();
+        tty->print_cr("Protected page at the reserved heap base: "
+                      PTR_FORMAT " / " INTX_FORMAT " bytes", _base, _noaccess_prefix);
+      }
+      assert(Universe::narrow_oop_use_implicit_null_checks() == true, "not initialized?");
+    } else {
+      Universe::set_narrow_oop_use_implicit_null_checks(false);
+    }
   }
 
   _base += _noaccess_prefix;
   _size -= _noaccess_prefix;
-  assert((size == _size) && ((uintptr_t)_base % _alignment == 0),
-         "must be exactly of required size and alignment");
+  assert(((uintptr_t)_base % _alignment == 0), "must be exactly of required alignment");
+}
+
+// Tries to allocate memory of size 'size' at address requested_address with alignment 'alignment'.
+// Does not check whether the reserved memory actually is at requested_address, as the memory returned
+// might still fulfill the wishes of the caller.
+// Assures the memory is aligned to 'alignment'.
+// NOTE: If ReservedHeapSpace already points to some reserved memory this is freed, first.
+void ReservedHeapSpace::try_reserve_heap(size_t size,
+                                         size_t alignment,
+                                         bool large,
+                                         char* requested_address) {
+  if (_base != NULL) {
+    // We tried before, but we didn't like the address delivered.
+    release();
+  }
+
+  // If OS doesn't support demand paging for large page memory, we need
+  // to use reserve_memory_special() to reserve and pin the entire region.
+  bool special = large && !os::can_commit_large_page_memory();
+  char* base = NULL;
+
+  if (PrintCompressedOopsMode && Verbose) {
+    tty->print("Trying to allocate at address " PTR_FORMAT " heap of size " PTR_FORMAT ".\n",
+               requested_address, (address)size);
+  }
+
+  if (special) {
+    base = os::reserve_memory_special(size, alignment, requested_address, false);
+
+    if (base != NULL) {
+      // Check alignment constraints.
+      assert((uintptr_t) base % alignment == 0,
+             err_msg("Large pages returned a non-aligned address, base: "
+                     PTR_FORMAT " alignment: " PTR_FORMAT,
+                     base, (void*)(uintptr_t)alignment));
+      _special = true;
+    }
+  }
+
+  if (base == NULL) {
+    // Failed; try to reserve regular memory below
+    if (UseLargePages && (!FLAG_IS_DEFAULT(UseLargePages) ||
+                          !FLAG_IS_DEFAULT(LargePageSizeInBytes))) {
+      if (PrintCompressedOopsMode) {
+        tty->cr();
+        tty->print_cr("Reserve regular memory without large pages.");
+      }
+    }
+
+    // Optimistically assume that the OSes returns an aligned base pointer.
+    // When reserving a large address range, most OSes seem to align to at
+    // least 64K.
+
+    // If the memory was requested at a particular address, use
+    // os::attempt_reserve_memory_at() to avoid over mapping something
+    // important.  If available space is not detected, return NULL.
+
+    if (requested_address != 0) {
+      base = os::attempt_reserve_memory_at(size, requested_address);
+    } else {
+      base = os::reserve_memory(size, NULL, alignment);
+    }
+  }
+  if (base == NULL) { return; }
+
+  // Done
+  _base = base;
+  _size = size;
+  _alignment = alignment;
+
+  // Check alignment constraints
+  if ((((size_t)base) & (alignment - 1)) != 0) {
+    // Base not aligned, retry.
+    release();
+  }
+}
+
+void ReservedHeapSpace::try_reserve_range(char *highest_start,
+                                          char *lowest_start,
+                                          size_t attach_point_alignment,
+                                          char *aligned_heap_base_min_address,
+                                          char *upper_bound,
+                                          size_t size,
+                                          size_t alignment,
+                                          bool large) {
+  const size_t attach_range = highest_start - lowest_start;
+  // Cap num_attempts at possible number.
+  // At least one is possible even for 0 sized attach range.
+  const uint64_t num_attempts_possible = (attach_range / attach_point_alignment) + 1;
+  const uint64_t num_attempts_to_try   = MIN2((uint64_t)HeapSearchSteps, num_attempts_possible);
+
+  const size_t stepsize = (attach_range == 0) ? // Only one try.
+    (size_t) highest_start : align_size_up(attach_range / num_attempts_to_try, attach_point_alignment);
+
+  // Try attach points from top to bottom.
+  char* attach_point = highest_start;
+  while (attach_point >= lowest_start  &&
+         attach_point <= highest_start &&  // Avoid wrap around.
+         ((_base == NULL) ||
+          (_base < aligned_heap_base_min_address || _base + size > upper_bound))) {
+    try_reserve_heap(size, alignment, large, attach_point);
+    attach_point -= stepsize;
+  }
 }
 
-ReservedHeapSpace::ReservedHeapSpace(size_t size, size_t alignment,
-                                     bool large, char* requested_address) :
-  ReservedSpace(size, alignment, large,
-                requested_address,
-                (UseCompressedOops && (Universe::narrow_oop_base() != NULL) &&
-                 Universe::narrow_oop_use_implicit_null_checks()) ?
-                  lcm(os::vm_page_size(), alignment) : 0) {
+#define SIZE_64K  ((uint64_t) UCONST64(      0x10000))
+#define SIZE_256M ((uint64_t) UCONST64(   0x10000000))
+#define SIZE_32G  ((uint64_t) UCONST64(  0x800000000))
+
+// Helper for heap allocation. Returns an array with addresses
+// (OS-specific) which are suited for disjoint base mode. Array is
+// NULL terminated.
+static char** get_attach_addresses_for_disjoint_mode() {
+  static uint64_t addresses[] = {
+     2 * SIZE_32G,
+     3 * SIZE_32G,
+     4 * SIZE_32G,
+     8 * SIZE_32G,
+    10 * SIZE_32G,
+     1 * SIZE_64K * SIZE_32G,
+     2 * SIZE_64K * SIZE_32G,
+     3 * SIZE_64K * SIZE_32G,
+     4 * SIZE_64K * SIZE_32G,
+    16 * SIZE_64K * SIZE_32G,
+    32 * SIZE_64K * SIZE_32G,
+    34 * SIZE_64K * SIZE_32G,
+    0
+  };
+
+  // Sort out addresses smaller than HeapBaseMinAddress. This assumes
+  // the array is sorted.
+  uint i = 0;
+  while (addresses[i] != 0 &&
+         (addresses[i] < OopEncodingHeapMax || addresses[i] < HeapBaseMinAddress)) {
+    i++;
+  }
+  uint start = i;
+
+  // Avoid more steps than requested.
+  i = 0;
+  while (addresses[start+i] != 0) {
+    if (i == HeapSearchSteps) {
+      addresses[start+i] = 0;
+      break;
+    }
+    i++;
+  }
+
+  return (char**) &addresses[start];
+}
+
+void ReservedHeapSpace::initialize_compressed_heap(const size_t size, size_t alignment, bool large) {
+  guarantee(size + noaccess_prefix_size(alignment) <= OopEncodingHeapMax,
+            "can not allocate compressed oop heap for this size");
+  guarantee(alignment == MAX2(alignment, (size_t)os::vm_page_size()), "alignment too small");
+  assert(HeapBaseMinAddress > 0, "sanity");
+
+  const size_t granularity = os::vm_allocation_granularity();
+  assert((size & (granularity - 1)) == 0,
+         "size not aligned to os::vm_allocation_granularity()");
+  assert((alignment & (granularity - 1)) == 0,
+         "alignment not aligned to os::vm_allocation_granularity()");
+  assert(alignment == 0 || is_power_of_2((intptr_t)alignment),
+         "not a power of 2");
+
+  // The necessary attach point alignment for generated wish addresses.
+  // This is needed to increase the chance of attaching for mmap and shmat.
+  const size_t os_attach_point_alignment =
+    AIX_ONLY(SIZE_256M)  // Known shm boundary alignment.
+    NOT_AIX(os::vm_allocation_granularity());
+  const size_t attach_point_alignment = lcm(alignment, os_attach_point_alignment);
+
+  char *aligned_heap_base_min_address = (char *)align_ptr_up((void *)HeapBaseMinAddress, alignment);
+  size_t noaccess_prefix = ((aligned_heap_base_min_address + size) > (char*)OopEncodingHeapMax) ?
+    noaccess_prefix_size(alignment) : 0;
+
+  // Attempt to alloc at user-given address.
+  if (!FLAG_IS_DEFAULT(HeapBaseMinAddress)) {
+    try_reserve_heap(size + noaccess_prefix, alignment, large, aligned_heap_base_min_address);
+    if (_base != aligned_heap_base_min_address) { // Enforce this exact address.
+      release();
+    }
+  }
+
+  // Keep heap at HeapBaseMinAddress.
+  if (_base == NULL) {
+
+    // Try to allocate the heap at addresses that allow efficient oop compression.
+    // Different schemes are tried, in order of decreasing optimization potential.
+    //
+    // For this, try_reserve_heap() is called with the desired heap base addresses.
+    // A call into the os layer to allocate at a given address can return memory
+    // at a different address than requested.  Still, this might be memory at a useful
+    // address. try_reserve_heap() always returns this allocated memory, as only here
+    // the criteria for a good heap are checked.
+
+    // Attempt to allocate so that we can run without base and scale (32-Bit unscaled compressed oops).
+    // Give it several tries from top of range to bottom.
+    if (aligned_heap_base_min_address + size <= (char *)UnscaledOopHeapMax) {
+
+      // Calc address range within we try to attach (range of possible start addresses).
+      char* const highest_start = (char *)align_ptr_down((char *)UnscaledOopHeapMax - size, attach_point_alignment);
+      char* const lowest_start  = (char *)align_ptr_up  (        aligned_heap_base_min_address             , attach_point_alignment);
+      try_reserve_range(highest_start, lowest_start, attach_point_alignment,
+                        aligned_heap_base_min_address, (char *)UnscaledOopHeapMax, size, alignment, large);
+    }
+
+    // zerobased: Attempt to allocate in the lower 32G.
+    // But leave room for the compressed class pointers, which is allocated above
+    // the heap.
+    char *zerobased_max = (char *)OopEncodingHeapMax;
+    // For small heaps, save some space for compressed class pointer
+    // space so it can be decoded with no base.
+    if (UseCompressedClassPointers && !UseSharedSpaces &&
+        OopEncodingHeapMax <= KlassEncodingMetaspaceMax) {
+      const size_t class_space = align_size_up(CompressedClassSpaceSize, alignment);
+      zerobased_max = (char *)OopEncodingHeapMax - class_space;
+    }
+
+    // Give it several tries from top of range to bottom.
+    if (aligned_heap_base_min_address + size <= zerobased_max &&    // Zerobased theoretical possible.
+        ((_base == NULL) ||                        // No previous try succeeded.
+         (_base + size > zerobased_max))) {        // Unscaled delivered an arbitrary address.
+
+      // Calc address range within we try to attach (range of possible start addresses).
+      char *const highest_start = (char *)align_ptr_down(zerobased_max - size, attach_point_alignment);
+      // SS10 and SS12u1 cannot compile "(char *)UnscaledOopHeapMax - size" on solaris sparc 32-bit:
+      // "Cannot use int to initialize char*." Introduce aux variable.
+      char *unscaled_end = (char *)UnscaledOopHeapMax;
+      unscaled_end -= size;
+      char *lowest_start = (size < UnscaledOopHeapMax) ?
+        MAX2(unscaled_end, aligned_heap_base_min_address) : aligned_heap_base_min_address;
+      lowest_start  = (char *)align_ptr_up(lowest_start, attach_point_alignment);
+      try_reserve_range(highest_start, lowest_start, attach_point_alignment,
+                        aligned_heap_base_min_address, zerobased_max, size, alignment, large);
+    }
+
+    // Now we go for heaps with base != 0.  We need a noaccess prefix to efficiently
+    // implement null checks.
+    noaccess_prefix = noaccess_prefix_size(alignment);
+
+    // Try to attach at addresses that are aligned to OopEncodingHeapMax. Disjointbase mode.
+    char** addresses = get_attach_addresses_for_disjoint_mode();
+    int i = 0;
+    while (addresses[i] &&                                 // End of array not yet reached.
+           ((_base == NULL) ||                             // No previous try succeeded.
+            (_base + size >  (char *)OopEncodingHeapMax && // Not zerobased or unscaled address.
+             !Universe::is_disjoint_heap_base_address((address)_base)))) {  // Not disjoint address.
+      char* const attach_point = addresses[i];
+      assert(attach_point >= aligned_heap_base_min_address, "Flag support broken");
+      try_reserve_heap(size + noaccess_prefix, alignment, large, attach_point);
+      i++;
+    }
+
+    // Last, desperate try without any placement.
+    if (_base == NULL) {
+      if (PrintCompressedOopsMode && Verbose) {
+        tty->print("Trying to allocate at address NULL heap of size " PTR_FORMAT ".\n", (address)size + noaccess_prefix);
+      }
+      initialize(size + noaccess_prefix, alignment, large, NULL, false);
+    }
+  }
+}
+
+ReservedHeapSpace::ReservedHeapSpace(size_t size, size_t alignment, bool large) : ReservedSpace() {
+
+  if (size == 0) {
+    return;
+  }
+
+  // Heap size should be aligned to alignment, too.
+  guarantee(is_size_aligned(size, alignment), "set by caller");
+
+  if (UseCompressedOops) {
+    initialize_compressed_heap(size, alignment, large);
+    if (_size > size) {
+      // We allocated heap with noaccess prefix.
+      // It can happen we get a zerobased/unscaled heap with noaccess prefix,
+      // if we had to try at arbitrary address.
+      establish_noaccess_prefix();
+    }
+  } else {
+    initialize(size, alignment, large, NULL, false);
+  }
+
+  assert(markOopDesc::encode_pointer_as_mark(_base)->decode_pointer() == _base,
+         "area must be distinguishable from marks for mark-sweep");
+  assert(markOopDesc::encode_pointer_as_mark(&_base[size])->decode_pointer() == &_base[size],
+         "area must be distinguishable from marks for mark-sweep");
+
   if (base() > 0) {
     MemTracker::record_virtual_memory_type((address)base(), mtJavaHeap);
   }
-
-  // Only reserved space for the java heap should have a noaccess_prefix
-  // if using compressed oops.
-  protect_noaccess_prefix(size);
 }
 
 // Reserve space for code segment.  Same as Java heap only we mark this as
@@ -615,19 +875,7 @@
   }
 
   if (pre_touch || AlwaysPreTouch) {
-    int vm_ps = os::vm_page_size();
-    for (char* curr = previous_high;
-         curr < unaligned_new_high;
-         curr += vm_ps) {
-      // Note the use of a write here; originally we tried just a read, but
-      // since the value read was unused, the optimizer removed the read.
-      // If we ever have a concurrent touchahead thread, we'll want to use
-      // a read, to avoid the potential of overwriting data (if a mutator
-      // thread beats the touchahead thread to a page).  There are various
-      // ways of making sure this read is not optimized away: for example,
-      // generating the code for a read procedure at runtime.
-      *curr = 0;
-    }
+    os::pretouch_memory(previous_high, unaligned_new_high);
   }
 
   _high += bytes;
@@ -803,8 +1051,7 @@
     ReservedSpace rs(size,          // size
                      alignment,     // alignment
                      UseLargePages, // large
-                     NULL,          // requested_address
-                     0);            // noacces_prefix
+                     (char *)NULL); // requested_address
 
     test_log(" rs.special() == %d", rs.special());
 
--- a/hotspot/src/share/vm/runtime/virtualspace.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/runtime/virtualspace.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -31,33 +31,29 @@
 
 class ReservedSpace VALUE_OBJ_CLASS_SPEC {
   friend class VMStructs;
- private:
+ protected:
   char*  _base;
   size_t _size;
   size_t _noaccess_prefix;
   size_t _alignment;
   bool   _special;
+ private:
   bool   _executable;
 
   // ReservedSpace
   ReservedSpace(char* base, size_t size, size_t alignment, bool special,
                 bool executable);
+ protected:
   void initialize(size_t size, size_t alignment, bool large,
                   char* requested_address,
-                  const size_t noaccess_prefix,
                   bool executable);
 
- protected:
-  // Create protection page at the beginning of the space.
-  void protect_noaccess_prefix(const size_t size);
-
  public:
   // Constructor
   ReservedSpace();
   ReservedSpace(size_t size);
   ReservedSpace(size_t size, size_t alignment, bool large,
-                char* requested_address = NULL,
-                const size_t noaccess_prefix = 0);
+                char* requested_address = NULL);
   ReservedSpace(size_t size, size_t alignment, bool large, bool executable);
 
   // Accessors
@@ -98,12 +94,23 @@
   return last_part(partition_size, alignment());
 }
 
-// Class encapsulating behavior specific of memory space reserved for Java heap
+// Class encapsulating behavior specific of memory space reserved for Java heap.
 class ReservedHeapSpace : public ReservedSpace {
-public:
-  // Constructor
-  ReservedHeapSpace(size_t size, size_t forced_base_alignment,
-                    bool large, char* requested_address);
+ private:
+  void try_reserve_heap(size_t size, size_t alignment, bool large,
+                        char *requested_address);
+  void try_reserve_range(char *highest_start, char *lowest_start,
+                         size_t attach_point_alignment, char *aligned_HBMA,
+                         char *upper_bound, size_t size, size_t alignment, bool large);
+  void initialize_compressed_heap(const size_t size, size_t alignment, bool large);
+  // Create protection page at the beginning of the space.
+  void establish_noaccess_prefix();
+ public:
+  // Constructor. Tries to find a heap that is good for compressed oops.
+  ReservedHeapSpace(size_t size, size_t forced_base_alignment, bool large);
+  // Returns the base to be used for compression, i.e. so that null can be
+  // encoded safely and implicit null checks can work.
+  char *compressed_oop_base() { return _base - _noaccess_prefix; }
 };
 
 // Class encapsulating behavior specific memory space for Code
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -2559,6 +2559,8 @@
   /**********************/                                                \
   /* frame              */                                                \
   /**********************/                                                \
+  NOT_ZERO(PPC64_ONLY(declare_constant(frame::abi_minframe_size)))        \
+  NOT_ZERO(PPC64_ONLY(declare_constant(frame::entry_frame_locals_size)))  \
                                                                           \
   NOT_ZERO(X86_ONLY(declare_constant(frame::entry_frame_call_wrapper_offset)))      \
   declare_constant(frame::pc_return_offset)                               \
--- a/hotspot/src/share/vm/runtime/vm_operations.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/runtime/vm_operations.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -100,6 +100,7 @@
   template(RotateGCLog)                           \
   template(WhiteBoxOperation)                     \
   template(ClassLoaderStatsOperation)             \
+  template(DumpHashtable)                         \
   template(MarkActiveNMethods)                    \
   template(PrintCompileQueue)                     \
   template(PrintCodeList)                         \
--- a/hotspot/src/share/vm/services/diagnosticCommand.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/classLoaderStats.hpp"
+#include "classfile/compactHashtable.hpp"
 #include "gc_implementation/shared/vmGCOperations.hpp"
 #include "runtime/javaCalls.hpp"
 #include "runtime/os.hpp"
@@ -56,6 +57,8 @@
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false));
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHistogramDCmd>(full_export, true, false));
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassStatsDCmd>(full_export, true, false));
+  DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SymboltableDCmd>(full_export, true, false));
+  DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<StringtableDCmd>(full_export, true, false));
 #endif // INCLUDE_SERVICES
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false));
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RotateGCLogDCmd>(full_export, true, false));
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, 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
@@ -124,9 +124,6 @@
 extern int BytesPerHeapOop;
 extern int BitsPerHeapOop;
 
-// Oop encoding heap max
-extern uint64_t OopEncodingHeapMax;
-
 const int BitsPerJavaInteger = 32;
 const int BitsPerJavaLong    = 64;
 const int BitsPerSize_t      = size_tSize * BitsPerByte;
@@ -195,7 +192,6 @@
   return (byte_size + (HeapWordSize-1)) >> LogHeapWordSize;
 }
 
-
 const size_t K                  = 1024;
 const size_t M                  = K*K;
 const size_t G                  = M*K;
@@ -397,8 +393,17 @@
 const int KlassAlignmentInBytes    = 1 << LogKlassAlignmentInBytes;
 const int KlassAlignment           = KlassAlignmentInBytes / HeapWordSize;
 
-// Klass encoding metaspace max size
-const uint64_t KlassEncodingMetaspaceMax = (uint64_t(max_juint) + 1) << LogKlassAlignmentInBytes;
+// Maximal size of heap where unscaled compression can be used. Also upper bound
+// for heap placement: 4GB.
+const  uint64_t UnscaledOopHeapMax = (uint64_t(max_juint) + 1);
+// Maximal size of heap where compressed oops can be used. Also upper bound for heap
+// placement for zero based compression algorithm: UnscaledOopHeapMax << LogMinObjAlignmentInBytes.
+extern uint64_t OopEncodingHeapMax;
+
+// Maximal size of compressed class space. Above this limit compression is not possible.
+// Also upper bound for placement of zero based class space. (Class space is further limited
+// to be < 3G, see arguments.cpp.)
+const  uint64_t KlassEncodingMetaspaceMax = (uint64_t(max_juint) + 1) << LogKlassAlignmentInBytes;
 
 // Machine dependent stuff
 
--- a/hotspot/src/share/vm/utilities/globalDefinitions_xlc.hpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_xlc.hpp	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2012, 2013 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -172,21 +172,21 @@
 #define offset_of(klass,field) (size_t)((intx)&(((klass*)16)->field) - 16)
 
 // Some constant sizes used throughout the AIX port
-#define SIZE_1K   ((uint64_t)         0x400ULL)
-#define SIZE_4K   ((uint64_t)        0x1000ULL)
-#define SIZE_64K  ((uint64_t)       0x10000ULL)
-#define SIZE_1M   ((uint64_t)      0x100000ULL)
-#define SIZE_4M   ((uint64_t)      0x400000ULL)
-#define SIZE_8M   ((uint64_t)      0x800000ULL)
-#define SIZE_16M  ((uint64_t)     0x1000000ULL)
-#define SIZE_256M ((uint64_t)    0x10000000ULL)
-#define SIZE_1G   ((uint64_t)    0x40000000ULL)
-#define SIZE_2G   ((uint64_t)    0x80000000ULL)
-#define SIZE_4G   ((uint64_t)   0x100000000ULL)
-#define SIZE_16G  ((uint64_t)   0x400000000ULL)
-#define SIZE_32G  ((uint64_t)   0x800000000ULL)
-#define SIZE_64G  ((uint64_t)  0x1000000000ULL)
-#define SIZE_1T   ((uint64_t) 0x10000000000ULL)
+#define SIZE_1K   ((uint64_t) UCONST64(        0x400))
+#define SIZE_4K   ((uint64_t) UCONST64(       0x1000))
+#define SIZE_64K  ((uint64_t) UCONST64(      0x10000))
+#define SIZE_1M   ((uint64_t) UCONST64(     0x100000))
+#define SIZE_4M   ((uint64_t) UCONST64(     0x400000))
+#define SIZE_8M   ((uint64_t) UCONST64(     0x800000))
+#define SIZE_16M  ((uint64_t) UCONST64(    0x1000000))
+#define SIZE_256M ((uint64_t) UCONST64(   0x10000000))
+#define SIZE_1G   ((uint64_t) UCONST64(   0x40000000))
+#define SIZE_2G   ((uint64_t) UCONST64(   0x80000000))
+#define SIZE_4G   ((uint64_t) UCONST64(  0x100000000))
+#define SIZE_16G  ((uint64_t) UCONST64(  0x400000000))
+#define SIZE_32G  ((uint64_t) UCONST64(  0x800000000))
+#define SIZE_64G  ((uint64_t) UCONST64( 0x1000000000))
+#define SIZE_1T   ((uint64_t) UCONST64(0x10000000000))
 
 
 #endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_XLC_HPP
--- a/hotspot/test/TEST.groups	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/test/TEST.groups	Fri Jan 09 13:28:02 2015 -0500
@@ -414,6 +414,12 @@
   gc/ \
   -gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java
 
+hotspot_gc_closed = \
+  sanity/ExecuteInternalVMTests.java
+
+hotspot_gc_gcold = \
+  stress/gc/TestGCOld.java
+
 hotspot_runtime = \
   runtime/ \
  -runtime/6888954/vmerrors.sh \
@@ -445,6 +451,8 @@
   :hotspot_compiler_3 \
   :hotspot_compiler_closed \
   :hotspot_gc \
+  :hotspot_gc_closed \
+  :hotspot_gc_gcold \
   :hotspot_runtime \
   :hotspot_runtime_closed \
   :hotspot_serviceability
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/TestSmallHeap.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test TestSmallHeap
+ * @bug 8067438
+ * @requires vm.gc=="null"
+ * @summary Verify that starting the VM with a small heap works
+ * @library /testlibrary
+ * @run main/othervm -Xmx4m -XX:+UseParallelGC TestSmallHeap
+ * @run main/othervm -Xmx4m -XX:+UseSerialGC TestSmallHeap
+ * @run main/othervm -Xmx4m -XX:+UseG1GC TestSmallHeap
+ * @run main/othervm -Xmx4m -XX:+UseConcMarkSweepGC -XX:CMSMarkStackSizeMax=1032 TestSmallHeap
+ *
+ * Note: It would be nice to verify the minimal supported heap size here,
+ * but that turns out to be quite tricky since we align the heap size based
+ * on the card table size. And the card table size is aligned based on the
+ * minimal pages size provided by the os. This means that on most platforms,
+ * where the minimal page size is 4k, we get a minimal heap size of 2m but
+ * on Solaris/Sparc we have a page size of 8k and get a minimal heap size
+ * of 8m.
+ * There is also no check in the VM for verifying that the maximum heap size
+ * is larger than the supported minimal heap size. This means that specifying
+ * -Xmx1m on the command line is fine but will give a heap of 2m (or 4m).
+ * To work around these rather strange behaviors this test uses 4m for all
+ * platforms.
+ */
+
+import sun.management.ManagementFactoryHelper;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class TestSmallHeap {
+
+    public static void main(String[] args) {
+        String maxHeap = ManagementFactoryHelper.getDiagnosticMXBean().getVMOption("MaxHeapSize").getValue();
+        String expectedMaxHeap = "4194304";
+        assertEQ(maxHeap, expectedMaxHeap);
+    }
+}
--- a/hotspot/test/gc/g1/TestEagerReclaimHumongousRegions2.java	Fri Jan 09 05:45:13 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test TestEagerReclaimHumongousRegions2
- * @bug 8051973
- * @summary Test to make sure that eager reclaim of humongous objects correctly clears
- * mark bitmaps at reclaim.
- * @key gc
- * @library /testlibrary
- */
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.Random;
-
-import com.oracle.java.testlibrary.OutputAnalyzer;
-import com.oracle.java.testlibrary.ProcessTools;
-
-// An object that has a few references to other instances to slow down marking.
-class ObjectWithSomeRefs {
-    public ObjectWithSomeRefs other1;
-    public ObjectWithSomeRefs other2;
-    public ObjectWithSomeRefs other3;
-    public ObjectWithSomeRefs other4;
-}
-
-class ReclaimRegionFast {
-    public static final long MAX_MILLIS_FOR_RUN = 50 * 1000; // The maximum runtime for the actual test.
-
-    public static final int M = 1024*1024;
-
-    public static LinkedList<Object> garbageList = new LinkedList<Object>();
-
-    public static void genGarbage(Object large) {
-        for (int i = 0; i < 64*1024; i++) {
-            Object[] garbage = new Object[50];
-            garbage[0] = large;
-            garbageList.add(garbage);
-        }
-        garbageList.clear();
-    }
-
-    public static ArrayList<ObjectWithSomeRefs> longList = new ArrayList<ObjectWithSomeRefs>();
-
-    public static void main(String[] args) {
-
-        for (int i = 0; i < 16*1024; i++) {
-             longList.add(new ObjectWithSomeRefs());
-        }
-
-        Random rnd = new Random();
-        for (int i = 0; i < longList.size(); i++) {
-             int len = longList.size();
-             longList.get(i).other1 = longList.get(rnd.nextInt(len));
-             longList.get(i).other2 = longList.get(rnd.nextInt(len));
-             longList.get(i).other3 = longList.get(rnd.nextInt(len));
-             longList.get(i).other4 = longList.get(rnd.nextInt(len));
-        }
-
-        int[] large1 = new int[M];
-        int[] large2 = null;
-        int[] large3 = null;
-        int[] large4 = null;
-
-        Object ref_from_stack = large1;
-
-        long start_millis = System.currentTimeMillis();
-
-        for (int i = 0; i < 20; i++) {
-            long current_millis = System.currentTimeMillis();
-            if ((current_millis - start_millis) > MAX_MILLIS_FOR_RUN) {
-              System.out.println("Finishing test because maximum runtime exceeded");
-              break;
-            }
-            // A set of large objects that will be reclaimed eagerly - and hopefully marked.
-            large1 = new int[M - 20];
-            large2 = new int[M - 20];
-            large3 = new int[M - 20];
-            large4 = new int[M - 20];
-            genGarbage(large1);
-            // Make sure that the compiler cannot completely remove
-            // the allocation of the large object until here.
-            System.out.println(large1 + " " + large2 + " " + large3 + " " + large4);
-        }
-
-        // Keep the reference to the first object alive.
-        System.out.println(ref_from_stack);
-    }
-}
-
-public class TestEagerReclaimHumongousRegions2 {
-    public static void main(String[] args) throws Exception {
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UseG1GC",
-            "-Xms128M",
-            "-Xmx128M",
-            "-Xmn2M",
-            "-XX:G1HeapRegionSize=1M",
-            "-XX:InitiatingHeapOccupancyPercent=0", // Want to have as much as possible initial marks.
-            "-XX:+PrintGC",
-            "-XX:+VerifyAfterGC",
-            "-XX:ConcGCThreads=1", // Want to make marking as slow as possible.
-            "-XX:+IgnoreUnrecognizedVMOptions", // G1VerifyBitmaps is develop only.
-            "-XX:+G1VerifyBitmaps",
-            ReclaimRegionFast.class.getName());
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        output.shouldHaveExitValue(0);
-    }
-}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test TestEagerReclaimHumongousRegionsClearMarkBits
+ * @bug 8051973
+ * @summary Test to make sure that eager reclaim of humongous objects correctly clears
+ * mark bitmaps at reclaim.
+ * @key gc
+ * @library /testlibrary
+ */
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.Random;
+
+import com.oracle.java.testlibrary.OutputAnalyzer;
+import com.oracle.java.testlibrary.ProcessTools;
+
+// An object that has a few references to other instances to slow down marking.
+class ObjectWithSomeRefs {
+    public ObjectWithSomeRefs other1;
+    public ObjectWithSomeRefs other2;
+    public ObjectWithSomeRefs other3;
+    public ObjectWithSomeRefs other4;
+}
+
+class ReclaimRegionFast {
+    public static final long MAX_MILLIS_FOR_RUN = 50 * 1000; // The maximum runtime for the actual test.
+
+    public static final int M = 1024*1024;
+
+    public static LinkedList<Object> garbageList = new LinkedList<Object>();
+
+    public static void genGarbage(Object large) {
+        for (int i = 0; i < 64*1024; i++) {
+            Object[] garbage = new Object[50];
+            garbage[0] = large;
+            garbageList.add(garbage);
+        }
+        garbageList.clear();
+    }
+
+    public static ArrayList<ObjectWithSomeRefs> longList = new ArrayList<ObjectWithSomeRefs>();
+
+    public static void main(String[] args) {
+
+        for (int i = 0; i < 16*1024; i++) {
+             longList.add(new ObjectWithSomeRefs());
+        }
+
+        Random rnd = new Random();
+        for (int i = 0; i < longList.size(); i++) {
+             int len = longList.size();
+             longList.get(i).other1 = longList.get(rnd.nextInt(len));
+             longList.get(i).other2 = longList.get(rnd.nextInt(len));
+             longList.get(i).other3 = longList.get(rnd.nextInt(len));
+             longList.get(i).other4 = longList.get(rnd.nextInt(len));
+        }
+
+        int[] large1 = new int[M];
+        int[] large2 = null;
+        int[] large3 = null;
+        int[] large4 = null;
+
+        Object ref_from_stack = large1;
+
+        long start_millis = System.currentTimeMillis();
+
+        for (int i = 0; i < 20; i++) {
+            long current_millis = System.currentTimeMillis();
+            if ((current_millis - start_millis) > MAX_MILLIS_FOR_RUN) {
+              System.out.println("Finishing test because maximum runtime exceeded");
+              break;
+            }
+            // A set of large objects that will be reclaimed eagerly - and hopefully marked.
+            large1 = new int[M - 20];
+            large2 = new int[M - 20];
+            large3 = new int[M - 20];
+            large4 = new int[M - 20];
+            genGarbage(large1);
+            // Make sure that the compiler cannot completely remove
+            // the allocation of the large object until here.
+            System.out.println(large1 + " " + large2 + " " + large3 + " " + large4);
+        }
+
+        // Keep the reference to the first object alive.
+        System.out.println(ref_from_stack);
+    }
+}
+
+public class TestEagerReclaimHumongousRegionsClearMarkBits {
+    public static void main(String[] args) throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-XX:+UseG1GC",
+            "-Xms128M",
+            "-Xmx128M",
+            "-Xmn2M",
+            "-XX:G1HeapRegionSize=1M",
+            "-XX:InitiatingHeapOccupancyPercent=0", // Want to have as much as possible initial marks.
+            "-XX:+PrintGC",
+            "-XX:+VerifyAfterGC",
+            "-XX:ConcGCThreads=1", // Want to make marking as slow as possible.
+            "-XX:+IgnoreUnrecognizedVMOptions", // G1VerifyBitmaps is develop only.
+            "-XX:+G1VerifyBitmaps",
+            ReclaimRegionFast.class.getName());
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldHaveExitValue(0);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test TestEagerReclaimHumongousRegionsWithRefs
+ * @bug 8048179
+ * @summary Test to make sure that eager reclaim of humongous objects that have previously
+ * been referenced by other old gen regions work. We simply try to fill
+ * up the heap with humongous objects and create a remembered set entry from an object by
+ * referencing that we know is in the old gen. After changing this reference, the object
+ * should still be eagerly reclaimable to avoid Full GC.
+ * @key gc
+ * @library /testlibrary
+ */
+
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+import java.util.LinkedList;
+
+import com.oracle.java.testlibrary.OutputAnalyzer;
+import com.oracle.java.testlibrary.ProcessTools;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+class RefHolder {
+  Object ref;
+}
+
+class ReclaimRegionFast {
+
+    public static final int M = 1024*1024;
+
+    public static LinkedList<Object> garbageList = new LinkedList<Object>();
+
+    public static void genGarbage() {
+        for (int i = 0; i < 32*1024; i++) {
+            garbageList.add(new int[100]);
+        }
+        garbageList.clear();
+    }
+
+
+    // A large object referenced by a static.
+    static int[] filler = new int[10 * M];
+
+    // Old gen object referencing the large object, generating remembered
+    // set entries.
+    static RefHolder fromOld = new RefHolder();
+
+    public static void main(String[] args) {
+
+        int[] large = new int[M];
+
+        Object ref_from_stack = large;
+
+        for (int i = 0; i < 100; i++) {
+            // A large object that will be reclaimed eagerly.
+            large = new int[6*M];
+            fromOld.ref = large;
+            genGarbage();
+        }
+
+        // Keep the reference to the first object alive.
+        System.out.println(ref_from_stack);
+    }
+}
+
+public class TestEagerReclaimHumongousRegionsWithRefs {
+
+    public static void main(String[] args) throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-XX:+UseG1GC",
+            "-Xms128M",
+            "-Xmx128M",
+            "-Xmn16M",
+            "-XX:+PrintGC",
+            ReclaimRegionFast.class.getName());
+
+        Pattern p = Pattern.compile("Full GC");
+
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+
+        int found = 0;
+        Matcher m = p.matcher(output.getStdout());
+        while (m.find()) {
+            found++;
+        }
+        System.out.println("Issued " + found + " Full GCs");
+
+        assertLessThan(found, 10, "Found that " + found + " Full GCs were issued. This is larger than the bound. Eager reclaim of objects once referenced from old gen seems to not work at all");
+        output.shouldHaveExitValue(0);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/g1/TestG1TraceEagerReclaimHumongousObjects.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test TestG1TraceEagerReclaimHumongousObjects
+ * @bug 8058801 8048179
+ * @summary Ensure that the output for a G1TraceEagerReclaimHumongousObjects
+ * includes the expected necessary messages.
+ * @key gc
+ * @library /testlibrary
+ */
+
+import com.oracle.java.testlibrary.ProcessTools;
+import com.oracle.java.testlibrary.OutputAnalyzer;
+import java.util.LinkedList;
+
+public class TestG1TraceEagerReclaimHumongousObjects {
+  public static void main(String[] args) throws Exception {
+    testGCLogs();
+    testHumongousObjectGCLogs();
+  }
+
+  private static void testGCLogs() throws Exception {
+
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
+                                               "-Xms128M",
+                                               "-Xmx128M",
+                                               "-Xmn16M",
+                                               "-XX:G1HeapRegionSize=1M",
+                                               "-XX:+PrintGC",
+                                               "-XX:+UnlockExperimentalVMOptions",
+                                               "-XX:G1LogLevel=finest",
+                                               "-XX:+G1TraceEagerReclaimHumongousObjects",
+                                               GCTest.class.getName());
+
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+
+    // As G1EagerReclaimHumongousObjects is set(default), below logs should be displayed.
+    // And GCTest doesn't have humongous objects, so values should be zero.
+    output.shouldContain("[Humongous Reclaim");
+    output.shouldContain("[Humongous Total: 0]");
+    output.shouldContain("[Humongous Candidate: 0]");
+    output.shouldContain("[Humongous Reclaimed: 0]");
+
+    output.shouldHaveExitValue(0);
+  }
+
+  private static void testHumongousObjectGCLogs() throws Exception {
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
+                                               "-Xms128M",
+                                               "-Xmx128M",
+                                               "-Xmn16M",
+                                               "-XX:G1HeapRegionSize=1M",
+                                               "-XX:+PrintGC",
+                                               "-XX:+UnlockExperimentalVMOptions",
+                                               "-XX:G1LogLevel=finest",
+                                               "-XX:+G1TraceEagerReclaimHumongousObjects",
+                                               GCWithHumongousObjectTest.class.getName());
+
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+
+    // As G1ReclaimDeadHumongousObjectsAtYoungGC is set(default), below logs should be displayed.
+    output.shouldContain("[Humongous Reclaim");
+    output.shouldContain("[Humongous Total");
+    output.shouldContain("[Humongous Candidate");
+    output.shouldContain("[Humongous Reclaimed");
+
+    // As G1TraceReclaimDeadHumongousObjectsAtYoungGC is set and GCWithHumongousObjectTest has humongous objects,
+    // these logs should be displayed.
+    output.shouldContain("Live humongous");
+    output.shouldContain("Dead humongous region");
+    output.shouldHaveExitValue(0);
+  }
+
+  static class GCTest {
+    private static byte[] garbage;
+
+    public static void main(String [] args) {
+      System.out.println("Creating garbage");
+      // create 128MB of garbage. This should result in at least one GC
+      for (int i = 0; i < 1024; i++) {
+        garbage = new byte[128 * 1024];
+      }
+      System.out.println("Done");
+    }
+  }
+
+  static class GCWithHumongousObjectTest {
+
+    public static final int M = 1024*1024;
+    public static LinkedList<Object> garbageList = new LinkedList<Object>();
+    // A large object referenced by a static.
+    static int[] filler = new int[10 * M];
+
+    public static void genGarbage() {
+      for (int i = 0; i < 32*1024; i++) {
+        garbageList.add(new int[100]);
+      }
+      garbageList.clear();
+    }
+
+    public static void main(String[] args) {
+
+      int[] large = new int[M];
+      Object ref = large;
+
+      System.out.println("Creating garbage");
+      for (int i = 0; i < 100; i++) {
+        // A large object that will be reclaimed eagerly.
+        large = new int[6*M];
+        genGarbage();
+        // Make sure that the compiler cannot completely remove
+        // the allocation of the large object until here.
+        System.out.println(large);
+      }
+
+      // Keep the reference to the first object alive.
+      System.out.println(ref);
+      System.out.println("Done");
+    }
+  }
+}
--- a/hotspot/test/gc/g1/TestG1TraceReclaimDeadHumongousObjectsAtYoungGC.java	Fri Jan 09 05:45:13 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test TestG1TraceReclaimDeadHumongousObjectsAtYoungGC
- * @bug 8058801
- * @summary Ensure that the output for a G1TraceReclaimDeadHumongousObjectsAtYoungGC
- * includes the expected necessary messages.
- * @key gc
- * @library /testlibrary
- */
-
-import com.oracle.java.testlibrary.ProcessTools;
-import com.oracle.java.testlibrary.OutputAnalyzer;
-import java.util.LinkedList;
-
-public class TestG1TraceReclaimDeadHumongousObjectsAtYoungGC {
-  public static void main(String[] args) throws Exception {
-    testGCLogs();
-    testHumongousObjectGCLogs();
-  }
-
-  private static void testGCLogs() throws Exception {
-
-    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
-                                               "-Xms128M",
-                                               "-Xmx128M",
-                                               "-Xmn16M",
-                                               "-XX:G1HeapRegionSize=1M",
-                                               "-XX:+PrintGC",
-                                               "-XX:+UnlockExperimentalVMOptions",
-                                               "-XX:G1LogLevel=finest",
-                                               "-XX:+G1TraceReclaimDeadHumongousObjectsAtYoungGC",
-                                               GCTest.class.getName());
-
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-
-    // As G1ReclaimDeadHumongousObjectsAtYoungGC is set(default), below logs should be displayed.
-    // And GCTest doesn't have humongous objects, so values should be zero.
-    output.shouldContain("[Humongous Reclaim");
-    output.shouldContain("[Humongous Total: 0]");
-    output.shouldContain("[Humongous Candidate: 0]");
-    output.shouldContain("[Humongous Reclaimed: 0]");
-
-    output.shouldHaveExitValue(0);
-  }
-
-  private static void testHumongousObjectGCLogs() throws Exception {
-    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
-                                               "-Xms128M",
-                                               "-Xmx128M",
-                                               "-Xmn16M",
-                                               "-XX:G1HeapRegionSize=1M",
-                                               "-XX:+PrintGC",
-                                               "-XX:+UnlockExperimentalVMOptions",
-                                               "-XX:G1LogLevel=finest",
-                                               "-XX:+G1TraceReclaimDeadHumongousObjectsAtYoungGC",
-                                               GCWithHumongousObjectTest.class.getName());
-
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-
-    // As G1ReclaimDeadHumongousObjectsAtYoungGC is set(default), below logs should be displayed.
-    output.shouldContain("[Humongous Reclaim");
-    output.shouldContain("[Humongous Total");
-    output.shouldContain("[Humongous Candidate");
-    output.shouldContain("[Humongous Reclaimed");
-
-    // As G1TraceReclaimDeadHumongousObjectsAtYoungGC is set and GCWithHumongousObjectTest has humongous objects,
-    // these logs should be displayed.
-    output.shouldContain("Live humongous");
-    output.shouldContain("Reclaim humongous region");
-    output.shouldHaveExitValue(0);
-  }
-
-  static class GCTest {
-    private static byte[] garbage;
-
-    public static void main(String [] args) {
-      System.out.println("Creating garbage");
-      // create 128MB of garbage. This should result in at least one GC
-      for (int i = 0; i < 1024; i++) {
-        garbage = new byte[128 * 1024];
-      }
-      System.out.println("Done");
-    }
-  }
-
-  static class GCWithHumongousObjectTest {
-
-    public static final int M = 1024*1024;
-    public static LinkedList<Object> garbageList = new LinkedList<Object>();
-    // A large object referenced by a static.
-    static int[] filler = new int[10 * M];
-
-    public static void genGarbage() {
-      for (int i = 0; i < 32*1024; i++) {
-        garbageList.add(new int[100]);
-      }
-      garbageList.clear();
-    }
-
-    public static void main(String[] args) {
-
-      int[] large = new int[M];
-      Object ref = large;
-
-      System.out.println("Creating garbage");
-      for (int i = 0; i < 100; i++) {
-        // A large object that will be reclaimed eagerly.
-        large = new int[6*M];
-        genGarbage();
-        // Make sure that the compiler cannot completely remove
-        // the allocation of the large object until here.
-        System.out.println(large);
-      }
-
-      // Keep the reference to the first object alive.
-      System.out.println(ref);
-      System.out.println("Done");
-    }
-  }
-}
--- a/hotspot/test/gc/g1/TestGCLogMessages.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/test/gc/g1/TestGCLogMessages.java	Fri Jan 09 13:28:02 2015 -0500
@@ -23,7 +23,7 @@
 
 /*
  * @test TestGCLogMessages
- * @bug 8035406 8027295 8035398 8019342 8027959
+ * @bug 8035406 8027295 8035398 8019342 8027959 8048179
  * @summary Ensure that the PrintGCDetails output for a minor GC with G1
  * includes the expected necessary messages.
  * @key gc
@@ -54,6 +54,7 @@
     output.shouldNotContain("[String Dedup Fixup");
     output.shouldNotContain("[Young Free CSet");
     output.shouldNotContain("[Non-Young Free CSet");
+    output.shouldNotContain("[Humongous Register");
     output.shouldNotContain("[Humongous Reclaim");
     output.shouldHaveExitValue(0);
 
@@ -72,9 +73,10 @@
     output.shouldContain("[String Dedup Fixup");
     output.shouldNotContain("[Young Free CSet");
     output.shouldNotContain("[Non-Young Free CSet");
-    output.shouldContain("[Humongous Reclaim");
+    output.shouldContain("[Humongous Register");
     output.shouldNotContain("[Humongous Total");
     output.shouldNotContain("[Humongous Candidate");
+    output.shouldContain("[Humongous Reclaim");
     output.shouldNotContain("[Humongous Reclaimed");
     output.shouldHaveExitValue(0);
 
@@ -95,9 +97,10 @@
     output.shouldContain("[String Dedup Fixup");
     output.shouldContain("[Young Free CSet");
     output.shouldContain("[Non-Young Free CSet");
-    output.shouldContain("[Humongous Reclaim");
+    output.shouldContain("[Humongous Register");
     output.shouldContain("[Humongous Total");
     output.shouldContain("[Humongous Candidate");
+    output.shouldContain("[Humongous Reclaim");
     output.shouldContain("[Humongous Reclaimed");
     output.shouldHaveExitValue(0);
   }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/BadObjectClass/BootstrapRedefine.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6583051
+ * @summary Give error if java.lang.Object has been incompatibly overridden on the bootpath
+ * @library /testlibrary
+ * @compile Object.java
+ * @run main BootstrapRedefine
+ */
+
+import com.oracle.java.testlibrary.*;
+
+public class BootstrapRedefine {
+
+    public static void main(String[] args) throws Exception {
+        String testClasses = System.getProperty("test.classes", ".");
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xbootclasspath/p:" + testClasses, "-version");
+        new OutputAnalyzer(pb.start())
+            .shouldContain("Incompatible definition of java.lang.Object")
+            .shouldHaveExitValue(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/BadObjectClass/Object.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,37 @@
+/*
+ * 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 java.lang;
+
+/**
+ * This is a fake java.lang.Object class.
+ */
+public class Object {
+
+    // Add some methods
+    void dummy1() { return; }
+    void dummy2() { return; }
+    void dummy3() { return; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/CommandLine/TestNullTerminatedFlags.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.oracle.java.testlibrary.*;
+
+/*
+ * @test TestNullTerminatedFlags
+ * @bug 6522873
+ * @summary Test that the VM don't allow random junk characters at the end of valid command line flags.
+ * @library /testlibrary
+ * @run driver TestNullTerminatedFlags
+ */
+public class TestNullTerminatedFlags {
+   public static String[] options = {
+            "-Xnoclassgc",
+            "-Xconcgc",
+            "-Xnoconcgc",
+            "-Xbatch",
+            "-green",
+            "-native",
+            "-Xsqnopause",
+            "-Xrs",
+            "-Xusealtsigs",
+            "-Xoptimize",
+            "-Xprof",
+            "-Xconcurrentio",
+            "-Xinternalversion",
+            "-Xprintflags",
+            "-Xint",
+            "-Xmixed",
+            "-Xcomp",
+            "-Xshare:dump",
+            "-Xshare:on",
+            "-Xshare:auto",
+            "-Xshare:off",
+            "-Xdebug",
+            "-Xnoagent",
+            "-Xboundthreads"
+        };
+
+    public static void main(String args[]) throws Exception{
+        for (String option : options) {
+            String testOption = option + "junk";
+            ProcessBuilder pb =
+                ProcessTools.createJavaProcessBuilder(testOption, "-version");
+            new OutputAnalyzer(pb.start())
+                    .shouldContain("Unrecognized option: " + testOption)
+                    .shouldHaveExitValue(1);
+        }
+    }
+}
+
--- a/hotspot/test/runtime/CompressedOops/UseCompressedOops.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/hotspot/test/runtime/CompressedOops/UseCompressedOops.java	Fri Jan 09 13:28:02 2015 -0500
@@ -35,20 +35,42 @@
 public class UseCompressedOops {
 
     public static void main(String[] args) throws Exception {
+        testCompressedOopsModesGCs();
+        testCompressedOopsModesGCs("-XX:+UseLargePages");
+    }
+
+    public static void testCompressedOopsModesGCs(String... flags) throws Exception {
+        ArrayList<String> args = new ArrayList<>();
+        Collections.addAll(args, flags);
+
+        // Test default.
+        testCompressedOopsModes(args);
+        // Test GCs.
+        testCompressedOopsModes(args, "-XX:+UseG1GC");
+        testCompressedOopsModes(args, "-XX:+UseConcMarkSweepGC");
+        testCompressedOopsModes(args, "-XX:+UseSerialGC");
+        testCompressedOopsModes(args, "-XX:+UseParallelGC");
+        testCompressedOopsModes(args, "-XX:+UseParallelOldGC");
+    }
+
+    public static void testCompressedOopsModes(ArrayList<String> flags1, String... flags2) throws Exception {
+        ArrayList<String> args = new ArrayList<>();
+        args.addAll(flags1);
+        Collections.addAll(args, flags2);
 
         if (Platform.is64bit()) {
             // Explicitly turn of compressed oops
-            testCompressedOops("-XX:-UseCompressedOops", "-Xmx32m")
+            testCompressedOops(args, "-XX:-UseCompressedOops", "-Xmx32m")
                 .shouldNotContain("Compressed Oops")
                 .shouldHaveExitValue(0);
 
             // Compressed oops should be on by default
-            testCompressedOops("-Xmx32m")
+            testCompressedOops(args, "-Xmx32m")
                 .shouldContain("Compressed Oops mode")
                 .shouldHaveExitValue(0);
 
             // Explicly enabling compressed oops
-            testCompressedOops("-XX:+UseCompressedOops", "-Xmx32m")
+            testCompressedOops(args, "-XX:+UseCompressedOops", "-Xmx32m")
                 .shouldContain("Compressed Oops mode")
                 .shouldHaveExitValue(0);
 
@@ -58,68 +80,89 @@
             // puts the heap way up, forcing different behaviour.
             if (!Platform.isOSX() && !Platform.isSolaris()) {
                 // Larger than 4gb heap should result in zero based with shift 3
-                testCompressedOops("-XX:+UseCompressedOops", "-Xmx5g")
+                testCompressedOops(args, "-XX:+UseCompressedOops", "-Xmx5g")
+                    .shouldContain("Zero based")
+                    .shouldContain("Oop shift amount: 3")
+                    .shouldHaveExitValue(0);
+
+                // Larger than 3gb heap and HeapBaseMinAddress=1g should result in zero based with shift 3
+                testCompressedOops(args, "-XX:+UseCompressedOops", "-Xmx3200m", "-XX:HeapBaseMinAddress=1g")
                     .shouldContain("Zero based")
                     .shouldContain("Oop shift amount: 3")
                     .shouldHaveExitValue(0);
 
                 // Small heap above 4gb should result in zero based with shift 3
-                testCompressedOops("-XX:+UseCompressedOops", "-Xmx32m", "-XX:HeapBaseMinAddress=4g")
+                testCompressedOops(args, "-XX:+UseCompressedOops", "-Xmx32m", "-XX:HeapBaseMinAddress=4g")
                     .shouldContain("Zero based")
                     .shouldContain("Oop shift amount: 3")
                     .shouldHaveExitValue(0);
 
                 // Small heap above 32gb should result in non-zero based with shift 3
-                testCompressedOops("-XX:+UseCompressedOops", "-Xmx32m", "-XX:HeapBaseMinAddress=32g")
+                testCompressedOops(args, "-XX:+UseCompressedOops", "-Xmx32m", "-XX:HeapBaseMinAddress=32g")
+                    .shouldContain("Non-zero disjoint base")
+                    .shouldContain("Oop shift amount: 3")
+                    .shouldHaveExitValue(0);
+
+                // Small heap above 32gb should result in non-zero based with shift 3
+                testCompressedOops(args, "-XX:+UseCompressedOops", "-Xmx32m", "-XX:HeapBaseMinAddress=72704m")
                     .shouldContain("Non-zero based")
                     .shouldContain("Oop shift amount: 3")
                     .shouldHaveExitValue(0);
 
                 // 32gb heap with heap base above 64gb and object alignment set to 16 bytes should result
                 // in non-zero based with shift 4
-                testCompressedOops("-XX:+UseCompressedOops", "-Xmx32g", "-XX:ObjectAlignmentInBytes=16",
+                testCompressedOops(args, "-XX:+UseCompressedOops", "-Xmx32g", "-XX:ObjectAlignmentInBytes=16",
                                "-XX:HeapBaseMinAddress=64g")
-                    .shouldContain("Non-zero based")
+                    .shouldContain("Non-zero disjoint base")
                     .shouldContain("Oop shift amount: 4")
                     .shouldHaveExitValue(0);
 
                 // 32gb heap with object alignment set to 16 bytes should result in zero based with shift 4
-                testCompressedOops("-XX:+UseCompressedOops", "-Xmx32g", "-XX:ObjectAlignmentInBytes=16")
+                testCompressedOops(args, "-XX:+UseCompressedOops", "-Xmx32g", "-XX:ObjectAlignmentInBytes=16")
                     .shouldContain("Zero based")
                     .shouldContain("Oop shift amount: 4")
                     .shouldHaveExitValue(0);
             }
 
+            // This is a pathologic case for the heap allocation algorithm. Regression test.
+            // HeapBaseMinAddress must be 2g and should not be set on the command line.
+            testCompressedOops(args, "-XX:+UseCompressedOops", "-Xmx2g")
+                .shouldNotContain("Max heap size too large for Compressed Oops")
+                .shouldHaveExitValue(0);
+            testCompressedOops(args, "-XX:+UseCompressedOops", "-Xmx29g", "-XX:CompressedClassSpaceSize=1g")
+                .shouldNotContain("Max heap size too large for Compressed Oops")
+                .shouldHaveExitValue(0);
+
             // Explicitly enabling compressed oops with 32gb heap should result a warning
-            testCompressedOops("-XX:+UseCompressedOops", "-Xmx32g")
+            testCompressedOops(args, "-XX:+UseCompressedOops", "-Xmx32g")
                 .shouldContain("Max heap size too large for Compressed Oops")
                 .shouldHaveExitValue(0);
 
             // 32gb heap should not result a warning
-            testCompressedOops("-Xmx32g")
+            testCompressedOops(args, "-Xmx32g")
                 .shouldNotContain("Max heap size too large for Compressed Oops")
                 .shouldHaveExitValue(0);
 
             // Explicitly enabling compressed oops with 32gb heap and object
             // alignment set to 8 byte should result a warning
-            testCompressedOops("-XX:+UseCompressedOops", "-Xmx32g", "-XX:ObjectAlignmentInBytes=8")
+            testCompressedOops(args, "-XX:+UseCompressedOops", "-Xmx32g", "-XX:ObjectAlignmentInBytes=8")
                 .shouldContain("Max heap size too large for Compressed Oops")
                 .shouldHaveExitValue(0);
 
             // 64gb heap and object alignment set to 16 bytes should result in a warning
-            testCompressedOops("-XX:+UseCompressedOops", "-Xmx64g", "-XX:ObjectAlignmentInBytes=16")
+            testCompressedOops(args, "-XX:+UseCompressedOops", "-Xmx64g", "-XX:ObjectAlignmentInBytes=16")
                 .shouldContain("Max heap size too large for Compressed Oops")
                 .shouldHaveExitValue(0);
 
         } else {
             // Compressed oops should only apply to 64bit platforms
-            testCompressedOops("-XX:+UseCompressedOops", "-Xmx32m")
+            testCompressedOops(args, "-XX:+UseCompressedOops", "-Xmx32m")
                 .shouldContain("Unrecognized VM option 'UseCompressedOops'")
                 .shouldHaveExitValue(1);
         }
     }
 
-    private static OutputAnalyzer testCompressedOops(String... flags) throws Exception {
+    private static OutputAnalyzer testCompressedOops(ArrayList<String> flags1, String... flags2) throws Exception {
         ArrayList<String> args = new ArrayList<>();
 
         // Always run with these three:
@@ -128,7 +171,8 @@
         args.add("-Xms32m");
 
         // Add the extra flags
-        Collections.addAll(args, flags);
+        args.addAll(flags1);
+        Collections.addAll(args, flags2);
 
         args.add("-version");
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License
+ * version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @bug 8059510
+ * @summary Test jcmd VM.symboltable and VM.stringtable options
+ * @library /testlibrary
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions DumpSymbolAndStringTable
+ */
+
+import com.oracle.java.testlibrary.*;
+
+public class DumpSymbolAndStringTable {
+    public static void main(String[] args) throws Exception {
+        // Grab my own PID
+        String pid = Integer.toString(ProcessTools.getProcessId());
+
+        ProcessBuilder pb = new ProcessBuilder();
+        pb.command(new String[] {JDKToolFinder.getJDKTool("jcmd"), pid, "VM.symboltable", "-verbose"});
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        try {
+            output.shouldContain("24 2: DumpSymbolAndStringTable\n");
+        } catch (RuntimeException e) {
+            output.shouldContain("Unknown diagnostic command");
+        }
+
+        pb.command(new String[] {JDKToolFinder.getJDKTool("jcmd"), pid, "VM.stringtable", "-verbose"});
+        output = new OutputAnalyzer(pb.start());
+        try {
+            output.shouldContain("16: java.lang.String\n");
+        } catch (RuntimeException e) {
+            output.shouldContain("Unknown diagnostic command");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8059510
+ * @summary Test SharedSymbolTableBucketSize option
+ * @library /testlibrary
+ */
+
+import com.oracle.java.testlibrary.*;
+
+public class SharedSymbolTableBucketSize {
+    public static void main(String[] args) throws Exception {
+        int bucket_size = 8;
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-Xshare:dump", "-XX:+PrintSharedSpaces",
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-XX:SharedArchiveFile=./sample.jsa",
+            "-XX:SharedSymbolTableBucketSize=" + Integer.valueOf(bucket_size));
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Loading classes to share");
+        output.shouldHaveExitValue(0);
+
+        String s = output.firstMatch("Average bucket size     : .*");
+        Float f = Float.parseFloat(s.substring(25));
+        int size = Math.round(f);
+        if (size != bucket_size) {
+          throw new Exception("FAILED: incorrect bucket size " + size +
+                              ", expect " + bucket_size);
+        }
+
+
+        // Invalid SharedSymbolTableBucketSize input
+        String input[] = {"-XX:SharedSymbolTableBucketSize=-1",
+                          "-XX:SharedSymbolTableBucketSize=2.5"};
+        for (int i = 0; i < input.length; i++) {
+          pb = ProcessTools.createJavaProcessBuilder(
+               "-Xshare:dump", "-XX:+PrintSharedSpaces",
+               "-XX:+UnlockDiagnosticVMOptions",
+               "-XX:SharedArchiveFile=./sample.jsa",
+               input[i]);
+          output = new OutputAnalyzer(pb.start());
+          output.shouldContain("Improperly specified VM option");
+      }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/stress/gc/TestGCOld.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,417 @@
+/*
+* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*/
+
+/*
+ * @test TestGCOld
+ * @key gc
+ * @key stress
+ * @requires vm.gc=="null"
+ * @summary Stress the GC by trying to make old objects more likely to be garbage than young objects.
+ * @run main/othervm -Xmx384M -XX:+UseSerialGC TestGCOld 50 1 20 10 10000
+ * @run main/othervm -Xmx384M -XX:+UseParallelGC TestGCOld 50 1 20 10 10000
+ * @run main/othervm -Xmx384M -XX:+UseParallelGC -XX:-UseParallelOldGC TestGCOld 50 1 20 10 10000
+ * @run main/othervm -Xmx384M -XX:+UseConcMarkSweepGC TestGCOld 50 1 20 10 10000
+ * @run main/othervm -Xmx384M -XX:+UseG1GC TestGCOld 50 1 20 10 10000
+ */
+
+import java.text.*;
+import java.util.Random;
+
+class TreeNode {
+    public TreeNode left, right;
+    public int val;                // will always be the height of the tree
+}
+
+
+/* Args:
+   live-data-size: in megabytes (approximate, will be rounded down).
+   work: units of mutator non-allocation work per byte allocated,
+     (in unspecified units.  This will affect the promotion rate
+      printed at the end of the run: more mutator work per step implies
+      fewer steps per second implies fewer bytes promoted per second.)
+   short/long ratio: ratio of short-lived bytes allocated to long-lived
+      bytes allocated.
+   pointer mutation rate: number of pointer mutations per step.
+   steps: number of steps to do.
+*/
+
+public class TestGCOld {
+
+  // Command-line parameters.
+
+  private static int size, workUnits, promoteRate, ptrMutRate, steps;
+
+  // Constants.
+
+  private static final int MEG = 1000000;
+  private static final int INSIGNIFICANT = 999; // this many bytes don't matter
+  private static final int BYTES_PER_WORD = 4;
+  private static final int BYTES_PER_NODE = 20; // bytes per TreeNode
+  private static final int WORDS_DEAD = 100;    // size of young garbage object
+
+  private final static int treeHeight = 14;
+  private final static long treeSize = heightToBytes(treeHeight);
+
+  private static final String msg1
+    = "Usage: java TestGCOld <size> <work> <ratio> <mutation> <steps>";
+  private static final String msg2
+    = "  where <size> is the live storage in megabytes";
+  private static final String msg3
+    = "        <work> is the mutator work per step (arbitrary units)";
+  private static final String msg4
+    = "        <ratio> is the ratio of short-lived to long-lived allocation";
+  private static final String msg5
+    = "        <mutation> is the mutations per step";
+  private static final String msg6
+    = "        <steps> is the number of steps";
+
+  // Counters (and global variables that discourage optimization)
+
+  private static long youngBytes = 0;    // total young bytes allocated
+  private static long nodes = 0;         // total tree nodes allocated
+  private static long actuallyMut = 0;   // pointer mutations in old trees
+  private static long mutatorSum = 0;    // checksum to discourage optimization
+  public static int[] aexport;           // exported array to discourage opt
+
+  // Global variables.
+
+  private static TreeNode[] trees;
+  private static int where = 0;               // roving index into trees
+  private static Random rnd = new Random();
+
+  // Returns the height of the given tree.
+
+  private static int height (TreeNode t) {
+    if (t == null) {
+      return 0;
+    }
+    else {
+      return 1 + Math.max (height (t.left), height (t.right));
+    }
+  }
+
+  // Returns the length of the shortest path in the given tree.
+
+  private static int shortestPath (TreeNode t) {
+    if (t == null) {
+      return 0;
+    }
+    else {
+      return 1 + Math.min (shortestPath (t.left), shortestPath (t.right));
+    }
+  }
+
+  // Returns the number of nodes in a balanced tree of the given height.
+
+  private static long heightToNodes (int h) {
+    if (h == 0) {
+      return 0;
+    }
+    else {
+      long n = 1;
+      while (h > 1) {
+        n = n + n;
+        h = h - 1;
+      }
+      return n + n - 1;
+    }
+  }
+
+  // Returns the number of bytes in a balanced tree of the given height.
+
+  private static long heightToBytes (int h) {
+    return BYTES_PER_NODE * heightToNodes (h);
+  }
+
+  // Returns the height of the largest balanced tree
+  // that has no more than the given number of nodes.
+
+  private static int nodesToHeight (long nodes) {
+    int h = 1;
+    long n = 1;
+    while (n + n - 1 <= nodes) {
+      n = n + n;
+      h = h + 1;
+    }
+    return h - 1;
+  }
+
+  // Returns the height of the largest balanced tree
+  // that occupies no more than the given number of bytes.
+
+  private static int bytesToHeight (long bytes) {
+    return nodesToHeight (bytes / BYTES_PER_NODE);
+  }
+
+  // Returns a newly allocated balanced binary tree of height h.
+
+  private static TreeNode makeTree(int h) {
+    if (h == 0) return null;
+    else {
+      TreeNode res = new TreeNode();
+      nodes++;
+      res.left = makeTree(h-1);
+      res.right = makeTree(h-1);
+      res.val = h;
+      return res;
+    }
+  }
+
+  // Allocates approximately size megabytes of trees and stores
+  // them into a global array.
+
+  private static void init() {
+    int ntrees = (int) ((size * MEG) / treeSize);
+    trees = new TreeNode[ntrees];
+
+    System.err.println("Allocating " + ntrees + " trees.");
+    System.err.println("  (" + (ntrees * treeSize) + " bytes)");
+    for (int i = 0; i < ntrees; i++) {
+      trees[i] = makeTree(treeHeight);
+      // doYoungGenAlloc(promoteRate*ntrees*treeSize, WORDS_DEAD);
+    }
+    System.err.println("  (" + nodes + " nodes)");
+
+    /* Allow any in-progress GC to catch up... */
+    // try { Thread.sleep(20000); } catch (InterruptedException x) {}
+  }
+
+  // Confirms that all trees are balanced and have the correct height.
+
+  private static void checkTrees() {
+    int ntrees = trees.length;
+    for (int i = 0; i < ntrees; i++) {
+      TreeNode t = trees[i];
+      int h1 = height(t);
+      int h2 = shortestPath(t);
+      if ((h1 != treeHeight) || (h2 != treeHeight)) {
+        System.err.println("*****BUG: " + h1 + " " + h2);
+      }
+    }
+  }
+
+  // Called only by replaceTree (below) and by itself.
+
+  private static void replaceTreeWork(TreeNode full, TreeNode partial, boolean dir) {
+    boolean canGoLeft = full.left != null && full.left.val > partial.val;
+    boolean canGoRight = full.right != null && full.right.val > partial.val;
+    if (canGoLeft && canGoRight) {
+      if (dir)
+        replaceTreeWork(full.left, partial, !dir);
+      else
+        replaceTreeWork(full.right, partial, !dir);
+    } else if (!canGoLeft && !canGoRight) {
+      if (dir)
+        full.left = partial;
+      else
+        full.right = partial;
+    } else if (!canGoLeft) {
+      full.left = partial;
+    } else {
+      full.right = partial;
+    }
+  }
+
+  // Given a balanced tree full and a smaller balanced tree partial,
+  // replaces an appropriate subtree of full by partial, taking care
+  // to preserve the shape of the full tree.
+
+  private static void replaceTree(TreeNode full, TreeNode partial) {
+    boolean dir = (partial.val % 2) == 0;
+    actuallyMut++;
+    replaceTreeWork(full, partial, dir);
+  }
+
+  // Allocates approximately n bytes of long-lived storage,
+  // replacing oldest existing long-lived storage.
+
+  private static void oldGenAlloc(long n) {
+    int full = (int) (n / treeSize);
+    long partial = n % treeSize;
+    // System.out.println("In oldGenAlloc, doing " + full + " full trees "
+    // + "and one partial tree of size " + partial);
+    for (int i = 0; i < full; i++) {
+      trees[where++] = makeTree(treeHeight);
+      if (where == trees.length) where = 0;
+    }
+    while (partial > INSIGNIFICANT) {
+      int h = bytesToHeight(partial);
+      TreeNode newTree = makeTree(h);
+      replaceTree(trees[where++], newTree);
+      if (where == trees.length) where = 0;
+      partial = partial - heightToBytes(h);
+    }
+  }
+
+  // Interchanges two randomly selected subtrees (of same size and depth).
+
+  private static void oldGenSwapSubtrees() {
+    // Randomly pick:
+    //   * two tree indices
+    //   * A depth
+    //   * A path to that depth.
+    int index1 = rnd.nextInt(trees.length);
+    int index2 = rnd.nextInt(trees.length);
+    int depth = rnd.nextInt(treeHeight);
+    int path = rnd.nextInt();
+    TreeNode tn1 = trees[index1];
+    TreeNode tn2 = trees[index2];
+    for (int i = 0; i < depth; i++) {
+      if ((path & 1) == 0) {
+        tn1 = tn1.left;
+        tn2 = tn2.left;
+      } else {
+        tn1 = tn1.right;
+        tn2 = tn2.right;
+      }
+      path >>= 1;
+    }
+    TreeNode tmp;
+    if ((path & 1) == 0) {
+      tmp = tn1.left;
+      tn1.left = tn2.left;
+      tn2.left = tmp;
+    } else {
+      tmp = tn1.right;
+      tn1.right = tn2.right;
+      tn2.right = tmp;
+    }
+    actuallyMut += 2;
+  }
+
+  // Update "n" old-generation pointers.
+
+  private static void oldGenMut(long n) {
+    for (int i = 0; i < n/2; i++) {
+      oldGenSwapSubtrees();
+    }
+  }
+
+  // Does the amount of mutator work appropriate for n bytes of young-gen
+  // garbage allocation.
+
+  private static void doMutWork(long n) {
+    int sum = 0;
+    long limit = workUnits*n/10;
+    for (long k = 0; k < limit; k++) sum++;
+    // We don't want dead code elimination to eliminate the loop above.
+    mutatorSum = mutatorSum + sum;
+  }
+
+  // Allocate n bytes of young-gen garbage, in units of "nwords"
+  // words.
+
+  private static void doYoungGenAlloc(long n, int nwords) {
+    final int nbytes = nwords*BYTES_PER_WORD;
+    int allocated = 0;
+    while (allocated < n) {
+      aexport = new int[nwords];
+      /* System.err.println("Step"); */
+      allocated += nbytes;
+    }
+    youngBytes = youngBytes + allocated;
+  }
+
+  // Allocate "n" bytes of young-gen data; and do the
+  // corresponding amount of old-gen allocation and pointer
+  // mutation.
+
+  // oldGenAlloc may perform some mutations, so this code
+  // takes those mutations into account.
+
+  private static void doStep(long n) {
+    long mutations = actuallyMut;
+
+    doYoungGenAlloc(n, WORDS_DEAD);
+    doMutWork(n);
+    oldGenAlloc(n / promoteRate);
+    oldGenMut(Math.max(0L, (mutations + ptrMutRate) - actuallyMut));
+  }
+
+  public static void main(String[] args) {
+    if (args.length != 5) {
+      System.err.println(msg1);
+      System.err.println(msg2);
+      System.err.println(msg3);
+      System.err.println(msg4);
+      System.err.println(msg5);
+      System.err.println(msg6);
+      return;
+    }
+
+    size = Integer.parseInt(args[0]);
+    workUnits = Integer.parseInt(args[1]);
+    promoteRate = Integer.parseInt(args[2]);
+    ptrMutRate = Integer.parseInt(args[3]);
+    steps = Integer.parseInt(args[4]);
+
+    System.out.println(size + " megabytes of live storage");
+    System.out.println(workUnits + " work units per step");
+    System.out.println("promotion ratio is 1:" + promoteRate);
+    System.out.println("pointer mutation rate is " + ptrMutRate);
+    System.out.println(steps + " steps");
+
+    init();
+//  checkTrees();
+    youngBytes = 0;
+    nodes = 0;
+
+    System.err.println("Initialization complete...");
+
+    long start = System.currentTimeMillis();
+
+    for (int step = 0; step < steps; step++) {
+      doStep(MEG);
+    }
+
+    long end = System.currentTimeMillis();
+    float secs = ((float)(end-start))/1000.0F;
+
+//  checkTrees();
+
+    NumberFormat nf = NumberFormat.getInstance();
+    nf.setMaximumFractionDigits(1);
+    System.out.println("\nTook " + nf.format(secs) + " sec in steady state.");
+    nf.setMaximumFractionDigits(2);
+    System.out.println("Allocated " + steps + " Mb of young gen garbage"
+                       + " (= " + nf.format(((float)steps)/secs) +
+                       " Mb/sec)");
+    System.out.println("    (actually allocated " +
+                       nf.format(((float) youngBytes)/MEG) + " megabytes)");
+    float promoted = ((float)steps) / (float)promoteRate;
+    System.out.println("Promoted " + promoted +
+                       " Mb (= " + nf.format(promoted/secs) + " Mb/sec)");
+    System.out.println("    (actually promoted " +
+                       nf.format(((float) (nodes * BYTES_PER_NODE))/MEG) +
+                       " megabytes)");
+    if (ptrMutRate != 0) {
+      System.out.println("Mutated " + actuallyMut +
+                         " pointers (= " +
+                         nf.format(actuallyMut/secs) + " ptrs/sec)");
+
+    }
+    // This output serves mainly to discourage optimization.
+    System.out.println("Checksum = " + (mutatorSum + aexport.length));
+
+  }
+}
--- a/jaxp/.hgtags	Fri Jan 09 05:45:13 2015 -0800
+++ b/jaxp/.hgtags	Fri Jan 09 13:28:02 2015 -0500
@@ -285,3 +285,5 @@
 3f46e2196498de33e7c65efa7b372e46f1faba01 jdk9-b40
 71dd8f7649428efd3a56ca5fefc80e59d37b8434 jdk9-b41
 47b0d3fa4118b9d56870cf4004987438c501f5c0 jdk9-b42
+40b242363040229a05224fbc5dc203a3f46a8f8f jdk9-b43
+0cb0844b58924d6086d2850c22087d06679d5eef jdk9-b44
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/Makefile	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,325 @@
+#
+# Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# Makefile to run various JAXP tests
+#
+
+.DEFAULT : all
+
+# Empty these to get rid of some default rules
+.SUFFIXES:
+.SUFFIXES: .java
+CO=
+GET=
+
+# Utilities used
+AWK       = awk
+CAT       = cat
+CD        = cd
+CHMOD     = chmod
+CP        = cp
+CUT       = cut
+DIRNAME   = dirname
+ECHO      = echo
+EGREP     = egrep
+EXPAND    = expand
+FIND      = find
+MKDIR     = mkdir
+PWD       = pwd
+SED       = sed
+SORT      = sort
+TEE       = tee
+UNAME     = uname
+UNIQ      = uniq
+WC        = wc
+ZIP       = zip
+
+# Get OS name from uname (Cygwin inexplicably adds _NT-5.1)
+UNAME_S := $(shell $(UNAME) -s | $(CUT) -f1 -d_)
+
+# Commands to run on paths to make mixed paths for java on windows
+ifeq ($(UNAME_S), CYGWIN)
+  # Location of developer shared files
+  SLASH_JAVA = J:
+  GETMIXEDPATH = cygpath -m
+else
+  # Location of developer shared files
+  SLASH_JAVA = /java
+
+  GETMIXEDPATH=$(ECHO)
+endif
+
+# Root of this test area (important to use full paths in some places)
+TEST_ROOT := $(shell $(PWD))
+
+# Root of all test results
+ifdef ALT_OUTPUTDIR
+  ABS_OUTPUTDIR = $(shell $(CD) $(ALT_OUTPUTDIR) && $(PWD))
+else
+  ABS_OUTPUTDIR = $(shell $(CD) $(TEST_ROOT)/.. && $(PWD))
+endif
+
+ABS_PLATFORM_BUILD_ROOT = $(ABS_OUTPUTDIR)
+ABS_TEST_OUTPUT_DIR := $(ABS_PLATFORM_BUILD_ROOT)/testoutput/$(UNIQUE_DIR)
+
+# Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test)
+ifndef PRODUCT_HOME
+  # Try to use j2sdk-image if it exists
+  ABS_JDK_IMAGE = $(ABS_PLATFORM_BUILD_ROOT)/images/j2sdk-image
+  PRODUCT_HOME :=                       		\
+    $(shell                             		\
+      if [ -d $(ABS_JDK_IMAGE) ] ; then 		\
+         $(ECHO) "$(ABS_JDK_IMAGE)";    		\
+       else                             		\
+         $(ECHO) "$(ABS_PLATFORM_BUILD_ROOT)";		\
+       fi)
+  PRODUCT_HOME := $(PRODUCT_HOME)
+endif
+
+# Expect JPRT to set JPRT_PRODUCT_ARGS (e.g. -server etc.)
+#   Should be passed into 'java' only.
+#   Could include: -d64 -server -client OR any java option
+ifdef JPRT_PRODUCT_ARGS
+  JAVA_ARGS = $(JPRT_PRODUCT_ARGS)
+endif
+
+# Expect JPRT to set JPRT_PRODUCT_VM_ARGS (e.g. -Xcomp etc.)
+#   Should be passed into anything running the vm (java, javac, javadoc, ...).
+ifdef JPRT_PRODUCT_VM_ARGS
+  JAVA_VM_ARGS = $(JPRT_PRODUCT_VM_ARGS)
+endif
+
+# Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results)
+ifdef JPRT_ARCHIVE_BUNDLE
+  ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE)
+else
+  ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip
+endif
+
+# How to create the test bundle (pass or fail, we want to create this)
+#   Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
+ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`     \
+	           && $(CD) $(ABS_TEST_OUTPUT_DIR)             \
+	           && $(CHMOD) -R a+r . \
+	           && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . )
+
+# important results files
+SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport/text/summary.txt")
+STATS_TXT_NAME = Stats.txt
+STATS_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/$(STATS_TXT_NAME)")
+RUNLIST   = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/runlist.txt")
+PASSLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/passlist.txt")
+FAILLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/faillist.txt")
+EXITCODE  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/exitcode.txt")
+
+TESTEXIT = \
+  if [ ! -s $(EXITCODE) ] ; then \
+    $(ECHO) "ERROR: EXITCODE file not filled in."; \
+    $(ECHO) "1" > $(EXITCODE); \
+  fi ; \
+  testExitCode=`$(CAT) $(EXITCODE)`; \
+  $(ECHO) "EXIT CODE: $${testExitCode}"; \
+  exit $${testExitCode}
+
+BUNDLE_UP_AND_EXIT = \
+( \
+  jtregExitCode=$$? && \
+  _summary="$(SUMMARY_TXT)"; \
+  $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \
+  $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \
+  if [ -r "$${_summary}" ] ; then \
+    $(ECHO) "Summary: $(UNIQUE_DIR)" > $(STATS_TXT); \
+    $(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \
+    $(EGREP) ' Passed\.' $(RUNLIST) \
+      | $(EGREP) -v ' Error\.' \
+      | $(EGREP) -v ' Failed\.' > $(PASSLIST); \
+    ( $(EGREP) ' Failed\.' $(RUNLIST); \
+      $(EGREP) ' Error\.' $(RUNLIST); \
+      $(EGREP) -v ' Passed\.' $(RUNLIST) ) \
+      | $(SORT) | $(UNIQ) > $(FAILLIST); \
+    if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \
+      $(EXPAND) $(FAILLIST) \
+        | $(CUT) -d' ' -f1 \
+        | $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \
+      if [ $${jtregExitCode} = 0 ] ; then \
+        jtregExitCode=1; \
+      fi; \
+    fi; \
+    runc="`$(CAT) $(RUNLIST)      | $(WC) -l | $(AWK) '{print $$1;}'`"; \
+    passc="`$(CAT) $(PASSLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
+    failc="`$(CAT) $(FAILLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
+    exclc="FIXME CODETOOLS-7900176"; \
+    $(ECHO) "TEST STATS: name=$(UNIQUE_DIR)  run=$${runc}  pass=$${passc}  fail=$${failc}" \
+      >> $(STATS_TXT); \
+  else \
+    $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
+  fi; \
+  if [ -f $(STATS_TXT) ] ; then \
+    $(CAT) $(STATS_TXT); \
+  fi; \
+  $(ZIP_UP_RESULTS) ; \
+  $(TESTEXIT) \
+)
+
+################################################################
+
+# Default make rule (runs default JAXP tests)
+all: jaxp_all
+	@$(ECHO) "Testing completed successfully"
+
+# Prep for output
+# Change execute permissions on shared library files.
+# Files in repositories should never have execute permissions, but
+# there are some tests that have pre-built shared libraries, and these
+# windows dll files must have execute permission. Adding execute
+# permission may happen automatically on windows when using certain
+# versions of mercurial but it cannot be guaranteed. And blindly
+# adding execute permission might be seen as a mercurial 'change', so
+# we avoid adding execute permission to repository files. But testing
+# from a plain source tree needs the chmod a+rx. Applying the chmod to
+# all shared libraries not just dll files. And with CYGWIN and sshd
+# service, you may need CYGWIN=ntsec for this to work.
+prep:
+	@$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
+	@$(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`
+	@if [ ! -d $(TEST_ROOT)/../.hg ] ; then                          \
+	  $(FIND) $(TEST_ROOT) \( -name \*.dll -o -name \*.DLL -o -name \*.so \)  \
+	        -exec $(CHMOD) a+rx {} \; ;                             \
+        fi
+
+# Cleanup
+clean:
+	@$(RM) -r $(ABS_TEST_OUTPUT_DIR)
+	@$(RM) $(ARCHIVE_BUNDLE)
+
+################################################################
+
+# jtreg tests
+
+# Expect JT_HOME to be set for jtreg tests. (home for jtreg)
+ifndef JT_HOME
+  JT_HOME = $(SLASH_JAVA)/re/jtreg/4.1/promoted/latest/binaries/jtreg
+  ifdef JPRT_JTREG_HOME
+    JT_HOME = $(JPRT_JTREG_HOME)
+  endif
+endif
+
+# Problematic tests to be excluded
+PROBLEM_LISTS=$(call MixedDirs,$(wildcard ProblemList.txt closed/ProblemList.txt))
+
+# Create exclude list for this platform and arch
+ifdef NO_EXCLUDES
+  JTREG_EXCLUSIONS =
+else
+  JTREG_EXCLUSIONS = $(PROBLEM_LISTS:%=-exclude:%)
+endif
+
+# convert list of directories to dos paths
+define MixedDirs
+$(foreach i,$1,$(shell $(GETMIXEDPATH) "${i}"))
+endef
+
+define SummaryInfo
+$(ECHO) "########################################################"
+$(CAT) $(?:%=$(ABS_TEST_OUTPUT_DIR)/%/$(STATS_TXT_NAME))
+$(ECHO) "########################################################"
+endef
+
+# ------------------------------------------------------------------
+
+jaxp_%:
+	$(ECHO) "Running tests: $@"
+	for each in $@; do \
+	        $(MAKE) -j 1 TEST_SELECTION=":$$each" UNIQUE_DIR=$$each jtreg_tests; \
+	done
+
+# ------------------------------------------------------------------
+
+ifdef CONCURRENCY
+  EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY)
+endif
+
+# Default JTREG to run (win32 script works for everybody)
+JTREG = $(JT_HOME)/win32/bin/jtreg
+# run in agentvm mode
+JTREG_BASIC_OPTIONS += -agentvm
+# Only run automatic tests
+JTREG_BASIC_OPTIONS += -a
+# Always turn on assertions
+JTREG_ASSERT_OPTION = -ea -esa
+JTREG_BASIC_OPTIONS += $(JTREG_ASSERT_OPTION)
+# Report details on all failed or error tests, times too
+JTREG_BASIC_OPTIONS += -v:fail,error,time
+# Retain all files for failing tests
+JTREG_BASIC_OPTIONS += -retain:fail,error
+# Ignore tests are not run and completely silent about it
+JTREG_IGNORE_OPTION = -ignore:quiet
+JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION)
+# Multiple by 4 the timeout numbers
+JTREG_TIMEOUT_OPTION =  -timeoutFactor:4
+JTREG_BASIC_OPTIONS += $(JTREG_TIMEOUT_OPTION)
+# Set the max memory for jtreg control vm
+JTREG_MEMORY_OPTION = -J-Xmx512m
+JTREG_BASIC_OPTIONS += $(JTREG_MEMORY_OPTION)
+# Add any extra options
+JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
+# Set other vm and test options
+JTREG_TEST_OPTIONS = $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_VM_ARGS:%=-vmoption:%)
+# Set the GC options for test vms
+#JTREG_GC_OPTION = -vmoption:-XX:+UseSerialGC
+#JTREG_TEST_OPTIONS += $(JTREG_GC_OPTION)
+# Set the max memory for jtreg target test vms
+JTREG_TESTVM_MEMORY_OPTION = -vmoption:-Xmx512m
+JTREG_TEST_OPTIONS += $(JTREG_TESTVM_MEMORY_OPTION)
+
+# Make sure jtreg exists
+$(JTREG): $(JT_HOME)
+
+# Run jtreg
+jtreg_tests: prep $(PRODUCT_HOME) $(JTREG)
+	(                                                                    \
+	  ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)");                   \
+            export JT_HOME;                                                  \
+            $(shell $(GETMIXEDPATH) "$(JTREG)")                              \
+              $(JTREG_BASIC_OPTIONS)                                         \
+              -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport")  \
+              -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork")    \
+              -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)")                \
+              $(JTREG_EXCLUSIONS)                                            \
+              $(JTREG_TEST_OPTIONS)                                          \
+              $(TEST_SELECTION)                                                    \
+	  ) ;                                                                \
+	  $(BUNDLE_UP_AND_EXIT)                                              \
+	) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT)
+
+PHONY_LIST += jtreg_tests
+
+################################################################
+
+# Phony targets (e.g. these are not filenames)
+.PHONY: all clean prep $(PHONY_LIST)
+
+################################################################
--- a/jaxp/test/TEST.ROOT	Fri Jan 09 05:45:13 2015 -0800
+++ b/jaxp/test/TEST.ROOT	Fri Jan 09 13:28:02 2015 -0500
@@ -2,5 +2,7 @@
 # It also contains test-suite configuration information.
 
 # Tests that must run in othervm mode
-othervm.dirs=javax/xml/jaxp/unittest
+othervm.dirs=javax/xml/jaxp
 
+# Group definitions
+groups=TEST.groups 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/TEST.groups	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,24 @@
+#  Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+#  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+#  This code is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU General Public License version 2 only, as
+#  published by the Free Software Foundation.
+#
+#  This code is distributed in the hope that it will be useful, but WITHOUT
+#  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+#  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+#  version 2 for more details (a copy is included in the LICENSE file that
+#  accompanied this code).
+#
+#  You should have received a copy of the GNU General Public License version
+#  2 along with this work; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+#  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+#  or visit www.oracle.com if you need additional information or have any
+#  questions.
+#
+
+jaxp_all = \
+    javax/xml/jaxp
--- a/jaxws/.hgtags	Fri Jan 09 05:45:13 2015 -0800
+++ b/jaxws/.hgtags	Fri Jan 09 13:28:02 2015 -0500
@@ -288,3 +288,5 @@
 5455969de31f3083bcfd779b7acc3ab758ecb308 jdk9-b40
 4f785187377fe4c7ff388a7026dd72fcccdcfe7a jdk9-b41
 301ddb4478fb36d1f025d14e7e48c2a434e9e6ff jdk9-b42
+edc13d27dc871be57d7ca77eef77e6d04972fee2 jdk9-b43
+2a03baa4d849818ff6d635f110c2813b12fc2326 jdk9-b44
--- a/jdk/.hgtags	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/.hgtags	Fri Jan 09 13:28:02 2015 -0500
@@ -285,3 +285,5 @@
 f1ed1540da70a066527fd043413107e47721edbf jdk9-b40
 e336cbd8b15e959e70ed02f0f5e93fa76ebd4c07 jdk9-b41
 6b2314173433467245261364a52fb8e347fe6342 jdk9-b42
+8c6ad41974f9ab6c33d544b088648314963f2a50 jdk9-b43
+8cc4dc300041eb70a7a40e4b2431a8f4d4965ea4 jdk9-b44
--- a/jdk/make/src/classes/build/tools/module/ModuleArchive.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/make/src/classes/build/tools/module/ModuleArchive.java	Fri Jan 09 13:28:02 2015 -0500
@@ -227,10 +227,12 @@
 
         private static String nativeDir(String filename) {
             if (System.getProperty("os.name").startsWith("Windows")) {
-                if (filename.endsWith(".dll"))
+                if (filename.endsWith(".dll") || filename.endsWith(".diz")
+                    || filename.endsWith(".pdb") || filename.endsWith(".map")) {
                     return "bin";
-                 else
+                } else {
                     return "lib";
+                }
             } else {
                 return "lib";
             }
--- a/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java	Fri Jan 09 13:28:02 2015 -0500
@@ -758,8 +758,8 @@
                         if (endYear == Year.MAX_VALUE) {
                             endYear = startYear;
                             lastRules.add(new TransRule(endYear, rule));
-                            lastRulesStartYear = Math.max(startYear, lastRulesStartYear);
                         }
+                        lastRulesStartYear = Math.max(startYear, lastRulesStartYear);
                     } else {
                         if (endYear == Year.MAX_VALUE) {
                             //endYear = zoneEnd.getYear();
--- a/jdk/src/demo/share/java2d/J2DBench/options/default.opt	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/demo/share/java2d/J2DBench/options/default.opt	Fri Jan 09 13:28:02 2015 -0500
@@ -5,33 +5,53 @@
 global.env.runcount=5
 global.env.repcount=0
 global.env.testtime=2500
+global.results.workunits=units
+global.results.timeunits=sec
+global.results.ratio=unitspersec
 global.dest.screen=disabled
 global.dest.offscreen=disabled
 global.dest.compatimg.compatimg=disabled
 global.dest.compatimg.opqcompatimg=disabled
 global.dest.compatimg.bmcompatimg=disabled
 global.dest.compatimg.transcompatimg=disabled
-global.dest.volimg=enabled
+global.dest.volimg.volimg=enabled
+global.dest.volimg.opqvolimg=disabled
+global.dest.volimg.bmvolimg=disabled
+global.dest.volimg.transvolimg=disabled
 global.dest.bufimg.IntXrgb=disabled
 global.dest.bufimg.IntArgb=disabled
+global.dest.bufimg.IntArgbPre=disabled
+global.dest.bufimg.3ByteBgr=disabled
 global.dest.bufimg.ByteIndexed=disabled
 global.dest.bufimg.ByteGray=disabled
+global.dest.bufimg.4ByteAbgr=disabled
+global.dest.bufimg.4ByteAbgrPre=disabled
+global.dest.bufimg.custom=disabled
 graphics.opts.anim=2
 graphics.opts.sizes=20,250
 graphics.opts.alpharule=SrcOver
+graphics.opts.transform=ident
 graphics.opts.extraalpha=Both
 graphics.opts.xormode=Off
 graphics.opts.clip=Both
 graphics.opts.renderhint=Default
-graphics.render.opts.randomcolor=Both
+graphics.render.opts.paint=single,random
 graphics.render.opts.alphacolor=Off
 graphics.render.opts.antialias=Both
+graphics.render.opts.stroke=width1
 graphics.render.tests.drawLine=enabled
+graphics.render.tests.drawLineHoriz=disabled
+graphics.render.tests.drawLineVert=disabled
 graphics.render.tests.fillRect=enabled
+graphics.render.tests.drawRect=disabled
 graphics.render.tests.fillOval=enabled
+graphics.render.tests.drawOval=disabled
 graphics.render.tests.fillPoly=disabled
 graphics.render.tests.drawPoly=disabled
 graphics.render.tests.shape.fillCubic=enabled
+graphics.render.tests.shape.drawCubic=disabled
+graphics.render.tests.shape.fillEllipse2D=disabled
+graphics.render.tests.shape.drawEllipse2D=disabled
 graphics.imaging.src.offscr.opaque=disabled
 graphics.imaging.src.offscr.bitmask=disabled
 graphics.imaging.src.offscr.translucent=disabled
@@ -44,33 +64,98 @@
 graphics.imaging.src.transcompatimg.opaque=disabled
 graphics.imaging.src.transcompatimg.bitmask=disabled
 graphics.imaging.src.transcompatimg.translucent=enabled
-graphics.imaging.src.volimg.opaque=disabled
-graphics.imaging.src.volimg.bitmask=disabled
-graphics.imaging.src.volimg.translucent=disabled
+graphics.imaging.src.opqvolimg.opaque=disabled
+graphics.imaging.src.opqvolimg.bitmask=disabled
+graphics.imaging.src.opqvolimg.translucent=disabled
+graphics.imaging.src.bmvolimg.opaque=disabled
+graphics.imaging.src.bmvolimg.bitmask=disabled
+graphics.imaging.src.bmvolimg.translucent=disabled
+graphics.imaging.src.transvolimg.opaque=disabled
+graphics.imaging.src.transvolimg.bitmask=disabled
+graphics.imaging.src.transvolimg.translucent=disabled
 graphics.imaging.src.bufimg.IntXrgb.opaque=enabled
 graphics.imaging.src.bufimg.IntXrgb.bitmask=disabled
 graphics.imaging.src.bufimg.IntXrgb.translucent=disabled
 graphics.imaging.src.bufimg.IntArgb.opaque=disabled
 graphics.imaging.src.bufimg.IntArgb.bitmask=disabled
 graphics.imaging.src.bufimg.IntArgb.translucent=enabled
+graphics.imaging.src.bufimg.IntArgbPre.opaque=disabled
+graphics.imaging.src.bufimg.IntArgbPre.bitmask=disabled
+graphics.imaging.src.bufimg.IntArgbPre.translucent=disabled
 graphics.imaging.src.bufimg.ByteGray.opaque=disabled
 graphics.imaging.src.bufimg.ByteGray.bitmask=disabled
 graphics.imaging.src.bufimg.ByteGray.translucent=disabled
+graphics.imaging.src.bufimg.3ByteBgr.opaque=disabled
+graphics.imaging.src.bufimg.3ByteBgr.bitmask=disabled
+graphics.imaging.src.bufimg.3ByteBgr.translucent=disabled
+graphics.imaging.src.bufimg.4ByteAbgr.opaque=disabled
+graphics.imaging.src.bufimg.4ByteAbgr.bitmask=disabled
+graphics.imaging.src.bufimg.4ByteAbgr.translucent=disabled
+graphics.imaging.src.bufimg.4ByteAbgrPre.opaque=disabled
+graphics.imaging.src.bufimg.4ByteAbgrPre.bitmask=disabled
+graphics.imaging.src.bufimg.4ByteAbgrPre.translucent=disabled
 graphics.imaging.src.bufimg.ByteIndexedBm.opaque=disabled
 graphics.imaging.src.bufimg.ByteIndexedBm.bitmask=disabled
 graphics.imaging.src.bufimg.ByteIndexedBm.translucent=disabled
-graphics.imaging.tests.drawimage=enabled
-graphics.imaging.tests.drawimagebg=disabled
-graphics.imaging.tests.drawimagescaleup=enabled
-graphics.imaging.tests.drawimagescaledown=disabled
-graphics.imaging.tests.drawimagetxform=enabled
+graphics.imaging.src.bufimg.unmanagedIntXrgb.opaque=disabled
+graphics.imaging.src.bufimg.unmanagedIntXrgb.bitmask=disabled
+graphics.imaging.src.bufimg.unmanagedIntXrgb.translucent=disabled
+graphics.imaging.src.bufimg.unmanagedIntArgb.opaque=disabled
+graphics.imaging.src.bufimg.unmanagedIntArgb.bitmask=disabled
+graphics.imaging.src.bufimg.unmanagedIntArgb.translucent=disabled
+graphics.imaging.src.bufimg.unmanagedIntArgbPre.opaque=disabled
+graphics.imaging.src.bufimg.unmanagedIntArgbPre.bitmask=disabled
+graphics.imaging.src.bufimg.unmanagedIntArgbPre.translucent=disabled
+graphics.imaging.src.bufimg.unmanaged3ByteBgr.opaque=disabled
+graphics.imaging.src.bufimg.unmanaged3ByteBgr.bitmask=disabled
+graphics.imaging.src.bufimg.unmanaged3ByteBgr.translucent=disabled
+graphics.imaging.benchmarks.opts.interpolation=Nearest neighbor
+graphics.imaging.benchmarks.opts.touchsrc=Off
+graphics.imaging.benchmarks.tests.drawimage=enabled
+graphics.imaging.benchmarks.tests.drawimagebg=disabled
+graphics.imaging.benchmarks.tests.drawimagescaleup=enabled
+graphics.imaging.benchmarks.tests.drawimagescaledown=disabled
+graphics.imaging.benchmarks.tests.drawimagescalesplit=disabled
+graphics.imaging.benchmarks.tests.drawimagetxform=enabled
+graphics.imaging.imageops.opts.op=convolve3x3zero
+graphics.imaging.imageops.tests.graphics2d.drawimageop=disabled
+graphics.imaging.imageops.tests.bufimgop.filternull=disabled
+graphics.imaging.imageops.tests.bufimgop.filtercached=disabled
+graphics.imaging.imageops.tests.rasterop.filternull=disabled
+graphics.imaging.imageops.tests.rasterop.filtercached=disabled
+graphics.misc.copytests.copyAreaVert=disabled
+graphics.misc.copytests.copyAreaHoriz=disabled
+graphics.misc.copytests.copyAreaDiag=disabled
+pixel.opts.renderto=Off
+pixel.opts.renderfrom=Off
+pixel.src.1BitBinary=disabled
+pixel.src.2BitBinary=disabled
+pixel.src.4BitBinary=disabled
+pixel.src.ByteIndexed=disabled
+pixel.src.ByteGray=disabled
+pixel.src.Short555=disabled
+pixel.src.Short565=disabled
+pixel.src.ShortGray=disabled
+pixel.src.3ByteBgr=disabled
+pixel.src.4ByteAbgr=disabled
+pixel.src.IntXrgb=disabled
+pixel.src.IntXbgr=disabled
+pixel.src.IntArgb=disabled
+pixel.bimgtests.getrgb=disabled
+pixel.bimgtests.setrgb=disabled
+pixel.rastests.getdataelem=disabled
+pixel.rastests.setdataelem=disabled
+pixel.rastests.getpixel=disabled
+pixel.rastests.setpixel=disabled
+pixel.dbtests.getelem=disabled
+pixel.dbtests.setelem=disabled
 text.opts.data.tlength=32
 text.opts.data.tscript=english
 text.opts.font.fname=lucida
 text.opts.font.fstyle=0
 text.opts.font.fsize=13.0
 text.opts.font.ftx=Identity
-text.opts.graphics.taa=Both
+text.opts.graphics.textaa=Off,On
 text.opts.graphics.tfm=Off
 text.opts.graphics.gaa=Off
 text.opts.graphics.gtx=Identity
@@ -114,3 +199,66 @@
 text.construction.tests.gvfromfontlayout=disabled
 text.construction.tests.tlfromfont=disabled
 text.construction.tests.tlfrommap=disabled
+imageio.opts.size=250
+imageio.opts.content=photo
+imageio.input.opts.general.source.file=disabled
+imageio.input.opts.general.source.url=disabled
+imageio.input.opts.general.source.byteArray=disabled
+imageio.input.opts.imageio.useCache=Off
+imageio.input.image.toolkit.opts.format=
+imageio.input.image.toolkit.tests.createImage=disabled
+imageio.input.image.imageio.opts.format=
+imageio.input.image.imageio.tests.imageioRead=disabled
+imageio.input.image.imageio.reader.opts.seekForwardOnly=On
+imageio.input.image.imageio.reader.opts.ignoreMetadata=On
+imageio.input.image.imageio.reader.opts.installListener=Off
+imageio.input.image.imageio.reader.tests.read=disabled
+imageio.input.image.imageio.reader.tests.getImageMetadata=disabled
+imageio.input.stream.tests.construct=disabled
+imageio.input.stream.tests.read=disabled
+imageio.input.stream.tests.readByteArray=disabled
+imageio.input.stream.tests.readFullyByteArray=disabled
+imageio.input.stream.tests.readBit=disabled
+imageio.input.stream.tests.readByte=disabled
+imageio.input.stream.tests.readUnsignedByte=disabled
+imageio.input.stream.tests.readShort=disabled
+imageio.input.stream.tests.readUnsignedShort=disabled
+imageio.input.stream.tests.readInt=disabled
+imageio.input.stream.tests.readUnsignedInt=disabled
+imageio.input.stream.tests.readFloat=disabled
+imageio.input.stream.tests.readLong=disabled
+imageio.input.stream.tests.readDouble=disabled
+imageio.input.stream.tests.skipBytes=disabled
+imageio.output.opts.general.dest.file=disabled
+imageio.output.opts.general.dest.byteArray=disabled
+imageio.output.opts.imageio.useCache=Off
+imageio.output.image.imageio.opts.format=
+imageio.output.image.imageio.tests.imageioWrite=disabled
+imageio.output.image.imageio.writer.opts.installListener=Off
+imageio.output.image.imageio.writer.tests.write=disabled
+imageio.output.stream.tests.construct=disabled
+imageio.output.stream.tests.write=disabled
+imageio.output.stream.tests.writeByteArray=disabled
+imageio.output.stream.tests.writeBit=disabled
+imageio.output.stream.tests.writeByte=disabled
+imageio.output.stream.tests.writeShort=disabled
+imageio.output.stream.tests.writeInt=disabled
+imageio.output.stream.tests.writeFloat=disabled
+imageio.output.stream.tests.writeLong=disabled
+imageio.output.stream.tests.writeDouble=disabled
+cmm.opts.profiles=1001
+cmm.colorconv.data.fromRGB=disabled
+cmm.colorconv.data.toRGB=disabled
+cmm.colorconv.data.fromCIEXYZ=disabled
+cmm.colorconv.data.toCIEXYZ=disabled
+cmm.colorconv.ccop.ccopOptions.size=250
+cmm.colorconv.ccop.ccopOptions.content=photo
+cmm.colorconv.ccop.ccopOptions.srcType=INT_ARGB
+cmm.colorconv.ccop.ccopOptions.dstType=INT_ARGB
+cmm.colorconv.ccop.op_img=disabled
+cmm.colorconv.ccop.op_rst=disabled
+cmm.colorconv.ccop.op_draw=disabled
+cmm.colorconv.embed.embedOptions.Images=512x512
+cmm.colorconv.embed.embd_img_read=disabled
+cmm.profiles.getHeader=disabled
+cmm.profiles.getNumComponents=disabled
--- a/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/Destinations.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/Destinations.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -57,6 +57,7 @@
     public static Group.EnableSet destroot;
     public static Group bufimgdestroot;
     public static Group compatimgdestroot;
+    public static Group volimgdestroot;
 
     public static void init() {
         destroot = new Group.EnableSet(TestEnvironment.globaloptroot,
@@ -79,7 +80,16 @@
             }
 
             if (ImageTests.hasVolatileImage) {
+                volimgdestroot = new Group.EnableSet(destroot, "volimg",
+                        "Output to Volatile Image");
+
+                volimgdestroot.setHorizontal();
                 new VolatileImg();
+                if (ImageTests.hasTransparentVolatileImage) {
+                    new VolatileImg(Transparency.OPAQUE);
+                    new VolatileImg(Transparency.BITMASK);
+                    new VolatileImg(Transparency.TRANSLUCENT);
+                }
             }
 
             bufimgdestroot = new Group.EnableSet(destroot, "bufimg",
@@ -91,6 +101,8 @@
             new BufImg(BufferedImage.TYPE_3BYTE_BGR);
             new BufImg(BufferedImage.TYPE_BYTE_INDEXED);
             new BufImg(BufferedImage.TYPE_BYTE_GRAY);
+            new BufImg(BufferedImage.TYPE_4BYTE_ABGR);
+            new BufImg(BufferedImage.TYPE_4BYTE_ABGR_PRE);
             new CustomImg();
         }
     }
@@ -206,18 +218,62 @@
     }
 
     public static class VolatileImg extends Destinations {
+        private final int transparency;
+
+        public static final String[] ShortNames = {
+                "volimg",
+                "opqvolimg",
+                "bmvolimg",
+                "transvolimg",
+        };
+
+        public static final String[] ShortDescriptions = {
+                "Default",
+                "Opaque",
+                "Bitmask",
+                "Translucent",
+        };
+
+        public static final String[] LongDescriptions = {
+                "Default VolatileImg Image",
+                "Opaque VolatileImg Image",
+                "Bitmask VolatileImg Image",
+                "Translucent VolatileImg Image",
+        };
+
+        public static final String[] ModifierNames = {
+                "VolatileImg()",
+                "VolatileImg(Opaque)",
+                "VolatileImg(Bitmask)",
+                "VolatileImg(Translucent)",
+        };
+
         public VolatileImg() {
-            super(destroot, "volimg", "Output to Volatile Image", false);
+            this(0);
         }
 
-        public String getModifierValueName(Object val) {
-            return "VolatileImg";
+        public VolatileImg(final int transparency) {
+            super(volimgdestroot,
+                  ShortNames[transparency],
+                  ShortDescriptions[transparency],
+                  false);
+            this.transparency = transparency;
         }
 
-        public void setDestination(TestEnvironment env) {
+        public String getModifierValueName(final Object val) {
+            return ModifierNames[transparency];
+        }
+
+        public void setDestination(final TestEnvironment env) {
             Component c = env.getCanvas();
-            env.setTestImage(c.createVolatileImage(env.getWidth(),
-                                                   env.getHeight()));
+            GraphicsConfiguration gc = c.getGraphicsConfiguration();
+            int w = env.getWidth();
+            int h = env.getHeight();
+            if (transparency == 0) {
+                env.setTestImage(gc.createCompatibleVolatileImage(w, h));
+            } else {
+                env.setTestImage(gc.createCompatibleVolatileImage(w, h, transparency));
+            }
         }
     }
 
--- a/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/Group.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/Group.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -44,6 +44,7 @@
 import javax.swing.BoxLayout;
 import javax.swing.JComponent;
 import javax.swing.JPanel;
+import javax.swing.JScrollPane;
 import javax.swing.JTabbedPane;
 import javax.swing.border.TitledBorder;
 import java.util.NoSuchElementException;
@@ -199,7 +200,7 @@
                     p.add(comp);
                 }
             }
-            return p;
+            return new JScrollPane(p);
         }
     }
 
--- a/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/J2DBench.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/J2DBench.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -60,6 +60,8 @@
 import javax.swing.BoxLayout;
 import javax.swing.JFileChooser;
 import javax.swing.JOptionPane;
+import javax.swing.SwingUtilities;
+
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
@@ -376,7 +378,11 @@
         }
 
         if (gui) {
-            startGUI();
+            SwingUtilities.invokeLater(new Runnable() {
+                public void run() {
+                    startGUI();
+                }
+            });
         } else {
 
             long start = System.currentTimeMillis();
@@ -772,6 +778,7 @@
 
         f.getContentPane().add(p, BorderLayout.SOUTH);
         f.pack();
+        f.setLocationRelativeTo(null);
         f.show();
     }
 
--- a/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/tests/GraphicsTests.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/tests/GraphicsTests.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -112,10 +112,10 @@
 
         sizeList = new Option.IntList(groptroot, "sizes",
                                       "Size of Operations to perform",
-                                      new int[] {1, 20, 100, 250, 1000},
+                                      new int[] {1, 20, 100, 250, 1000, 4000},
                                       new String[] {
                                           "1x1", "20x20", "100x100", "250x250",
-                                          "1000x1000",
+                                          "1000x1000", "4000x4000",
                                       },
                                       new String[] {
                                           "Tiny Shapes (1x1)",
@@ -123,6 +123,7 @@
                                           "Medium Shapes (100x100)",
                                           "Large Shapes (250x250)",
                                           "X-Large Shapes (1000x1000)",
+                                          "Huge Shapes (4000x4000)",
                                       }, 0xa);
         if (hasGraphics2D) {
             String rulenames[] = {
--- a/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/tests/ImageTests.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/tests/ImageTests.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -53,6 +53,7 @@
 import java.awt.AlphaComposite;
 import java.awt.Dimension;
 import java.awt.GraphicsConfiguration;
+import java.awt.RenderingHints;
 import java.awt.image.BufferedImage;
 import java.awt.image.BufferedImageOp;
 import java.awt.image.ByteLookupTable;
@@ -77,6 +78,7 @@
 
 public abstract class ImageTests extends GraphicsTests {
     public static boolean hasVolatileImage;
+    public static boolean hasTransparentVolatileImage;
     public static boolean hasCompatImage;
 
     static {
@@ -89,14 +91,20 @@
             hasCompatImage = true;
         } catch (NoSuchMethodError e) {
         }
+        try {
+            new Canvas().getMousePosition();
+            hasTransparentVolatileImage = true;
+        } catch (NoSuchMethodError e) {
+        }
     }
 
     static Group imageroot;
     static Group.EnableSet imgsrcroot;
     static Group.EnableSet bufimgsrcroot;
 
+    static Group imgbenchroot;
     static Group imgtestroot;
-    static Group imgoptionsroot;
+    static Group imgtestOptRoot;
 
     static Group imageOpRoot;
     static Group imageOpOptRoot;
@@ -106,6 +114,7 @@
     static Group rasterOpTestRoot;
     static Option opList;
     static Option doTouchSrc;
+    static Option interpolation;
 
     static String transNodeNames[] = {
         null, "opaque", "bitmask", "translucent",
@@ -122,19 +131,9 @@
 
         imgsrcroot = new Group.EnableSet(imageroot, "src",
                                          "Image Rendering Sources");
-        imgsrcroot.setBordered(true);
-
-        imgoptionsroot = new Group(imgsrcroot, "options",
-                                "Image Source Options");
-        imgoptionsroot.setBordered(true);
-        doTouchSrc =
-            new Option.Toggle(imgoptionsroot, "touchsrc",
-                              "Touch src image before every operation",
-                               Option.Toggle.Off);
-
-        imgtestroot = new Group(imageroot, "tests",
-                                "Image Rendering Tests");
-        imgtestroot.setBordered(true);
+        imgbenchroot = new Group(imageroot, "benchmarks",
+                                "Image Rendering Benchmarks");
+        imgtestOptRoot = new Group(imgbenchroot, "opts", "Options");
 
         new OffScreen();
 
@@ -144,9 +143,14 @@
                 new CompatImg(Transparency.BITMASK);
                 new CompatImg(Transparency.TRANSLUCENT);
             }
-
             if (hasVolatileImage) {
-                new VolatileImg();
+                if (hasTransparentVolatileImage) {
+                    new VolatileImg(Transparency.OPAQUE);
+                    new VolatileImg(Transparency.BITMASK);
+                    new VolatileImg(Transparency.TRANSLUCENT);
+                } else {
+                    new VolatileImg();
+                }
             }
 
             bufimgsrcroot =
@@ -154,11 +158,15 @@
                                     "BufferedImage Rendering Sources");
             new BufImg(BufferedImage.TYPE_INT_RGB);
             new BufImg(BufferedImage.TYPE_INT_ARGB);
+            new BufImg(BufferedImage.TYPE_INT_ARGB_PRE);
             new BufImg(BufferedImage.TYPE_BYTE_GRAY);
             new BufImg(BufferedImage.TYPE_3BYTE_BGR);
+            new BufImg(BufferedImage.TYPE_4BYTE_ABGR);
+            new BufImg(BufferedImage.TYPE_4BYTE_ABGR_PRE);
             new BmByteIndexBufImg();
             new BufImg(BufferedImage.TYPE_INT_RGB, true);
             new BufImg(BufferedImage.TYPE_INT_ARGB, true);
+            new BufImg(BufferedImage.TYPE_INT_ARGB_PRE, true);
             new BufImg(BufferedImage.TYPE_3BYTE_BGR, true);
 
             imageOpRoot = new Group(imageroot, "imageops",
@@ -211,12 +219,31 @@
             new BufImgOpFilter(true);
             new RasterOpFilter(false);
             new RasterOpFilter(true);
+
+            String interpolationnames[] = {"Nearest neighbor", "Bilinear",
+                                           "Bicubic",};
+            interpolation =
+                    new ObjectList(imgtestOptRoot, "interpolation",
+                                   "Interpolation",
+                                   interpolationnames, new Object[] {
+                            RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR,
+                            RenderingHints.VALUE_INTERPOLATION_BILINEAR,
+                            RenderingHints.VALUE_INTERPOLATION_BICUBIC,
+                    }, interpolationnames, interpolationnames, 1);
         }
 
+        doTouchSrc =
+                new Option.Toggle(imgtestOptRoot, "touchsrc",
+                                  "Touch source image before every operation",
+                                  Option.Toggle.Off);
+
+        imgtestroot = new Group(imgbenchroot, "tests", "Image Rendering Tests");
+
         new DrawImage();
         new DrawImageBg();
         new DrawImageScale("up", 1.5f);
         new DrawImageScale("down", .75f);
+        new DrawImageScale("split", .5f);
         new DrawImageTransform();
     }
 
@@ -236,6 +263,7 @@
         super(parent, nodeName, description);
         addDependency(imgsrcroot, srcFilter);
         addDependency(doTouchSrc);
+        addDependency(interpolation);
     }
 
     public GraphicsTests.Context createContext() {
@@ -248,6 +276,11 @@
 
         ictx.src = env.getSrcImage();
         ictx.touchSrc = env.isEnabled(doTouchSrc);
+        if (hasGraphics2D) {
+            Graphics2D g2d = (Graphics2D) ctx.graphics;
+            final Object modifier = env.getModifier(interpolation);
+            g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, modifier);
+        }
     }
 
     public abstract static class TriStateImageType extends Group {
@@ -290,13 +323,27 @@
     }
 
     public static class VolatileImg extends TriStateImageType {
+        private final int transparency;
+
         public VolatileImg() {
-            super(imgsrcroot, "volimg", "Volatile Image", Transparency.OPAQUE);
+            this(0);
+        }
+
+        public VolatileImg(int transparency) {
+            super(imgsrcroot, Destinations.VolatileImg.ShortNames[transparency],
+                  Destinations.VolatileImg.LongDescriptions[transparency],
+                  transparency);
+            this.transparency = transparency;
         }
 
         public Image makeImage(TestEnvironment env, int w, int h) {
             Canvas c = env.getCanvas();
-            return c.createVolatileImage(w, h);
+            GraphicsConfiguration gc = c.getGraphicsConfiguration();
+            if (transparency == 0) {
+                return gc.createCompatibleVolatileImage(w, h);
+            } else {
+                return gc.createCompatibleVolatileImage(w, h, transparency);
+            }
         }
     }
 
--- a/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/tests/cmm/ColorConvertOpTests.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/tests/cmm/ColorConvertOpTests.java	Fri Jan 09 13:28:02 2015 -0500
@@ -60,7 +60,7 @@
 public class ColorConvertOpTests extends ColorConversionTests {
 
     private static class ImageContent {
-        static ImageContent BLANK = new ImageContent("bank", "Blank (opaque black)");
+        static ImageContent BLANK = new ImageContent("blank", "Blank (opaque black)");
         static ImageContent RANDOM = new ImageContent("random", "Random");
         static ImageContent VECTOR = new ImageContent("vector", "Vector Art");
         static ImageContent PHOTO= new ImageContent("photo", "Photograph");
@@ -83,7 +83,7 @@
         static ImageType INT_RGB = new ImageType(BufferedImage.TYPE_INT_RGB, "INT_RGB", "TYPE_INT_RGB");
         static ImageType INT_BGR = new ImageType(BufferedImage.TYPE_INT_BGR, "INT_BGR", "TYPE_INT_BGR");
         static ImageType BYTE_3BYTE_BGR = new ImageType(BufferedImage.TYPE_3BYTE_BGR, "3BYTE_BGR", "TYPE_3BYTE_BGR");
-        static ImageType BYTE_4BYTE_ABGR = new ImageType(BufferedImage.TYPE_4BYTE_ABGR, "4BYTE_BGR", "TYPE_4BYTE_BGR");
+        static ImageType BYTE_4BYTE_ABGR = new ImageType(BufferedImage.TYPE_4BYTE_ABGR, "4BYTE_ABGR", "TYPE_4BYTE_ABGR");
         static ImageType COMPATIBLE_DST = new ImageType(0, "Compatible", "Compatible destination");
 
         private ImageType(int type, String abbr, String descr) {
@@ -130,7 +130,7 @@
 
         for (int i = 0; i < num; i++) {
             t[i] = allTypes[i];
-            names[i] = t[i].toString();
+            names[i] = t[i].abbrev;
             abbrev[i] = t[i].abbrev;
             descr[i] = t[i].descr;
         }
--- a/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/tests/cmm/EmbeddedProfileTests.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/tests/cmm/EmbeddedProfileTests.java	Fri Jan 09 13:28:02 2015 -0500
@@ -100,7 +100,7 @@
         String[] descr = new String[num];
 
         for (int i = 0; i < num; i++) {
-            names[i] = images[i].toString();
+            names[i] = images[i].abbrev;
             abbrev[i] = images[i].abbrev;
             descr[i] = images[i].description;
         }
@@ -153,7 +153,7 @@
                 iis = ImageIO.createImageInputStream(url.openStream());
                 reader = (ImageReader) ImageIO.getImageReaders(iis).next();
             } catch (IOException e) {
-                throw new RuntimeException("Unable to run the becnhmark", e);
+                throw new RuntimeException("Unable to run the benchmark", e);
             }
 
             do {
--- a/jdk/src/demo/share/jfc/TableExample/TableSorter.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/demo/share/jfc/TableExample/TableSorter.java	Fri Jan 09 13:28:02 2015 -0500
@@ -267,7 +267,7 @@
         than assigned otherwise sister calls in the recursion might
         get out of sinc.  When the number of elements is three they
         are partitioned so that the first set, [low, mid), has one
-        element and and the second, [mid, high), has two. We skip the
+        element and the second, [mid, high), has two. We skip the
         optimisation when the number of elements is three or less as
         the first compare in the normal merge will produce the same
         sequence of steps. This optimisation seems to be worthwhile
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/CipherBlockChaining.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/CipherBlockChaining.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
 package com.sun.crypto.provider;
 
 import java.security.InvalidKeyException;
+import java.security.ProviderException;
+
 
 /**
  * This class represents ciphers in cipher block chaining (CBC) mode.
@@ -122,31 +124,31 @@
      *
      * <p>The input plain text <code>plain</code>, starting at
      * <code>plainOffset</code> and ending at
-     * <code>(plainOffset + len - 1)</code>, is encrypted.
+     * <code>(plainOffset + plainLen - 1)</code>, is encrypted.
      * The result is stored in <code>cipher</code>, starting at
      * <code>cipherOffset</code>.
      *
-     * <p>It is the application's responsibility to make sure that
-     * <code>plainLen</code> is a multiple of the embedded cipher's block size,
-     * as any excess bytes are ignored.
-     *
      * @param plain the buffer with the input data to be encrypted
      * @param plainOffset the offset in <code>plain</code>
      * @param plainLen the length of the input data
      * @param cipher the buffer for the result
      * @param cipherOffset the offset in <code>cipher</code>
+     * @exception ProviderException if <code>len</code> is not
+     * a multiple of the block size
      * @return the length of the encrypted data
      */
     int encrypt(byte[] plain, int plainOffset, int plainLen,
                 byte[] cipher, int cipherOffset)
     {
-        int i;
+        if ((plainLen % blockSize) != 0) {
+            throw new ProviderException("Internal error in input buffering");
+        }
         int endIndex = plainOffset + plainLen;
 
         for (; plainOffset < endIndex;
              plainOffset+=blockSize, cipherOffset += blockSize) {
-            for (i=0; i<blockSize; i++) {
-                k[i] = (byte)(plain[i+plainOffset] ^ r[i]);
+            for (int i = 0; i < blockSize; i++) {
+                k[i] = (byte)(plain[i + plainOffset] ^ r[i]);
             }
             embeddedCipher.encryptBlock(k, 0, cipher, cipherOffset);
             System.arraycopy(cipher, cipherOffset, r, 0, blockSize);
@@ -159,14 +161,10 @@
      *
      * <p>The input cipher text <code>cipher</code>, starting at
      * <code>cipherOffset</code> and ending at
-     * <code>(cipherOffset + len - 1)</code>, is decrypted.
+     * <code>(cipherOffset + cipherLen - 1)</code>, is decrypted.
      * The result is stored in <code>plain</code>, starting at
      * <code>plainOffset</code>.
      *
-     * <p>It is the application's responsibility to make sure that
-     * <code>cipherLen</code> is a multiple of the embedded cipher's block
-     * size, as any excess bytes are ignored.
-     *
      * <p>It is also the application's responsibility to make sure that
      * <code>init</code> has been called before this method is called.
      * (This check is omitted here, to avoid double checking.)
@@ -176,23 +174,23 @@
      * @param cipherLen the length of the input data
      * @param plain the buffer for the result
      * @param plainOffset the offset in <code>plain</code>
+     * @exception ProviderException if <code>len</code> is not
+     * a multiple of the block size
      * @return the length of the decrypted data
-     *
-     * @exception IllegalBlockSizeException if input data whose length does
-     * not correspond to the embedded cipher's block size is passed to the
-     * embedded cipher
      */
     int decrypt(byte[] cipher, int cipherOffset, int cipherLen,
                 byte[] plain, int plainOffset)
     {
-        int i;
+        if ((cipherLen % blockSize) != 0) {
+            throw new ProviderException("Internal error in input buffering");
+        }
         int endIndex = cipherOffset + cipherLen;
 
         for (; cipherOffset < endIndex;
              cipherOffset += blockSize, plainOffset += blockSize) {
             embeddedCipher.decryptBlock(cipher, cipherOffset, k, 0);
-            for (i = 0; i < blockSize; i++) {
-                plain[i+plainOffset] = (byte)(k[i] ^ r[i]);
+            for (int i = 0; i < blockSize; i++) {
+                plain[i + plainOffset] = (byte)(k[i] ^ r[i]);
             }
             System.arraycopy(cipher, cipherOffset, r, 0, blockSize);
         }
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/CipherCore.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/CipherCore.java	Fri Jan 09 13:28:02 2015 -0500
@@ -708,7 +708,7 @@
             len -= blockSize;
         }
         // do not count the trailing bytes which do not make up a unit
-        len = (len > 0 ? (len - (len%unitBytes)) : 0);
+        len = (len > 0 ? (len - (len % unitBytes)) : 0);
 
         // check output buffer capacity
         if ((output == null) ||
@@ -747,6 +747,9 @@
                     int bufferCapacity = buffer.length - buffered;
                     if (bufferCapacity != 0) {
                         temp = Math.min(bufferCapacity, inputConsumed);
+                        if (unitBytes != blockSize) {
+                            temp -= ((buffered + temp) % unitBytes);
+                        }
                         System.arraycopy(input, inputOffset, buffer, buffered, temp);
                         inputOffset += temp;
                         inputConsumed -= temp;
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/CipherFeedback.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/CipherFeedback.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 package com.sun.crypto.provider;
 
 import java.security.InvalidKeyException;
+import java.security.ProviderException;
 
 /**
  * This class represents ciphers in cipher-feedback (CFB) mode.
@@ -133,66 +134,72 @@
      *
      * <p>The input plain text <code>plain</code>, starting at
      * <code>plainOffset</code> and ending at
-     * <code>(plainOffset + len - 1)</code>, is encrypted.
+     * <code>(plainOffset + plainLen - 1)</code>, is encrypted.
      * The result is stored in <code>cipher</code>, starting at
      * <code>cipherOffset</code>.
      *
-     * <p>It is the application's responsibility to make sure that
-     * <code>plainLen</code> is a multiple of the stream unit size
-     * <code>numBytes</code>, as any excess bytes are ignored.
-     *
-     * <p>It is also the application's responsibility to make sure that
-     * <code>init</code> has been called before this method is called.
-     * (This check is omitted here, to avoid double checking.)
-     *
      * @param plain the buffer with the input data to be encrypted
      * @param plainOffset the offset in <code>plain</code>
      * @param plainLen the length of the input data
      * @param cipher the buffer for the result
      * @param cipherOffset the offset in <code>cipher</code>
+     * @exception ProviderException if <code>plainLen</code> is not
+     * a multiple of the <code>numBytes</code>
      * @return the length of the encrypted data
      */
     int encrypt(byte[] plain, int plainOffset, int plainLen,
-                byte[] cipher, int cipherOffset)
-    {
-        int i, len;
-        len = blockSize - numBytes;
+                byte[] cipher, int cipherOffset) {
+        if ((plainLen % numBytes) != 0) {
+            throw new ProviderException("Internal error in input buffering");
+        }
+
+        int nShift = blockSize - numBytes;
         int loopCount = plainLen / numBytes;
-        int oddBytes = plainLen % numBytes;
 
-        if (len == 0) {
-            for (; loopCount > 0 ;
-                 plainOffset += numBytes, cipherOffset += numBytes,
-                 loopCount--) {
-                embeddedCipher.encryptBlock(register, 0, k, 0);
-                for (i = 0; i < blockSize; i++)
-                    register[i] = cipher[i+cipherOffset] =
-                        (byte)(k[i] ^ plain[i+plainOffset]);
+        for (; loopCount > 0 ;
+             plainOffset += numBytes, cipherOffset += numBytes,
+             loopCount--) {
+            embeddedCipher.encryptBlock(register, 0, k, 0);
+            if (nShift != 0) {
+                System.arraycopy(register, numBytes, register, 0, nShift);
+            }
+            for (int i = 0; i < numBytes; i++) {
+                register[nShift + i] = cipher[i + cipherOffset] =
+                        (byte)(k[i] ^ plain[i + plainOffset]);
             }
-            if (oddBytes > 0) {
-                embeddedCipher.encryptBlock(register, 0, k, 0);
-                for (i=0; i<oddBytes; i++)
-                    register[i] = cipher[i+cipherOffset] =
-                        (byte)(k[i] ^ plain[i+plainOffset]);
-            }
-        } else {
-            for (; loopCount > 0 ;
-                 plainOffset += numBytes, cipherOffset += numBytes,
-                 loopCount--) {
-                embeddedCipher.encryptBlock(register, 0, k, 0);
-                System.arraycopy(register, numBytes, register, 0, len);
-                for (i=0; i<numBytes; i++)
-                    register[i+len] = cipher[i+cipherOffset] =
-                        (byte)(k[i] ^ plain[i+plainOffset]);
+        }
+        return plainLen;
+    }
 
-            }
-            if (oddBytes != 0) {
-                embeddedCipher.encryptBlock(register, 0, k, 0);
-                System.arraycopy(register, numBytes, register, 0, len);
-                for (i=0; i<oddBytes; i++) {
-                    register[i+len] = cipher[i+cipherOffset] =
-                        (byte)(k[i] ^ plain[i+plainOffset]);
-                }
+    /**
+     * Performs the last encryption operation.
+     *
+     * <p>The input plain text <code>plain</code>, starting at
+     * <code>plainOffset</code> and ending at
+     * <code>(plainOffset + plainLen - 1)</code>, is encrypted.
+     * The result is stored in <code>cipher</code>, starting at
+     * <code>cipherOffset</code>.
+     *
+     * @param plain the buffer with the input data to be encrypted
+     * @param plainOffset the offset in <code>plain</code>
+     * @param plainLen the length of the input data
+     * @param cipher the buffer for the result
+     * @param cipherOffset the offset in <code>cipher</code>
+     * @return the number of bytes placed into <code>cipher</code>
+     */
+    int encryptFinal(byte[] plain, int plainOffset, int plainLen,
+                     byte[] cipher, int cipherOffset) {
+
+        int oddBytes = plainLen % numBytes;
+        int len = encrypt(plain, plainOffset, (plainLen - oddBytes),
+                          cipher, cipherOffset);
+        plainOffset += len;
+        cipherOffset += len;
+        if (oddBytes != 0) {
+            embeddedCipher.encryptBlock(register, 0, k, 0);
+            for (int i = 0; i < oddBytes; i++) {
+                 cipher[i + cipherOffset] =
+                    (byte)(k[i] ^ plain[i + plainOffset]);
             }
         }
         return plainLen;
@@ -203,17 +210,52 @@
      *
      * <p>The input cipher text <code>cipher</code>, starting at
      * <code>cipherOffset</code> and ending at
-     * <code>(cipherOffset + len - 1)</code>, is decrypted.
+     * <code>(cipherOffset + cipherLen - 1)</code>, is decrypted.
      * The result is stored in <code>plain</code>, starting at
      * <code>plainOffset</code>.
      *
-     * <p>It is the application's responsibility to make sure that
-     * <code>cipherLen</code> is a multiple of the stream unit size
-     * <code>numBytes</code>, as any excess bytes are ignored.
+     * @param cipher the buffer with the input data to be decrypted
+     * @param cipherOffset the offset in <code>cipherOffset</code>
+     * @param cipherLen the length of the input data
+     * @param plain the buffer for the result
+     * @param plainOffset the offset in <code>plain</code>
+     * @exception ProviderException if <code>cipherLen</code> is not
+     * a multiple of the <code>numBytes</code>
+     * @return the length of the decrypted data
+     */
+    int decrypt(byte[] cipher, int cipherOffset, int cipherLen,
+                byte[] plain, int plainOffset) {
+        if ((cipherLen % numBytes) != 0) {
+            throw new ProviderException("Internal error in input buffering");
+        }
+
+        int nShift = blockSize - numBytes;
+        int loopCount = cipherLen / numBytes;
+
+        for (; loopCount > 0;
+             plainOffset += numBytes, cipherOffset += numBytes,
+             loopCount--) {
+            embeddedCipher.encryptBlock(register, 0, k, 0);
+            if (nShift != 0) {
+                System.arraycopy(register, numBytes, register, 0, nShift);
+            }
+            for (int i = 0; i < numBytes; i++) {
+                register[i + nShift] = cipher[i + cipherOffset];
+                plain[i + plainOffset]
+                    = (byte)(cipher[i + cipherOffset] ^ k[i]);
+            }
+        }
+        return cipherLen;
+    }
+
+    /**
+     * Performs the last decryption operation.
      *
-     * <p>It is also the application's responsibility to make sure that
-     * <code>init</code> has been called before this method is called.
-     * (This check is omitted here, to avoid double checking.)
+     * <p>The input cipher text <code>cipher</code>, starting at
+     * <code>cipherOffset</code> and ending at
+     * <code>(cipherOffset + cipherLen - 1)</code>, is decrypted.
+     * The result is stored in <code>plain</code>, starting at
+     * <code>plainOffset</code>.
      *
      * @param cipher the buffer with the input data to be decrypted
      * @param cipherOffset the offset in <code>cipherOffset</code>
@@ -222,53 +264,19 @@
      * @param plainOffset the offset in <code>plain</code>
      * @return the length of the decrypted data
      */
-    int decrypt(byte[] cipher, int cipherOffset, int cipherLen,
-                byte[] plain, int plainOffset)
-    {
-        int i, len;
-        len = blockSize - numBytes;
-        int loopCount = cipherLen / numBytes;
-        int oddBytes = cipherLen % numBytes;
+    int decryptFinal(byte[] cipher, int cipherOffset, int cipherLen,
+                byte[] plain, int plainOffset) {
 
-        if (len == 0) {
-            for (; loopCount > 0;
-                 plainOffset += numBytes, cipherOffset += numBytes,
-                 loopCount--) {
-                embeddedCipher.encryptBlock(register, 0, k, 0);
-                for (i = 0; i < blockSize; i++) {
-                    register[i] = cipher[i+cipherOffset];
-                    plain[i+plainOffset]
-                        = (byte)(cipher[i+cipherOffset] ^ k[i]);
-                }
-            }
-            if (oddBytes > 0) {
-                embeddedCipher.encryptBlock(register, 0, k, 0);
-                for (i=0; i<oddBytes; i++) {
-                    register[i] = cipher[i+cipherOffset];
-                    plain[i+plainOffset]
-                        = (byte)(cipher[i+cipherOffset] ^ k[i]);
-                }
-            }
-        } else {
-            for (; loopCount > 0;
-                 plainOffset += numBytes, cipherOffset += numBytes,
-                 loopCount--) {
-                embeddedCipher.encryptBlock(register, 0, k, 0);
-                System.arraycopy(register, numBytes, register, 0, len);
-                for (i=0; i<numBytes; i++) {
-                    register[i+len] = cipher[i+cipherOffset];
-                    plain[i+plainOffset]
-                        = (byte)(cipher[i+cipherOffset] ^ k[i]);
-                }
-            }
-            if (oddBytes != 0) {
-                embeddedCipher.encryptBlock(register, 0, k, 0);
-                System.arraycopy(register, numBytes, register, 0, len);
-                for (i=0; i<oddBytes; i++) {
-                    register[i+len] = cipher[i+cipherOffset];
-                    plain[i+plainOffset]
-                        = (byte)(cipher[i+cipherOffset] ^ k[i]);
-                }
+        int oddBytes = cipherLen % numBytes;
+        int len = decrypt(cipher, cipherOffset, (cipherLen - oddBytes),
+                          plain, plainOffset);
+        cipherOffset += len;
+        plainOffset += len;
+        if (oddBytes != 0) {
+            embeddedCipher.encryptBlock(register, 0, k, 0);
+            for (int i = 0; i < oddBytes; i++) {
+                plain[i + plainOffset]
+                    = (byte)(cipher[i + cipherOffset] ^ k[i]);
             }
         }
         return cipherLen;
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 201313, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 
 import java.security.InvalidKeyException;
 
+
 /**
  * This class represents ciphers in counter (CTR) mode.
  *
@@ -136,14 +137,6 @@
      * The result is stored in <code>cipher</code>, starting at
      * <code>cipherOffset</code>.
      *
-     * <p>It is the application's responsibility to make sure that
-     * <code>plainLen</code> is a multiple of the embedded cipher's block size,
-     * as any excess bytes are ignored.
-     *
-     * <p>It is also the application's responsibility to make sure that
-     * <code>init</code> has been called before this method is called.
-     * (This check is omitted here, to avoid double checking.)
-     *
      * @param in the buffer with the input data to be encrypted
      * @param inOffset the offset in <code>plain</code>
      * @param len the length of the input data
@@ -155,30 +148,7 @@
         return crypt(in, inOff, len, out, outOff);
     }
 
-    /**
-     * Performs decryption operation.
-     *
-     * <p>The input cipher text <code>cipher</code>, starting at
-     * <code>cipherOffset</code> and ending at
-     * <code>(cipherOffset + len - 1)</code>, is decrypted.
-     * The result is stored in <code>plain</code>, starting at
-     * <code>plainOffset</code>.
-     *
-     * <p>It is the application's responsibility to make sure that
-     * <code>cipherLen</code> is a multiple of the embedded cipher's block
-     * size, as any excess bytes are ignored.
-     *
-     * <p>It is also the application's responsibility to make sure that
-     * <code>init</code> has been called before this method is called.
-     * (This check is omitted here, to avoid double checking.)
-     *
-     * @param in the buffer with the input data to be decrypted
-     * @param inOff the offset in <code>cipherOffset</code>
-     * @param len the length of the input data
-     * @param out the buffer for the result
-     * @param outOff the offset in <code>plain</code>
-     * @return the length of the decrypted data
-     */
+    // CTR encrypt and decrypt are identical
     int decrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
         return crypt(in, inOff, len, out, outOff);
     }
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/ElectronicCodeBook.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/ElectronicCodeBook.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 package com.sun.crypto.provider;
 
 import java.security.InvalidKeyException;
+import java.security.ProviderException;
 
 /**
  * This class represents ciphers in electronic codebook (ECB) mode.
@@ -96,28 +97,24 @@
     /**
      * Performs encryption operation.
      *
-     * <p>The input plain text <code>plain</code>, starting at
-     * <code>plainOffset</code> and ending at
-     * <code>(plainOffset + len - 1)</code>, is encrypted.
-     * The result is stored in <code>cipher</code>, starting at
-     * <code>cipherOffset</code>.
-     *
-     * <p>It is the application's responsibility to make sure that
-     * <code>plainLen</code> is a multiple of the embedded cipher's block size,
-     * as any excess bytes are ignored.
-     *
-     * <p>It is also the application's responsibility to make sure that
-     * <code>init</code> has been called before this method is called.
-     * (This check is omitted here, to avoid double checking.)
+     * <p>The input plain text <code>in</code>, starting at
+     * <code>inOff</code> and ending at * <code>(inOff + len - 1)</code>,
+     * is encrypted. The result is stored in <code>out</code>, starting at
+     * <code>outOff</code>.
      *
      * @param in the buffer with the input data to be encrypted
-     * @param inOffset the offset in <code>plain</code>
+     * @param inOff the offset in <code>plain</code>
      * @param len the length of the input data
      * @param out the buffer for the result
      * @param outOff the offset in <code>cipher</code>
+     * @exception ProviderException if <code>len</code> is not
+     * a multiple of the block size
      * @return the length of the encrypted data
      */
     int encrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
+        if ((len % blockSize) != 0) {
+             throw new ProviderException("Internal error in input buffering");
+        }
         for (int i = len; i >= blockSize; i -= blockSize) {
             embeddedCipher.encryptBlock(in, inOff, out, outOff);
             inOff += blockSize;
@@ -129,28 +126,24 @@
     /**
      * Performs decryption operation.
      *
-     * <p>The input cipher text <code>cipher</code>, starting at
-     * <code>cipherOffset</code> and ending at
-     * <code>(cipherOffset + len - 1)</code>, is decrypted.
-     * The result is stored in <code>plain</code>, starting at
-     * <code>plainOffset</code>.
-     *
-     * <p>It is the application's responsibility to make sure that
-     * <code>cipherLen</code> is a multiple of the embedded cipher's block
-     * size, as any excess bytes are ignored.
-     *
-     * <p>It is also the application's responsibility to make sure that
-     * <code>init</code> has been called before this method is called.
-     * (This check is omitted here, to avoid double checking.)
+     * <p>The input cipher text <code>in</code>, starting at
+     * <code>inOff</code> and ending at * <code>(inOff + len - 1)</code>,
+     * is decrypted.The result is stored in <code>out</code>, starting at
+     * <code>outOff</code>.
      *
      * @param in the buffer with the input data to be decrypted
      * @param inOff the offset in <code>cipherOffset</code>
      * @param len the length of the input data
      * @param out the buffer for the result
      * @param outOff the offset in <code>plain</code>
+     * @exception ProviderException if <code>len</code> is not
+     * a multiple of the block size
      * @return the length of the decrypted data
      */
     int decrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
+        if ((len % blockSize) != 0) {
+             throw new ProviderException("Internal error in input buffering");
+        }
         for (int i = len; i >= blockSize; i -= blockSize) {
             embeddedCipher.decryptBlock(in, inOff, out, outOff);
             inOff += blockSize;
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -371,21 +371,19 @@
      * and ending at <code>(inOff + len - 1)</code>, is encrypted. The result
      * is stored in <code>out</code>, starting at <code>outOfs</code>.
      *
-     * <p>It is the application's responsibility to make sure that
-     * <code>len</code> is a multiple of the embedded cipher's block size,
-     * otherwise, a ProviderException will be thrown.
-     *
-     * <p>It is also the application's responsibility to make sure that
-     * <code>init</code> has been called before this method is called.
-     * (This check is omitted here, to avoid double checking.)
-     *
      * @param in the buffer with the input data to be encrypted
      * @param inOfs the offset in <code>in</code>
      * @param len the length of the input data
      * @param out the buffer for the result
      * @param outOfs the offset in <code>out</code>
+     * @exception ProviderException if <code>len</code> is not
+     * a multiple of the block size
+     * @return the number of bytes placed into the <code>out</code> buffer
      */
     int encrypt(byte[] in, int inOfs, int len, byte[] out, int outOfs) {
+        if ((len % blockSize) != 0) {
+             throw new ProviderException("Internal error in input buffering");
+        }
         processAAD();
         if (len > 0) {
             gctrPAndC.update(in, inOfs, len, out, outOfs);
@@ -398,9 +396,6 @@
     /**
      * Performs encryption operation for the last time.
      *
-     * <p>NOTE: <code>len</code> may not be multiple of the embedded
-     * cipher's block size for this call.
-     *
      * @param in the input buffer with the data to be encrypted
      * @param inOfs the offset in <code>in</code>
      * @param len the length of the input data
@@ -439,21 +434,19 @@
      * is decrypted. The result is stored in <code>out</code>, starting at
      * <code>outOfs</code>.
      *
-     * <p>It is the application's responsibility to make sure that
-     * <code>len</code> is a multiple of the embedded cipher's block
-     * size, as any excess bytes are ignored.
-     *
-     * <p>It is also the application's responsibility to make sure that
-     * <code>init</code> has been called before this method is called.
-     * (This check is omitted here, to avoid double checking.)
-     *
      * @param in the buffer with the input data to be decrypted
      * @param inOfs the offset in <code>in</code>
      * @param len the length of the input data
      * @param out the buffer for the result
      * @param outOfs the offset in <code>out</code>
+     * @exception ProviderException if <code>len</code> is not
+     * a multiple of the block size
+     * @return the number of bytes placed into the <code>out</code> buffer
      */
     int decrypt(byte[] in, int inOfs, int len, byte[] out, int outOfs) {
+        if ((len % blockSize) != 0) {
+             throw new ProviderException("Internal error in input buffering");
+        }
         processAAD();
 
         if (len > 0) {
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/JceKeyStore.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/JceKeyStore.java	Fri Jan 09 13:28:02 2015 -0500
@@ -898,4 +898,20 @@
         md.update("Mighty Aphrodite".getBytes("UTF8"));
         return md;
     }
+
+    /**
+     * Probe the first few bytes of the keystore data stream for a valid
+     * JCEKS keystore encoding.
+     */
+    @Override
+    public boolean engineProbe(InputStream stream) throws IOException {
+        DataInputStream dataStream;
+        if (stream instanceof DataInputStream) {
+            dataStream = (DataInputStream)stream;
+        } else {
+            dataStream = new DataInputStream(stream);
+        }
+
+        return JCEKS_MAGIC == dataStream.readInt();
+    }
 }
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/OutputFeedback.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/OutputFeedback.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 package com.sun.crypto.provider;
 
 import java.security.InvalidKeyException;
+import java.security.ProviderException;
 
 /**
  * This class represents ciphers in output-feedback (OFB) mode.
@@ -132,17 +133,52 @@
      *
      * <p>The input plain text <code>plain</code>, starting at
      * <code>plainOffset</code> and ending at
-     * <code>(plainOffset + len - 1)</code>, is encrypted.
+     * <code>(plainOffset + plainLen - 1)</code>, is encrypted.
      * The result is stored in <code>cipher</code>, starting at
      * <code>cipherOffset</code>.
      *
-     * <p>It is the application's responsibility to make sure that
-     * <code>plainLen</code> is a multiple of the stream unit size
-     * <code>numBytes</code>, as any excess bytes are ignored.
+     * @param plain the buffer with the input data to be encrypted
+     * @param plainOffset the offset in <code>plain</code>
+     * @param plainLen the length of the input data
+     * @param cipher the buffer for the result
+     * @param cipherOffset the offset in <code>cipher</code>
+     * @exception ProviderException if <code>plainLen</code> is not
+     * a multiple of the <code>numBytes</code>
+     * @return the length of the encrypted data
+     */
+    int encrypt(byte[] plain, int plainOffset, int plainLen,
+                byte[] cipher, int cipherOffset) {
+
+        if ((plainLen % numBytes) != 0) {
+            throw new ProviderException("Internal error in input buffering");
+        }
+        int nShift = blockSize - numBytes;
+        int loopCount = plainLen / numBytes;
+
+        for (; loopCount > 0;
+             plainOffset += numBytes, cipherOffset += numBytes,
+             loopCount--) {
+            embeddedCipher.encryptBlock(register, 0, k, 0);
+            for (int i = 0; i < numBytes; i++) {
+                cipher[i + cipherOffset] =
+                    (byte)(k[i] ^ plain[i + plainOffset]);
+                if (nShift != 0) {
+                    System.arraycopy(register, numBytes, register, 0, nShift);
+                }
+                System.arraycopy(k, 0, register, nShift, numBytes);
+            }
+        }
+        return plainLen;
+    }
+
+    /**
+     * Performs last encryption operation.
      *
-     * <p>It is also the application's responsibility to make sure that
-     * <code>init</code> has been called before this method is called.
-     * (This check is omitted here, to avoid double checking.)
+     * <p>The input plain text <code>plain</code>, starting at
+     * <code>plainOffset</code> and ending at
+     * <code>(plainOffset + plainLen - 1)</code>, is encrypted.
+     * The result is stored in <code>cipher</code>, starting at
+     * <code>cipherOffset</code>.
      *
      * @param plain the buffer with the input data to be encrypted
      * @param plainOffset the offset in <code>plain</code>
@@ -151,82 +187,34 @@
      * @param cipherOffset the offset in <code>cipher</code>
      * @return the length of the encrypted data
      */
-    int encrypt(byte[] plain, int plainOffset, int plainLen,
-                byte[] cipher, int cipherOffset)
-    {
-        int i;
-        int len = blockSize - numBytes;
-        int loopCount = plainLen / numBytes;
+    int encryptFinal(byte[] plain, int plainOffset, int plainLen,
+                     byte[] cipher, int cipherOffset) {
         int oddBytes = plainLen % numBytes;
+        int len = encrypt(plain, plainOffset, (plainLen - oddBytes),
+                          cipher, cipherOffset);
+        plainOffset += len;
+        cipherOffset += len;
 
-        if (len == 0) {
-            for (; loopCount > 0;
-                 plainOffset += numBytes, cipherOffset += numBytes,
-                 loopCount--) {
-                embeddedCipher.encryptBlock(register, 0, k, 0);
-                for (i=0; i<numBytes; i++)
-                    cipher[i+cipherOffset] =
-                        (byte)(k[i] ^ plain[i+plainOffset]);
-                System.arraycopy(k, 0, register, 0, numBytes);
-            }
-            if (oddBytes > 0) {
-                embeddedCipher.encryptBlock(register, 0, k, 0);
-                for (i=0; i<oddBytes; i++)
-                    cipher[i+cipherOffset] =
-                        (byte)(k[i] ^ plain[i+plainOffset]);
-                System.arraycopy(k, 0, register, 0, numBytes);
-            }
-        } else {
-            for (; loopCount > 0;
-                 plainOffset += numBytes, cipherOffset += numBytes,
-                 loopCount--) {
-                embeddedCipher.encryptBlock(register, 0, k, 0);
-                for (i=0; i<numBytes; i++)
-                    cipher[i+cipherOffset] =
-                        (byte)(k[i] ^ plain[i+plainOffset]);
-                System.arraycopy(register, numBytes, register, 0, len);
-                System.arraycopy(k, 0, register, len, numBytes);
-            }
-            if (oddBytes > 0) {
-                embeddedCipher.encryptBlock(register, 0, k, 0);
-                for (i=0; i<oddBytes; i++)
-                    cipher[i+cipherOffset] =
-                        (byte)(k[i] ^ plain[i+plainOffset]);
-                System.arraycopy(register, numBytes, register, 0, len);
-                System.arraycopy(k, 0, register, len, numBytes);
+        if (oddBytes != 0) {
+            embeddedCipher.encryptBlock(register, 0, k, 0);
+            for (int i = 0; i < oddBytes; i++) {
+                cipher[i + cipherOffset] =
+                    (byte)(k[i] ^ plain[ i + plainOffset]);
             }
         }
         return plainLen;
     }
 
-    /**
-     * Performs decryption operation.
-     *
-     * <p>The input cipher text <code>cipher</code>, starting at
-     * <code>cipherOffset</code> and ending at
-     * <code>(cipherOffset + len - 1)</code>, is decrypted.
-     * The result is stored in <code>plain</code>, starting at
-     * <code>plainOffset</code>.
-     *
-     * <p>It is the application's responsibility to make sure that
-     * <code>cipherLen</code> is a multiple of the stream unit size
-     * <code>numBytes</code>, as any excess bytes are ignored.
-     *
-     * <p>It is also the application's responsibility to make sure that
-     * <code>init</code> has been called before this method is called.
-     * (This check is omitted here, to avoid double checking.)
-     *
-     * @param cipher the buffer with the input data to be decrypted
-     * @param cipherOffset the offset in <code>cipherOffset</code>
-     * @param cipherLen the length of the input data
-     * @param plain the buffer for the result
-     * @param plainOffset the offset in <code>plain</code>
-     * @return the length of the decrypted data
-     */
+    // OFB encrypt and decrypt are identical
     int decrypt(byte[] cipher, int cipherOffset, int cipherLen,
-                        byte[] plain, int plainOffset)
-    {
-        // OFB encrypt and decrypt are identical
+                byte[] plain, int plainOffset) {
         return encrypt(cipher, cipherOffset, cipherLen, plain, plainOffset);
     }
+
+    // OFB encrypt and decrypt are identical
+    int decryptFinal(byte[] cipher, int cipherOffset, int cipherLen,
+                     byte[] plain, int plainOffset) {
+        // OFB encrypt and decrypt are identical
+        return encryptFinal(cipher, cipherOffset, cipherLen, plain, plainOffset);
+    }
 }
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PCBC.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PCBC.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
 package com.sun.crypto.provider;
 
 import java.security.InvalidKeyException;
+import java.security.ProviderException;
+
 
 /**
  * This class represents ciphers in Plaintext Cipher Block Chaining (PCBC)
@@ -118,38 +120,36 @@
      *
      * <p>The input plain text <code>plain</code>, starting at
      * <code>plainOffset</code> and ending at
-     * <code>(plainOffset + len - 1)</code>, is encrypted.
+     * <code>(plainOffset + plainLen - 1)</code>, is encrypted.
      * The result is stored in <code>cipher</code>, starting at
      * <code>cipherOffset</code>.
      *
-     * <p>It is the application's responsibility to make sure that
-     * <code>plainLen</code> is a multiple of the embedded cipher's block size,
-     * as any excess bytes are ignored.
-     *
-     * <p>It is also the application's responsibility to make sure that
-     * <code>init</code> has been called before this method is called.
-     * (This check is omitted here, to avoid double checking.)
-     *
      * @param plain the buffer with the input data to be encrypted
      * @param plainOffset the offset in <code>plain</code>
      * @param plainLen the length of the input data
      * @param cipher the buffer for the result
      * @param cipherOffset the offset in <code>cipher</code>
+     * @exception ProviderException if <code>plainLen</code> is not
+     * a multiple of the block size
+     * @return the length of the encrypted data
      */
     int encrypt(byte[] plain, int plainOffset, int plainLen,
                 byte[] cipher, int cipherOffset)
     {
+        if ((plainLen % blockSize) != 0) {
+            throw new ProviderException("Internal error in input buffering");
+        }
         int i;
         int endIndex = plainOffset + plainLen;
 
         for (; plainOffset < endIndex;
              plainOffset += blockSize, cipherOffset += blockSize) {
-            for (i=0; i<blockSize; i++) {
-                k[i] ^= plain[i+plainOffset];
+            for (i = 0; i < blockSize; i++) {
+                k[i] ^= plain[i + plainOffset];
             }
             embeddedCipher.encryptBlock(k, 0, cipher, cipherOffset);
             for (i = 0; i < blockSize; i++) {
-                k[i] = (byte)(plain[i+plainOffset] ^ cipher[i+cipherOffset]);
+                k[i] = (byte)(plain[i + plainOffset] ^ cipher[i + cipherOffset]);
             }
         }
         return plainLen;
@@ -160,27 +160,25 @@
      *
      * <p>The input cipher text <code>cipher</code>, starting at
      * <code>cipherOffset</code> and ending at
-     * <code>(cipherOffset + len - 1)</code>, is decrypted.
+     * <code>(cipherOffset + cipherLen - 1)</code>, is decrypted.
      * The result is stored in <code>plain</code>, starting at
      * <code>plainOffset</code>.
      *
-     * <p>It is the application's responsibility to make sure that
-     * <code>cipherLen</code> is a multiple of the embedded cipher's block
-     * size, as any excess bytes are ignored.
-     *
-     * <p>It is also the application's responsibility to make sure that
-     * <code>init</code> has been called before this method is called.
-     * (This check is omitted here, to avoid double checking.)
-     *
      * @param cipher the buffer with the input data to be decrypted
      * @param cipherOffset the offset in <code>cipherOffset</code>
      * @param cipherLen the length of the input data
      * @param plain the buffer for the result
      * @param plainOffset the offset in <code>plain</code>
+     * @exception ProviderException if <code>cipherLen</code> is not
+     * a multiple of the block size
+     * @return the length of the decrypted data
      */
     int decrypt(byte[] cipher, int cipherOffset, int cipherLen,
                 byte[] plain, int plainOffset)
     {
+        if ((cipherLen % blockSize) != 0) {
+             throw new ProviderException("Internal error in input buffering");
+        }
         int i;
         int endIndex = cipherOffset + cipherLen;
 
@@ -189,10 +187,10 @@
             embeddedCipher.decryptBlock(cipher, cipherOffset,
                                    plain, plainOffset);
             for (i = 0; i < blockSize; i++) {
-                plain[i+plainOffset] ^= k[i];
+                plain[i + plainOffset] ^= k[i];
             }
             for (i = 0; i < blockSize; i++) {
-                k[i] = (byte)(plain[i+plainOffset] ^ cipher[i+cipherOffset]);
+                k[i] = (byte)(plain[i + plainOffset] ^ cipher[i + cipherOffset]);
             }
         }
         return cipherLen;
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/ClassReader.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/ClassReader.java	Fri Jan 09 13:28:02 2015 -0500
@@ -497,7 +497,7 @@
                     code.max_locals  >= TOO_BIG ||
                     code.getLength() >= TOO_BIG ||
                     name.endsWith("X")) {
-                    // No, we don't really know what to do this this one.
+                    // No, we don't really know what to do with this one.
                     // Do not compress the rare and strange "u4" and "X" cases.
                     a = null;
                 }
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Coding.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Coding.java	Fri Jan 09 13:28:02 2015 -0500
@@ -95,7 +95,7 @@
       If S>0, the unsigned value of a byte sequence is regarded as a binary
       integer.  If any of the S low-order bits are zero, the corresponding
       signed value will be non-negative.  If all of the S low-order bits
-      (S>0) are one, the the corresponding signed value will be negative.
+      (S>0) are one, the corresponding signed value will be negative.
 
       The non-negative signed values are compact and monotonically increasing
       (from 0) in the ordering of the corresponding unsigned values.
--- a/jdk/src/java.base/share/classes/java/io/FileInputStream.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/io/FileInputStream.java	Fri Jan 09 13:28:02 2015 -0500
@@ -26,6 +26,7 @@
 package java.io;
 
 import java.nio.channels.FileChannel;
+import java.util.concurrent.atomic.AtomicBoolean;
 import sun.nio.ch.FileChannelImpl;
 
 
@@ -57,10 +58,9 @@
      */
     private final String path;
 
-    private FileChannel channel = null;
+    private volatile FileChannel channel;
 
-    private final Object closeLock = new Object();
-    private volatile boolean closed = false;
+    private final AtomicBoolean closed = new AtomicBoolean(false);
 
     /**
      * Creates a <code>FileInputStream</code> by
@@ -313,14 +313,14 @@
      * @spec JSR-51
      */
     public void close() throws IOException {
-        synchronized (closeLock) {
-            if (closed) {
-                return;
-            }
-            closed = true;
+        if (!closed.compareAndSet(false, true)) {
+            // if compareAndSet() returns false closed was already true
+            return;
         }
-        if (channel != null) {
-           channel.close();
+
+        FileChannel fc = channel;
+        if (fc != null) {
+           fc.close();
         }
 
         fd.closeAll(new Closeable() {
@@ -364,12 +364,23 @@
      * @spec JSR-51
      */
     public FileChannel getChannel() {
-        synchronized (this) {
-            if (channel == null) {
-                channel = FileChannelImpl.open(fd, path, true, false, this);
+        FileChannel fc = this.channel;
+        if (fc == null) {
+            synchronized (this) {
+                fc = this.channel;
+                if (fc == null) {
+                    this.channel = fc = FileChannelImpl.open(fd, path, true, false, this);
+                    if (closed.get()) {
+                        try {
+                            fc.close();
+                        } catch (IOException ioe) {
+                            throw new InternalError(ioe); // should not happen
+                        }
+                    }
+                }
             }
-            return channel;
         }
+        return fc;
     }
 
     private static native void initIDs();
--- a/jdk/src/java.base/share/classes/java/io/FileOutputStream.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/io/FileOutputStream.java	Fri Jan 09 13:28:02 2015 -0500
@@ -26,6 +26,7 @@
 package java.io;
 
 import java.nio.channels.FileChannel;
+import java.util.concurrent.atomic.AtomicBoolean;
 import sun.misc.SharedSecrets;
 import sun.misc.JavaIOFileDescriptorAccess;
 import sun.nio.ch.FileChannelImpl;
@@ -68,7 +69,7 @@
     /**
      * The associated channel, initialized lazily.
      */
-    private FileChannel channel;
+    private volatile FileChannel channel;
 
     /**
      * The path of the referenced file
@@ -76,8 +77,7 @@
      */
     private final String path;
 
-    private final Object closeLock = new Object();
-    private volatile boolean closed = false;
+    private final AtomicBoolean closed = new AtomicBoolean(false);
 
     /**
      * Creates a file output stream to write to the file with the
@@ -341,15 +341,14 @@
      * @spec JSR-51
      */
     public void close() throws IOException {
-        synchronized (closeLock) {
-            if (closed) {
-                return;
-            }
-            closed = true;
+        if (!closed.compareAndSet(false, true)) {
+            // if compareAndSet() returns false closed was already true
+            return;
         }
 
-        if (channel != null) {
-            channel.close();
+        FileChannel fc = channel;
+        if (fc != null) {
+           fc.close();
         }
 
         fd.closeAll(new Closeable() {
@@ -394,12 +393,23 @@
      * @spec JSR-51
      */
     public FileChannel getChannel() {
-        synchronized (this) {
-            if (channel == null) {
-                channel = FileChannelImpl.open(fd, path, false, true, this);
+        FileChannel fc = this.channel;
+        if (fc == null) {
+            synchronized (this) {
+                fc = this.channel;
+                if (fc == null) {
+                    this.channel = fc = FileChannelImpl.open(fd, path, false, true, this);
+                    if (closed.get()) {
+                        try {
+                            fc.close();
+                        } catch (IOException ioe) {
+                            throw new InternalError(ioe); // should not happen
+                        }
+                    }
+                }
             }
-            return channel;
         }
+        return fc;
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/io/InputStream.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/io/InputStream.java	Fri Jan 09 13:28:02 2015 -0500
@@ -25,6 +25,8 @@
 
 package java.io;
 
+import java.util.Objects;
+
 /**
  * This abstract class is the superclass of all classes representing
  * an input stream of bytes.
@@ -48,6 +50,8 @@
     // use when skipping.
     private static final int MAX_SKIP_BUFFER_SIZE = 2048;
 
+    private static final int TRANSFER_BUFFER_SIZE = 8192;
+
     /**
      * Reads the next byte of data from the input stream. The value byte is
      * returned as an <code>int</code> in the range <code>0</code> to
@@ -364,4 +368,40 @@
         return false;
     }
 
+    /**
+     * Reads all bytes from this input stream and writes the bytes to the
+     * given output stream in the order that they are read. On return, this
+     * input stream will be at end of stream. This method does not close either
+     * stream.
+     * <p>
+     * This method may block indefinitely reading from the input stream, or
+     * writing to the output stream. The behavior for the case where the input
+     * and/or output stream is <i>asynchronously closed</i>, or the thread
+     * interrupted during the transfer, is highly input and output stream
+     * specific, and therefore not specified.
+     * <p>
+     * If an I/O error occurs reading from the input stream or writing to the
+     * output stream, then it may do so after some bytes have been read or
+     * written. Consequently the input stream may not be at end of stream and
+     * one, or both, streams may be in an inconsistent state. It is strongly
+     * recommended that both streams be promptly closed if an I/O error occurs.
+     *
+     * @param  out the output stream, non-null
+     * @return the number of bytes transferred
+     * @throws IOException if an I/O error occurs when reading or writing
+     * @throws NullPointerException if {@code out} is {@code null}
+     *
+     * @since 1.9
+     */
+    public long transferTo(OutputStream out) throws IOException {
+        Objects.requireNonNull(out, "out");
+        long transferred = 0;
+        byte[] buffer = new byte[TRANSFER_BUFFER_SIZE];
+        int read;
+        while ((read = this.read(buffer, 0, TRANSFER_BUFFER_SIZE)) >= 0) {
+            out.write(buffer, 0, read);
+            transferred += read;
+        }
+        return transferred;
+    }
 }
--- a/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java	Fri Jan 09 13:28:02 2015 -0500
@@ -2345,7 +2345,7 @@
                 skipped++;
                 n--;
             }
-            return skipped + skip(n);
+            return skipped + in.skip(n);
         }
 
         public int available() throws IOException {
--- a/jdk/src/java.base/share/classes/java/io/RandomAccessFile.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/io/RandomAccessFile.java	Fri Jan 09 13:28:02 2015 -0500
@@ -26,6 +26,7 @@
 package java.io;
 
 import java.nio.channels.FileChannel;
+import java.util.concurrent.atomic.AtomicBoolean;
 import sun.nio.ch.FileChannelImpl;
 
 
@@ -59,7 +60,7 @@
 public class RandomAccessFile implements DataOutput, DataInput, Closeable {
 
     private FileDescriptor fd;
-    private FileChannel channel = null;
+    private volatile FileChannel channel;
     private boolean rw;
 
     /**
@@ -68,8 +69,7 @@
      */
     private final String path;
 
-    private Object closeLock = new Object();
-    private volatile boolean closed = false;
+    private final AtomicBoolean closed = new AtomicBoolean(false);
 
     private static final int O_RDONLY = 1;
     private static final int O_RDWR =   2;
@@ -276,13 +276,24 @@
      * @since 1.4
      * @spec JSR-51
      */
-    public final FileChannel getChannel() {
-        synchronized (this) {
-            if (channel == null) {
-                channel = FileChannelImpl.open(fd, path, true, rw, this);
+    public FileChannel getChannel() {
+        FileChannel fc = this.channel;
+        if (fc == null) {
+            synchronized (this) {
+                fc = this.channel;
+                if (fc == null) {
+                    this.channel = fc = FileChannelImpl.open(fd, path, true, rw, this);
+                    if (closed.get()) {
+                        try {
+                            fc.close();
+                        } catch (IOException ioe) {
+                            throw new InternalError(ioe); // should not happen
+                        }
+                    }
+                }
             }
-            return channel;
         }
+        return fc;
     }
 
     /**
@@ -604,14 +615,14 @@
      * @spec JSR-51
      */
     public void close() throws IOException {
-        synchronized (closeLock) {
-            if (closed) {
-                return;
-            }
-            closed = true;
+        if (!closed.compareAndSet(false, true)) {
+            // if compareAndSet() returns false closed was already true
+            return;
         }
-        if (channel != null) {
-            channel.close();
+
+        FileChannel fc = channel;
+        if (fc != null) {
+           fc.close();
         }
 
         fd.closeAll(new Closeable() {
--- a/jdk/src/java.base/share/classes/java/lang/Class.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1529,7 +1529,7 @@
      * the accessible public fields of the class or interface represented by
      * this {@code Class} object.
      *
-     * <p> If this {@code Class} object represents a class or interface with no
+     * <p> If this {@code Class} object represents a class or interface with
      * no accessible public fields, then this method returns an array of length
      * 0.
      *
--- a/jdk/src/java.base/share/classes/java/lang/ClassValue.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/ClassValue.java	Fri Jan 09 13:28:02 2015 -0500
@@ -162,7 +162,7 @@
      * observe the time-dependent states as it computes {@code V1}, etc.
      * This does not remove the threat of a stale value, since there is a window of time
      * between the return of {@code computeValue} in {@code T} and the installation
-     * of the the new value.  No user synchronization is possible during this time.
+     * of the new value.  No user synchronization is possible during this time.
      *
      * @param type the type whose class value must be removed
      * @throws NullPointerException if the argument is null
@@ -285,7 +285,7 @@
      * will receive the notification without delay.
      * <p>
      * If version were not volatile, one thread T1 could persistently hold onto
-     * a stale value this.value == V1, while while another thread T2 advances
+     * a stale value this.value == V1, while another thread T2 advances
      * (under a lock) to this.value == V2.  This will typically be harmless,
      * but if T1 and T2 interact causally via some other channel, such that
      * T1's further actions are constrained (in the JMM) to happen after
--- a/jdk/src/java.base/share/classes/java/lang/Integer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/Integer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -840,7 +840,7 @@
     /**
      * Parses the string argument as an unsigned decimal integer. The
      * characters in the string must all be decimal digits, except
-     * that the first character may be an an ASCII plus sign {@code
+     * that the first character may be an ASCII plus sign {@code
      * '+'} ({@code '\u005Cu002B'}). The resulting integer value
      * is returned, exactly as if the argument and the radix 10 were
      * given as arguments to the {@link
--- a/jdk/src/java.base/share/classes/java/lang/Long.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/Long.java	Fri Jan 09 13:28:02 2015 -0500
@@ -971,7 +971,7 @@
     /**
      * Parses the string argument as an unsigned decimal {@code long}. The
      * characters in the string must all be decimal digits, except
-     * that the first character may be an an ASCII plus sign {@code
+     * that the first character may be an ASCII plus sign {@code
      * '+'} ({@code '\u005Cu002B'}). The resulting integer value
      * is returned, exactly as if the argument and the radix 10 were
      * given as arguments to the {@link
--- a/jdk/src/java.base/share/classes/java/lang/Math.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/Math.java	Fri Jan 09 13:28:02 2015 -0500
@@ -2224,7 +2224,7 @@
          * multiply-store result is subnormal, the next multiply will
          * round it away to zero.  This is done by first multiplying
          * by 2 ^ (scaleFactor % n) and then multiplying several
-         * times by by 2^n as needed where n is the exponent of number
+         * times by 2^n as needed where n is the exponent of number
          * that is a covenient power of two.  In this way, at most one
          * real rounding error occurs.  If the double value set is
          * being used exclusively, the rounding will occur on a
@@ -2249,7 +2249,7 @@
 
         // magnitude of a power of two so large that scaling a finite
         // nonzero value by it would be guaranteed to over or
-        // underflow; due to rounding, scaling down takes takes an
+        // underflow; due to rounding, scaling down takes an
         // additional power of two which is reflected here
         final int MAX_SCALE = DoubleConsts.MAX_EXPONENT + -DoubleConsts.MIN_EXPONENT +
                               DoubleConsts.SIGNIFICAND_WIDTH + 1;
@@ -2318,7 +2318,7 @@
     public static float scalb(float f, int scaleFactor) {
         // magnitude of a power of two so large that scaling a finite
         // nonzero value by it would be guaranteed to over or
-        // underflow; due to rounding, scaling down takes takes an
+        // underflow; due to rounding, scaling down takes an
         // additional power of two which is reflected here
         final int MAX_SCALE = FloatConsts.MAX_EXPONENT + -FloatConsts.MIN_EXPONENT +
                               FloatConsts.SIGNIFICAND_WIDTH + 1;
--- a/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java	Fri Jan 09 13:28:02 2015 -0500
@@ -750,7 +750,7 @@
      * {@link Process#getErrorStream()} will return a
      * <a href="#redirect-output">null input stream</a>.
      *
-     * <p>If the {@link #redirectErrorStream redirectErrorStream}
+     * <p>If the {@link #redirectErrorStream() redirectErrorStream}
      * attribute has been set {@code true}, then the redirection set
      * by this method has no effect.
      *
--- a/jdk/src/java.base/share/classes/java/lang/Throwable.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/Throwable.java	Fri Jan 09 13:28:02 2015 -0500
@@ -202,7 +202,7 @@
      * The field is initialized to a zero-length array.  A {@code
      * null} value of this field indicates subsequent calls to {@link
      * #setStackTrace(StackTraceElement[])} and {@link
-     * #fillInStackTrace()} will be be no-ops.
+     * #fillInStackTrace()} will be no-ops.
      *
      * @serial
      * @since 1.4
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java	Fri Jan 09 13:28:02 2015 -0500
@@ -116,7 +116,7 @@
     /**
      * Construct a temporary unchecked instance of MethodType for use only as a key to the intern table.
      * Does not check the given parameters for validity, and must be discarded after it is used as a searching key.
-     * The parameters are reversed for this constructor, so that is is not accidentally used.
+     * The parameters are reversed for this constructor, so that it is not accidentally used.
      */
     private MethodType(Class<?>[] ptypes, Class<?> rtype) {
         this.rtype = rtype;
@@ -1006,7 +1006,7 @@
      * Therefore, the number returned is the number of arguments
      * <em>including</em> and <em>after</em> the given parameter,
      * <em>plus</em> the number of long or double arguments
-     * at or after after the argument for the given parameter.
+     * at or after the argument for the given parameter.
      * <p>
      * This method is included for the benefit of applications that must
      * generate bytecodes that process method handles and invokedynamic.
--- a/jdk/src/java.base/share/classes/java/math/BigDecimal.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/math/BigDecimal.java	Fri Jan 09 13:28:02 2015 -0500
@@ -393,7 +393,7 @@
      * <p>Note that if the sequence of characters is already available
      * within a character array, using this constructor is faster than
      * converting the {@code char} array to string and using the
-     * {@code BigDecimal(String)} constructor .
+     * {@code BigDecimal(String)} constructor.
      *
      * @param  in {@code char} array that is the source of characters.
      * @param  offset first character in the array to inspect.
@@ -466,7 +466,8 @@
                     } else if (c == '.') {   // have dot
                         // have dot
                         if (dot) // two dots
-                            throw new NumberFormatException();
+                            throw new NumberFormatException("Character array"
+                                + " contains more than one decimal point.");
                         dot = true;
                     } else if (Character.isDigit(c)) { // slow path
                         int digit = Character.digit(c, 10);
@@ -488,14 +489,16 @@
                         exp = parseExp(in, offset, len);
                         // Next test is required for backwards compatibility
                         if ((int) exp != exp) // overflow
-                            throw new NumberFormatException();
+                            throw new NumberFormatException("Exponent overflow.");
                         break; // [saves a test]
                     } else {
-                        throw new NumberFormatException();
+                        throw new NumberFormatException("Character " + c
+                            + " is neither a decimal digit number, decimal point, nor"
+                            + " \"e\" notation exponential mark.");
                     }
                 }
                 if (prec == 0) // no digits found
-                    throw new NumberFormatException();
+                    throw new NumberFormatException("No digits found.");
                 // Adjust scale if exp is not zero.
                 if (exp != 0) { // had significant exponent
                     scl = adjustScale(scl, exp);
@@ -541,22 +544,24 @@
                     if (c == '.') {
                         // have dot
                         if (dot) // two dots
-                            throw new NumberFormatException();
+                            throw new NumberFormatException("Character array"
+                                + " contains more than one decimal point.");
                         dot = true;
                         continue;
                     }
                     // exponent expected
                     if ((c != 'e') && (c != 'E'))
-                        throw new NumberFormatException();
+                        throw new NumberFormatException("Character array"
+                            + " is missing \"e\" notation exponential mark.");
                     exp = parseExp(in, offset, len);
                     // Next test is required for backwards compatibility
                     if ((int) exp != exp) // overflow
-                        throw new NumberFormatException();
+                        throw new NumberFormatException("Exponent overflow.");
                     break; // [saves a test]
                 }
                 // here when no characters left
                 if (prec == 0) // no digits found
-                    throw new NumberFormatException();
+                    throw new NumberFormatException("No digits found.");
                 // Adjust scale if exp is not zero.
                 if (exp != 0) { // had significant exponent
                     scl = adjustScale(scl, exp);
@@ -592,10 +597,10 @@
                     }
                 }
             }
-        } catch (ArrayIndexOutOfBoundsException e) {
-            throw new NumberFormatException();
-        } catch (NegativeArraySizeException e) {
-            throw new NumberFormatException();
+        } catch (ArrayIndexOutOfBoundsException | NegativeArraySizeException e) {
+            NumberFormatException nfe = new NumberFormatException();
+            nfe.initCause(e);
+            throw nfe;
         }
         this.scale = scl;
         this.precision = prec;
@@ -627,7 +632,7 @@
             len--;
         }
         if (len <= 0) // no exponent digits
-            throw new NumberFormatException();
+            throw new NumberFormatException("No exponent digits.");
         // skip leading zeros in the exponent
         while (len > 10 && (c=='0' || (Character.digit(c, 10) == 0))) {
             offset++;
@@ -635,7 +640,7 @@
             len--;
         }
         if (len > 10) // too many nonzero exponent digits
-            throw new NumberFormatException();
+            throw new NumberFormatException("Too many nonzero exponent digits.");
         // c now holds first digit of exponent
         for (;; len--) {
             int v;
@@ -644,7 +649,7 @@
             } else {
                 v = Character.digit(c, 10);
                 if (v < 0) // not a digit
-                    throw new NumberFormatException();
+                    throw new NumberFormatException("Not a digit.");
             }
             exp = exp * 10 + v;
             if (len == 1)
--- a/jdk/src/java.base/share/classes/java/nio/file/Path.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/nio/file/Path.java	Fri Jan 09 13:28:02 2015 -0500
@@ -29,6 +29,7 @@
 import java.io.IOException;
 import java.net.URI;
 import java.util.Iterator;
+import java.util.NoSuchElementException;
 
 /**
  * An object that may be used to locate a file in a file system. It will
@@ -246,6 +247,12 @@
      * "{@code foo/bar}" starts with "{@code foo}" and "{@code foo/bar}". It
      * does not start with "{@code f}" or "{@code fo}".
      *
+     * @implSpec
+     * The default implementation is equivalent for this path to:
+     * <pre>{@code
+     *     startsWith(getFileSystem().getPath(other));
+     * }</pre>
+     *
      * @param   other
      *          the given path string
      *
@@ -255,7 +262,9 @@
      * @throws  InvalidPathException
      *          If the path string cannot be converted to a Path.
      */
-    boolean startsWith(String other);
+    default boolean startsWith(String other) {
+        return startsWith(getFileSystem().getPath(other));
+    }
 
     /**
      * Tests if this path ends with the given path.
@@ -294,6 +303,12 @@
      * Path}"{@code foo/bar}" with the {@code String} "{@code bar/}" returns
      * {@code true}.
      *
+     * @implSpec
+     * The default implementation is equivalent for this path to:
+     * <pre>{@code
+     *     endsWith(getFileSystem().getPath(other));
+     * }</pre>
+     *
      * @param   other
      *          the given path string
      *
@@ -303,7 +318,9 @@
      * @throws  InvalidPathException
      *          If the path string cannot be converted to a Path.
      */
-    boolean endsWith(String other);
+    default boolean endsWith(String other) {
+        return endsWith(getFileSystem().getPath(other));
+    }
 
     /**
      * Returns a path that is this path with redundant name elements eliminated.
@@ -365,6 +382,12 @@
      * invoking this method with the path string "{@code gus}" will result in
      * the {@code Path} "{@code foo/bar/gus}".
      *
+     * @implSpec
+     * The default implementation is equivalent for this path to:
+     * <pre>{@code
+     *     resolve(getFileSystem().getPath(other));
+     * }</pre>
+     *
      * @param   other
      *          the path string to resolve against this path
      *
@@ -375,7 +398,9 @@
      *
      * @see FileSystem#getPath
      */
-    Path resolve(String other);
+    default Path resolve(String other) {
+        return resolve(getFileSystem().getPath(other));
+    }
 
     /**
      * Resolves the given path against this path's {@link #getParent parent}
@@ -389,6 +414,14 @@
      * returns this path's parent, or where this path doesn't have a parent, the
      * empty path.
      *
+     * @implSpec
+     * The default implementation is equivalent for this path to:
+     * <pre>{@code
+     *     (getParent() == null) ? other : getParent().resolve(other);
+     * }</pre>
+     * unless {@code other == null}, in which case a
+     * {@code NullPointerException} is thrown.
+     *
      * @param   other
      *          the path to resolve against this path's parent
      *
@@ -396,13 +429,24 @@
      *
      * @see #resolve(Path)
      */
-    Path resolveSibling(Path other);
+    default Path resolveSibling(Path other) {
+        if (other == null)
+            throw new NullPointerException();
+        Path parent = getParent();
+        return (parent == null) ? other : parent.resolve(other);
+    }
 
     /**
      * Converts a given path string to a {@code Path} and resolves it against
      * this path's {@link #getParent parent} path in exactly the manner
      * specified by the {@link #resolveSibling(Path) resolveSibling} method.
      *
+     * @implSpec
+     * The default implementation is equivalent for this path to:
+     * <pre>{@code
+     *     resolveSibling(getFileSystem().getPath(other));
+     * }</pre>
+     *
      * @param   other
      *          the path string to resolve against this path's parent
      *
@@ -413,7 +457,9 @@
      *
      * @see FileSystem#getPath
      */
-    Path resolveSibling(String other);
+    default Path resolveSibling(String other) {
+        return resolveSibling(getFileSystem().getPath(other));
+    }
 
     /**
      * Constructs a relative path between this path and a given path.
@@ -590,12 +636,28 @@
      * File} object returned by this method is {@link #equals equal} to the
      * original {@code File}.
      *
+     * @implSpec
+     * The default implementation is equivalent for this path to:
+     * <pre>{@code
+     *     new File(toString());
+     * }</pre>
+     * if the {@code FileSystem} which created this {@code Path} is the default
+     * file system; otherwise an {@code UnsupportedOperationException} is
+     * thrown.
+     *
      * @return  a {@code File} object representing this path
      *
      * @throws  UnsupportedOperationException
      *          if this {@code Path} is not associated with the default provider
      */
-    File toFile();
+    default File toFile() {
+        if (getFileSystem() == FileSystems.getDefault()) {
+            return new File(toString());
+        } else {
+            throw new UnsupportedOperationException("Path not associated with "
+                    + "default file system.");
+        }
+    }
 
     // -- watchable --
 
@@ -681,6 +743,13 @@
      *
      *     WatchKey key = dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
      * </pre>
+     *
+     * @implSpec
+     * The default implementation is equivalent for this path to:
+     * <pre>{@code
+     *     register(watcher, events, new WatchEvent.Modifier[0]);
+     * }</pre>
+     *
      * @param   watcher
      *          The watch service to which this object is to be registered
      * @param   events
@@ -706,9 +775,10 @@
      *          method is invoked to check read access to the file.
      */
     @Override
-    WatchKey register(WatchService watcher,
-                      WatchEvent.Kind<?>... events)
-        throws IOException;
+    default WatchKey register(WatchService watcher,
+                      WatchEvent.Kind<?>... events) throws IOException {
+        return register(watcher, events, new WatchEvent.Modifier[0]);
+    }
 
     // -- Iterable --
 
@@ -721,10 +791,36 @@
      * is the name of the file or directory denoted by this path. The {@link
      * #getRoot root} component, if present, is not returned by the iterator.
      *
+     * @implSpec
+     * The default implementation returns an {@code Iterator<Path>} which, for
+     * this path, traverses the {@code Path}s returned by
+     * {@code getName(index)}, where {@code index} ranges from zero to
+     * {@code getNameCount() - 1}, inclusive.
+     *
      * @return  an iterator over the name elements of this path.
      */
     @Override
-    Iterator<Path> iterator();
+    default Iterator<Path> iterator() {
+        return new Iterator<Path>() {
+            private int i = 0;
+
+            @Override
+            public boolean hasNext() {
+                return (i < getNameCount());
+            }
+
+            @Override
+            public Path next() {
+                if (i < getNameCount()) {
+                    Path result = getName(i);
+                    i++;
+                    return result;
+                } else {
+                    throw new NoSuchElementException();
+                }
+            }
+        };
+    }
 
     // -- compareTo/equals/hashCode --
 
--- a/jdk/src/java.base/share/classes/java/security/DomainCombiner.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/security/DomainCombiner.java	Fri Jan 09 13:28:02 2015 -0500
@@ -92,7 +92,7 @@
      * @param currentDomains the ProtectionDomains associated with the
      *          current execution Thread, up to the most recent
      *          privileged {@code ProtectionDomain}.
-     *          The ProtectionDomains are are listed in order of execution,
+     *          The ProtectionDomains are listed in order of execution,
      *          with the most recently executing {@code ProtectionDomain}
      *          residing at the beginning of the array. This parameter may
      *          be {@code null} if the current execution Thread
--- a/jdk/src/java.base/share/classes/java/security/KeyStore.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/security/KeyStore.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -92,9 +92,23 @@
  * be used (in a variety of formats).
  *
  * <p> Typical ways to request a KeyStore object include
+ * specifying an existing keystore file,
  * relying on the default type and providing a specific keystore type.
  *
  * <ul>
+ * <li>To specify an existing keystore file:
+ * <pre>
+ *    // get keystore password
+ *    char[] password = getPassword();
+ *
+ *    // probe the keystore file and load the keystore entries
+ *    KeyStore ks = KeyStore.getInstance(new File("keyStoreName"), password);
+ *</pre>
+ * The system will probe the specified file to determine its keystore type
+ * and return a keystore implementation with its entries already loaded.
+ * When this approach is used there is no need to call the keystore's
+ * {@link #load(java.io.InputStream, char[]) load} method.
+ *
  * <li>To rely on the default type:
  * <pre>
  *    KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
@@ -110,7 +124,8 @@
  * </ul>
  *
  * <p> Before a keystore can be accessed, it must be
- * {@link #load(java.io.InputStream, char[]) loaded}.
+ * {@link #load(java.io.InputStream, char[]) loaded}
+ * (unless it was already loaded during instantiation).
  * <pre>
  *    KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
  *
@@ -179,6 +194,7 @@
 
 public class KeyStore {
 
+    private static final Debug kdebug = Debug.getInstance("keystore");
     private static final Debug pdebug =
                         Debug.getInstance("provider", "Provider");
     private static final boolean skipDebug =
@@ -1594,6 +1610,188 @@
     }
 
     /**
+     * Returns a loaded keystore object of the appropriate keystore type.
+     * First the keystore type is determined by probing the specified file.
+     * Then a keystore object is instantiated and loaded using the data from
+     * that file.
+     * A password may be supplied to unlock the keystore data or perform an
+     * integrity check.
+     *
+     * <p>
+     * This method traverses the list of registered security {@link Providers},
+     * starting with the most preferred Provider.
+     * For each {@link KeyStoreSpi} implementation supported by a Provider,
+     * it invokes the {@link engineProbe} method to determine if it supports
+     * the specified keystore.
+     * A new KeyStore object is returned that encapsulates the KeyStoreSpi
+     * implementation from the first Provider that supports the specified file.
+     *
+     * <p> Note that the list of registered providers may be retrieved via
+     * the {@link Security#getProviders() Security.getProviders()} method.
+     *
+     * @param  file the keystore file
+     * @param  password the keystore password, which may be {@code null}
+     *
+     * @return a keystore object loaded with keystore data
+     *
+     * @throws KeyStoreException if no Provider supports a KeyStoreSpi
+     *             implementation for the specified keystore file.
+     * @throws IOException if there is an I/O or format problem with the
+     *             keystore data, if a password is required but not given,
+     *             or if the given password was incorrect. If the error is
+     *             due to a wrong password, the {@link Throwable#getCause cause}
+     *             of the {@code IOException} should be an
+     *             {@code UnrecoverableKeyException}.
+     * @throws NoSuchAlgorithmException if the algorithm used to check the
+     *             integrity of the keystore cannot be found.
+     * @throws CertificateException if any of the certificates in the
+     *             keystore could not be loaded.
+     * @throws IllegalArgumentException if file does not exist or does not
+     *             refer to a normal file.
+     * @throws NullPointerException if file is {@code null}.
+     * @throws SecurityException if a security manager exists and its
+     *             {@link java.lang.SecurityManager#checkRead} method denies
+     *             read access to the specified file.
+     *
+     * @see Provider
+     *
+     * @since 1.9
+     */
+    public static final KeyStore getInstance(File file, char[] password)
+        throws KeyStoreException, IOException, NoSuchAlgorithmException,
+            CertificateException {
+        return getInstance(file, password, null, true);
+    }
+
+    /**
+     * Returns a loaded keystore object of the appropriate keystore type.
+     * First the keystore type is determined by probing the specified file.
+     * Then a keystore object is instantiated and loaded using the data from
+     * that file.
+     * A {@code LoadStoreParameter} may be supplied which specifies how to
+     * unlock the keystore data or perform an integrity check.
+     *
+     * <p>
+     * This method traverses the list of registered security {@link Providers},
+     * starting with the most preferred Provider.
+     * For each {@link KeyStoreSpi} implementation supported by a Provider,
+     * it invokes the {@link engineProbe} method to determine if it supports
+     * the specified keystore.
+     * A new KeyStore object is returned that encapsulates the KeyStoreSpi
+     * implementation from the first Provider that supports the specified file.
+     *
+     * <p> Note that the list of registered providers may be retrieved via
+     * the {@link Security#getProviders() Security.getProviders()} method.
+     *
+     * @param  file the keystore file
+     * @param  param the {@code LoadStoreParameter} that specifies how to load
+     *             the keystore, which may be {@code null}
+     *
+     * @return a keystore object loaded with keystore data
+     *
+     * @throws KeyStoreException if no Provider supports a KeyStoreSpi
+     *             implementation for the specified keystore file.
+     * @throws IOException if there is an I/O or format problem with the
+     *             keystore data. If the error is due to an incorrect
+     *             {@code ProtectionParameter} (e.g. wrong password)
+     *             the {@link Throwable#getCause cause} of the
+     *             {@code IOException} should be an
+     *             {@code UnrecoverableKeyException}.
+     * @throws NoSuchAlgorithmException if the algorithm used to check the
+     *             integrity of the keystore cannot be found.
+     * @throws CertificateException if any of the certificates in the
+     *             keystore could not be loaded.
+     * @throws IllegalArgumentException if file does not exist or does not
+     *             refer to a normal file, or if param is not recognized.
+     * @throws NullPointerException if file is {@code null}.
+     * @throws SecurityException if a security manager exists and its
+     *             {@link java.lang.SecurityManager#checkRead} method denies
+     *             read access to the specified file.
+     *
+     * @see Provider
+     *
+     * @since 1.9
+     */
+    public static final KeyStore getInstance(File file,
+        LoadStoreParameter param) throws KeyStoreException, IOException,
+            NoSuchAlgorithmException, CertificateException {
+        return getInstance(file, null, param, false);
+    }
+
+    // Used by getInstance(File, char[]) & getInstance(File, LoadStoreParameter)
+    private static final KeyStore getInstance(File file, char[] password,
+        LoadStoreParameter param, boolean hasPassword)
+            throws KeyStoreException, IOException, NoSuchAlgorithmException,
+                CertificateException {
+
+        if (file == null) {
+            throw new NullPointerException();
+        }
+
+        if (file.isFile() == false) {
+            throw new IllegalArgumentException(
+                "File does not exist or it does not refer to a normal file: " +
+                    file);
+        }
+
+        KeyStore keystore = null;
+
+        try (DataInputStream dataStream =
+            new DataInputStream(
+                new BufferedInputStream(
+                    new FileInputStream(file)))) {
+
+            dataStream.mark(Integer.MAX_VALUE);
+
+            // Detect the keystore type
+            for (String type : Security.getAlgorithms("KeyStore")) {
+                Object[] objs = null;
+
+                try {
+                    objs = Security.getImpl(type, "KeyStore", (String)null);
+
+                    KeyStoreSpi impl = (KeyStoreSpi)objs[0];
+                    if (impl.engineProbe(dataStream)) {
+
+                        if (kdebug != null) {
+                            kdebug.println(type + " keystore detected: " +
+                                file);
+                        }
+
+                        keystore = new KeyStore(impl, (Provider)objs[1], type);
+                        break;
+                    }
+                } catch (NoSuchAlgorithmException | NoSuchProviderException e) {
+                    // ignore
+                    if (kdebug != null) {
+                        kdebug.println(type + " not found - " + e);
+                    }
+                } catch (IOException e) {
+                    // ignore
+                    if (kdebug != null) {
+                        kdebug.println("I/O error in " + file + " - " + e);
+                    }
+                }
+                dataStream.reset(); // prepare the stream for the next probe
+            }
+
+            // Load the keystore data
+            if (keystore != null) {
+                if (hasPassword) {
+                    dataStream.reset(); // prepare the stream for loading
+                    keystore.load(dataStream, password);
+                } else {
+                    keystore.load(param);
+                }
+                return keystore;
+            }
+        }
+
+        throw new KeyStoreException("Unrecognized keystore format: " +
+            keystore);
+    }
+
+    /**
      * A description of a to-be-instantiated KeyStore object.
      *
      * <p>An instance of this class encapsulates the information needed to
@@ -1713,7 +1911,7 @@
          * by invoking the CallbackHandler.
          *
          * <p>Subsequent calls to {@link #getKeyStore} return the same object
-         * as the initial call. If the initial call to failed with a
+         * as the initial call. If the initial call failed with a
          * KeyStoreException, subsequent calls also throw a
          * KeyStoreException.
          *
@@ -1760,6 +1958,50 @@
                 AccessController.getContext());
         }
 
+        /**
+         * Returns a new Builder object.
+         *
+         * <p>The first call to the {@link #getKeyStore} method on the returned
+         * builder will create a KeyStore using {@code file} to detect the
+         * keystore type and then call its {@link KeyStore#load load()} method.
+         * It uses the same algorithm to determine the keystore type as
+         * described in {@link KeyStore#getInstance(File, LoadStoreParameter)}.
+         * The {@code inputStream} argument is constructed from {@code file}.
+         * If {@code protection} is a {@code PasswordProtection}, the password
+         * is obtained by calling the {@code getPassword} method.
+         * Otherwise, if {@code protection} is a
+         * {@code CallbackHandlerProtection},
+         * the password is obtained by invoking the CallbackHandler.
+         *
+         * <p>Subsequent calls to {@link #getKeyStore} return the same object
+         * as the initial call. If the initial call failed with a
+         * KeyStoreException, subsequent calls also throw a KeyStoreException.
+         *
+         * <p>Calls to {@link #getProtectionParameter getProtectionParameter()}
+         * will return a {@link KeyStore.PasswordProtection PasswordProtection}
+         * object encapsulating the password that was used to invoke the
+         * {@code load} method.
+         *
+         * <p><em>Note</em> that the {@link #getKeyStore} method is executed
+         * within the {@link AccessControlContext} of the code invoking this
+         * method.
+         *
+         * @return a new Builder object
+         * @param file the File that contains the KeyStore data
+         * @param protection the ProtectionParameter securing the KeyStore data
+         * @throws NullPointerException if file or protection is null
+         * @throws IllegalArgumentException if protection is not an instance
+         *   of either PasswordProtection or CallbackHandlerProtection; or
+         *   if file does not exist or does not refer to a normal file
+         *
+         * @since 1.9
+         */
+        public static Builder newInstance(File file,
+            ProtectionParameter protection) {
+
+            return newInstance("", null, file, protection);
+        }
+
         private static final class FileBuilder extends Builder {
 
             private final String type;
@@ -1817,42 +2059,46 @@
                     }
                     public KeyStore run0() throws Exception {
                         KeyStore ks;
-                        if (provider == null) {
-                            ks = KeyStore.getInstance(type);
+                        char[] password = null;
+
+                        // Acquire keystore password
+                        if (protection instanceof PasswordProtection) {
+                            password =
+                                ((PasswordProtection)protection).getPassword();
+                            keyProtection = protection;
                         } else {
-                            ks = KeyStore.getInstance(type, provider);
-                        }
-                        InputStream in = null;
-                        char[] password = null;
-                        try {
-                            in = new FileInputStream(file);
-                            if (protection instanceof PasswordProtection) {
-                                password =
-                                ((PasswordProtection)protection).getPassword();
-                                keyProtection = protection;
-                            } else {
-                                CallbackHandler handler =
-                                    ((CallbackHandlerProtection)protection)
+                            CallbackHandler handler =
+                                ((CallbackHandlerProtection)protection)
                                     .getCallbackHandler();
-                                PasswordCallback callback = new PasswordCallback
-                                    ("Password for keystore " + file.getName(),
+                            PasswordCallback callback = new PasswordCallback
+                                ("Password for keystore " + file.getName(),
                                     false);
-                                handler.handle(new Callback[] {callback});
-                                password = callback.getPassword();
-                                if (password == null) {
-                                    throw new KeyStoreException("No password" +
-                                                                " provided");
-                                }
-                                callback.clearPassword();
-                                keyProtection = new PasswordProtection(password);
+                            handler.handle(new Callback[] {callback});
+                            password = callback.getPassword();
+                            if (password == null) {
+                                throw new KeyStoreException("No password" +
+                                                            " provided");
                             }
-                            ks.load(in, password);
-                            return ks;
-                        } finally {
-                            if (in != null) {
-                                in.close();
+                            callback.clearPassword();
+                            keyProtection = new PasswordProtection(password);
+                        }
+
+                        if (type.isEmpty()) {
+                            // Instantiate keystore and load keystore data
+                            ks = KeyStore.getInstance(file, password);
+                        } else {
+                            // Instantiate keystore
+                            if (provider == null) {
+                                ks = KeyStore.getInstance(type);
+                            } else {
+                                ks = KeyStore.getInstance(type, provider);
+                            }
+                            // Load keystore data
+                            try (InputStream in = new FileInputStream(file)) {
+                                ks.load(in, password);
                             }
                         }
+                        return ks;
                     }
                 };
                 try {
@@ -1998,5 +2244,4 @@
             return protection;
         }
     }
-
 }
--- a/jdk/src/java.base/share/classes/java/security/KeyStoreSpi.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/security/KeyStoreSpi.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -590,4 +590,27 @@
         }
         return false;
     }
+
+    /**
+     * Probes the specified input stream to determine whether it contains a
+     * keystore that is supported by this implementation, or not.
+     *
+     * <p>
+     * @implSpec
+     * This method returns false by default. Keystore implementations should
+     * override this method to peek at the data stream directly or to use other
+     * content detection mechanisms.
+     *
+     * @param  stream the keystore data to be probed
+     *
+     * @return true if the keystore data is supported, otherwise false
+     *
+     * @throws IOException if there is an I/O problem with the keystore data.
+     * @throws NullPointerException if stream is {@code null}.
+     *
+     * @since 1.9
+     */
+    public boolean engineProbe(InputStream stream) throws IOException {
+        return false;
+    }
 }
--- a/jdk/src/java.base/share/classes/java/security/Provider.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/security/Provider.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1711,7 +1711,7 @@
          *
          * @param parameter the parameter to test
          *
-         * @return false if this this service cannot use the specified
+         * @return false if this service cannot use the specified
          * parameter; true if it can possibly use the parameter
          *
          * @throws InvalidParameterException if the value of parameter is
--- a/jdk/src/java.base/share/classes/java/security/Signature.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/security/Signature.java	Fri Jan 09 13:28:02 2015 -0500
@@ -776,7 +776,7 @@
     /**
      * Updates the data to be signed or verified using the specified
      * ByteBuffer. Processes the {@code data.remaining()} bytes
-     * starting at at {@code data.position()}.
+     * starting at {@code data.position()}.
      * Upon return, the buffer's position will be equal to its limit;
      * its limit will not have changed.
      *
--- a/jdk/src/java.base/share/classes/java/security/SignatureSpi.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/security/SignatureSpi.java	Fri Jan 09 13:28:02 2015 -0500
@@ -131,7 +131,7 @@
     /**
      * Updates the data to be signed or verified using the specified
      * ByteBuffer. Processes the {@code data.remaining()} bytes
-     * starting at at {@code data.position()}.
+     * starting at {@code data.position()}.
      * Upon return, the buffer's position will be equal to its limit;
      * its limit will not have changed.
      *
--- a/jdk/src/java.base/share/classes/java/security/interfaces/DSAKeyPairGenerator.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/security/interfaces/DSAKeyPairGenerator.java	Fri Jan 09 13:28:02 2015 -0500
@@ -54,7 +54,7 @@
  *
  * </ol>
  *
- * <p>Note: it is not always necessary to do do algorithm-specific
+ * <p>Note: it is not always necessary to do algorithm-specific
  * initialization for a DSA key pair generator. That is, it is not always
  * necessary to call an {@code initialize} method in this interface.
  * Algorithm-independent initialization using the {@code initialize} method
--- a/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatter.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatter.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1097,7 +1097,7 @@
      * This returns an immutable formatter capable of formatting and parsing
      * the ISO-8601 instant format.
      * When formatting, the second-of-minute is always output.
-     * The nano-of-second outputs zero, three, six or nine digits digits as necessary.
+     * The nano-of-second outputs zero, three, six or nine digits as necessary.
      * When parsing, time to at least the seconds field is required.
      * Fractional seconds from zero to nine are parsed.
      * The localized decimal style is not used.
--- a/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Fri Jan 09 13:28:02 2015 -0500
@@ -793,7 +793,7 @@
      * They are converted to a date-time with a zone-offset of UTC and formatted
      * using the standard ISO-8601 format.
      * With this method, formatting nano-of-second outputs zero, three, six
-     * or nine digits digits as necessary.
+     * or nine digits as necessary.
      * The localized decimal style is not used.
      * <p>
      * The instant is obtained using {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS}
--- a/jdk/src/java.base/share/classes/java/util/Arrays.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/Arrays.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1221,7 +1221,7 @@
      *
      * <p>The implementation takes equal advantage of ascending and
      * descending order in its input array, and can take advantage of
-     * ascending and descending order in different parts of the the same
+     * ascending and descending order in different parts of the same
      * input array.  It is well-suited to merging two or more sorted arrays:
      * simply concatenate the arrays and sort the resulting array.
      *
@@ -1280,7 +1280,7 @@
      *
      * <p>The implementation takes equal advantage of ascending and
      * descending order in its input array, and can take advantage of
-     * ascending and descending order in different parts of the the same
+     * ascending and descending order in different parts of the same
      * input array.  It is well-suited to merging two or more sorted arrays:
      * simply concatenate the arrays and sort the resulting array.
      *
@@ -1407,7 +1407,7 @@
      *
      * <p>The implementation takes equal advantage of ascending and
      * descending order in its input array, and can take advantage of
-     * ascending and descending order in different parts of the the same
+     * ascending and descending order in different parts of the same
      * input array.  It is well-suited to merging two or more sorted arrays:
      * simply concatenate the arrays and sort the resulting array.
      *
@@ -1473,7 +1473,7 @@
      *
      * <p>The implementation takes equal advantage of ascending and
      * descending order in its input array, and can take advantage of
-     * ascending and descending order in different parts of the the same
+     * ascending and descending order in different parts of the same
      * input array.  It is well-suited to merging two or more sorted arrays:
      * simply concatenate the arrays and sort the resulting array.
      *
--- a/jdk/src/java.base/share/classes/java/util/Base64.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/Base64.java	Fri Jan 09 13:28:02 2015 -0500
@@ -556,7 +556,7 @@
          *
          * <p> It is the responsibility of the invoker of this method to make
          * sure the output byte array {@code dst} has enough space for decoding
-         * all bytes from the input byte array. No bytes will be be written to
+         * all bytes from the input byte array. No bytes will be written to
          * the output byte array if the output byte array is not big enough.
          *
          * <p> If the input byte array is not in valid Base64 encoding scheme
--- a/jdk/src/java.base/share/classes/java/util/Calendar.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/Calendar.java	Fri Jan 09 13:28:02 2015 -0500
@@ -2993,7 +2993,7 @@
     }
 
     /**
-     * Sets the date of this {@code Calendar} with the the given date
+     * Sets the date of this {@code Calendar} with the given date
      * specifiers - week year, week of year, and day of week.
      *
      * <p>Unlike the {@code set} method, all of the calendar fields
--- a/jdk/src/java.base/share/classes/java/util/Locale.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/Locale.java	Fri Jan 09 13:28:02 2015 -0500
@@ -95,7 +95,7 @@
  *   <code>Locale</code> always canonicalizes to lower case.</dd>
  *
  *   <dd>Well-formed language values have the form
- *   <code>[a-zA-Z]{2,8}</code>.  Note that this is not the the full
+ *   <code>[a-zA-Z]{2,8}</code>.  Note that this is not the full
  *   BCP47 language production, since it excludes extlang.  They are
  *   not needed since modern three-letter language codes replace
  *   them.</dd>
@@ -1691,7 +1691,7 @@
     }
 
     /**
-     * Returns a name for the the locale's script that is appropriate for display to
+     * Returns a name for the locale's script that is appropriate for display to
      * the user. If possible, the name will be localized for the default
      * {@link Locale.Category#DISPLAY DISPLAY} locale.  Returns
      * the empty string if this locale doesn't specify a script code.
--- a/jdk/src/java.base/share/classes/java/util/ResourceBundle.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/ResourceBundle.java	Fri Jan 09 13:28:02 2015 -0500
@@ -994,7 +994,7 @@
      * bundle is found, the default control's {@link Control#getFallbackLocale
      * getFallbackLocale} method is called, which returns the current default
      * locale.  A new sequence of candidate locale names is generated using this
-     * locale and and searched again, as above.
+     * locale and searched again, as above.
      *
      * <p>If still no result bundle is found, the base name alone is looked up. If
      * this still fails, a <code>MissingResourceException</code> is thrown.
--- a/jdk/src/java.base/share/classes/java/util/Spliterator.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/Spliterator.java	Fri Jan 09 13:28:02 2015 -0500
@@ -84,7 +84,7 @@
  * via the {@link #estimateSize} method.  Ideally, as reflected in characteristic
  * {@link #SIZED}, this value corresponds exactly to the number of elements
  * that would be encountered in a successful traversal.  However, even when not
- * exactly known, an estimated value value may still be useful to operations
+ * exactly known, an estimated value may still be useful to operations
  * being performed on the source, such as helping to determine whether it is
  * preferable to split further or traverse the remaining elements sequentially.
  *
--- a/jdk/src/java.base/share/classes/java/util/Spliterators.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/Spliterators.java	Fri Jan 09 13:28:02 2015 -0500
@@ -132,7 +132,7 @@
      * @param array The array, assumed to be unmodified during use
      * @param additionalCharacteristics Additional spliterator characteristics
      *        of this spliterator's source or elements beyond {@code SIZED} and
-     *        {@code SUBSIZED} which are are always reported
+     *        {@code SUBSIZED} which are always reported
      * @return A spliterator for an array
      * @throws NullPointerException if the given array is {@code null}
      * @see Arrays#spliterator(Object[])
@@ -164,7 +164,7 @@
      * @param toIndex One past the greatest index to cover
      * @param additionalCharacteristics Additional spliterator characteristics
      *        of this spliterator's source or elements beyond {@code SIZED} and
-     *        {@code SUBSIZED} which are are always reported
+     *        {@code SUBSIZED} which are always reported
      * @return A spliterator for an array
      * @throws NullPointerException if the given array is {@code null}
      * @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
@@ -196,7 +196,7 @@
      * @param array The array, assumed to be unmodified during use
      * @param additionalCharacteristics Additional spliterator characteristics
      *        of this spliterator's source or elements beyond {@code SIZED} and
-     *        {@code SUBSIZED} which are are always reported
+     *        {@code SUBSIZED} which are always reported
      * @return A spliterator for an array
      * @throws NullPointerException if the given array is {@code null}
      * @see Arrays#spliterator(int[])
@@ -226,7 +226,7 @@
      * @param toIndex One past the greatest index to cover
      * @param additionalCharacteristics Additional spliterator characteristics
      *        of this spliterator's source or elements beyond {@code SIZED} and
-     *        {@code SUBSIZED} which are are always reported
+     *        {@code SUBSIZED} which are always reported
      * @return A spliterator for an array
      * @throws NullPointerException if the given array is {@code null}
      * @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
@@ -258,7 +258,7 @@
      * @param array The array, assumed to be unmodified during use
      * @param additionalCharacteristics Additional spliterator characteristics
      *        of this spliterator's source or elements beyond {@code SIZED} and
-     *        {@code SUBSIZED} which are are always reported
+     *        {@code SUBSIZED} which are always reported
      * @return A spliterator for an array
      * @throws NullPointerException if the given array is {@code null}
      * @see Arrays#spliterator(long[])
@@ -282,7 +282,7 @@
      * {@code SIZED} and {@code SUBSIZED}.  The caller may provide additional
      * characteristics for the spliterator to report.  (For example, if it is
      * known the array will not be further modified, specify {@code IMMUTABLE};
-     * if the array data is considered to have an an encounter order, specify
+     * if the array data is considered to have an encounter order, specify
      * {@code ORDERED}).  The method {@link Arrays#spliterator(long[], int, int)} can
      * often be used instead, which returns a spliterator that reports
      * {@code SIZED}, {@code SUBSIZED}, {@code IMMUTABLE}, and {@code ORDERED}.
@@ -292,7 +292,7 @@
      * @param toIndex One past the greatest index to cover
      * @param additionalCharacteristics Additional spliterator characteristics
      *        of this spliterator's source or elements beyond {@code SIZED} and
-     *        {@code SUBSIZED} which are are always reported
+     *        {@code SUBSIZED} which are always reported
      * @return A spliterator for an array
      * @throws NullPointerException if the given array is {@code null}
      * @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
@@ -324,7 +324,7 @@
      * @param array The array, assumed to be unmodified during use
      * @param additionalCharacteristics Additional spliterator characteristics
      *        of this spliterator's source or elements beyond {@code SIZED} and
-     *        {@code SUBSIZED} which are are always reported
+     *        {@code SUBSIZED} which are always reported
      * @return A spliterator for an array
      * @throws NullPointerException if the given array is {@code null}
      * @see Arrays#spliterator(double[])
@@ -348,7 +348,7 @@
      * {@code SIZED} and {@code SUBSIZED}.  The caller may provide additional
      * characteristics for the spliterator to report.  (For example, if it is
      * known the array will not be further modified, specify {@code IMMUTABLE};
-     * if the array data is considered to have an an encounter order, specify
+     * if the array data is considered to have an encounter order, specify
      * {@code ORDERED}).  The method {@link Arrays#spliterator(long[], int, int)} can
      * often be used instead, which returns a spliterator that reports
      * {@code SIZED}, {@code SUBSIZED}, {@code IMMUTABLE}, and {@code ORDERED}.
@@ -358,7 +358,7 @@
      * @param toIndex One past the greatest index to cover
      * @param additionalCharacteristics Additional spliterator characteristics
      *        of this spliterator's source or elements beyond {@code SIZED} and
-     *        {@code SUBSIZED} which are are always reported
+     *        {@code SUBSIZED} which are always reported
      * @return A spliterator for an array
      * @throws NullPointerException if the given array is {@code null}
      * @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
@@ -907,7 +907,7 @@
          * @param array the array, assumed to be unmodified during use
          * @param additionalCharacteristics Additional spliterator characteristics
          * of this spliterator's source or elements beyond {@code SIZED} and
-         * {@code SUBSIZED} which are are always reported
+         * {@code SUBSIZED} which are always reported
          */
         public ArraySpliterator(Object[] array, int additionalCharacteristics) {
             this(array, 0, array.length, additionalCharacteristics);
@@ -920,7 +920,7 @@
          * @param fence one past the greatest index to cover
          * @param additionalCharacteristics Additional spliterator characteristics
          * of this spliterator's source or elements beyond {@code SIZED} and
-         * {@code SUBSIZED} which are are always reported
+         * {@code SUBSIZED} which are always reported
          */
         public ArraySpliterator(Object[] array, int origin, int fence, int additionalCharacteristics) {
             this.array = array;
@@ -992,7 +992,7 @@
          * @param array the array, assumed to be unmodified during use
          * @param additionalCharacteristics Additional spliterator characteristics
          *        of this spliterator's source or elements beyond {@code SIZED} and
-         *        {@code SUBSIZED} which are are always reported
+         *        {@code SUBSIZED} which are always reported
          */
         public IntArraySpliterator(int[] array, int additionalCharacteristics) {
             this(array, 0, array.length, additionalCharacteristics);
@@ -1005,7 +1005,7 @@
          * @param fence one past the greatest index to cover
          * @param additionalCharacteristics Additional spliterator characteristics
          *        of this spliterator's source or elements beyond {@code SIZED} and
-         *        {@code SUBSIZED} which are are always reported
+         *        {@code SUBSIZED} which are always reported
          */
         public IntArraySpliterator(int[] array, int origin, int fence, int additionalCharacteristics) {
             this.array = array;
@@ -1075,7 +1075,7 @@
          * @param array the array, assumed to be unmodified during use
          * @param additionalCharacteristics Additional spliterator characteristics
          *        of this spliterator's source or elements beyond {@code SIZED} and
-         *        {@code SUBSIZED} which are are always reported
+         *        {@code SUBSIZED} which are always reported
          */
         public LongArraySpliterator(long[] array, int additionalCharacteristics) {
             this(array, 0, array.length, additionalCharacteristics);
@@ -1088,7 +1088,7 @@
          * @param fence one past the greatest index to cover
          * @param additionalCharacteristics Additional spliterator characteristics
          *        of this spliterator's source or elements beyond {@code SIZED} and
-         *        {@code SUBSIZED} which are are always reported
+         *        {@code SUBSIZED} which are always reported
          */
         public LongArraySpliterator(long[] array, int origin, int fence, int additionalCharacteristics) {
             this.array = array;
@@ -1158,7 +1158,7 @@
          * @param array the array, assumed to be unmodified during use
          * @param additionalCharacteristics Additional spliterator characteristics
          *        of this spliterator's source or elements beyond {@code SIZED} and
-         *        {@code SUBSIZED} which are are always reported
+         *        {@code SUBSIZED} which are always reported
          */
         public DoubleArraySpliterator(double[] array, int additionalCharacteristics) {
             this(array, 0, array.length, additionalCharacteristics);
@@ -1171,7 +1171,7 @@
          * @param fence one past the greatest index to cover
          * @param additionalCharacteristics Additional spliterator characteristics
          *        of this spliterator's source or elements beyond {@code SIZED} and
-         *        {@code SUBSIZED} which are are always reported
+         *        {@code SUBSIZED} which are always reported
          */
         public DoubleArraySpliterator(double[] array, int origin, int fence, int additionalCharacteristics) {
             this.array = array;
@@ -1698,7 +1698,7 @@
         private int batch;            // batch size for splits
 
         /**
-         * Creates a spliterator using the given given
+         * Creates a spliterator using the given
          * collection's {@link java.util.Collection#iterator()) for traversal,
          * and reporting its {@link java.util.Collection#size()) as its initial
          * size.
--- a/jdk/src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java	Fri Jan 09 13:28:02 2015 -0500
@@ -43,9 +43,8 @@
  * supported by the Java runtime environment itself.
  *
  * <h3>Packaging of Locale Sensitive Service Provider Implementations</h3>
- * Implementations of these locale sensitive services are packaged using the
- * <a href="../../../../technotes/guides/extensions/index.html">Java Extension Mechanism</a>
- * as installed extensions.  A provider identifies itself with a
+ * Implementations of these locale sensitive services can be made available
+ * by adding them to the application's class path. A provider identifies itself with a
  * provider-configuration file in the resource directory META-INF/services,
  * using the fully qualified provider interface class name as the file name.
  * The file should contain a list of fully-qualified concrete provider class names,
--- a/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java	Fri Jan 09 13:28:02 2015 -0500
@@ -204,7 +204,6 @@
     /**
      * Updates the CRC-32C checksum with the specified array of bytes.
      */
-    @SuppressWarnings("deprecation") // Unsafe.{getInt, getLong}
     private static int updateBytes(int crc, byte[] b, int off, int end) {
 
         // Do only byte reads for arrays so short they can't be aligned
@@ -228,11 +227,11 @@
                 int secondHalf;
                 if (Unsafe.ADDRESS_SIZE == 4) {
                     // On 32 bit platforms read two ints instead of a single 64bit long
-                    firstHalf = UNSAFE.getInt(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
-                    secondHalf = UNSAFE.getInt(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off
+                    firstHalf = UNSAFE.getInt(b, (long)Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
+                    secondHalf = UNSAFE.getInt(b, (long)Unsafe.ARRAY_BYTE_BASE_OFFSET + off
                                                + Integer.BYTES);
                 } else {
-                    long value = UNSAFE.getLong(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
+                    long value = UNSAFE.getLong(b, (long)Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
                     if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
                         firstHalf = (int) value;
                         secondHalf = (int) (value >>> 32);
--- a/jdk/src/java.base/share/classes/javax/security/auth/Policy.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/javax/security/auth/Policy.java	Fri Jan 09 13:28:02 2015 -0500
@@ -76,7 +76,7 @@
  * </pre>
  *
  * The CodeBase and Signedby components of the triplet name/value pairs
- * are optional.  If they are not present, then any any codebase will match,
+ * are optional.  If they are not present, then any codebase will match,
  * and any signer (including unsigned code) will match.
  * For Example,
  *
--- a/jdk/src/java.base/share/classes/javax/security/auth/SubjectDomainCombiner.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/javax/security/auth/SubjectDomainCombiner.java	Fri Jan 09 13:28:02 2015 -0500
@@ -137,7 +137,7 @@
      * @param currentDomains the ProtectionDomains associated with the
      *          current execution Thread, up to the most recent
      *          privileged {@code ProtectionDomain}.
-     *          The ProtectionDomains are are listed in order of execution,
+     *          The ProtectionDomains are listed in order of execution,
      *          with the most recently executing {@code ProtectionDomain}
      *          residing at the beginning of the array. This parameter may
      *          be {@code null} if the current execution Thread
--- a/jdk/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Frame.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Frame.java	Fri Jan 09 13:28:02 2015 -0500
@@ -192,7 +192,7 @@
     private static final int LOCAL = 0x2000000;
 
     /**
-     * Kind of the the types that are relative to the stack of an input stack
+     * Kind of the types that are relative to the stack of an input stack
      * map frame. The value of such types is a position relatively to the top of
      * this stack.
      */
--- a/jdk/src/java.base/share/classes/jdk/internal/util/xml/XMLStreamWriter.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/jdk/internal/util/xml/XMLStreamWriter.java	Fri Jan 09 13:28:02 2015 -0500
@@ -116,7 +116,7 @@
     public void writeStartDocument() throws XMLStreamException;
 
     /**
-     * Write the XML Declaration. Defaults the the encoding to utf-8
+     * Write the XML Declaration. Defaults the encoding to utf-8
      * @param version version of the xml document
      * @throws XMLStreamException
      */
--- a/jdk/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java	Fri Jan 09 13:28:02 2015 -0500
@@ -80,7 +80,7 @@
      * @param defc the class in which the proposed member is actually defined
      * @param mods modifier flags for the proposed member
      * @param lookupClass the class for which the access check is being made
-     * @return true iff the the accessing class can access such a member
+     * @return true iff the accessing class can access such a member
      */
     public static boolean isMemberAccessible(Class<?> refc,  // symbolic ref class
                                              Class<?> defc,  // actual def class
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -46,11 +46,7 @@
 \    -verbose:[class|gc|jni]\n\
 \                  enable verbose output\n\
 \    -version      print product version and exit\n\
-\    -version:<value>\n\
-\                  require the specified version to run\n\
 \    -showversion  print product version and continue\n\
-\    -jre-restrict-search | -no-jre-restrict-search\n\
-\                  include/exclude user private JREs in the version search\n\
 \    -? -help      print this help message\n\
 \    -X            print help on non-standard options\n\
 \    -ea[:<packagename>...|:<classname>]\n\
--- a/jdk/src/java.base/share/classes/sun/misc/JavaNioAccess.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/misc/JavaNioAccess.java	Fri Jan 09 13:28:02 2015 -0500
@@ -42,7 +42,7 @@
 
     /**
      * Constructs a direct ByteBuffer referring to the block of memory starting
-     * at the given memory address and and extending {@code cap} bytes.
+     * at the given memory address and extending {@code cap} bytes.
      * The {@code ob} parameter is an arbitrary object that is attached
      * to the resulting buffer.
      */
--- a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java	Fri Jan 09 13:28:02 2015 -0500
@@ -958,6 +958,8 @@
      * other threads. This method is generally only useful if the
      * underlying field is a Java volatile (or if an array cell, one
      * that is otherwise only accessed using volatile accesses).
+     *
+     * Corresponds to C11 atomic_store_explicit(..., memory_order_release).
      */
     public native void    putOrderedObject(Object o, long offset, Object x);
 
@@ -1111,22 +1113,40 @@
 
 
     /**
-     * Ensures lack of reordering of loads before the fence
-     * with loads or stores after the fence.
+     * Ensures that loads before the fence will not be reordered with loads and
+     * stores after the fence; a "LoadLoad plus LoadStore barrier".
+     *
+     * Corresponds to C11 atomic_thread_fence(memory_order_acquire)
+     * (an "acquire fence").
+     *
+     * A pure LoadLoad fence is not provided, since the addition of LoadStore
+     * is almost always desired, and most current hardware instructions that
+     * provide a LoadLoad barrier also provide a LoadStore barrier for free.
      * @since 1.8
      */
     public native void loadFence();
 
     /**
-     * Ensures lack of reordering of stores before the fence
-     * with loads or stores after the fence.
+     * Ensures that loads and stores before the fence will not be reordered with
+     * stores after the fence; a "StoreStore plus LoadStore barrier".
+     *
+     * Corresponds to C11 atomic_thread_fence(memory_order_release)
+     * (a "release fence").
+     *
+     * A pure StoreStore fence is not provided, since the addition of LoadStore
+     * is almost always desired, and most current hardware instructions that
+     * provide a StoreStore barrier also provide a LoadStore barrier for free.
      * @since 1.8
      */
     public native void storeFence();
 
     /**
-     * Ensures lack of reordering of loads or stores before the fence
-     * with loads or stores after the fence.
+     * Ensures that loads and stores before the fence will not be reordered
+     * with loads and stores after the fence.  Implies the effects of both
+     * loadFence() and storeFence(), and in addition, the effect of a StoreLoad
+     * barrier.
+     *
+     * Corresponds to C11 atomic_thread_fence(memory_order_seq_cst).
      * @since 1.8
      */
     public native void fullFence();
--- a/jdk/src/java.base/share/classes/sun/misc/VM.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/misc/VM.java	Fri Jan 09 13:28:02 2015 -0500
@@ -150,7 +150,7 @@
     private static volatile boolean booted = false;
     private static final Object lock = new Object();
 
-    // Invoked by by System.initializeSystemClass just before returning.
+    // Invoked by System.initializeSystemClass just before returning.
     // Subsystems that are invoked during initialization can check this
     // property in order to avoid doing things that should wait until the
     // application class loader has been set up.
--- a/jdk/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java	Fri Jan 09 13:28:02 2015 -0500
@@ -2187,7 +2187,7 @@
             return resp.get(0).substring(4);
         }
         // on multiple lines answers, like the ones above, remove 1st and last
-        // line, concat the the others.
+        // line, concat the others.
         StringBuilder sb = new StringBuilder();
         for (int i = 1; i < resp.size() - 1; i++) {
             sb.append(resp.get(i).substring(3));
--- a/jdk/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java	Fri Jan 09 13:28:02 2015 -0500
@@ -110,6 +110,9 @@
     // -- Standard channel operations --
 
     protected void implCloseChannel() throws IOException {
+        if (!fd.valid())
+            return; // nothing to do
+
         // Release and invalidate any locks that we still hold
         if (fileLockTable != null) {
             for (FileLock fl: fileLockTable.removeAll()) {
--- a/jdk/src/java.base/share/classes/sun/nio/fs/AbstractPath.java	Fri Jan 09 05:45:13 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.nio.fs;
-
-import java.nio.file.*;
-import java.io.File;
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-/**
- * Base implementation class of {@code Path}.
- */
-
-abstract class AbstractPath implements Path {
-    protected AbstractPath() { }
-
-    @Override
-    public final boolean startsWith(String other) {
-        return startsWith(getFileSystem().getPath(other));
-    }
-
-    @Override
-    public final boolean endsWith(String other) {
-        return endsWith(getFileSystem().getPath(other));
-    }
-
-    @Override
-    public final Path resolve(String other) {
-        return resolve(getFileSystem().getPath(other));
-    }
-
-    @Override
-    public final Path resolveSibling(Path other) {
-        if (other == null)
-            throw new NullPointerException();
-        Path parent = getParent();
-        return (parent == null) ? other : parent.resolve(other);
-    }
-
-    @Override
-    public final Path resolveSibling(String other) {
-        return resolveSibling(getFileSystem().getPath(other));
-    }
-
-    @Override
-    public final Iterator<Path> iterator() {
-        return new Iterator<Path>() {
-            private int i = 0;
-            @Override
-            public boolean hasNext() {
-                return (i < getNameCount());
-            }
-            @Override
-            public Path next() {
-                if (i < getNameCount()) {
-                    Path result = getName(i);
-                    i++;
-                    return result;
-                } else {
-                    throw new NoSuchElementException();
-                }
-            }
-            @Override
-            public void remove() {
-                throw new UnsupportedOperationException();
-            }
-        };
-    }
-
-    @Override
-    public final File toFile() {
-        return new File(toString());
-    }
-
-    @Override
-    public final WatchKey register(WatchService watcher,
-                                   WatchEvent.Kind<?>... events)
-        throws IOException
-    {
-        return register(watcher, events, new WatchEvent.Modifier[0]);
-    }
-}
--- a/jdk/src/java.base/share/classes/sun/reflect/Label.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/Label.java	Fri Jan 09 13:28:02 2015 -0500
@@ -52,7 +52,7 @@
         final short patchBCI;
         final int   stackDepth;
     }
-    private List<PatchInfo> patches = new ArrayList<>();
+    private final List<PatchInfo> patches = new ArrayList<>();
 
     public Label() {
     }
--- a/jdk/src/java.base/share/classes/sun/reflect/ReflectionFactory.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/ReflectionFactory.java	Fri Jan 09 13:28:02 2015 -0500
@@ -135,7 +135,7 @@
      * be initialized and therefore must not be called until the
      * first get/set of this field.
      * @param field the field
-     * @param override true if caller has overridden aaccessibility
+     * @param override true if caller has overridden accessibility
      */
     public FieldAccessor newFieldAccessor(Field field, boolean override) {
         checkInitted();
--- a/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java	Fri Jan 09 13:28:02 2015 -0500
@@ -280,19 +280,25 @@
      * be rare).
      */
     private Method[] getMemberMethods() {
-        if (memberMethods == null) {
-            memberMethods = AccessController.doPrivileged(
-                new PrivilegedAction<Method[]>() {
-                    public Method[] run() {
-                        final Method[] mm = type.getDeclaredMethods();
-                        validateAnnotationMethods(mm);
-                        AccessibleObject.setAccessible(mm, true);
-                        return mm;
-                    }
-                });
+        Method[] value = memberMethods;
+        if (value == null) {
+            value = computeMemberMethods();
+            memberMethods = value;
         }
-        return memberMethods;
+        return value;
     }
+
+    private Method[] computeMemberMethods() {
+        return AccessController.doPrivileged(
+            new PrivilegedAction<Method[]>() {
+                public Method[] run() {
+                    final Method[] methods = type.getDeclaredMethods();
+                    validateAnnotationMethods(methods);
+                    AccessibleObject.setAccessible(methods, true);
+                    return methods;
+                }});
+    }
+
     private transient volatile Method[] memberMethods = null;
 
     /**
--- a/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationParser.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationParser.java	Fri Jan 09 13:28:02 2015 -0500
@@ -772,7 +772,7 @@
     }
 
     /**
-     * Return an appropriate exception proxy for a mismatching array
+     * Returns an appropriate exception proxy for a mismatching array
      * annotation where the erroneous array has the specified tag.
      */
     private static ExceptionProxy exceptionProxy(int tag) {
--- a/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationSupport.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationSupport.java	Fri Jan 09 13:28:02 2015 -0500
@@ -115,7 +115,7 @@
 
 
     /**
-     * Figures out if conatiner class comes before containee class among the
+     * Figures out if container class comes before containee class among the
      * keys of the given map.
      *
      * @return true if container class is found before containee class when
--- a/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationType.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationType.java	Fri Jan 09 13:28:02 2015 -0500
@@ -55,7 +55,7 @@
     private final Map<String, Object> memberDefaults;
 
     /**
-     * Member name -> Method object mapping. This (and its assoicated
+     * Member name -> Method object mapping. This (and its associated
      * accessor) are used only to generate AnnotationTypeMismatchExceptions.
      */
     private final Map<String, Method> members;
@@ -117,7 +117,7 @@
         memberDefaults = new HashMap<String, Object>(0);
         members = new HashMap<String, Method>(methods.length+1, 1.0f);
 
-        for (Method method :  methods) {
+        for (Method method : methods) {
             if (method.getParameterTypes().length != 0)
                 throw new IllegalArgumentException(method + " has params");
             String name = method.getName();
@@ -213,7 +213,7 @@
     }
 
     /**
-     * Returns true if this this annotation type is inherited.
+     * Returns true if this annotation type is inherited.
      */
     public boolean isInherited() {
         return inherited;
--- a/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationTypeMismatchExceptionProxy.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationTypeMismatchExceptionProxy.java	Fri Jan 09 13:28:02 2015 -0500
@@ -36,7 +36,7 @@
 class AnnotationTypeMismatchExceptionProxy extends ExceptionProxy {
     private static final long serialVersionUID = 7844069490309503934L;
     private Method member;
-    private String foundType;
+    private final String foundType;
 
     /**
      * It turns out to be convenient to construct these proxies in
--- a/jdk/src/java.base/share/classes/sun/reflect/annotation/EnumConstantNotPresentExceptionProxy.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/EnumConstantNotPresentExceptionProxy.java	Fri Jan 09 13:28:02 2015 -0500
@@ -33,8 +33,8 @@
  */
 public class EnumConstantNotPresentExceptionProxy extends ExceptionProxy {
     private static final long serialVersionUID = -604662101303187330L;
-    Class<? extends Enum<?>> enumType;
-    String constName;
+    final Class<? extends Enum<?>> enumType;
+    final String constName;
 
     public EnumConstantNotPresentExceptionProxy(Class<? extends Enum<?>> enumType,
                                                 String constName) {
--- a/jdk/src/java.base/share/classes/sun/reflect/annotation/TypeNotPresentExceptionProxy.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/TypeNotPresentExceptionProxy.java	Fri Jan 09 13:28:02 2015 -0500
@@ -34,8 +34,8 @@
  */
 public class TypeNotPresentExceptionProxy extends ExceptionProxy {
     private static final long serialVersionUID = 5565925172427947573L;
-    String typeName;
-    Throwable cause;
+    final String typeName;
+    final Throwable cause;
 
     public TypeNotPresentExceptionProxy(String typeName, Throwable cause) {
         this.typeName = typeName;
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java	Fri Jan 09 13:28:02 2015 -0500
@@ -76,11 +76,11 @@
      * kind. Classes produced will be those that would be loaded by the
      * defining class loader of the declaration <tt>d</tt> (if <tt>d</tt>
      * is a type declaration, or by the defining loader of the declaring
-     * class of <tt>d</tt>  otherwise.
+     * class of <tt>d</tt> otherwise.
      * <p> Type variables will be created or lookup as necessary in the
      * scope <tt> s</tt>.
      * @param d - the generic declaration (class, interface, method or
-     * constructor) that thsi factory services
+     * constructor) that this factory services
      * @param s  the scope in which the factory will allocate and search for
      * type variables
      * @return an instance of <tt>CoreReflectionFactory</tt>
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/factory/GenericsFactory.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/factory/GenericsFactory.java	Fri Jan 09 13:28:02 2015 -0500
@@ -42,7 +42,7 @@
  * of a specific implementation by using this interface. For example,
  * repositories of generic type information are initialized with a
  * factory conforming to this interface, and use it to generate the
- * tpe information they are required to provide. As a result, such
+ * type information they are required to provide. As a result, such
  * repository code can be shared across different reflective systems.
  */
 public interface GenericsFactory {
@@ -60,7 +60,7 @@
     TypeVariable<?> makeTypeVariable(String name,
                                      FieldTypeSignature[] bounds);
     /**
-     * Return an instance of the <tt>ParameterizedType</tt> interface
+     * Returns an instance of the <tt>ParameterizedType</tt> interface
      * that corresponds to a generic type instantiation of the
      * generic declaration <tt>declaration</tt> with actual type arguments
      * <tt>typeArgs</tt>.
@@ -123,7 +123,7 @@
     /**
      * Returns a (possibly generic) array type.
      * If the component type is a parameterized type, it must
-     * only have unbounded wildcard arguemnts, otherwise
+     * only have unbounded wildcard arguments, otherwise
      * a MalformedParameterizedTypeException is thrown.
      * @param componentType - the component type of the array
      * @return a (possibly generic) array type.
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/parser/SignatureParser.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/parser/SignatureParser.java	Fri Jan 09 13:28:02 2015 -0500
@@ -227,7 +227,7 @@
      *     "<" FormalTypeParameter+ ">"
      */
     private FormalTypeParameter[] parseFormalTypeParameters(){
-        List<FormalTypeParameter> ftps =  new ArrayList<>(3);
+        List<FormalTypeParameter> ftps = new ArrayList<>(3);
         assert(current() == '<'); // should not have been called at all
         if (current() != '<') { throw error("expected '<'");}
         advance();
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/GenericArrayTypeImpl.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/GenericArrayTypeImpl.java	Fri Jan 09 13:28:02 2015 -0500
@@ -53,10 +53,10 @@
 
 
     /**
-     * Returns  a <tt>Type</tt> object representing the component type
+     * Returns a <tt>Type</tt> object representing the component type
      * of this array.
      *
-     * @return  a <tt>Type</tt> object representing the component type
+     * @return a <tt>Type</tt> object representing the component type
      *     of this array
      * @since 1.5
      */
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/LazyReflectiveObjectGenerator.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/LazyReflectiveObjectGenerator.java	Fri Jan 09 13:28:02 2015 -0500
@@ -25,7 +25,9 @@
 
 package sun.reflect.generics.reflectiveObjects;
 
+import java.lang.reflect.Type;
 import sun.reflect.generics.factory.GenericsFactory;
+import sun.reflect.generics.tree.FieldTypeSignature;
 import sun.reflect.generics.visitor.Reifier;
 
 
@@ -54,4 +56,16 @@
     // produce a reifying visitor (could this be typed as a TypeTreeVisitor?
     protected Reifier getReifier(){return Reifier.make(getFactory());}
 
+    Type[] reifyBounds(FieldTypeSignature[] boundASTs) {
+        final int length = boundASTs.length;
+        final Type[] bounds = new Type[length];
+        // iterate over bound trees, reifying each in turn
+        for (int i = 0; i < length; i++) {
+            Reifier r = getReifier();
+            boundASTs[i].accept(r);
+            bounds[i] = r.getResult();
+        }
+        return bounds;
+    }
+
 }
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java	Fri Jan 09 13:28:02 2015 -0500
@@ -51,17 +51,16 @@
  */
 public class TypeVariableImpl<D extends GenericDeclaration>
     extends LazyReflectiveObjectGenerator implements TypeVariable<D> {
-    D genericDeclaration;
-    private String name;
-    // upper bounds - evaluated lazily
-    private Type[] bounds;
+    private final D genericDeclaration;
+    private final String name;
 
-    // The ASTs for the bounds. We are required to evaluate the bounds
-    // lazily, so we store these at least until we are first asked
-    // for the bounds. This also neatly solves the
-    // problem with F-bounds - you can't reify them before the formal
-    // is defined.
-    private FieldTypeSignature[] boundASTs;
+    /**
+     * The upper bounds.  Lazily converted from FieldTypeSignature[] to Type[].
+     * We are required to evaluate the bounds lazily, so we store them as ASTs
+     * until we are first asked for them.  This also neatly solves the problem
+     * with F-bounds - you can't reify them before the formal is defined.
+     */
+    private volatile Object[] bounds;
 
     // constructor is private to enforce access through static factory
     private TypeVariableImpl(D decl, String n, FieldTypeSignature[] bs,
@@ -69,18 +68,7 @@
         super(f);
         genericDeclaration = decl;
         name = n;
-        boundASTs = bs;
-    }
-
-    // Accessors
-
-    // accessor for ASTs for bounds. Must not be called after
-    // bounds have been evaluated, because we might throw the ASTs
-    // away (but that is not thread-safe, is it?)
-    private FieldTypeSignature[] getBoundASTs() {
-        // check that bounds were not evaluated yet
-        assert(bounds == null);
-        return boundASTs;
+        bounds = bs;
     }
 
     /**
@@ -123,7 +111,7 @@
      *  <li>Otherwise, B is resolved.
      * </ul>
      *
-     * @throws <tt>TypeNotPresentException</tt>  if any of the
+     * @throws <tt>TypeNotPresentException</tt> if any of the
      *     bounds refers to a non-existent type declaration
      * @throws <tt>MalformedParameterizedTypeException</tt> if any of the
      *     bounds refer to a parameterized type that cannot be instantiated
@@ -132,34 +120,23 @@
      *     type variable
     */
     public Type[] getBounds() {
-        // lazily initialize bounds if necessary
-        if (bounds == null) {
-            FieldTypeSignature[] fts = getBoundASTs(); // get AST
-            // allocate result array; note that
-            // keeping ts and bounds separate helps with threads
-            Type[] ts = new Type[fts.length];
-            // iterate over bound trees, reifying each in turn
-            for ( int j = 0; j  < fts.length; j++) {
-                Reifier r = getReifier();
-                fts[j].accept(r);
-                ts[j] = r.getResult();
-            }
-            // cache result
-            bounds = ts;
-            // could throw away bound ASTs here; thread safety?
+        Object[] value = bounds;
+        if (value instanceof FieldTypeSignature[]) {
+            value = reifyBounds((FieldTypeSignature[])value);
+            bounds = value;
         }
-        return bounds.clone(); // return cached bounds
+        return (Type[])value.clone();
     }
 
     /**
-     * Returns the <tt>GenericDeclaration</tt>  object representing the
+     * Returns the <tt>GenericDeclaration</tt> object representing the
      * generic declaration that declared this type variable.
      *
      * @return the generic declaration that declared this type variable.
      *
      * @since 1.5
      */
-    public D getGenericDeclaration(){
+    public D getGenericDeclaration() {
         if (genericDeclaration instanceof Class)
             ReflectUtil.checkPackageAccess((Class)genericDeclaration);
         else if ((genericDeclaration instanceof Method) ||
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/WildcardTypeImpl.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/WildcardTypeImpl.java	Fri Jan 09 13:28:02 2015 -0500
@@ -39,25 +39,26 @@
  */
 public class WildcardTypeImpl extends LazyReflectiveObjectGenerator
     implements WildcardType {
-    // upper bounds - evaluated lazily
-    private Type[] upperBounds;
-    // lower bounds - evaluated lazily
-    private Type[] lowerBounds;
-    // The ASTs for the bounds. We are required to evaluate the bounds
-    // lazily, so we store these at least until we are first asked
-    // for the bounds. This also neatly solves the
-    // problem with F-bounds - you can't reify them before the formal
-    // is defined.
-    private FieldTypeSignature[] upperBoundASTs;
-    private FieldTypeSignature[] lowerBoundASTs;
+
+    /*
+     * We are required to evaluate the bounds lazily, so we store them as ASTs
+     * until we are first asked for them.  This also neatly solves the problem
+     * with F-bounds - you can't reify them before the formal is defined.
+     */
+
+    /** The upper bounds.  Lazily converted from FieldTypeSignature[] to Type[]. */
+    private volatile Object[] upperBounds;
+
+    /** The lower bounds.  Lazily converted from FieldTypeSignature[] to Type[]. */
+    private volatile Object[] lowerBounds;
 
     // constructor is private to enforce access through static factory
     private WildcardTypeImpl(FieldTypeSignature[] ubs,
                              FieldTypeSignature[] lbs,
                              GenericsFactory f) {
         super(f);
-        upperBoundASTs = ubs;
-        lowerBoundASTs = lbs;
+        upperBounds = ubs;
+        lowerBounds = lbs;
     }
 
     /**
@@ -76,27 +77,8 @@
         return new WildcardTypeImpl(ubs, lbs, f);
     }
 
-    // Accessors
-
-    // accessor for ASTs for upper bounds. Must not be called after upper
-    // bounds have been evaluated, because we might throw the ASTs
-    // away (but that is not thread-safe, is it?)
-    private FieldTypeSignature[] getUpperBoundASTs() {
-        // check that upper bounds were not evaluated yet
-        assert(upperBounds == null);
-        return upperBoundASTs;
-    }
-    // accessor for ASTs for lower bounds. Must not be called after lower
-    // bounds have been evaluated, because we might throw the ASTs
-    // away (but that is not thread-safe, is it?)
-    private FieldTypeSignature[] getLowerBoundASTs() {
-        // check that lower bounds were not evaluated yet
-        assert(lowerBounds == null);
-        return lowerBoundASTs;
-    }
-
     /**
-     * Returns an array of <tt>Type</tt> objects representing the  upper
+     * Returns an array of <tt>Type</tt> objects representing the upper
      * bound(s) of this type variable.  Note that if no upper bound is
      * explicitly declared, the upper bound is <tt>Object</tt>.
      *
@@ -117,24 +99,12 @@
      *     for any reason
      */
     public Type[] getUpperBounds() {
-        // lazily initialize bounds if necessary
-        if (upperBounds == null) {
-            FieldTypeSignature[] fts = getUpperBoundASTs(); // get AST
-
-            // allocate result array; note that
-            // keeping ts and bounds separate helps with threads
-            Type[] ts = new Type[fts.length];
-            // iterate over bound trees, reifying each in turn
-            for ( int j = 0; j  < fts.length; j++) {
-                Reifier r = getReifier();
-                fts[j].accept(r);
-                ts[j] = r.getResult();
-            }
-            // cache result
-            upperBounds = ts;
-            // could throw away upper bound ASTs here; thread safety?
+        Object[] value = upperBounds;
+        if (value instanceof FieldTypeSignature[]) {
+            value = reifyBounds((FieldTypeSignature[])value);
+            upperBounds = value;
         }
-        return upperBounds.clone(); // return cached bounds
+        return (Type[])value.clone();
     }
 
     /**
@@ -160,23 +130,12 @@
      *     for any reason
      */
     public Type[] getLowerBounds() {
-        // lazily initialize bounds if necessary
-        if (lowerBounds == null) {
-            FieldTypeSignature[] fts = getLowerBoundASTs(); // get AST
-            // allocate result array; note that
-            // keeping ts and bounds separate helps with threads
-            Type[] ts = new Type[fts.length];
-            // iterate over bound trees, reifying each in turn
-            for ( int j = 0; j  < fts.length; j++) {
-                Reifier r = getReifier();
-                fts[j].accept(r);
-                ts[j] = r.getResult();
-            }
-            // cache result
-            lowerBounds = ts;
-            // could throw away lower bound ASTs here; thread safety?
+        Object[] value = lowerBounds;
+        if (value instanceof FieldTypeSignature[]) {
+            value = reifyBounds((FieldTypeSignature[])value);
+            lowerBounds = value;
         }
-        return lowerBounds.clone(); // return cached bounds
+        return (Type[])value.clone();
     }
 
     public String toString() {
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/repository/AbstractRepository.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/repository/AbstractRepository.java	Fri Jan 09 13:28:02 2015 -0500
@@ -56,7 +56,7 @@
     /**
      * Returns a <tt>Reifier</tt> used to convert parts of the
      * AST into reflective objects.
-     * @return  a <tt>Reifier</tt> used to convert parts of the
+     * @return a <tt>Reifier</tt> used to convert parts of the
      * AST into reflective objects
      */
     protected Reifier getReifier(){return Reifier.make(getFactory());}
@@ -76,7 +76,7 @@
     }
 
     /**
-     * Returns the AST for the genric type info of this entity.
+     * Returns the AST for the generic type info of this entity.
      * @param s - a string representing the generic signature of this
      * entity
      * @return the AST for the generic type info of this entity.
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/repository/ClassRepository.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/repository/ClassRepository.java	Fri Jan 09 13:28:02 2015 -0500
@@ -25,12 +25,12 @@
 
 package sun.reflect.generics.repository;
 
+import java.lang.reflect.Type;
 import sun.reflect.generics.factory.GenericsFactory;
 import sun.reflect.generics.tree.ClassSignature;
 import sun.reflect.generics.tree.TypeTree;
 import sun.reflect.generics.visitor.Reifier;
 import sun.reflect.generics.parser.SignatureParser;
-import java.lang.reflect.Type;
 
 
 /**
@@ -70,47 +70,54 @@
         return new ClassRepository(rawSig, f);
     }
 
-    // public API
  /*
  * When queried for a particular piece of type information, the
  * general pattern is to consult the corresponding cached value.
  * If the corresponding field is non-null, it is returned.
  * If not, it is created lazily. This is done by selecting the appropriate
  * part of the tree and transforming it into a reflective object
- * using a visitor.
- * a visitor, which is created by feeding it the factory
+ * using a visitor, which is created by feeding it the factory
  * with which the repository was created.
  */
 
     public Type getSuperclass() {
-        Type superclass = this.superclass;
-        if (superclass == null) { // lazily initialize superclass
-            Reifier r = getReifier(); // obtain visitor
-            // Extract superclass subtree from AST and reify
-            getTree().getSuperclass().accept(r);
-            // extract result from visitor and cache it
-            superclass = r.getResult();
-            this.superclass = superclass;
+        Type value = superclass;
+        if (value == null) {
+            value = computeSuperclass();
+            superclass = value;
         }
-        return superclass; // return cached result
+        return value;
     }
 
     public Type[] getSuperInterfaces() {
-        Type[] superInterfaces = this.superInterfaces;
-        if (superInterfaces == null) { // lazily initialize super interfaces
-            // first, extract super interface subtree(s) from AST
-            TypeTree[] ts  = getTree().getSuperInterfaces();
-            // create array to store reified subtree(s)
-            superInterfaces = new Type[ts.length];
-            // reify all subtrees
-            for (int i = 0; i < ts.length; i++) {
-                Reifier r = getReifier(); // obtain visitor
-                ts[i].accept(r);// reify subtree
-                // extract result from visitor and store it
-                superInterfaces[i] = r.getResult();
-            }
-            this.superInterfaces = superInterfaces;
+        Type[] value = superInterfaces;
+        if (value == null) {
+            value = computeSuperInterfaces();
+            superInterfaces = value;
         }
-        return superInterfaces.clone(); // return cached result
+        return value.clone();
+    }
+
+    private Type computeSuperclass() {
+        Reifier r = getReifier(); // obtain visitor
+        // Extract superclass subtree from AST and reify
+        getTree().getSuperclass().accept(r);
+        return r.getResult();
+    }
+
+    private Type[] computeSuperInterfaces() {
+        // first, extract super interface subtree(s) from AST
+        TypeTree[] ts = getTree().getSuperInterfaces();
+        // create array to store reified subtree(s)
+        int length = ts.length;
+        Type[] superInterfaces = new Type[length];
+        // reify all subtrees
+        for (int i = 0; i < length; i++) {
+            Reifier r = getReifier(); // obtain visitor
+            ts[i].accept(r);// reify subtree
+            // extract result from visitor and store it
+            superInterfaces[i] = r.getResult();
+        }
+        return superInterfaces;
     }
 }
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/repository/ConstructorRepository.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/repository/ConstructorRepository.java	Fri Jan 09 13:28:02 2015 -0500
@@ -43,8 +43,11 @@
 public class ConstructorRepository
     extends GenericDeclRepository<MethodTypeSignature> {
 
-    private Type[] paramTypes; // caches the generic parameter types info
-    private Type[] exceptionTypes; // caches the generic exception types info
+    /** The generic parameter types.  Lazily initialized. */
+    private volatile Type[] parameterTypes;
+
+    /** The generic exception types.  Lazily initialized. */
+    private volatile Type[] exceptionTypes;
 
  // protected, to enforce use of static factory yet allow subclassing
     protected ConstructorRepository(String rawSig, GenericsFactory f) {
@@ -64,57 +67,67 @@
      * @return a <tt>ConstructorRepository</tt> that manages the generic type
      * information represented in the signature <tt>rawSig</tt>
      */
-    public static ConstructorRepository make(String rawSig,
-                                             GenericsFactory f) {
+    public static ConstructorRepository make(String rawSig, GenericsFactory f) {
         return new ConstructorRepository(rawSig, f);
     }
 
-    // public API
-
  /*
  * When queried for a particular piece of type information, the
  * general pattern is to consult the corresponding cached value.
  * If the corresponding field is non-null, it is returned.
  * If not, it is created lazily. This is done by selecting the appropriate
  * part of the tree and transforming it into a reflective object
- * using a visitor.
- * a visitor, which is created by feeding it the factory
+ * using a visitor, which is created by feeding it the factory
  * with which the repository was created.
  */
 
-    public Type[] getParameterTypes(){
-        if (paramTypes == null) { // lazily initialize parameter types
-            // first, extract parameter type subtree(s) from AST
-            TypeSignature[] pts = getTree().getParameterTypes();
-            // create array to store reified subtree(s)
-            Type[] ps = new Type[pts.length];
-            // reify all subtrees
-            for (int i = 0; i < pts.length; i++) {
-                Reifier r = getReifier(); // obtain visitor
-                pts[i].accept(r); // reify subtree
-                // extract result from visitor and store it
-                ps[i] = r.getResult();
-            }
-            paramTypes = ps; // cache overall result
+    public Type[] getParameterTypes() {
+        Type[] value = parameterTypes;
+        if (value == null) {
+            value = computeParameterTypes();
+            parameterTypes = value;
         }
-        return paramTypes.clone(); // return cached result
+        return value.clone();
+    }
+
+    public Type[] getExceptionTypes() {
+        Type[] value = exceptionTypes;
+        if (value == null) {
+            value = computeExceptionTypes();
+            exceptionTypes = value;
+        }
+        return value.clone();
     }
 
-    public Type[] getExceptionTypes(){
-        if (exceptionTypes == null) { // lazily initialize exception types
-            // first, extract exception type subtree(s) from AST
-            FieldTypeSignature[] ets = getTree().getExceptionTypes();
-            // create array to store reified subtree(s)
-            Type[] es = new Type[ets.length];
-            // reify all subtrees
-            for (int i = 0; i < ets.length; i++) {
-                Reifier r = getReifier(); // obtain visitor
-                ets[i].accept(r); // reify subtree
-                // extract result from visitor and store it
-                es[i] = r.getResult();
-            }
-            exceptionTypes = es; // cache overall result
+    private Type[] computeParameterTypes() {
+        // first, extract parameter type subtree(s) from AST
+        TypeSignature[] pts = getTree().getParameterTypes();
+        // create array to store reified subtree(s)
+        int length = pts.length;
+        Type[] parameterTypes = new Type[length];
+        // reify all subtrees
+        for (int i = 0; i < length; i++) {
+            Reifier r = getReifier(); // obtain visitor
+            pts[i].accept(r); // reify subtree
+            // extract result from visitor and store it
+            parameterTypes[i] = r.getResult();
         }
-        return exceptionTypes.clone(); // return cached result
+        return parameterTypes;
+    }
+
+    private Type[] computeExceptionTypes() {
+        // first, extract exception type subtree(s) from AST
+        FieldTypeSignature[] ets = getTree().getExceptionTypes();
+        // create array to store reified subtree(s)
+        int length = ets.length;
+        Type[] exceptionTypes = new Type[length];
+        // reify all subtrees
+        for (int i = 0; i < length; i++) {
+            Reifier r = getReifier(); // obtain visitor
+            ets[i].accept(r); // reify subtree
+            // extract result from visitor and store it
+            exceptionTypes[i] = r.getResult();
+        }
+        return exceptionTypes;
     }
 }
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/repository/FieldRepository.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/repository/FieldRepository.java	Fri Jan 09 13:28:02 2015 -0500
@@ -41,7 +41,8 @@
  */
 public class FieldRepository extends AbstractRepository<TypeSignature> {
 
-    private Type genericType; // caches the generic type info
+    /** The generic type info.  Lazily initialized. */
+    private volatile Type genericType;
 
  // protected, to enforce use of static factory yet allow subclassing
     protected FieldRepository(String rawSig, GenericsFactory f) {
@@ -61,31 +62,32 @@
      * @return a <tt>FieldRepository</tt> that manages the generic type
      * information represented in the signature <tt>rawSig</tt>
      */
-    public static FieldRepository make(String rawSig,
-                                             GenericsFactory f) {
+    public static FieldRepository make(String rawSig, GenericsFactory f) {
         return new FieldRepository(rawSig, f);
     }
 
-    // public API
-
  /*
  * When queried for a particular piece of type information, the
  * general pattern is to consult the corresponding cached value.
  * If the corresponding field is non-null, it is returned.
  * If not, it is created lazily. This is done by selecting the appropriate
  * part of the tree and transforming it into a reflective object
- * using a visitor.
- * a visitor, which is created by feeding it the factory
+ * using a visitor, which is created by feeding it the factory
  * with which the repository was created.
  */
 
-    public Type getGenericType(){
-        if (genericType == null) { // lazily initialize generic type
-            Reifier r = getReifier(); // obtain visitor
-            getTree().accept(r); // reify subtree
-            // extract result from visitor and cache it
-            genericType = r.getResult();
+    public Type getGenericType() {
+        Type value = genericType;
+        if (value == null) {
+            value = computeGenericType();
+            genericType = value;
         }
-        return genericType; // return cached result
+        return value;
+    }
+
+    private Type computeGenericType() {
+        Reifier r = getReifier();       // obtain visitor
+        getTree().accept(r);            // reify subtree
+        return r.getResult();           // extract result from visitor
     }
 }
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java	Fri Jan 09 13:28:02 2015 -0500
@@ -43,13 +43,12 @@
     extends AbstractRepository<S> {
 
     /** The formal type parameters.  Lazily initialized. */
-    private volatile TypeVariable<?>[] typeParams;
+    private volatile TypeVariable<?>[] typeParameters;
 
     protected GenericDeclRepository(String rawSig, GenericsFactory f) {
         super(rawSig, f);
     }
 
-    // public API
  /*
  * When queried for a particular piece of type information, the
  * general pattern is to consult the corresponding cached value.
@@ -61,25 +60,31 @@
  */
 
     /**
-     * Return the formal type parameters of this generic declaration.
+     * Returns the formal type parameters of this generic declaration.
      * @return the formal type parameters of this generic declaration
      */
     public TypeVariable<?>[] getTypeParameters() {
-        TypeVariable<?>[] typeParams = this.typeParams;
-        if (typeParams == null) { // lazily initialize type parameters
-            // first, extract type parameter subtree(s) from AST
-            FormalTypeParameter[] ftps = getTree().getFormalTypeParameters();
-            // create array to store reified subtree(s)
-            typeParams = new TypeVariable<?>[ftps.length];
-            // reify all subtrees
-            for (int i = 0; i < ftps.length; i++) {
-                Reifier r = getReifier(); // obtain visitor
-                ftps[i].accept(r); // reify subtree
-                // extract result from visitor and store it
-                typeParams[i] = (TypeVariable<?>) r.getResult();
-            }
-            this.typeParams = typeParams; // cache overall result
+        TypeVariable<?>[] value = typeParameters;
+        if (value == null) {
+            value = computeTypeParameters();
+            typeParameters = value;
         }
-        return typeParams.clone(); // return cached result
+        return value.clone();
+    }
+
+    private TypeVariable<?>[] computeTypeParameters() {
+        // first, extract type parameter subtree(s) from AST
+        FormalTypeParameter[] ftps = getTree().getFormalTypeParameters();
+        // create array to store reified subtree(s)
+        int length = ftps.length;
+        TypeVariable<?>[] typeParameters = new TypeVariable<?>[length];
+        // reify all subtrees
+        for (int i = 0; i < length; i++) {
+            Reifier r = getReifier(); // obtain visitor
+            ftps[i].accept(r); // reify subtree
+            // extract result from visitor and store it
+            typeParameters[i] = (TypeVariable<?>) r.getResult();
+        }
+        return typeParameters;
     }
 }
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/repository/MethodRepository.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/repository/MethodRepository.java	Fri Jan 09 13:28:02 2015 -0500
@@ -39,7 +39,8 @@
  */
 public class MethodRepository extends ConstructorRepository {
 
-    private Type returnType; // caches the generic return type info
+    /** The generic return type info.  Lazily initialized. */
+    private volatile Type returnType;
 
  // private, to enforce use of static factory
     private MethodRepository(String rawSig, GenericsFactory f) {
@@ -59,18 +60,21 @@
         return new MethodRepository(rawSig, f);
     }
 
-    // public API
-
     public Type getReturnType() {
-        if (returnType == null) { // lazily initialize return type
-            Reifier r = getReifier(); // obtain visitor
-            // Extract return type subtree from AST and reify
-            getTree().getReturnType().accept(r);
-            // extract result from visitor and cache it
-            returnType = r.getResult();
-            }
-        return returnType; // return cached result
+        Type value = returnType;
+        if (value == null) {
+            value = computeReturnType();
+            returnType = value;
+        }
+        return value;
     }
 
+    private Type computeReturnType() {
+        Reifier r = getReifier(); // obtain visitor
+        // Extract return type subtree from AST and reify
+        getTree().getReturnType().accept(r);
+        // extract result from visitor and cache it
+        return r.getResult();
+    }
 
 }
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/scope/AbstractScope.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/scope/AbstractScope.java	Fri Jan 09 13:28:02 2015 -0500
@@ -29,7 +29,6 @@
 import java.lang.reflect.TypeVariable;
 
 
-
 /**
  * Abstract superclass for lazy scope objects, used when building
  * factories for generic information repositories.
@@ -49,7 +48,7 @@
     /**
      * Constructor. Takes a reflective object whose scope the newly
      * constructed instance will represent.
-     * @param D - A generic declaration whose scope the newly
+     * @param decl - A generic declaration whose scope the newly
      * constructed instance will represent
      */
     protected AbstractScope(D decl){ recvr = decl;}
@@ -63,7 +62,7 @@
 
     /** This method must be implemented by any concrete subclass.
      * It must return the enclosing scope of this scope. If this scope
-     * is a top-level scope, an instance of  DummyScope must be returned.
+     * is a top-level scope, an instance of DummyScope must be returned.
      * @return The enclosing scope of this scope
      */
     protected abstract Scope computeEnclosingScope();
@@ -72,13 +71,13 @@
      * Accessor for the enclosing scope, which is computed lazily and cached.
      * @return the enclosing scope
      */
-    protected Scope getEnclosingScope(){
-        Scope enclosingScope = this.enclosingScope;
-        if (enclosingScope == null) {
-            enclosingScope = computeEnclosingScope();
-            this.enclosingScope = enclosingScope;
+    protected Scope getEnclosingScope() {
+        Scope value = enclosingScope;
+        if (value == null) {
+            value = computeEnclosingScope();
+            enclosingScope = value;
         }
-        return enclosingScope;
+        return value;
     }
 
     /**
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/tree/Signature.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/tree/Signature.java	Fri Jan 09 13:28:02 2015 -0500
@@ -27,7 +27,7 @@
 
 /**
  * Common superinterface for generic signatures. These are the signatures
- * of complete class and method/constructor delcarations.
+ * of complete class and method/constructor declarations.
  */
 public interface Signature extends Tree{
     FormalTypeParameter[] getFormalTypeParameters();
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/tree/Wildcard.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/tree/Wildcard.java	Fri Jan 09 13:28:02 2015 -0500
@@ -28,8 +28,8 @@
 import sun.reflect.generics.visitor.TypeTreeVisitor;
 
 public class Wildcard implements TypeArgument {
-    private FieldTypeSignature[] upperBounds;
-    private FieldTypeSignature[] lowerBounds;
+    private final FieldTypeSignature[] upperBounds;
+    private final FieldTypeSignature[] lowerBounds;
 
     private Wildcard(FieldTypeSignature[] ubs, FieldTypeSignature[] lbs) {
         upperBounds = ubs;
@@ -43,11 +43,11 @@
         return new Wildcard(ubs, lbs);
     }
 
-    public FieldTypeSignature[] getUpperBounds(){
+    public FieldTypeSignature[] getUpperBounds() {
         return upperBounds;
     }
 
-    public FieldTypeSignature[] getLowerBounds(){
+    public FieldTypeSignature[] getLowerBounds() {
         if (lowerBounds.length == 1 &&
             lowerBounds[0] == BottomSignature.make())
             return emptyBounds;
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/visitor/Reifier.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/visitor/Reifier.java	Fri Jan 09 13:28:02 2015 -0500
@@ -39,7 +39,7 @@
  */
 public class Reifier implements TypeTreeVisitor<Type> {
     private Type resultType;
-    private GenericsFactory factory;
+    private final GenericsFactory factory;
 
     private Reifier(GenericsFactory f){
         factory = f;
--- a/jdk/src/java.base/share/classes/sun/reflect/misc/MethodUtil.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/misc/MethodUtil.java	Fri Jan 09 13:28:02 2015 -0500
@@ -40,6 +40,7 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.Modifier;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 import sun.misc.IOUtils;
@@ -216,17 +217,21 @@
      * key in the method cache.
      */
     private static class Signature {
-        private String methodName;
-        private Class<?>[] argClasses;
-
-        private volatile int hashCode = 0;
+        private final String methodName;
+        private final Class<?>[] argClasses;
+        private final int hashCode;
 
         Signature(Method m) {
             this.methodName = m.getName();
             this.argClasses = m.getParameterTypes();
+            this.hashCode = methodName.hashCode() + Arrays.hashCode(argClasses);
         }
 
-        public boolean equals(Object o2) {
+        @Override public int hashCode() {
+            return hashCode;
+        }
+
+        @Override public boolean equals(Object o2) {
             if (this == o2) {
                 return true;
             }
@@ -244,25 +249,6 @@
             }
             return true;
         }
-
-        /**
-         * Hash code computed using algorithm suggested in
-         * Effective Java, Item 8.
-         */
-        public int hashCode() {
-            if (hashCode == 0) {
-                int result = 17;
-                result = 37 * result + methodName.hashCode();
-                if (argClasses != null) {
-                    for (int i = 0; i < argClasses.length; i++) {
-                        result = 37 * result + ((argClasses[i] == null) ? 0 :
-                            argClasses[i].hashCode());
-                    }
-                }
-                hashCode = result;
-            }
-            return hashCode;
-        }
     }
 
 
--- a/jdk/src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java	Fri Jan 09 13:28:02 2015 -0500
@@ -319,7 +319,7 @@
             return;
         }
 
-        // disallow any method not declared in one of the proxy intefaces
+        // disallow any method not declared in one of the proxy interfaces
         throw new IllegalArgumentException("Can't handle: " + method);
     }
 
--- a/jdk/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java	Fri Jan 09 13:28:02 2015 -0500
@@ -69,6 +69,8 @@
 import sun.security.pkcs.ContentInfo;
 import sun.security.x509.AlgorithmId;
 import sun.security.pkcs.EncryptedPrivateKeyInfo;
+import sun.security.provider.JavaKeyStore.JKS;
+import sun.security.util.KeyStoreDelegator;
 
 
 /**
@@ -129,6 +131,13 @@
  */
 public final class PKCS12KeyStore extends KeyStoreSpi {
 
+    // special PKCS12 keystore that supports PKCS12 and JKS file formats
+    public static final class DualFormatPKCS12 extends KeyStoreDelegator {
+        public DualFormatPKCS12() {
+            super("PKCS12", PKCS12KeyStore.class, "JKS", JKS.class);
+        }
+    }
+
     public static final int VERSION_3 = 3;
 
     private static final String[] KEY_PROTECTION_ALGORITHM = {
@@ -1053,6 +1062,39 @@
     }
 
     /**
+     * Determines if the keystore {@code Entry} for the specified
+     * {@code alias} is an instance or subclass of the specified
+     * {@code entryClass}.
+     *
+     * @param alias the alias name
+     * @param entryClass the entry class
+     *
+     * @return true if the keystore {@code Entry} for the specified
+     *          {@code alias} is an instance or subclass of the
+     *          specified {@code entryClass}, false otherwise
+     *
+     * @since 1.5
+     */
+    @Override
+    public boolean
+        engineEntryInstanceOf(String alias,
+                              Class<? extends KeyStore.Entry> entryClass)
+    {
+        if (entryClass == KeyStore.TrustedCertificateEntry.class) {
+            return engineIsCertificateEntry(alias);
+        }
+
+        Entry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
+        if (entryClass == KeyStore.PrivateKeyEntry.class) {
+            return (entry != null && entry instanceof PrivateKeyEntry);
+        }
+        if (entryClass == KeyStore.SecretKeyEntry.class) {
+            return (entry != null && entry instanceof SecretKeyEntry);
+        }
+        return false;
+    }
+
+    /**
      * Returns the (alias) name of the first keystore entry whose certificate
      * matches the given certificate.
      *
@@ -1084,7 +1126,7 @@
             } else {
                 continue;
             }
-            if (certElem.equals(cert)) {
+            if (certElem != null && certElem.equals(cert)) {
                 return alias;
             }
         }
@@ -1923,7 +1965,12 @@
                 safeContentsData = safeContents.getData();
             } else if (contentType.equals((Object)ContentInfo.ENCRYPTED_DATA_OID)) {
                 if (password == null) {
-                   continue;
+
+                    if (debug != null) {
+                        debug.println("Warning: skipping PKCS#7 encryptedData" +
+                            " content-type - no password was supplied");
+                    }
+                    continue;
                 }
 
                 if (debug != null) {
@@ -1965,8 +2012,9 @@
                             password = new char[1];
                             continue;
                         }
-                        throw new IOException(
-                            "failed to decrypt safe contents entry: " + e, e);
+                        throw new IOException("keystore password was incorrect",
+                            new UnrecoverableKeyException(
+                                "failed to decrypt safe contents entry: " + e));
                     }
                 }
             } else {
@@ -2284,4 +2332,73 @@
         counter++;
         return (String.valueOf(counter));
     }
+
+    /*
+     * PKCS12 permitted first 24 bytes:
+     *
+     * 30 82 -- -- 02 01 03 30 82 -- -- 06 09 2A 86 48 86 F7 0D 01 07 01 A0 8-
+     * 30 -- 02 01 03 30 -- 06 09 2A 86 48 86 F7 0D 01 07 01 A0 -- 04 -- -- --
+     * 30 81 -- 02 01 03 30 81 -- 06 09 2A 86 48 86 F7 0D 01 07 01 A0 81 -- 04
+     * 30 82 -- -- 02 01 03 30 81 -- 06 09 2A 86 48 86 F7 0D 01 07 01 A0 81 --
+     * 30 83 -- -- -- 02 01 03 30 82 -- -- 06 09 2A 86 48 86 F7 0D 01 07 01 A0
+     * 30 83 -- -- -- 02 01 03 30 83 -- -- -- 06 09 2A 86 48 86 F7 0D 01 07 01
+     * 30 84 -- -- -- -- 02 01 03 30 83 -- -- -- 06 09 2A 86 48 86 F7 0D 01 07
+     * 30 84 -- -- -- -- 02 01 03 30 84 -- -- -- -- 06 09 2A 86 48 86 F7 0D 01
+     */
+
+    private static final long[][] PKCS12_HEADER_PATTERNS = {
+        { 0x3082000002010330L, 0x82000006092A8648L, 0x86F70D010701A080L },
+        { 0x3000020103300006L, 0x092A864886F70D01L, 0x0701A00004000000L },
+        { 0x3081000201033081L, 0x0006092A864886F7L, 0x0D010701A0810004L },
+        { 0x3082000002010330L, 0x810006092A864886L, 0xF70D010701A08100L },
+        { 0x3083000000020103L, 0x3082000006092A86L, 0x4886F70D010701A0L },
+        { 0x3083000000020103L, 0x308200000006092AL, 0x864886F70D010701L },
+        { 0x3084000000000201L, 0x0330820000000609L, 0x2A864886F70D0107L },
+        { 0x3084000000000201L, 0x0330820000000006L, 0x092A864886F70D01L }
+    };
+
+    private static final long[][] PKCS12_HEADER_MASKS = {
+        { 0xFFFF0000FFFFFFFFL, 0xFF0000FFFFFFFFFFL, 0xFFFFFFFFFFFFFFF0L },
+        { 0xFF00FFFFFFFF00FFL, 0xFFFFFFFFFFFFFFFFL, 0xFFFFFF00FF000000L },
+        { 0xFFFF00FFFFFFFFFFL, 0x00FFFFFFFFFFFFFFL, 0xFFFFFFFFFFFF00FFL },
+        { 0xFFFF0000FFFFFFFFL, 0xFF00FFFFFFFFFFFFL, 0xFFFFFFFFFFFFFF00L },
+        { 0xFFFF000000FFFFFFL, 0xFFFF0000FFFFFFFFL, 0xFFFFFFFFFFFFFFFFL },
+        { 0xFFFF000000FFFFFFL, 0xFFFF000000FFFFFFL, 0xFFFFFFFFFFFFFFFFL },
+        { 0xFFFF00000000FFFFL, 0xFFFFFF000000FFFFL, 0xFFFFFFFFFFFFFFFFL },
+        { 0xFFFF00000000FFFFL, 0xFFFFFF00000000FFL, 0xFFFFFFFFFFFFFFFFL }
+    };
+
+    /**
+     * Probe the first few bytes of the keystore data stream for a valid
+     * PKCS12 keystore encoding.
+     */
+    @Override
+    public boolean engineProbe(InputStream stream) throws IOException {
+
+        DataInputStream dataStream;
+        if (stream instanceof DataInputStream) {
+            dataStream = (DataInputStream)stream;
+        } else {
+            dataStream = new DataInputStream(stream);
+        }
+
+        long firstPeek = dataStream.readLong();
+        long nextPeek = dataStream.readLong();
+        long finalPeek = dataStream.readLong();
+        boolean result = false;
+
+        for (int i = 0; i < PKCS12_HEADER_PATTERNS.length; i++) {
+            if (PKCS12_HEADER_PATTERNS[i][0] ==
+                    (firstPeek & PKCS12_HEADER_MASKS[i][0]) &&
+                (PKCS12_HEADER_PATTERNS[i][1] ==
+                    (nextPeek & PKCS12_HEADER_MASKS[i][1])) &&
+                (PKCS12_HEADER_PATTERNS[i][2] ==
+                    (finalPeek & PKCS12_HEADER_MASKS[i][2]))) {
+                result = true;
+                break;
+            }
+        }
+
+        return result;
+    }
 }
--- a/jdk/src/java.base/share/classes/sun/security/provider/DSA.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/provider/DSA.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -117,7 +117,6 @@
         if (params == null) {
             throw new InvalidKeyException("DSA private key lacks parameters");
         }
-        checkKey(params);
 
         this.params = params;
         this.presetX = priv.getX();
@@ -149,7 +148,6 @@
         if (params == null) {
             throw new InvalidKeyException("DSA public key lacks parameters");
         }
-        checkKey(params);
 
         this.params = params;
         this.presetY = pub.getY();
@@ -291,16 +289,6 @@
         return null;
     }
 
-    protected void checkKey(DSAParams params) throws InvalidKeyException {
-        // FIPS186-3 states in sec4.2 that a hash function which provides
-        // a lower security strength than the (L, N) pair ordinarily should
-        // not be used.
-        int valueN = params.getQ().bitLength();
-        if (valueN > md.getDigestLength()*8) {
-            throw new InvalidKeyException("Key is too strong for this signature algorithm");
-        }
-    }
-
     private BigInteger generateR(BigInteger p, BigInteger q, BigInteger g,
                          BigInteger k) {
         BigInteger temp = g.modPow(k, p);
@@ -480,14 +468,6 @@
            }
         }
 
-        @Override
-        protected void checkKey(DSAParams params) throws InvalidKeyException {
-            int valueL = params.getP().bitLength();
-            if (valueL > 1024) {
-                throw new InvalidKeyException("Key is too long for this algorithm");
-            }
-        }
-
         /*
          * Please read bug report 4044247 for an alternative, faster,
          * NON-FIPS approved method to generate K
--- a/jdk/src/java.base/share/classes/sun/security/provider/JavaKeyStore.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/provider/JavaKeyStore.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,9 +31,11 @@
 import java.security.cert.CertificateFactory;
 import java.security.cert.CertificateException;
 import java.util.*;
+
 import sun.misc.IOUtils;
-
 import sun.security.pkcs.EncryptedPrivateKeyInfo;
+import sun.security.pkcs12.PKCS12KeyStore;
+import sun.security.util.KeyStoreDelegator;
 
 /**
  * This class provides the keystore implementation referred to as "JKS".
@@ -49,7 +51,7 @@
  * @since 1.2
  */
 
-abstract class JavaKeyStore extends KeyStoreSpi {
+public abstract class JavaKeyStore extends KeyStoreSpi {
 
     // regular JKS
     public static final class JKS extends JavaKeyStore {
@@ -65,6 +67,13 @@
         }
     }
 
+    // special JKS that supports JKS and PKCS12 file formats
+    public static final class DualFormatJKS extends KeyStoreDelegator {
+        public DualFormatJKS() {
+            super("JKS", JKS.class, "PKCS12", PKCS12KeyStore.class);
+        }
+    }
+
     private static final int MAGIC = 0xfeedfeed;
     private static final int VERSION_1 = 0x01;
     private static final int VERSION_2 = 0x02;
@@ -799,4 +808,20 @@
         md.update("Mighty Aphrodite".getBytes("UTF8"));
         return md;
     }
+
+    /**
+     * Probe the first few bytes of the keystore data stream for a valid
+     * JKS keystore encoding.
+     */
+    @Override
+    public boolean engineProbe(InputStream stream) throws IOException {
+        DataInputStream dataStream;
+        if (stream instanceof DataInputStream) {
+            dataStream = (DataInputStream)stream;
+        } else {
+            dataStream = new DataInputStream(stream);
+        }
+
+        return MAGIC == dataStream.readInt();
+    }
 }
--- a/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1040,7 +1040,7 @@
     }
 
     /**
-     * Evaluates the the global policy for the permissions granted to
+     * Evaluates the global policy for the permissions granted to
      * the ProtectionDomain and tests whether the permission is
      * granted.
      *
--- a/jdk/src/java.base/share/classes/sun/security/provider/Sun.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/provider/Sun.java	Fri Jan 09 13:28:02 2015 -0500
@@ -40,7 +40,7 @@
 
     private static final String INFO = "SUN " +
     "(DSA key/parameter generation; DSA signing; SHA-1, MD5 digests; " +
-    "SecureRandom; X.509 certificates; JKS & DKS keystores; " +
+    "SecureRandom; X.509 certificates; PKCS12, JKS & DKS keystores; " +
     "PKIX CertPathValidator; " +
     "PKIX CertPathBuilder; LDAP, Collection CertStores, JavaPolicy Policy; " +
     "JavaLoginConfig Configuration)";
--- a/jdk/src/java.base/share/classes/sun/security/provider/SunEntries.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/provider/SunEntries.java	Fri Jan 09 13:28:02 2015 -0500
@@ -228,7 +228,10 @@
         /*
          * KeyStore
          */
-        map.put("KeyStore.JKS", "sun.security.provider.JavaKeyStore$JKS");
+        map.put("KeyStore.PKCS12",
+                        "sun.security.pkcs12.PKCS12KeyStore$DualFormatPKCS12");
+        map.put("KeyStore.JKS",
+                        "sun.security.provider.JavaKeyStore$DualFormatJKS");
         map.put("KeyStore.CaseExactJKS",
                         "sun.security.provider.JavaKeyStore$CaseExactJKS");
         map.put("KeyStore.DKS", "sun.security.provider.DomainKeyStore$DKS");
--- a/jdk/src/java.base/share/classes/sun/security/ssl/EphemeralKeyManager.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/EphemeralKeyManager.java	Fri Jan 09 13:28:02 2015 -0500
@@ -41,7 +41,7 @@
 
     /*
      * Current cached RSA KeyPairs. Elements are never null.
-     * Indexed via the the constants above.
+     * Indexed via the constants above.
      */
     private final EphemeralKeyPair[] keys = new EphemeralKeyPair[] {
         new EphemeralKeyPair(null),
--- a/jdk/src/java.base/share/classes/sun/security/ssl/MAC.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/MAC.java	Fri Jan 09 13:28:02 2015 -0500
@@ -120,7 +120,7 @@
      * @param buf compressed record on which the MAC is computed
      * @param offset start of compressed record data
      * @param len the size of the compressed record
-     * @param isSimulated if true, simulate the the MAC computation
+     * @param isSimulated if true, simulate the MAC computation
      */
     final byte[] compute(byte type, byte buf[],
             int offset, int len, boolean isSimulated) {
@@ -147,7 +147,7 @@
      * @param type record type
      * @param bb a ByteBuffer in which the position and limit
      *          demarcate the data to be MAC'd.
-     * @param isSimulated if true, simulate the the MAC computation
+     * @param isSimulated if true, simulate the MAC computation
      */
     final byte[] compute(byte type, ByteBuffer bb, boolean isSimulated) {
         if (macAlg.size == 0) {
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java	Fri Jan 09 13:28:02 2015 -0500
@@ -77,7 +77,7 @@
  *      All data is routed through
  *      EngineInputRecord/EngineOutputRecord.  However, all handshake
  *      data (ct_alert/ct_change_cipher_spec/ct_handshake) are passed
- *      through to the the underlying InputRecord/OutputRecord, and
+ *      through to the underlying InputRecord/OutputRecord, and
  *      the data uses the internal buffers.
  *
  *      Application data is handled slightly different, we copy the data
@@ -158,7 +158,7 @@
      *                v                                     |
      *               ERROR>------>----->CLOSED<--------<----+
      *
-     * ALSO, note that the the purpose of handshaking (renegotiation is
+     * ALSO, note that the purpose of handshaking (renegotiation is
      * included) is to assign a different, and perhaps new, session to
      * the connection.  The SSLv3 spec is a bit confusing on that new
      * protocol feature.
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Fri Jan 09 13:28:02 2015 -0500
@@ -144,7 +144,7 @@
      *                                     v
      *                                 APP_CLOSED
      *
-     * ALSO, note that the the purpose of handshaking (renegotiation is
+     * ALSO, note that the purpose of handshaking (renegotiation is
      * included) is to assign a different, and perhaps new, session to
      * the connection.  The SSLv3 spec is a bit confusing on that new
      * protocol feature.
@@ -2190,7 +2190,7 @@
     }
 
     /**
-     * Returns the the SSL Session in use by this connection.  These can
+     * Returns the SSL Session in use by this connection.  These can
      * be long lived, and frequently correspond to an entire login session
      * for some user.
      */
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1467,7 +1467,7 @@
                 if (serverPrincipal != null) {
                     // When service is bound, we check ASAP. Otherwise,
                     // will check after client request is received
-                    // in in Kerberos ClientKeyExchange
+                    // in Kerberos ClientKeyExchange
                     SecurityManager sm = System.getSecurityManager();
                     try {
                         if (sm != null) {
--- a/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Fri Jan 09 13:28:02 2015 -0500
@@ -124,6 +124,7 @@
 
     private Set<Pair <String, String>> providers = null;
     private String storetype = null;
+    private boolean hasStoretypeOption = false;
     private String srcProviderName = null;
     private String providerName = null;
     private String pathlist = null;
@@ -483,11 +484,13 @@
             } else if (collator.compare(flags, "-storetype") == 0 ||
                     collator.compare(flags, "-deststoretype") == 0) {
                 storetype = args[++i];
+                hasStoretypeOption = true;
             } else if (collator.compare(flags, "-srcstorepass") == 0) {
                 srcstorePass = getPass(modifier, args[++i]);
                 passwords.add(srcstorePass);
             } else if (collator.compare(flags, "-srcstoretype") == 0) {
                 srcstoretype = args[++i];
+                hasStoretypeOption = true;
             } else if (collator.compare(flags, "-srckeypass") == 0) {
                 srckeyPass = getPass(modifier, args[++i]);
                 passwords.add(srckeyPass);
@@ -809,36 +812,42 @@
         }
 
         // Create new keystore
-        if (providerName == null) {
-            keyStore = KeyStore.getInstance(storetype);
+        // Probe for keystore type when filename is available
+        if (ksfile != null && ksStream != null && providerName == null &&
+            hasStoretypeOption == false) {
+            keyStore = KeyStore.getInstance(ksfile, storePass);
         } else {
-            keyStore = KeyStore.getInstance(storetype, providerName);
-        }
-
-        /*
-         * Load the keystore data.
-         *
-         * At this point, it's OK if no keystore password has been provided.
-         * We want to make sure that we can load the keystore data, i.e.,
-         * the keystore data has the right format. If we cannot load the
-         * keystore, why bother asking the user for his or her password?
-         * Only if we were able to load the keystore, and no keystore
-         * password has been provided, will we prompt the user for the
-         * keystore password to verify the keystore integrity.
-         * This means that the keystore is loaded twice: first load operation
-         * checks the keystore format, second load operation verifies the
-         * keystore integrity.
-         *
-         * If the keystore password has already been provided (at the
-         * command line), however, the keystore is loaded only once, and the
-         * keystore format and integrity are checked "at the same time".
-         *
-         * Null stream keystores are loaded later.
-         */
-        if (!nullStream) {
-            keyStore.load(ksStream, storePass);
-            if (ksStream != null) {
-                ksStream.close();
+            if (providerName == null) {
+                keyStore = KeyStore.getInstance(storetype);
+            } else {
+                keyStore = KeyStore.getInstance(storetype, providerName);
+            }
+
+            /*
+             * Load the keystore data.
+             *
+             * At this point, it's OK if no keystore password has been provided.
+             * We want to make sure that we can load the keystore data, i.e.,
+             * the keystore data has the right format. If we cannot load the
+             * keystore, why bother asking the user for his or her password?
+             * Only if we were able to load the keystore, and no keystore
+             * password has been provided, will we prompt the user for the
+             * keystore password to verify the keystore integrity.
+             * This means that the keystore is loaded twice: first load operation
+             * checks the keystore format, second load operation verifies the
+             * keystore integrity.
+             *
+             * If the keystore password has already been provided (at the
+             * command line), however, the keystore is loaded only once, and the
+             * keystore format and integrity are checked "at the same time".
+             *
+             * Null stream keystores are loaded later.
+             */
+            if (!nullStream) {
+                keyStore.load(ksStream, storePass);
+                if (ksStream != null) {
+                    ksStream.close();
+                }
             }
         }
 
@@ -1881,6 +1890,7 @@
         boolean isPkcs11 = false;
 
         InputStream is = null;
+        File srcksfile = null;
 
         if (P11KEYSTORE.equalsIgnoreCase(srcstoretype) ||
                 KeyStoreUtil.isWindowsKeyStore(srcstoretype)) {
@@ -1893,7 +1903,7 @@
             isPkcs11 = true;
         } else {
             if (srcksfname != null) {
-                File srcksfile = new File(srcksfname);
+                srcksfile = new File(srcksfname);
                     if (srcksfile.exists() && srcksfile.length() == 0) {
                         throw new Exception(rb.getString
                                 ("Source.keystore.file.exists.but.is.empty.") +
@@ -1908,10 +1918,16 @@
 
         KeyStore store;
         try {
-            if (srcProviderName == null) {
-                store = KeyStore.getInstance(srcstoretype);
+            // Probe for keystore type when filename is available
+            if (srcksfile != null && is != null && srcProviderName == null &&
+                hasStoretypeOption == false) {
+                store = KeyStore.getInstance(srcksfile, srcstorePass);
             } else {
-                store = KeyStore.getInstance(srcstoretype, srcProviderName);
+                if (srcProviderName == null) {
+                    store = KeyStore.getInstance(srcstoretype);
+                } else {
+                    store = KeyStore.getInstance(srcstoretype, srcProviderName);
+                }
             }
 
             if (srcstorePass == null
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/util/KeyStoreDelegator.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,306 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.util;
+
+import java.io.*;
+import java.security.*;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.cert.CertificateException;
+import java.util.*;
+
+import sun.security.util.Debug;
+
+/**
+ * This class delegates to a primary or secondary keystore implementation.
+ *
+ * @since 1.9
+ */
+
+public class KeyStoreDelegator extends KeyStoreSpi {
+
+    private static final String KEYSTORE_TYPE_COMPAT = "keystore.type.compat";
+    private static final Debug debug = Debug.getInstance("keystore");
+
+    private String primaryType;   // the primary keystore's type
+    private String secondaryType; // the secondary keystore's type
+    private Class<? extends KeyStoreSpi> primaryKeyStore;
+                                  // the primary keystore's class
+    private Class<? extends KeyStoreSpi> secondaryKeyStore;
+                                  // the secondary keystore's class
+    private String type; // the delegate's type
+    private KeyStoreSpi keystore; // the delegate
+    private boolean compatModeEnabled = true;
+
+    public KeyStoreDelegator(
+        String primaryType,
+        Class<? extends KeyStoreSpi> primaryKeyStore,
+        String secondaryType,
+        Class<? extends KeyStoreSpi> secondaryKeyStore) {
+
+        // Check whether compatibility mode has been disabled
+        compatModeEnabled = "true".equalsIgnoreCase(
+            AccessController.doPrivileged((PrivilegedAction<String>) () ->
+                Security.getProperty(KEYSTORE_TYPE_COMPAT)));
+
+        if (compatModeEnabled) {
+            this.primaryType = primaryType;
+            this.secondaryType = secondaryType;
+            this.primaryKeyStore = primaryKeyStore;
+            this.secondaryKeyStore = secondaryKeyStore;
+        } else {
+            this.primaryType = primaryType;
+            this.secondaryType = null;
+            this.primaryKeyStore = primaryKeyStore;
+            this.secondaryKeyStore = null;
+
+            if (debug != null) {
+                debug.println("WARNING: compatibility mode disabled for " +
+                    primaryType + " and " + secondaryType + " keystore types");
+            }
+        }
+    }
+
+    @Override
+    public Key engineGetKey(String alias, char[] password)
+        throws NoSuchAlgorithmException, UnrecoverableKeyException {
+        return keystore.engineGetKey(alias, password);
+    }
+
+    @Override
+    public Certificate[] engineGetCertificateChain(String alias) {
+        return keystore.engineGetCertificateChain(alias);
+    }
+
+    @Override
+    public Certificate engineGetCertificate(String alias) {
+        return keystore.engineGetCertificate(alias);
+    }
+
+    @Override
+    public Date engineGetCreationDate(String alias) {
+        return keystore.engineGetCreationDate(alias);
+    }
+
+    @Override
+    public void engineSetKeyEntry(String alias, Key key, char[] password,
+        Certificate[] chain) throws KeyStoreException {
+        keystore.engineSetKeyEntry(alias, key, password, chain);
+    }
+
+    @Override
+    public void engineSetKeyEntry(String alias, byte[] key, Certificate[] chain)
+        throws KeyStoreException {
+        keystore.engineSetKeyEntry(alias, key, chain);
+    }
+
+    @Override
+    public void engineSetCertificateEntry(String alias, Certificate cert)
+        throws KeyStoreException {
+        keystore.engineSetCertificateEntry(alias, cert);
+    }
+
+    @Override
+    public void engineDeleteEntry(String alias) throws KeyStoreException {
+        keystore.engineDeleteEntry(alias);
+    }
+
+    @Override
+    public Enumeration<String> engineAliases() {
+        return keystore.engineAliases();
+    }
+
+    @Override
+    public boolean engineContainsAlias(String alias) {
+        return keystore.engineContainsAlias(alias);
+    }
+
+    @Override
+    public int engineSize() {
+        return keystore.engineSize();
+    }
+
+    @Override
+    public boolean engineIsKeyEntry(String alias) {
+        return keystore.engineIsKeyEntry(alias);
+    }
+
+    @Override
+    public boolean engineIsCertificateEntry(String alias) {
+        return keystore.engineIsCertificateEntry(alias);
+    }
+
+    @Override
+    public String engineGetCertificateAlias(Certificate cert) {
+        return keystore.engineGetCertificateAlias(cert);
+    }
+
+    @Override
+    public KeyStore.Entry engineGetEntry(String alias,
+        KeyStore.ProtectionParameter protParam)
+            throws KeyStoreException, NoSuchAlgorithmException,
+                UnrecoverableEntryException {
+        return keystore.engineGetEntry(alias, protParam);
+    }
+
+    @Override
+    public void engineSetEntry(String alias, KeyStore.Entry entry,
+        KeyStore.ProtectionParameter protParam)
+            throws KeyStoreException {
+        keystore.engineSetEntry(alias, entry, protParam);
+    }
+
+    @Override
+    public boolean engineEntryInstanceOf(String alias,
+        Class<? extends KeyStore.Entry> entryClass) {
+        return keystore.engineEntryInstanceOf(alias, entryClass);
+    }
+
+    @Override
+    public void engineStore(OutputStream stream, char[] password)
+        throws IOException, NoSuchAlgorithmException, CertificateException {
+
+        if (debug != null) {
+            debug.println("Storing keystore in " + type + " format");
+        }
+        keystore.engineStore(stream, password);
+    }
+
+    @Override
+    public void engineLoad(InputStream stream, char[] password)
+        throws IOException, NoSuchAlgorithmException, CertificateException {
+
+        // A new keystore is always created in the primary keystore format
+        if (stream == null) {
+            try {
+                keystore = primaryKeyStore.newInstance();
+
+            } catch (InstantiationException | IllegalAccessException e) {
+                // can safely ignore
+            }
+            type = primaryType;
+
+            if (debug != null) {
+                debug.println("Creating a new keystore in " + type + " format");
+            }
+            keystore.engineLoad(stream, password);
+
+        } else {
+            // First try the primary keystore then try the secondary keystore
+            try (InputStream bufferedStream = new BufferedInputStream(stream)) {
+                bufferedStream.mark(Integer.MAX_VALUE);
+
+                try {
+                    keystore = primaryKeyStore.newInstance();
+                    type = primaryType;
+                    keystore.engineLoad(bufferedStream, password);
+
+                } catch (Exception e) {
+
+                    // incorrect password
+                    if (e instanceof IOException &&
+                        e.getCause() instanceof UnrecoverableKeyException) {
+                        throw (IOException)e;
+                    }
+
+                    try {
+                        // Ignore secondary keystore when no compatibility mode
+                        if (!compatModeEnabled) {
+                            throw e;
+                        }
+
+                        keystore = secondaryKeyStore.newInstance();
+                        type = secondaryType;
+                        bufferedStream.reset();
+                        keystore.engineLoad(bufferedStream, password);
+
+                        if (debug != null) {
+                            debug.println("WARNING: switching from " +
+                              primaryType + " to " + secondaryType +
+                              " keystore file format has altered the " +
+                              "keystore security level");
+                        }
+
+                    } catch (InstantiationException |
+                        IllegalAccessException e2) {
+                        // can safely ignore
+
+                    } catch (IOException |
+                        NoSuchAlgorithmException |
+                        CertificateException e3) {
+
+                        // incorrect password
+                        if (e3 instanceof IOException &&
+                            e3.getCause() instanceof
+                                UnrecoverableKeyException) {
+                            throw (IOException)e3;
+                        }
+                        // rethrow the outer exception
+                        if (e instanceof IOException) {
+                            throw (IOException)e;
+                        } else if (e instanceof CertificateException) {
+                            throw (CertificateException)e;
+                        } else if (e instanceof NoSuchAlgorithmException) {
+                            throw (NoSuchAlgorithmException)e;
+                        }
+                    }
+                }
+            }
+
+            if (debug != null) {
+                debug.println("Loaded a keystore in " + type + " format");
+            }
+        }
+    }
+
+    /**
+     * Probe the first few bytes of the keystore data stream for a valid
+     * keystore encoding. Only the primary keystore implementation is probed.
+     */
+    @Override
+    public boolean engineProbe(InputStream stream) throws IOException {
+
+        boolean result = false;
+
+        try {
+            keystore = primaryKeyStore.newInstance();
+            type = primaryType;
+            result = keystore.engineProbe(stream);
+
+        } catch (Exception e) {
+            throw new IOException(e);
+
+        } finally {
+            // reset
+            if (result == false) {
+                type = null;
+                keystore = null;
+            }
+        }
+
+        return result;
+    }
+}
--- a/jdk/src/java.base/share/classes/sun/security/x509/AlgorithmId.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/AlgorithmId.java	Fri Jan 09 13:28:02 2015 -0500
@@ -39,7 +39,7 @@
  * algorithm type, and may also be used in other cases.  Equivalence is
  * defined according to OID and (where relevant) parameters.
  *
- * <P>Subclasses may be used, for example when when the algorithm ID has
+ * <P>Subclasses may be used, for example when the algorithm ID has
  * associated parameters which some code (e.g. code using public keys) needs
  * to have parsed.  Two examples of such algorithms are Diffie-Hellman key
  * exchange, and the Digital Signature Standard Algorithm (DSS/DSA).
--- a/jdk/src/java.base/share/classes/sun/security/x509/GeneralName.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/GeneralName.java	Fri Jan 09 13:28:02 2015 -0500
@@ -221,7 +221,7 @@
     /**
      * Encode the name to the specified DerOutputStream.
      *
-     * @param out the DerOutputStream to encode the the GeneralName to.
+     * @param out the DerOutputStream to encode the GeneralName to.
      * @exception IOException on encoding errors.
      */
     public void encode(DerOutputStream out) throws IOException {
--- a/jdk/src/java.base/share/classes/sun/security/x509/URIName.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/URIName.java	Fri Jan 09 13:28:02 2015 -0500
@@ -302,7 +302,7 @@
      * <p>
      * RFC5280: For URIs, the constraint applies to the host part of the name.
      * The constraint may specify a host or a domain.  Examples would be
-     * "foo.bar.com";  and ".xyz.com".  When the the constraint begins with
+     * "foo.bar.com";  and ".xyz.com".  When the constraint begins with
      * a period, it may be expanded with one or more subdomains.  That is,
      * the constraint ".xyz.com" is satisfied by both abc.xyz.com and
      * abc.def.xyz.com.  However, the constraint ".xyz.com" is not satisfied
--- a/jdk/src/java.base/share/classes/sun/security/x509/X500Name.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/X500Name.java	Fri Jan 09 13:28:02 2015 -0500
@@ -336,7 +336,7 @@
     }
 
     /**
-     * Return an immutable List of the the AVAs contained in all the
+     * Return an immutable List of the AVAs contained in all the
      * RDNs of this X500Name.
      */
     public List<AVA> allAvas() {
--- a/jdk/src/java.base/share/classes/sun/text/normalizer/NormalizerBase.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/text/normalizer/NormalizerBase.java	Fri Jan 09 13:28:02 2015 -0500
@@ -646,9 +646,9 @@
 
     /**
      * Compose a string.
-     * The string will be composed to according the the specified mode.
+     * The string will be composed according to the specified mode.
      * @param str        The string to compose.
-     * @param compat     If true the string will be composed accoding to
+     * @param compat     If true the string will be composed according to
      *                    NFKC rules and if false will be composed according to
      *                    NFC rules.
      * @param options    The only recognized option is UNICODE_3_2
@@ -694,9 +694,9 @@
 
     /**
      * Decompose a string.
-     * The string will be decomposed to according the the specified mode.
+     * The string will be decomposed according to the specified mode.
      * @param str       The string to decompose.
-     * @param compat    If true the string will be decomposed accoding to NFKD
+     * @param compat    If true the string will be decomposed according to NFKD
      *                   rules and if false will be decomposed according to NFD
      *                   rules.
      * @return String   The decomposed string
@@ -708,9 +708,9 @@
 
     /**
      * Decompose a string.
-     * The string will be decomposed to according the the specified mode.
+     * The string will be decomposed according to the specified mode.
      * @param str     The string to decompose.
-     * @param compat  If true the string will be decomposed accoding to NFKD
+     * @param compat  If true the string will be decomposed according to NFKD
      *                 rules and if false will be decomposed according to NFD
      *                 rules.
      * @param options The normalization options, ORed together (0 for no options).
@@ -756,7 +756,7 @@
 
     /**
      * Normalize a string.
-     * The string will be normalized according the the specified normalization
+     * The string will be normalized according to the specified normalization
      * mode and options.
      * @param src       The char array to compose.
      * @param srcStart  Start index of the source
--- a/jdk/src/java.base/share/classes/sun/text/normalizer/UCharacterIterator.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/text/normalizer/UCharacterIterator.java	Fri Jan 09 13:28:02 2015 -0500
@@ -247,7 +247,7 @@
 
     //// for StringPrep
     /**
-     * Convenience method for returning the underlying text storage as as string
+     * Convenience method for returning the underlying text storage as a string
      * @return the underlying text storage in the iterator as a string
      * @stable ICU 2.4
      */
--- a/jdk/src/java.base/share/classes/sun/text/normalizer/UTF16.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/text/normalizer/UTF16.java	Fri Jan 09 13:28:02 2015 -0500
@@ -94,7 +94,7 @@
  *   </li>
  *   <li>
  *    <strong>Exceptions:</strong> The error checking will throw an exception
- *   if indices are out of bounds. Other than than that, all methods will
+ *   if indices are out of bounds. Other than that, all methods will
  *   behave reasonably, even if unmatched surrogates or out-of-bounds UTF-32
  *   values are present. <code>UCharacter.isLegal()</code> can be used to check
  *   for validity if desired.
--- a/jdk/src/java.base/share/classes/sun/util/locale/provider/SPILocaleProviderAdapter.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/util/locale/provider/SPILocaleProviderAdapter.java	Fri Jan 09 13:28:02 2015 -0500
@@ -77,7 +77,8 @@
                 public P run() {
                     P delegate = null;
 
-                    for (LocaleServiceProvider provider : ServiceLoader.loadInstalled(c)) {
+                    for (LocaleServiceProvider provider :
+                             ServiceLoader.load(c, ClassLoader.getSystemClassLoader())) {
                         if (delegate == null) {
                             try {
                                 delegate =
--- a/jdk/src/java.base/share/conf/security/java.security	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/conf/security/java.security	Fri Jan 09 13:28:02 2015 -0500
@@ -183,7 +183,17 @@
 #
 # Default keystore type.
 #
-keystore.type=jks
+keystore.type=pkcs12
+
+#
+# Controls compatibility mode for JKS and PKCS12 keystore types.
+#
+# When set to 'true', both JKS and PKCS12 keystore types support loading
+# keystore files in either JKS or PKCS12 format. When set to 'false' the
+# JKS keystore type supports loading only JKS keystore files and the PKCS12
+# keystore type supports loading only PKCS12 keystore files.
+#
+keystore.type.compat=true
 
 #
 # List of comma-separated packages that start with or equal this string
--- a/jdk/src/java.base/share/native/include/jvm.h	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/native/include/jvm.h	Fri Jan 09 13:28:02 2015 -0500
@@ -334,15 +334,6 @@
                         jobject loader, jclass caller);
 
 /*
- * Find a class from a given class loader. Throw ClassNotFoundException
- * or NoClassDefFoundError depending on the value of the last
- * argument.
- */
-JNIEXPORT jclass JNICALL
-JVM_FindClassFromClassLoader(JNIEnv *env, const char *name, jboolean init,
-                             jobject loader, jboolean throwError);
-
-/*
  * Find a class from a given class.
  */
 JNIEXPORT jclass JNICALL
--- a/jdk/src/java.base/share/native/libjli/java.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/native/libjli/java.c	Fri Jan 09 13:28:02 2015 -0500
@@ -169,6 +169,13 @@
 static jlong initialHeapSize    = 0;  /* inital heap size */
 
 /*
+ * A minimum -Xss stack size suitable for all platforms.
+ */
+#ifndef STACK_SIZE_MINIMUM
+#define STACK_SIZE_MINIMUM (32 * KB)
+#endif
+
+/*
  * Entry point.
  */
 int
@@ -737,7 +744,7 @@
 }
 
 /*
- * Adds a new VM option with the given given name and value.
+ * Adds a new VM option with the given name and value.
  */
 void
 AddOption(char *str, void *info)
@@ -766,6 +773,14 @@
         jlong tmp;
         if (parse_size(str + 4, &tmp)) {
             threadStackSize = tmp;
+            /*
+             * Make sure the thread stack size is big enough that we won't get a stack
+             * overflow before the JVM startup code can check to make sure the stack
+             * is big enough.
+             */
+            if (threadStackSize < STACK_SIZE_MINIMUM) {
+                threadStackSize = STACK_SIZE_MINIMUM;
+            }
         }
     }
 
--- a/jdk/src/java.base/share/native/libzip/Deflater.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/share/native/libzip/Deflater.c	Fri Jan 09 13:28:02 2015 -0500
@@ -76,10 +76,11 @@
         JNU_ThrowOutOfMemoryError(env, 0);
         return jlong_zero;
     } else {
-        char *msg;
-        switch (deflateInit2(strm, level, Z_DEFLATED,
-                             nowrap ? -MAX_WBITS : MAX_WBITS,
-                             DEF_MEM_LEVEL, strategy)) {
+        const char *msg;
+        int ret = deflateInit2(strm, level, Z_DEFLATED,
+                               nowrap ? -MAX_WBITS : MAX_WBITS,
+                               DEF_MEM_LEVEL, strategy);
+        switch (ret) {
           case Z_OK:
             return ptr_to_jlong(strm);
           case Z_MEM_ERROR:
@@ -91,7 +92,11 @@
             JNU_ThrowIllegalArgumentException(env, 0);
             return jlong_zero;
           default:
-            msg = strm->msg;
+            msg = ((strm->msg != NULL) ? strm->msg :
+                   (ret == Z_VERSION_ERROR) ?
+                   "zlib returned Z_VERSION_ERROR: "
+                   "compile time and runtime zlib implementations differ" :
+                   "unknown error initializing zlib library");
             free(strm);
             JNU_ThrowInternalError(env, msg);
             return jlong_zero;
--- a/jdk/src/java.base/unix/classes/sun/nio/ch/FileKey.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/unix/classes/sun/nio/ch/FileKey.java	Fri Jan 09 13:28:02 2015 -0500
@@ -38,13 +38,9 @@
 
     private FileKey() { }
 
-    public static FileKey create(FileDescriptor fd) {
+    public static FileKey create(FileDescriptor fd) throws IOException {
         FileKey fk = new FileKey();
-        try {
-            fk.init(fd);
-        } catch (IOException ioe) {
-            throw new Error(ioe);
-        }
+        fk.init(fd);
         return fk;
     }
 
--- a/jdk/src/java.base/unix/classes/sun/nio/fs/UnixPath.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/unix/classes/sun/nio/fs/UnixPath.java	Fri Jan 09 13:28:02 2015 -0500
@@ -40,9 +40,7 @@
  * Solaris/Linux implementation of java.nio.file.Path
  */
 
-class UnixPath
-    extends AbstractPath
-{
+class UnixPath implements Path {
     private static ThreadLocal<SoftReference<CharsetEncoder>> encoder =
         new ThreadLocal<SoftReference<CharsetEncoder>>();
 
--- a/jdk/src/java.base/unix/native/libjli/java_md_solinux.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/unix/native/libjli/java_md_solinux.c	Fri Jan 09 13:28:02 2015 -0500
@@ -89,7 +89,7 @@
  *
  * However, if the environment contains a LD_LIBRARY_PATH, this will cause the
  * launcher to inspect the LD_LIBRARY_PATH. The launcher will check
- *  a. if the LD_LIBRARY_PATH's first component is the the path to the desired
+ *  a. if the LD_LIBRARY_PATH's first component is the path to the desired
  *     libjvm.so
  *  b. if any other libjvm.so is found in any of the paths.
  * If case b is true, then the launcher will set the LD_LIBRARY_PATH to the
--- a/jdk/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c	Fri Jan 09 13:28:02 2015 -0500
@@ -2070,7 +2070,7 @@
              * so we switch to IPV6_ADD_MEMBERSHIP socket option.
              * As of 2.4.7 kernel IPV6_ADD_MEMBERSHIP can't handle IPv4-mapped
              * addresses so we have to use IP_ADD_MEMBERSHIP for IPv4 multicast
-             * groups. However if the socket is an IPv6 socket then then setsockopt
+             * groups. However if the socket is an IPv6 socket then setsockopt
              * should return ENOPROTOOPT. We assume this will be fixed in Linux
              * at some stage.
              */
--- a/jdk/src/java.base/unix/native/libnet/PlainSocketImpl.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/unix/native/libnet/PlainSocketImpl.c	Fri Jan 09 13:28:02 2015 -0500
@@ -1053,7 +1053,7 @@
     } else {
         fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
         /* Bug 4086704 - If the Socket associated with this file descriptor
-         * was closed (sysCloseFD), the the file descriptor is set to -1.
+         * was closed (sysCloseFD), the file descriptor is set to -1.
          */
         if (fd == -1) {
             JNU_ThrowByName(env, "java/net/SocketException", "Socket closed");
--- a/jdk/src/java.base/unix/native/libnet/SocketOutputStream.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/unix/native/libnet/SocketOutputStream.c	Fri Jan 09 13:28:02 2015 -0500
@@ -74,7 +74,7 @@
     } else {
         fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
         /* Bug 4086704 - If the Socket associated with this file descriptor
-         * was closed (sysCloseFD), the the file descriptor is set to -1.
+         * was closed (sysCloseFD), the file descriptor is set to -1.
          */
         if (fd == -1) {
             JNU_ThrowByName(env, "java/net/SocketException", "Socket closed");
--- a/jdk/src/java.base/unix/native/libnet/net_util_md.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/unix/native/libnet/net_util_md.c	Fri Jan 09 13:28:02 2015 -0500
@@ -1433,7 +1433,7 @@
 
     /*
      * On Linux the receive buffer is used for both socket
-     * structures and the the packet payload. The implication
+     * structures and the packet payload. The implication
      * is that if SO_RCVBUF is too small then small packets
      * must be discard.
      */
--- a/jdk/src/java.base/windows/classes/sun/nio/ch/FileKey.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/windows/classes/sun/nio/ch/FileKey.java	Fri Jan 09 13:28:02 2015 -0500
@@ -39,13 +39,9 @@
 
     private FileKey() { }
 
-    public static FileKey create(FileDescriptor fd) {
+    public static FileKey create(FileDescriptor fd) throws IOException {
         FileKey fk = new FileKey();
-        try {
-            fk.init(fd);
-        } catch (IOException ioe) {
-            throw new Error(ioe);
-        }
+        fk.init(fd);
         return fk;
     }
 
--- a/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsPath.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsPath.java	Fri Jan 09 13:28:02 2015 -0500
@@ -41,7 +41,7 @@
  * Windows implementation of Path
  */
 
-class WindowsPath extends AbstractPath {
+class WindowsPath implements Path {
 
     // The maximum path that does not require long path prefix. On Windows
     // the maximum path is 260 minus 1 (NUL) but for directories it is 260
--- a/jdk/src/java.base/windows/native/libjli/cmdtoargs.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/windows/native/libjli/cmdtoargs.c	Fri Jan 09 13:28:02 2015 -0500
@@ -26,7 +26,7 @@
 
 /*
  * Converts a single string command line to the traditional argc, argv.
- * There are rules which govern the breaking of the the arguments, and
+ * There are rules which govern the breaking of the arguments, and
  * these rules are embodied in the regression tests below, and duplicated
  * in the jdk regression tests.
  */
--- a/jdk/src/java.base/windows/native/libnet/TwoStacksPlainSocketImpl.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.base/windows/native/libnet/TwoStacksPlainSocketImpl.c	Fri Jan 09 13:28:02 2015 -0500
@@ -1159,7 +1159,7 @@
     } else {
         fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
         /* Bug 4086704 - If the Socket associated with this file descriptor
-         * was closed (sysCloseFD), the the file descriptor is set to -1.
+         * was closed (sysCloseFD), the file descriptor is set to -1.
          */
         if (fd == -1) {
             JNU_ThrowByName(env, "java/net/SocketException", "Socket closed");
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxButton.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxButton.java	Fri Jan 09 13:28:02 2015 -0500
@@ -70,6 +70,7 @@
         return comboBox == null ? true : comboBox.isEnabled();
     }
 
+    @SuppressWarnings("deprecation")
     public boolean isFocusTraversable() {
         return false;
     }
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxUI.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxUI.java	Fri Jan 09 13:28:02 2015 -0500
@@ -496,10 +496,15 @@
     // This is somewhat messy.  The difference here from BasicComboBoxUI.EnterAction is that
     // arrow up or down does not automatically select the
     @SuppressWarnings("serial") // anonymous class
-    private static final Action triggerSelectionAction = new AbstractAction() {
+    private final Action triggerSelectionAction = new AbstractAction() {
         public void actionPerformed(final ActionEvent e) {
             triggerSelectionEvent((JComboBox)e.getSource(), e);
         }
+
+        @Override
+        public boolean isEnabled() {
+            return comboBox.isPopupVisible() && super.isEnabled();
+        }
     };
 
     @SuppressWarnings("serial") // anonymous class
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1300,12 +1300,12 @@
                 filters = (FileFilter[]) e.getNewValue();
                 fireContentsChanged(this, -1, -1);
             } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
-                fireContentsChanged(this, -1, -1);
+                setSelectedItem(e.getNewValue());
             }
         }
 
         public void setSelectedItem(Object filter) {
-            if(filter != null) {
+            if (filter != null && !containsFileFilter(filter)) {
                 getFileChooser().setFileFilter((FileFilter) filter);
                 fireContentsChanged(this, -1, -1);
             }
@@ -1353,6 +1353,10 @@
         }
     }
 
+    private boolean containsFileFilter(Object fileFilter) {
+        return Objects.equals(fileFilter, getFileChooser().getFileFilter());
+    }
+
     /**
      * Acts when FilterComboBox has changed the selected item.
      */
@@ -1363,7 +1367,10 @@
         }
 
         public void actionPerformed(final ActionEvent e) {
-            getFileChooser().setFileFilter((FileFilter) filterComboBox.getSelectedItem());
+            Object selectedFilter = filterComboBox.getSelectedItem();
+            if (!containsFileFilter(selectedFilter)) {
+                getFileChooser().setFileFilter((FileFilter) selectedFilter);
+            }
         }
     }
 
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameDockIconUI.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameDockIconUI.java	Fri Jan 09 13:28:02 2015 -0500
@@ -303,6 +303,7 @@
             }
         }
 
+        @SuppressWarnings("deprecation")
         public void hide() {
             final Container parent = getParent();
             final Rectangle r = this.getBounds();
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaScrollPaneUI.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaScrollPaneUI.java	Fri Jan 09 13:28:02 2015 -0500
@@ -41,7 +41,7 @@
 
     // This is a grody hack to trick BasicScrollPaneUI into scrolling horizontally
     // when we notice that the shift key is down. This should be removed when AWT/Swing
-    // becomes aware of of multi-axis scroll wheels.
+    // becomes aware of multi-axis scroll wheels.
     protected class XYMouseWheelHandler extends javax.swing.plaf.basic.BasicScrollPaneUI.MouseWheelHandler {
         public void mouseWheelMoved(final MouseWheelEvent e) {
             JScrollBar vScrollBar = null;
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java	Fri Jan 09 13:28:02 2015 -0500
@@ -2231,6 +2231,7 @@
             return total;
         }
 
+        @SuppressWarnings("deprecation")
         public void layoutContainer(final Container parent) {
             /* Some of the code in this method deals with changing the
              * visibility of components to hide and show the contents for the
@@ -2725,6 +2726,7 @@
             return calculateMaxTabWidth(tabPlacement);
         }
 
+        @SuppressWarnings("deprecation")
         public void layoutContainer(final Container parent) {
             /* Some of the code in this method deals with changing the
              * visibility of components to hide and show the contents for the
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenu.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenu.java	Fri Jan 09 13:28:02 2015 -0500
@@ -229,6 +229,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     public void addNotify() {
         synchronized (getTreeLock()) {
             super.addNotify();
@@ -354,6 +355,7 @@
     public void setIndeterminate(boolean indeterminate) { }
 
     @Override
+    @SuppressWarnings("deprecation")
     public void setToolTipText(final String text) {
         final MenuComponentPeer peer = getPeer();
         if (!(peer instanceof CMenuItem)) return;
@@ -363,6 +365,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     public void setIcon(final Icon i) {
         final MenuComponentPeer peer = getPeer();
         if (!(peer instanceof CMenuItem)) return;
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuBar.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuBar.java	Fri Jan 09 13:28:02 2015 -0500
@@ -246,6 +246,7 @@
             fSubmenus.remove(menu);
     }
 
+    @SuppressWarnings("deprecation")
     public Menu add(final Menu m, final int index) {
         synchronized (getTreeLock()) {
             if (m.getParent() != null) {
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuItem.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuItem.java	Fri Jan 09 13:28:02 2015 -0500
@@ -97,6 +97,7 @@
         fMenuItem.removeComponentListener(this);
     }
 
+    @SuppressWarnings("deprecation")
     static void syncLabelAndKS(MenuItem menuItem, String label, KeyStroke ks) {
         final MenuComponentPeer peer = menuItem.getPeer();
         if (!(peer instanceof CMenuItem)) {
@@ -165,6 +166,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     public void setToolTipText(final String text) {
         final MenuComponentPeer peer = getPeer();
         if (!(peer instanceof CMenuItem)) return;
@@ -173,6 +175,7 @@
         cmi.setToolTipText(text);
     }
 
+    @SuppressWarnings("deprecation")
     public void setIcon(final Icon i) {
         final MenuComponentPeer peer = getPeer();
         if (!(peer instanceof CMenuItem)) return;
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java	Fri Jan 09 13:28:02 2015 -0500
@@ -57,6 +57,7 @@
     }
 
     ScreenMenuPropertyListener fPropertyListener;
+    @SuppressWarnings("deprecation")
     public void addNotify() {
         super.addNotify();
 
@@ -154,6 +155,7 @@
         setVisible(false);
     }
 
+    @SuppressWarnings("deprecation")
     public void setToolTipText(final String text) {
         final MenuComponentPeer peer = getPeer();
         if (!(peer instanceof CMenuItem)) return;
@@ -161,6 +163,7 @@
         ((CMenuItem)peer).setToolTipText(text);
     }
 
+    @SuppressWarnings("deprecation")
     public void setIcon(final Icon i) {
         final MenuComponentPeer peer = getPeer();
         if (!(peer instanceof CMenuItem)) return;
@@ -205,6 +208,7 @@
             }
         }
 
+    @SuppressWarnings("deprecation")
     public void setIndeterminate(final boolean indeterminate) {
         final MenuComponentPeer peer = getPeer();
         if (peer instanceof CCheckboxMenuItem) {
--- a/jdk/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -202,6 +202,7 @@
         return true;
     }
 
+    @SuppressWarnings("deprecation")
     private static void enterFullScreenExclusive(Window w) {
         FullScreenCapable peer = (FullScreenCapable)w.getPeer();
         if (peer != null) {
@@ -209,6 +210,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     private static void exitFullScreenExclusive(Window w) {
         FullScreenCapable peer = (FullScreenCapable)w.getPeer();
         if (peer != null) {
--- a/jdk/src/java.desktop/macosx/classes/sun/java2d/OSXSurfaceData.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/sun/java2d/OSXSurfaceData.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -125,6 +125,7 @@
         return fConfig;
     }
 
+    @SuppressWarnings("deprecation")
     protected void setBounds(int x, int y, int w, int h) {
         fBounds.reshape(x, y, w, y + h);
     }
@@ -1094,7 +1095,7 @@
     }
 
     /**
-     * Clips the copy area to the heavywieght bounds and returns the cliped rectangle. The tricky part here is the the
+     * Clips the copy area to the heavywieght bounds and returns the cliped rectangle. The tricky part here is the
      * passed arguments x, y are in the coordinate space of the sg2d/lightweight comp. In order to do the clipping we
      * translate them to the coordinate space of the surface, and the returned clipped rectangle is in the coordinate
      * space of the surface.
--- a/jdk/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLVolatileSurfaceManager.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLVolatileSurfaceManager.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -74,6 +74,7 @@
      * Create a pbuffer-based SurfaceData object (or init the backbuffer
      * of an existing window if this is a double buffered GraphicsConfig)
      */
+    @SuppressWarnings("deprecation")
     protected SurfaceData initAcceleratedSurface() {
         SurfaceData sData = null;
         Component comp = vImg.getComponent();
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1243,6 +1243,7 @@
         changeFocusedWindow(activate, null);
     }
 
+    @SuppressWarnings("deprecation")
     private boolean isOneOfOwnersOf(LWWindowPeer peer) {
         Window owner = (peer != null ? peer.getTarget().getOwner() : null);
         while (owner != null) {
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -88,6 +88,7 @@
         super.startDrag(dsc, cursor, dragImage, dragImageOffset);
     }
 
+    @SuppressWarnings("deprecation")
     protected void startDrag(Transferable transferable, long[] formats, Map<Long, DataFlavor> formatMap) {
         DragGestureEvent trigger = getTrigger();
         InputEvent         triggerEvent = trigger.getTriggerEvent();
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java	Fri Jan 09 13:28:02 2015 -0500
@@ -46,6 +46,7 @@
         show();
     }
 
+    @SuppressWarnings("deprecation")
     public void addNotify() {
         if (getPeer() == null) {
             LWCToolkit toolkit = (LWCToolkit)Toolkit.getDefaultToolkit();
@@ -60,6 +61,7 @@
 
     public void unregisterAccelerator(AWTKeyStroke stroke) {}
 
+    @SuppressWarnings("deprecation")
     protected long getLayerPtr() {
         LWWindowPeer peer = (LWWindowPeer)getPeer();
         return peer.getLayerPtr();
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CInputMethod.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CInputMethod.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -385,6 +385,7 @@
 
     // java.awt.Toolkit#getNativeContainer() is not available
     //    from this package
+    @SuppressWarnings("deprecation")
     private LWComponentPeer<?, ?> getNearestNativePeer(Component comp) {
         if (comp==null)
             return null;
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuBar.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuBar.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     public void addHelpMenu(Menu m) {
         CMenu cMenu = (CMenu)m.getPeer();
         nativeSetHelpMenu(getModel(), cMenu.getModel());
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Fri Jan 09 13:28:02 2015 -0500
@@ -190,6 +190,7 @@
             nativeSetNSWindowRepresentedFilename(c.getNSWindowPtr(), filename);
         }}
     }) {
+        @SuppressWarnings("deprecation")
         public CPlatformWindow convertJComponentToTarget(final JRootPane p) {
             Component root = SwingUtilities.getRoot(p);
             if (root == null || (LWWindowPeer)root.getPeer() == null) return null;
@@ -519,6 +520,7 @@
     }
 
     @Override // PlatformWindow
+    @SuppressWarnings("deprecation")
     public void setVisible(boolean visible) {
         final long nsWindowPtr = getNSWindowPtr();
 
@@ -674,6 +676,7 @@
     }
 
     @Override  // PlatformWindow
+    @SuppressWarnings("deprecation")
     public void toFront() {
         final long nsWindowPtr = getNSWindowPtr();
         LWCToolkit lwcToolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTrayIcon.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTrayIcon.java	Fri Jan 09 13:28:02 2015 -0500
@@ -68,6 +68,7 @@
         updateImage();
     }
 
+    @SuppressWarnings("deprecation")
     private CPopupMenu checkAndCreatePopupPeer() {
         CPopupMenu menuPeer = null;
         if (popup != null) {
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java	Fri Jan 09 13:28:02 2015 -0500
@@ -78,6 +78,7 @@
      * Synthetic event delivery for focus management
      */
     @Override
+    @SuppressWarnings("deprecation")
     public void synthesizeWindowActivation(boolean activated) {
         if (isActive != activated) {
             isActive = activated;
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m	Fri Jan 09 13:28:02 2015 -0500
@@ -104,6 +104,67 @@
 
 @implementation AWTWindow_Normal
 AWT_NS_WINDOW_IMPLEMENTATION
+
+// Gesture support
+- (void)postGesture:(NSEvent *)event as:(jint)type a:(jdouble)a b:(jdouble)b {
+    AWT_ASSERT_APPKIT_THREAD;
+
+    JNIEnv *env = [ThreadUtilities getJNIEnv];
+    jobject platformWindow = [((AWTWindow *)self.delegate).javaPlatformWindow jObjectWithEnv:env];
+    if (platformWindow != NULL) {
+        // extract the target AWT Window object out of the CPlatformWindow
+        static JNF_MEMBER_CACHE(jf_target, jc_CPlatformWindow, "target", "Ljava/awt/Window;");
+        jobject awtWindow = JNFGetObjectField(env, platformWindow, jf_target);
+        if (awtWindow != NULL) {
+            // translate the point into Java coordinates
+            NSPoint loc = [event locationInWindow];
+            loc.y = [self frame].size.height - loc.y;
+
+            // send up to the GestureHandler to recursively dispatch on the AWT event thread
+            static JNF_CLASS_CACHE(jc_GestureHandler, "com/apple/eawt/event/GestureHandler");
+            static JNF_STATIC_MEMBER_CACHE(sjm_handleGestureFromNative, jc_GestureHandler, "handleGestureFromNative", "(Ljava/awt/Window;IDDDD)V");
+            JNFCallStaticVoidMethod(env, sjm_handleGestureFromNative, awtWindow, type, (jdouble)loc.x, (jdouble)loc.y, (jdouble)a, (jdouble)b);
+            (*env)->DeleteLocalRef(env, awtWindow);
+        }
+        (*env)->DeleteLocalRef(env, platformWindow);
+    }
+}
+
+- (void)beginGestureWithEvent:(NSEvent *)event {
+    [self postGesture:event
+                   as:com_apple_eawt_event_GestureHandler_PHASE
+                    a:-1.0
+                    b:0.0];
+}
+
+- (void)endGestureWithEvent:(NSEvent *)event {
+    [self postGesture:event
+                   as:com_apple_eawt_event_GestureHandler_PHASE
+                    a:1.0
+                    b:0.0];
+}
+
+- (void)magnifyWithEvent:(NSEvent *)event {
+    [self postGesture:event
+                   as:com_apple_eawt_event_GestureHandler_MAGNIFY
+                    a:[event magnification]
+                    b:0.0];
+}
+
+- (void)rotateWithEvent:(NSEvent *)event {
+    [self postGesture:event
+                   as:com_apple_eawt_event_GestureHandler_ROTATE
+                    a:[event rotation]
+                    b:0.0];
+}
+
+- (void)swipeWithEvent:(NSEvent *)event {
+    [self postGesture:event
+                   as:com_apple_eawt_event_GestureHandler_SWIPE
+                    a:[event deltaX]
+                    b:[event deltaY]];
+}
+
 @end
 @implementation AWTWindow_Panel
 AWT_NS_WINDOW_IMPLEMENTATION
@@ -399,67 +460,6 @@
 }
 
 
-// Gesture support
-- (void)postGesture:(NSEvent *)event as:(jint)type a:(jdouble)a b:(jdouble)b {
-AWT_ASSERT_APPKIT_THREAD;
-
-    JNIEnv *env = [ThreadUtilities getJNIEnv];
-    jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
-    if (platformWindow != NULL) {
-        // extract the target AWT Window object out of the CPlatformWindow
-        static JNF_MEMBER_CACHE(jf_target, jc_CPlatformWindow, "target", "Ljava/awt/Window;");
-        jobject awtWindow = JNFGetObjectField(env, platformWindow, jf_target);
-        if (awtWindow != NULL) {
-            // translate the point into Java coordinates
-            NSPoint loc = [event locationInWindow];
-            loc.y = [self.nsWindow frame].size.height - loc.y;
-
-            // send up to the GestureHandler to recursively dispatch on the AWT event thread
-            static JNF_CLASS_CACHE(jc_GestureHandler, "com/apple/eawt/event/GestureHandler");
-            static JNF_STATIC_MEMBER_CACHE(sjm_handleGestureFromNative, jc_GestureHandler, "handleGestureFromNative", "(Ljava/awt/Window;IDDDD)V");
-            JNFCallStaticVoidMethod(env, sjm_handleGestureFromNative, awtWindow, type, (jdouble)loc.x, (jdouble)loc.y, (jdouble)a, (jdouble)b);
-            (*env)->DeleteLocalRef(env, awtWindow);
-        }
-        (*env)->DeleteLocalRef(env, platformWindow);
-    }
-}
-
-- (void)beginGestureWithEvent:(NSEvent *)event {
-    [self postGesture:event
-                   as:com_apple_eawt_event_GestureHandler_PHASE
-                    a:-1.0
-                    b:0.0];
-}
-
-- (void)endGestureWithEvent:(NSEvent *)event {
-    [self postGesture:event
-                   as:com_apple_eawt_event_GestureHandler_PHASE
-                    a:1.0
-                    b:0.0];
-}
-
-- (void)magnifyWithEvent:(NSEvent *)event {
-    [self postGesture:event
-                   as:com_apple_eawt_event_GestureHandler_MAGNIFY
-                    a:[event magnification]
-                    b:0.0];
-}
-
-- (void)rotateWithEvent:(NSEvent *)event {
-    [self postGesture:event
-                   as:com_apple_eawt_event_GestureHandler_ROTATE
-                    a:[event rotation]
-                    b:0.0];
-}
-
-- (void)swipeWithEvent:(NSEvent *)event {
-    [self postGesture:event
-                   as:com_apple_eawt_event_GestureHandler_SWIPE
-                    a:[event deltaX]
-                    b:[event deltaY]];
-}
-
-
 // NSWindowDelegate methods
 
 - (void) _deliverMoveResizeEvent {
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/ImageSurfaceData.m	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/ImageSurfaceData.m	Fri Jan 09 13:28:02 2015 -0500
@@ -1692,7 +1692,7 @@
 {
     ImageSDOps *isdo = (ImageSDOps*)ops;
 
-    // For every ImageSD_Unlock, we need to be be conservative and mark the pixels
+    // For every ImageSD_Unlock, we need to be conservative and mark the pixels
     // as modified by the Sun2D renderer.
     isdo->javaImageInfo[sun_java2d_OSXOffScreenSurfaceData_kNeedToSyncFromJavaPixelsIndex] = 1;
 
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/QuartzSurfaceData.m	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/QuartzSurfaceData.m	Fri Jan 09 13:28:02 2015 -0500
@@ -72,7 +72,7 @@
 
 // given a UInt32 color, it tries to find that find the corresponding CGColorRef in the hash cache. If the CGColorRef
 // doesn't exist or there is a collision, it creates a new one CGColorRef and put's in the cache. Then,
-// it sets with current fill/stroke color for the the CGContext passed in (qsdo->cgRef).
+// it sets with current fill/stroke color for the CGContext passed in (qsdo->cgRef).
 void setCachedColor(QuartzSDOps *qsdo, UInt32 color)
 {
     static const CGFloat kColorConversionMultiplier = 1.0f/255.0f;
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTStrike.m	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTStrike.m	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,14 +25,11 @@
 
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
 #import "java_awt_geom_PathIterator.h"
-#import "sun_awt_SunHints.h"
 #import "sun_font_CStrike.h"
 #import "sun_font_CStrikeDisposer.h"
 #import "CGGlyphImages.h"
 #import "CGGlyphOutlines.h"
-#import "AWTStrike.h"
 #import "CoreTextSupport.h"
-//#import "jni_util.h"
 #include "fontscalerdefs.h"
 
 /* Use THIS_FILE when it is available. */
@@ -65,10 +62,10 @@
         invDevTx.b *= -1;
         invDevTx.c *= -1;
         fFontTx = CGAffineTransformConcat(CGAffineTransformConcat(tx, invDevTx), sInverseTX);
-        fDevTx = CGAffineTransformInvert(invDevTx);
+        fDevTx = CGAffineTransformInvert(CGAffineTransformConcat(invDevTx, sInverseTX));
 
         // the "font size" is the square root of the determinant of the matrix
-        fSize = sqrt(abs(fFontTx.a * fFontTx.d - fFontTx.b * fFontTx.c));
+        fSize = sqrt(fabs(fFontTx.a * fFontTx.d - fFontTx.b * fFontTx.c));
     }
     return self;
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/beans/editors/ColorEditor.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/beans/editors/ColorEditor.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
 public class ColorEditor extends Panel implements PropertyEditor {
     private static final long serialVersionUID = 1781257185164716054L;
 
+    @SuppressWarnings("deprecation")
     public ColorEditor() {
         setLayout(null);
 
@@ -69,10 +70,12 @@
         changeColor(c);
     }
 
+    @SuppressWarnings("deprecation")
     public Dimension preferredSize() {
         return new Dimension(ourWidth, 40);
     }
 
+    @SuppressWarnings("deprecation")
     public boolean keyUp(Event e, int key) {
         if (e.target == text) {
             try {
@@ -107,6 +110,7 @@
 
     }
 
+    @SuppressWarnings("deprecation")
     public boolean action(Event e, Object arg) {
         if (e.target == choser) {
             changeColor(colors[choser.getSelectedIndex()]);
--- a/jdk/src/java.desktop/share/classes/com/sun/beans/editors/FontEditor.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/beans/editors/FontEditor.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
 public class FontEditor extends Panel implements java.beans.PropertyEditor {
     private static final long serialVersionUID = 6732704486002715933L;
 
+    @SuppressWarnings("deprecation")
     public FontEditor() {
         setLayout(null);
 
@@ -62,6 +63,7 @@
     }
 
 
+    @SuppressWarnings("deprecation")
     public Dimension preferredSize() {
         return new Dimension(300, 40);
     }
@@ -93,6 +95,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     private void changeFont(Font f) {
         font = f;
         if (sample != null) {
@@ -124,6 +127,7 @@
                    font.getStyle() + ", " + font.getSize() + ")";
     }
 
+    @SuppressWarnings("deprecation")
     public boolean action(Event e, Object arg) {
         String family = familyChoser.getSelectedItem();
         int style = styles[styleChoser.getSelectedIndex()];
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java	Fri Jan 09 13:28:02 2015 -0500
@@ -898,7 +898,7 @@
                              y > innerR)) {
                 return false;
             }
-            // Rotate to origin and and verify x is valid.
+            // Rotate to origin and verify x is valid.
             int triangleSize = innerR * 3 / 2;
             double x1 = Math.cos(angle) * x - Math.sin(angle) * y;
             double y1 = Math.sin(angle) * x + Math.cos(angle) * y;
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java	Fri Jan 09 13:28:02 2015 -0500
@@ -143,6 +143,7 @@
         return map;
     }
 
+    @SuppressWarnings("deprecation")
     public String getFileName() {
         JFileChooser fc = getFileChooser();
         String typedInName = fileNameTextField != null ?
@@ -419,6 +420,7 @@
 
 
 
+    @SuppressWarnings("deprecation")
     protected class SelectionListener implements ListSelectionListener {
         public void valueChanged(ListSelectionEvent e) {
             if (!e.getValueIsAdjusting()) {
@@ -1304,7 +1306,7 @@
      * Render different filters
      */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
-    public class FilterComboBoxRenderer extends DefaultListCellRenderer implements UIResource {
+    public class FilterComboBoxRenderer extends DefaultListCellRenderer {
         public String getName() {
             // As SynthComboBoxRenderer's are asked for a size BEFORE they
             // are parented getName is overriden to force the name to be
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifDesktopIconUI.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifDesktopIconUI.java	Fri Jan 09 13:28:02 2015 -0500
@@ -245,6 +245,7 @@
                 e.isPopupTrigger(), MouseEvent.NOBUTTON));
         }
 
+        @SuppressWarnings("deprecation")
         public boolean isFocusTraversable() {
             return false;
         }
@@ -336,6 +337,7 @@
                 e.getClickCount(), e.isPopupTrigger(), MouseEvent.NOBUTTON ));
         }
 
+        @SuppressWarnings("deprecation")
         public boolean isFocusTraversable() {
             return false;
         }
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java	Fri Jan 09 13:28:02 2015 -0500
@@ -242,6 +242,7 @@
             setBorderPainted(false);
         }
 
+        @SuppressWarnings("deprecation")
         public boolean isFocusTraversable() {
             return false;
         }
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsDesktopPaneUI.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsDesktopPaneUI.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -60,6 +60,7 @@
         super.installDefaults();
     }
 
+    @SuppressWarnings("deprecation")
     protected void installKeyboardActions() {
         super.installKeyboardActions();
 
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Fri Jan 09 13:28:02 2015 -0500
@@ -2487,6 +2487,7 @@
     /**
      * Calculates the dialog unit mapping.
      */
+    @SuppressWarnings("deprecation")
     private void calculateBaseUnits() {
         // This calculation comes from:
         // http://support.microsoft.com/default.aspx?scid=kb;EN-US;125681
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupWindow.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupWindow.java	Fri Jan 09 13:28:02 2015 -0500
@@ -78,6 +78,7 @@
         paint(g);
     }
 
+    @SuppressWarnings("deprecation")
     public void hide() {
         super.hide();
         /** We need to call removeNotify() here because hide() does
@@ -89,6 +90,7 @@
         removeNotify();
     }
 
+    @SuppressWarnings("deprecation")
     public void show() {
         super.show();
         this.pack();
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java	Fri Jan 09 13:28:02 2015 -0500
@@ -700,6 +700,7 @@
             setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
         }
 
+        @SuppressWarnings("deprecation")
         public boolean isFocusTraversable() {
             return false;
         }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java	Fri Jan 09 13:28:02 2015 -0500
@@ -87,7 +87,7 @@
      * @param info the description of the device
      */
     /*
-     * The initial mode and and only supported mode default to OMNI_ON_POLY.
+     * The initial mode and only supported mode default to OMNI_ON_POLY.
      */
     protected AbstractMidiDevice(MidiDevice.Info info) {
 
@@ -108,7 +108,7 @@
 
     /** Open the device from an application program.
      * Setting the open reference count to -1 here prevents Transmitters and Receivers that
-     * opened the the device implicitly from closing it. The only way to close the device after
+     * opened the device implicitly from closing it. The only way to close the device after
      * this call is a call to close().
      */
     public final void open() throws MidiUnavailableException {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java	Fri Jan 09 13:28:02 2015 -0500
@@ -167,9 +167,9 @@
         for (int i = 0; i < allchannelnames.length; i++) {
             if ((channelmask & m) != 0L) {
                 if (i < channelnames.length) {
-                    sb.append(channelnames[i] + " ");
+                    sb.append(channelnames[i]).append(' ');
                 } else {
-                    sb.append(allchannelnames[i] + " ");
+                    sb.append(allchannelnames[i]).append(' ');
                 }
             }
             m *= 2L;
--- a/jdk/src/java.desktop/share/classes/java/awt/Button.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/Button.java	Fri Jan 09 13:28:02 2015 -0500
@@ -609,7 +609,7 @@
          * Perform the specified Action on the object
          *
          * @param i zero-based index of actions
-         * @return true if the the action was performed; else false.
+         * @return true if the action was performed; else false.
          */
         public boolean doAccessibleAction(int i) {
             if (i == 0) {
--- a/jdk/src/java.desktop/share/classes/java/awt/Canvas.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/Canvas.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -70,6 +70,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     void setGraphicsConfiguration(GraphicsConfiguration gc) {
         synchronized(getTreeLock()) {
             CanvasPeer peer = (CanvasPeer)getPeer();
--- a/jdk/src/java.desktop/share/classes/java/awt/Checkbox.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/Checkbox.java	Fri Jan 09 13:28:02 2015 -0500
@@ -788,7 +788,7 @@
          * Perform the specified Action on the object
          *
          * @param i zero-based index of actions
-         * @return true if the the action was performed; else false.
+         * @return true if the action was performed; else false.
          */
         public boolean doAccessibleAction(int i) {
             return false;    //  To be fully implemented in a future release
--- a/jdk/src/java.desktop/share/classes/java/awt/Component.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/Component.java	Fri Jan 09 13:28:02 2015 -0500
@@ -4281,7 +4281,7 @@
         }
 
         /**
-         * Makes specified region of the the next available buffer visible
+         * Makes specified region of the next available buffer visible
          * by either blitting or flipping.
          */
         void showSubRegion(int x1, int y1, int x2, int y2) {
@@ -7431,7 +7431,7 @@
      * @param id one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
      *        KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or
      *        KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS
-     * @return <code>true</code> if the the Set of focus traversal keys for the
+     * @return <code>true</code> if the Set of focus traversal keys for the
      *         given focus traversal operation has been explicitly defined for
      *         this Component; <code>false</code> otherwise.
      * @throws IllegalArgumentException if id is not one of
--- a/jdk/src/java.desktop/share/classes/java/awt/Container.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/Container.java	Fri Jan 09 13:28:02 2015 -0500
@@ -805,6 +805,7 @@
      * to new heavyweight parent.
      * @since 1.5
      */
+    @SuppressWarnings("deprecation")
     private void reparentTraverse(ContainerPeer parentPeer, Container child) {
         checkTreeLock();
 
@@ -828,6 +829,7 @@
      * Container must be heavyweight.
      * @since 1.5
      */
+    @SuppressWarnings("deprecation")
     private void reparentChild(Component comp) {
         checkTreeLock();
         if (comp == null) {
@@ -3193,7 +3195,7 @@
      *        KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
      *        KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or
      *        KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS
-     * @return <code>true</code> if the the Set of focus traversal keys for the
+     * @return <code>true</code> if the Set of focus traversal keys for the
      *         given focus traversal operation has been explicitly defined for
      *         this Component; <code>false</code> otherwise.
      * @throws IllegalArgumentException if id is not one of
@@ -4189,6 +4191,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     private void recursiveShowHeavyweightChildren() {
         if (!hasHeavyweightDescendants() || !isVisible()) {
             return;
@@ -4210,6 +4213,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     private void recursiveHideHeavyweightChildren() {
         if (!hasHeavyweightDescendants()) {
             return;
@@ -4231,6 +4235,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     private void recursiveRelocateHeavyweightChildren(Point origin) {
         for (int index = 0; index < getComponentCount(); index++) {
             Component comp = getComponent(index);
--- a/jdk/src/java.desktop/share/classes/java/awt/DefaultFocusTraversalPolicy.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/DefaultFocusTraversalPolicy.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -93,6 +93,7 @@
      * @return <code>true</code> if aComponent meets the above requirements;
      *         <code>false</code> otherwise
      */
+    @SuppressWarnings("deprecation")
     protected boolean accept(Component aComponent) {
         if (!(aComponent.isVisible() && aComponent.isDisplayable() &&
               aComponent.isEnabled()))
--- a/jdk/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java	Fri Jan 09 13:28:02 2015 -0500
@@ -796,6 +796,7 @@
      * @return <code>true</code>
      * @see Component#dispatchEvent
      */
+    @SuppressWarnings("deprecation")
     public boolean dispatchKeyEvent(KeyEvent e) {
         Component focusOwner = (((AWTEvent)e).isPosted) ? getFocusOwner() : e.getComponent();
 
@@ -1021,6 +1022,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     private boolean preDispatchKeyEvent(KeyEvent ke) {
         if (((AWTEvent) ke).isPosted) {
             Component focusOwner = getFocusOwner();
--- a/jdk/src/java.desktop/share/classes/java/awt/Dialog.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/Dialog.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -749,6 +749,7 @@
      * @see Component#isDisplayable
      * @see #removeNotify
      */
+    @SuppressWarnings("deprecation")
     public void addNotify() {
         synchronized (getTreeLock()) {
             if (parent != null && parent.getPeer() == null) {
@@ -897,6 +898,7 @@
     /**
      * @return true if we actually showed, false if we just called toFront()
      */
+    @SuppressWarnings("deprecation")
     private boolean conditionalShow(Component toFocus, AtomicLong time) {
         boolean retval;
 
--- a/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java	Fri Jan 09 13:28:02 2015 -0500
@@ -823,7 +823,7 @@
     }
 
     /**
-     * Returns the the event currently being dispatched by the
+     * Returns the event currently being dispatched by the
      * <code>EventQueue</code> associated with the calling thread. This is
      * useful if a method needs access to the event, but was not designed to
      * receive a reference to it as an argument. Note that this method should
--- a/jdk/src/java.desktop/share/classes/java/awt/FileDialog.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/FileDialog.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -314,6 +314,7 @@
      * Creates the file dialog's peer.  The peer allows us to change the look
      * of the file dialog without changing its functionality.
      */
+    @SuppressWarnings("deprecation")
     public void addNotify() {
         synchronized(getTreeLock()) {
             if (parent != null && parent.getPeer() == null) {
--- a/jdk/src/java.desktop/share/classes/java/awt/FlowLayout.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/FlowLayout.java	Fri Jan 09 13:28:02 2015 -0500
@@ -503,7 +503,7 @@
      * @param width the width dimensions
      * @param height the height dimensions
      * @param rowStart the beginning of the row
-     * @param rowEnd the the ending of the row
+     * @param rowEnd the ending of the row
      * @param useBaseline Whether or not to align on baseline.
      * @param ascent Ascent for the components. This is only valid if
      *               useBaseline is true.
--- a/jdk/src/java.desktop/share/classes/java/awt/FontMetrics.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/FontMetrics.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -409,6 +409,7 @@
      * @see       #charsWidth(char[], int, int)
      * @see       #stringWidth(String)
      */
+    @SuppressWarnings("deprecation")
     public int bytesWidth(byte data[], int off, int len) {
         return stringWidth(new String(data, 0, off, len));
     }
--- a/jdk/src/java.desktop/share/classes/java/awt/Graphics.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/Graphics.java	Fri Jan 09 13:28:02 2015 -0500
@@ -843,6 +843,7 @@
      * @see         java.awt.Graphics#drawChars
      * @see         java.awt.Graphics#drawString
      */
+    @SuppressWarnings("deprecation")
     public void drawBytes(byte data[], int offset, int length, int x, int y) {
         drawString(new String(data, 0, offset, length), x, y);
     }
--- a/jdk/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java	Fri Jan 09 13:28:02 2015 -0500
@@ -28,6 +28,7 @@
 
 import java.awt.image.BufferedImage;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Locale;
 
 import sun.font.FontManager;
@@ -161,43 +162,38 @@
      */
     private static boolean getHeadlessProperty() {
         if (headless == null) {
-            java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction<Object>() {
-                public Object run() {
-                    String nm = System.getProperty("java.awt.headless");
+            AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
+                String nm = System.getProperty("java.awt.headless");
 
-                    if (nm == null) {
-                        /* No need to ask for DISPLAY when run in a browser */
-                        if (System.getProperty("javaplugin.version") != null) {
-                            headless = defaultHeadless = Boolean.FALSE;
+                if (nm == null) {
+                    /* No need to ask for DISPLAY when run in a browser */
+                    if (System.getProperty("javaplugin.version") != null) {
+                        headless = defaultHeadless = Boolean.FALSE;
+                    } else {
+                        String osName = System.getProperty("os.name");
+                        if (osName.contains("OS X") && "sun.awt.HToolkit".equals(
+                                System.getProperty("awt.toolkit")))
+                        {
+                            headless = defaultHeadless = Boolean.TRUE;
                         } else {
-                            String osName = System.getProperty("os.name");
-                            if (osName.contains("OS X") && "sun.awt.HToolkit".equals(
-                                    System.getProperty("awt.toolkit")))
-                            {
-                                headless = defaultHeadless = Boolean.TRUE;
-                            } else {
-                                headless = defaultHeadless =
-                                    Boolean.valueOf(("Linux".equals(osName) ||
-                                                     "SunOS".equals(osName) ||
-                                                     "FreeBSD".equals(osName) ||
-                                                     "NetBSD".equals(osName) ||
-                                                     "OpenBSD".equals(osName) ||
-                                                     "AIX".equals(osName)) &&
-                                                     (System.getenv("DISPLAY") == null));
-                            }
+                            final String display = System.getenv("DISPLAY");
+                            headless = defaultHeadless =
+                                ("Linux".equals(osName) ||
+                                 "SunOS".equals(osName) ||
+                                 "FreeBSD".equals(osName) ||
+                                 "NetBSD".equals(osName) ||
+                                 "OpenBSD".equals(osName) ||
+                                 "AIX".equals(osName)) &&
+                                 (display == null || display.trim().isEmpty());
                         }
-                    } else if (nm.equals("true")) {
-                        headless = Boolean.TRUE;
-                    } else {
-                        headless = Boolean.FALSE;
                     }
-                    return null;
-                }
+                } else {
+                    headless = Boolean.valueOf(nm);
                 }
-            );
+                return null;
+            });
         }
-        return headless.booleanValue();
+        return headless;
     }
 
     /**
--- a/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1771,7 +1771,7 @@
      * will be notified in the order in which they were added; the current
      * KeyboardFocusManager will be notified last. Notifications will halt
      * as soon as one KeyEventPostProcessor returns <code>true</code> from its
-     * <code>postProcessKeyEvent</code> method. There is no limit to the the
+     * <code>postProcessKeyEvent</code> method. There is no limit to the
      * total number of KeyEventPostProcessors that can be added, nor to the
      * number of times that a particular KeyEventPostProcessor instance can be
      * added.
@@ -2666,7 +2666,7 @@
                      * We allow to trigger restoreFocus() in the dispatching process
                      * only if we have the last request to dispatch. If the last request
                      * fails, focus will be restored to either the component of the last
-                     * previously succeeded request, or to to the focus owner that was
+                     * previously succeeded request, or to the focus owner that was
                      * before this clearing process.
                      */
                     if (!iter.hasNext()) {
@@ -3054,6 +3054,7 @@
         return (wto != wfrom);
     }
 
+    @SuppressWarnings("deprecation")
     static Component getHeavyweight(Component comp) {
         if (comp == null || comp.getPeer() == null) {
             return null;
--- a/jdk/src/java.desktop/share/classes/java/awt/List.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/List.java	Fri Jan 09 13:28:02 2015 -0500
@@ -347,7 +347,7 @@
     }
 
     /**
-     * Adds the specified item to the the scrolling list
+     * Adds the specified item to the scrolling list
      * at the position indicated by the index.  The index is
      * zero-based.  If the value of the index is less than zero,
      * or if the value of the index is greater than or equal to
@@ -364,7 +364,7 @@
     }
 
     /**
-     * Adds the specified item to the the list
+     * Adds the specified item to the list
      * at the position indicated by the index.
      *
      * @param  item the item to be added
--- a/jdk/src/java.desktop/share/classes/java/awt/MultipleGradientPaintContext.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/MultipleGradientPaintContext.java	Fri Jan 09 13:28:02 2015 -0500
@@ -418,7 +418,7 @@
             // each interval
             gradients[i] = new int[GRADIENT_SIZE];
 
-            // get the the 2 colors
+            // get the 2 colors
             rgb1 = colors[i].getRGB();
             rgb2 = colors[i+1].getRGB();
 
--- a/jdk/src/java.desktop/share/classes/java/awt/PopupMenu.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/PopupMenu.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -153,6 +153,7 @@
      *                parent's hierarchy
      * @exception RuntimeException if the parent is not showing on screen
      */
+    @SuppressWarnings("deprecation")
     public void show(Component origin, int x, int y) {
         // Use localParent for thread safety.
         MenuContainer localParent = parent;
--- a/jdk/src/java.desktop/share/classes/java/awt/RadialGradientPaint.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/RadialGradientPaint.java	Fri Jan 09 13:28:02 2015 -0500
@@ -94,7 +94,7 @@
  * Note that some minor variations in distances may occur due to sampling at
  * the granularity of a pixel.
  * If no cycle method is specified, {@code NO_CYCLE} will be chosen by
- * default, which means the the last keyframe color will be used to fill the
+ * default, which means the last keyframe color will be used to fill the
  * remaining area.
  * <p>
  * The colorSpace parameter allows the user to specify in which colorspace
--- a/jdk/src/java.desktop/share/classes/java/awt/ScrollPane.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/ScrollPane.java	Fri Jan 09 13:28:02 2015 -0500
@@ -732,6 +732,7 @@
         /**
          * Invoked when the value of the adjustable has changed.
          */
+        @SuppressWarnings("deprecation")
         public void adjustmentValueChanged(AdjustmentEvent e) {
             Adjustable adj = e.getAdjustable();
             int value = e.getValue();
@@ -831,6 +832,7 @@
     /**
      * Invoked when the value of the adjustable has changed.
      */
+    @SuppressWarnings("deprecation")
     public void adjustmentValueChanged(AdjustmentEvent e) {
         Adjustable adj = e.getAdjustable();
         int value = e.getValue();
--- a/jdk/src/java.desktop/share/classes/java/awt/SplashScreen.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/SplashScreen.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -203,6 +203,7 @@
      * @return URL for the current splash screen image file
      * @throws IllegalStateException if the splash screen has already been closed
      */
+    @SuppressWarnings("deprecation")
     public URL getImageURL() throws IllegalStateException {
         synchronized (SplashScreen.class) {
             checkVisible();
--- a/jdk/src/java.desktop/share/classes/java/awt/WaitDispatchSupport.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/WaitDispatchSupport.java	Fri Jan 09 13:28:02 2015 -0500
@@ -208,7 +208,7 @@
                     }
                 }, interval);
             }
-            // Dispose SequencedEvent we are dispatching on the the current
+            // Dispose SequencedEvent we are dispatching on the current
             // AppContext, to prevent us from hang - see 4531693 for details
             SequencedEvent currentSE = KeyboardFocusManager.
                 getCurrentKeyboardFocusManager().getCurrentSequencedEvent();
@@ -220,7 +220,7 @@
             }
             // In case the exit() method is called before starting
             // new event pump it will post the waking event to EDT.
-            // The event will be handled after the the new event pump
+            // The event will be handled after the new event pump
             // starts. Thus, the enter() method will not hang.
             //
             // Event pump should be privileged. See 6300270.
--- a/jdk/src/java.desktop/share/classes/java/awt/Window.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/Window.java	Fri Jan 09 13:28:02 2015 -0500
@@ -755,6 +755,7 @@
      * @see Container#removeNotify
      * @since 1.0
      */
+    @SuppressWarnings("deprecation")
     public void addNotify() {
         synchronized (getTreeLock()) {
             Container parent = this.parent;
@@ -798,6 +799,7 @@
      * @see Component#isDisplayable
      * @see #setMinimumSize
      */
+    @SuppressWarnings("deprecation")
     public void pack() {
         Container parent = this.parent;
         if (parent != null && parent.getPeer() == null) {
@@ -1070,6 +1072,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     static void updateChildFocusableWindowState(Window w) {
         if (w.getPeer() != null && w.isShowing()) {
             ((WindowPeer)w.getPeer()).updateFocusableWindowState();
@@ -1157,6 +1160,7 @@
      * as reported in javadoc. So we need to implement this functionality even if a
      * child overrides dispose() in a wrong way without calling super.dispose().
      */
+    @SuppressWarnings("deprecation")
     void disposeImpl() {
         dispose();
         if (getPeer() != null) {
@@ -3623,6 +3627,7 @@
      *
      * @since 1.7
      */
+    @SuppressWarnings("deprecation")
     public void setOpacity(float opacity) {
         synchronized (getTreeLock()) {
             if (opacity < 0.0f || opacity > 1.0f) {
@@ -3721,6 +3726,7 @@
      *
      * @since 1.7
      */
+    @SuppressWarnings("deprecation")
     public void setShape(Shape shape) {
         synchronized (getTreeLock()) {
             if (shape != null) {
@@ -3838,6 +3844,7 @@
      * @see GraphicsConfiguration#isTranslucencyCapable()
      */
     @Override
+    @SuppressWarnings("deprecation")
     public void setBackground(Color bgColor) {
         Color oldBg = getBackground();
         super.setBackground(bgColor);
@@ -3890,6 +3897,7 @@
         return bg != null ? bg.getAlpha() == 255 : true;
     }
 
+    @SuppressWarnings("deprecation")
     private void updateWindow() {
         synchronized (getTreeLock()) {
             WindowPeer peer = (WindowPeer)getPeer();
@@ -4080,6 +4088,7 @@
                 window.securityWarningHeight = height;
             }
 
+            @SuppressWarnings("deprecation")
             public void setSecurityWarningPosition(Window window,
                     Point2D point, float alignmentX, float alignmentY)
             {
--- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/DataFlavor.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/datatransfer/DataFlavor.java	Fri Jan 09 13:28:02 2015 -0500
@@ -384,7 +384,7 @@
      * @param representationClass the class used to transfer data in this flavor
      * @param humanPresentableName the human-readable string used to identify
      *                 this flavor; if this parameter is <code>null</code>
-     *                 then the value of the the MIME Content Type is used
+     *                 then the value of the MIME Content Type is used
      * @exception NullPointerException if <code>representationClass</code> is null
      */
     public DataFlavor(Class<?> representationClass, String humanPresentableName) {
@@ -418,7 +418,7 @@
      *                 is thrown
      * @param humanPresentableName the human-readable string used to identify
      *                 this flavor; if this parameter is <code>null</code>
-     *                 then the value of the the MIME Content Type is used
+     *                 then the value of the MIME Content Type is used
      * @exception IllegalArgumentException if <code>mimeType</code> is
      *                 invalid or if the class is not successfully loaded
      * @exception NullPointerException if <code>mimeType</code> is null
--- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/StringSelection.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/datatransfer/StringSelection.java	Fri Jan 09 13:28:02 2015 -0500
@@ -47,6 +47,7 @@
     private static final int STRING = 0;
     private static final int PLAIN_TEXT = 1;
 
+    @SuppressWarnings("deprecation")
     private static final DataFlavor[] flavors = {
         DataFlavor.stringFlavor,
         DataFlavor.plainTextFlavor // deprecated
--- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/SystemFlavorMap.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/datatransfer/SystemFlavorMap.java	Fri Jan 09 13:28:02 2015 -0500
@@ -624,6 +624,7 @@
         return new ArrayList<>(returnValue);
     }
 
+    @SuppressWarnings("deprecation")
     private static Set<DataFlavor> convertMimeTypeToDataFlavors(
         final String baseType) {
 
--- a/jdk/src/java.desktop/share/classes/java/awt/dnd/DropTarget.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/dnd/DropTarget.java	Fri Jan 09 13:28:02 2015 -0500
@@ -499,6 +499,7 @@
      *
      */
 
+    @SuppressWarnings("deprecation")
     public void addNotify(ComponentPeer peer) {
         if (peer == componentPeer) return;
 
@@ -690,6 +691,7 @@
          * update the geometry of the autoscroll region
          */
 
+        @SuppressWarnings("deprecation")
         private void updateRegion() {
            Insets    i    = autoScroll.getAutoscrollInsets();
            Dimension size = component.getSize();
--- a/jdk/src/java.desktop/share/classes/java/awt/event/KeyEvent.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/event/KeyEvent.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1309,7 +1309,7 @@
     /**
      * Set the keyChar value to indicate a logical character.
      *
-     * @param keyChar a char corresponding to to the combination of keystrokes
+     * @param keyChar a char corresponding to the combination of keystrokes
      *                that make up this event.
      */
     public void setKeyChar(char keyChar) {
--- a/jdk/src/java.desktop/share/classes/java/awt/event/KeyListener.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/event/KeyListener.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@
  *
  * @see KeyAdapter
  * @see KeyEvent
- * @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/keylistener.html">Tutorial: Writing a Key Listener</a>
+ * @see <a href="https://docs.oracle.com/javase/tutorial/uiswing/events/keylistener.html">Tutorial: Writing a Key Listener</a>
  *
  * @since 1.1
  */
--- a/jdk/src/java.desktop/share/classes/java/awt/font/GlyphVector.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/font/GlyphVector.java	Fri Jan 09 13:28:02 2015 -0500
@@ -341,7 +341,7 @@
     /**
      * Returns the position of the specified glyph relative to the
      * origin of this <code>GlyphVector</code>.
-     * If <code>glyphIndex</code> equals the number of of glyphs in
+     * If <code>glyphIndex</code> equals the number of glyphs in
      * this <code>GlyphVector</code>, this method returns the position after
      * the last glyph. This position is used to define the advance of
      * the entire <code>GlyphVector</code>.
@@ -358,7 +358,7 @@
     /**
      * Sets the position of the specified glyph within this
      * <code>GlyphVector</code>.
-     * If <code>glyphIndex</code> equals the number of of glyphs in
+     * If <code>glyphIndex</code> equals the number of glyphs in
      * this <code>GlyphVector</code>, this method sets the position after
      * the last glyph. This position is used to define the advance of
      * the entire <code>GlyphVector</code>.
@@ -477,7 +477,7 @@
      * coordinates of the glyph numbered <code>beginGlyphIndex + position/2</code>.
      * Odd numbered array entries beginning with position one are the Y
      * coordinates of the glyph numbered <code>beginGlyphIndex + (position-1)/2</code>.
-     * If <code>beginGlyphIndex</code> equals the number of of glyphs in
+     * If <code>beginGlyphIndex</code> equals the number of glyphs in
      * this <code>GlyphVector</code>, this method gets the position after
      * the last glyph and this position is used to define the advance of
      * the entire <code>GlyphVector</code>.
--- a/jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java	Fri Jan 09 13:28:02 2015 -0500
@@ -832,7 +832,7 @@
     /**
      * Attribute key for the embedding level of the text.  Values are
      * instances of <b><code>Integer</code></b>.  The default value is
-     * <code>null</code>, indicating that the the Bidirectional
+     * <code>null</code>, indicating that the Bidirectional
      * algorithm should run without explicit embeddings.
      *
      * <p>Positive values 1 through 61 are <em>embedding</em> levels,
--- a/jdk/src/java.desktop/share/classes/java/awt/im/spi/package.html	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/im/spi/package.html	Fri Jan 09 13:28:02 2015 -0500
@@ -55,9 +55,8 @@
 
 <H4><A NAME="Packaging"></A>Packaging Input Methods</H4>
 
-<P>Input methods are packaged as installed extensions, as specified
-by the <A HREF="../../../../../technotes/guides/extensions/index.html">Extension
-Mechanism</A>. The main JAR file of an input method must contain the
+<P>Input methods can be made available by adding them to the application's
+class path. The main JAR file of an input method must contain the
 file:</P>
 
 <PRE>    META-INF/services/java.awt.im.spi.InputMethodDescriptor</PRE>
--- a/jdk/src/java.desktop/share/classes/java/awt/image/ColorConvertOp.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/ColorConvertOp.java	Fri Jan 09 13:28:02 2015 -0500
@@ -577,7 +577,7 @@
 
     /**
      * Returns the bounding box of the destination, given this source.
-     * Note that this will be the same as the the bounding box of the
+     * Note that this will be the same as the bounding box of the
      * source.
      * @param src the source <code>BufferedImage</code>
      * @return a <code>Rectangle2D</code> that is the bounding box
@@ -589,7 +589,7 @@
 
     /**
      * Returns the bounding box of the destination, given this source.
-     * Note that this will be the same as the the bounding box of the
+     * Note that this will be the same as the bounding box of the
      * source.
      * @param src the source <code>Raster</code>
      * @return a <code>Rectangle2D</code> that is the bounding box
--- a/jdk/src/java.desktop/share/classes/java/awt/image/ComponentColorModel.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/ComponentColorModel.java	Fri Jan 09 13:28:02 2015 -0500
@@ -92,7 +92,7 @@
  * <p>
  * For instances with unsigned sample values,
  * the unnormalized color/alpha component representation is only
- * supported if two conditions hold.  First, sample value value 0 must
+ * supported if two conditions hold.  First, sample value 0 must
  * map to normalized component value 0.0 and sample value 2<sup>n</sup> - 1
  * to 1.0.  Second the min/max range of all color components of the
  * <code>ColorSpace</code> must be 0.0 to 1.0.  In this case, the
--- a/jdk/src/java.desktop/share/classes/java/awt/print/PrinterIOException.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/print/PrinterIOException.java	Fri Jan 09 13:28:02 2015 -0500
@@ -76,7 +76,7 @@
     }
 
     /**
-     * Returns the the cause of this exception (the <code>IOException</code>
+     * Returns the cause of this exception (the <code>IOException</code>
      * that terminated the print job).
      *
      * @return  the cause of this exception.
--- a/jdk/src/java.desktop/share/classes/java/beans/Encoder.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/beans/Encoder.java	Fri Jan 09 13:28:02 2015 -0500
@@ -121,7 +121,7 @@
      * it is returned.
      * <li>
      * A persistence delegate is then looked up by the name
-     * composed of the the fully qualified name of the given type
+     * composed of the fully qualified name of the given type
      * and the "PersistenceDelegate" postfix.
      * For example, a persistence delegate for the {@code Bean} class
      * should be named {@code BeanPersistenceDelegate}
--- a/jdk/src/java.desktop/share/classes/java/beans/Transient.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/beans/Transient.java	Fri Jan 09 13:28:02 2015 -0500
@@ -41,7 +41,7 @@
  * indicates to encoders derived from {@link Encoder}
  * that this feature should be ignored.
  * <p>
- * The {@code Transient} annotation may be be used
+ * The {@code Transient} annotation may be used
  * in any of the methods that are involved
  * in a {@link FeatureDescriptor} subclass
  * to identify the transient feature in the annotated class and its subclasses.
--- a/jdk/src/java.desktop/share/classes/javax/imageio/IIOParam.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/IIOParam.java	Fri Jan 09 13:28:02 2015 -0500
@@ -442,7 +442,7 @@
     }
 
     /**
-     * Returns the set of of source bands to be used. The returned
+     * Returns the set of source bands to be used. The returned
      * value is that set by the most recent call to
      * <code>setSourceBands</code>, or <code>null</code> if there have
      * been no calls to <code>setSourceBands</code>.
--- a/jdk/src/java.desktop/share/classes/javax/imageio/event/IIOReadUpdateListener.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/event/IIOReadUpdateListener.java	Fri Jan 09 13:28:02 2015 -0500
@@ -70,7 +70,7 @@
      * a value of 1 means no gaps.
      * @param periodY the vertical spacing between updated pixels;
      * a value of 1 means no gaps.
-     * @param bands an array of <code>int</code>s indicating the the
+     * @param bands an array of <code>int</code>s indicating the
      * set bands that may be updated.
      */
     void passStarted(ImageReader source,
@@ -187,7 +187,7 @@
      * a value of 1 means no gaps.
      * @param periodY the vertical spacing between updated pixels;
      * a value of 1 means no gaps.
-     * @param bands an array of <code>int</code>s indicating the the
+     * @param bands an array of <code>int</code>s indicating the
      * set bands that may be updated.
      *
      * @see #passStarted
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/jpeg/JPEGQTable.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/jpeg/JPEGQTable.java	Fri Jan 09 13:28:02 2015 -0500
@@ -136,7 +136,7 @@
     /**
      * Constructs a quantization table from the argument, which must
      * contain 64 elements in natural order (not zig-zag order).
-     * A copy is made of the the input array.
+     * A copy is made of the input array.
      * @param table the quantization table, as an <code>int</code> array.
      * @throws IllegalArgumentException if <code>table</code> is
      * <code>null</code> or <code>table.length</code> is not equal to 64.
--- a/jdk/src/java.desktop/share/classes/javax/print/ServiceUI.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/print/ServiceUI.java	Fri Jan 09 13:28:02 2015 -0500
@@ -149,6 +149,7 @@
      * or attributes is null, or the initial PrintService is not in the
      * list of browsable services.
      */
+    @SuppressWarnings("deprecation")
     public static PrintService printDialog(GraphicsConfiguration gc,
                                            int x, int y,
                                            PrintService[] services,
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiMessage.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiMessage.java	Fri Jan 09 13:28:02 2015 -0500
@@ -52,7 +52,7 @@
  * API uses integers instead of bytes when expressing MIDI data. For example,
  * the {@link #getStatus()} method of {@code MidiMessage} returns MIDI status
  * bytes as integers. If you are processing MIDI data that originated outside
- * Java Sound and now is encoded as signed bytes, the bytes can can be
+ * Java Sound and now is encoded as signed bytes, the bytes can be
  * converted to integers using this conversion:
  *
  * <center>{@code int i = (int)(byte & 0xFF)}</center>
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/ShortMessage.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/ShortMessage.java	Fri Jan 09 13:28:02 2015 -0500
@@ -303,7 +303,7 @@
      * @param  status the MIDI status byte
      * @param  data1 the first data byte
      * @param  data2 the second data byte
-     * @throws InvalidMidiDataException if the the status byte, or all data
+     * @throws InvalidMidiDataException if the status byte, or all data
      *         bytes belonging to the message, do not specify a valid MIDI
      *         message
      * @see #setMessage(int, int, int, int)
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/Clip.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/Clip.java	Fri Jan 09 13:28:02 2015 -0500
@@ -178,7 +178,7 @@
     /**
      * Sets the first and last sample frames that will be played in the loop.
      * The ending point must be greater than or equal to the starting point, and
-     * both must fall within the the size of the loaded media. A value of 0 for
+     * both must fall within the size of the loaded media. A value of 0 for
      * the starting point means the beginning of the loaded media. Similarly, a
      * value of -1 for the ending point indicates the last frame of the media.
      *
--- a/jdk/src/java.desktop/share/classes/javax/swing/AbstractButton.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/AbstractButton.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1474,7 +1474,7 @@
      * area.  If you wish to have a transparent button, such as
      * an icon only button, for example, then you should set
      * this to <code>false</code>. Do not call <code>setOpaque(false)</code>.
-     * The default value for the the <code>contentAreaFilled</code>
+     * The default value for the <code>contentAreaFilled</code>
      * property is <code>true</code>.
      * <p>
      * This function may cause the component's opaque property to change.
@@ -1538,7 +1538,7 @@
     }
 
     /**
-     * Returns the keyboard mnemonic from the the current model.
+     * Returns the keyboard mnemonic from the current model.
      * @return the keyboard mnemonic from the model
      */
     public int getMnemonic() {
@@ -2562,7 +2562,7 @@
          * Perform the specified Action on the object
          *
          * @param i zero-based index of actions
-         * @return true if the the action was performed; else false.
+         * @return true if the action was performed; else false.
          */
         public boolean doAccessibleAction(int i) {
             if (i == 0) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/ArrayTable.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/ArrayTable.java	Fri Jan 09 13:28:02 2015 -0500
@@ -51,7 +51,7 @@
     /**
      * Writes the passed in ArrayTable to the passed in ObjectOutputStream.
      * The data is saved as an integer indicating how many key/value
-     * pairs are being archived, followed by the the key/value pairs. If
+     * pairs are being archived, followed by the key/value pairs. If
      * <code>table</code> is null, 0 will be written to <code>s</code>.
      * <p>
      * This is a convenience method that ActionMap/InputMap and
--- a/jdk/src/java.desktop/share/classes/javax/swing/Box.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/Box.java	Fri Jan 09 13:28:02 2015 -0500
@@ -82,7 +82,7 @@
 
     /**
      * Creates a <code>Box</code> that displays its components
-     * along the the specified axis.
+     * along the specified axis.
      *
      * @param axis  can be {@link BoxLayout#X_AXIS},
      *              {@link BoxLayout#Y_AXIS},
--- a/jdk/src/java.desktop/share/classes/javax/swing/DebugGraphics.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/DebugGraphics.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1453,6 +1453,7 @@
 
     /** Returns a DebugGraphics for use in buffering window.
       */
+    @SuppressWarnings("deprecation")
     private Graphics debugGraphics() {
         DebugGraphics        debugGraphics;
         DebugGraphicsInfo    info = info();
--- a/jdk/src/java.desktop/share/classes/javax/swing/GroupLayout.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/GroupLayout.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1213,15 +1213,15 @@
             registerComponents(horizontalGroup, HORIZONTAL);
             registerComponents(verticalGroup, VERTICAL);
         }
-        StringBuffer buffer = new StringBuffer();
-        buffer.append("HORIZONTAL\n");
-        createSpringDescription(buffer, horizontalGroup, "  ", HORIZONTAL);
-        buffer.append("\nVERTICAL\n");
-        createSpringDescription(buffer, verticalGroup, "  ", VERTICAL);
-        return buffer.toString();
+        StringBuilder sb = new StringBuilder();
+        sb.append("HORIZONTAL\n");
+        createSpringDescription(sb, horizontalGroup, "  ", HORIZONTAL);
+        sb.append("\nVERTICAL\n");
+        createSpringDescription(sb, verticalGroup, "  ", VERTICAL);
+        return sb.toString();
     }
 
-    private void createSpringDescription(StringBuffer buffer, Spring spring,
+    private void createSpringDescription(StringBuilder sb, Spring spring,
             String indent, int axis) {
         String origin = "";
         String padding = "";
@@ -1239,20 +1239,19 @@
             padding = ", userCreated=" + paddingSpring.getUserCreated() +
                     ", matches=" + paddingSpring.getMatchDescription();
         }
-        buffer.append(indent + spring.getClass().getName() + " " +
-                Integer.toHexString(spring.hashCode()) + " " +
-                origin +
-                ", size=" + spring.getSize() +
-                ", alignment=" + spring.getAlignment() +
-                " prefs=[" + spring.getMinimumSize(axis) +
-                " " + spring.getPreferredSize(axis) +
-                " " + spring.getMaximumSize(axis) +
-                padding + "]\n");
+        sb.append(indent).append(spring.getClass().getName()).append(' ')
+                .append(Integer.toHexString(spring.hashCode())).append(' ')
+                .append(origin).append(", size=").append(spring.getSize())
+                .append(", alignment=").append(spring.getAlignment())
+                .append(" prefs=[").append(spring.getMinimumSize(axis))
+                .append(' ').append(spring.getPreferredSize(axis)).append(' ')
+                .append(spring.getMaximumSize(axis)).append(padding)
+                .append("]\n");
         if (spring instanceof Group) {
             List<Spring> springs = ((Group)spring).springs;
             indent += "  ";
             for (int counter = 0; counter < springs.size(); counter++) {
-                createSpringDescription(buffer, springs.get(counter), indent,
+                createSpringDescription(sb, springs.get(counter), indent,
                         axis);
             }
         }
@@ -2397,7 +2396,7 @@
      * {@code CONSTANT_DESCENT}; otherwise the baseline is anchored to the top
      * of the group.
      * <p>
-     * Elements aligned to the baseline are resizable if they have have
+     * Elements aligned to the baseline are resizable if they have
      * a baseline resize behavior of {@code CONSTANT_ASCENT} or
      * {@code CONSTANT_DESCENT}. Elements with a baseline resize
      * behavior of {@code OTHER} or {@code CENTER_OFFSET} are not resizable.
--- a/jdk/src/java.desktop/share/classes/javax/swing/JApplet.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JApplet.java	Fri Jan 09 13:28:02 2015 -0500
@@ -243,6 +243,7 @@
     *      hidden: true
     * description: The menubar for accessing pulldown menus from this applet.
     */
+    @SuppressWarnings("deprecation")
     public void setJMenuBar(JMenuBar menuBar) {
         getRootPane().setMenuBar(menuBar);
     }
@@ -253,6 +254,7 @@
     * @return the menubar set on this applet
     * @see #setJMenuBar
     */
+    @SuppressWarnings("deprecation")
     public JMenuBar getJMenuBar() {
         return getRootPane().getMenuBar();
     }
--- a/jdk/src/java.desktop/share/classes/javax/swing/JColorChooser.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JColorChooser.java	Fri Jan 09 13:28:02 2015 -0500
@@ -133,6 +133,7 @@
      * returns true.
      * @see java.awt.GraphicsEnvironment#isHeadless
      */
+    @SuppressWarnings("deprecation")
     public static Color showDialog(Component component,
         String title, Color initialColor) throws HeadlessException {
 
@@ -543,17 +544,17 @@
      * @return  a string representation of this <code>JColorChooser</code>
      */
     protected String paramString() {
-        StringBuilder chooserPanelsString = new StringBuilder("");
-        for (int i=0; i<chooserPanels.length; i++) {
-            chooserPanelsString.append("[" + chooserPanels[i].toString()
-                                       + "]");
+        StringBuilder chooserPanelsString = new StringBuilder();
+        for (AbstractColorChooserPanel panel : chooserPanels) {
+            chooserPanelsString.append('[').append(panel)
+                               .append(']');
         }
-        String previewPanelString = (previewPanel != null ?
-                                     previewPanel.toString() : "");
+        String previewPanelString = (previewPanel != null ? previewPanel
+                .toString() : "");
 
-        return super.paramString() +
-        ",chooserPanels=" + chooserPanelsString.toString() +
-        ",previewPanel=" + previewPanelString;
+        return super.paramString() + ",chooserPanels="
+                + chooserPanelsString.toString() + ",previewPanel="
+                + previewPanelString;
     }
 
 /////////////////
@@ -654,6 +655,7 @@
         okButton.getAccessibleContext().setAccessibleDescription(okString);
         okButton.setActionCommand("OK");
         okButton.addActionListener(new ActionListener() {
+            @SuppressWarnings("deprecation")
             public void actionPerformed(ActionEvent e) {
                 hide();
             }
@@ -685,6 +687,7 @@
 
         cancelButton.setActionCommand("cancel");
         cancelButton.addActionListener(new ActionListener() {
+            @SuppressWarnings("deprecation")
             public void actionPerformed(ActionEvent e) {
                 hide();
             }
@@ -723,6 +726,7 @@
         this.addWindowListener(new Closer());
     }
 
+    @SuppressWarnings("deprecation")
     public void show() {
         initialColor = chooserPane.getColor();
         super.show();
@@ -734,6 +738,7 @@
 
     @SuppressWarnings("serial") // JDK-implementation class
     class Closer extends WindowAdapter implements Serializable{
+        @SuppressWarnings("deprecation")
         public void windowClosing(WindowEvent e) {
             cancelButton.doClick(0);
             Window w = e.getWindow();
--- a/jdk/src/java.desktop/share/classes/javax/swing/JComboBox.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JComboBox.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1320,8 +1320,8 @@
      */
     public void actionPerformed(ActionEvent e) {
         ComboBoxEditor editor = getEditor();
-        if ((editor != null) && (e != null)
-                && (editor.getEditorComponent() == e.getSource())) {
+        if ((editor != null) && (e != null) && (editor == e.getSource()
+                || editor.getEditorComponent() == e.getSource())) {
             setPopupVisible(false);
             getModel().setSelectedItem(editor.getItem());
             String oldCommand = getActionCommand();
@@ -1919,7 +1919,7 @@
          * Perform the specified Action on the object
          *
          * @param i zero-based index of actions
-         * @return true if the the action was performed; else false.
+         * @return true if the action was performed; else false.
          */
         public boolean doAccessibleAction(int i) {
             if (i == 0) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1882,7 +1882,7 @@
     }
 
     /**
-     * Sets the the horizontal alignment.
+     * Sets the horizontal alignment.
      *
      * @param alignmentY  the new horizontal alignment
      * @see #getAlignmentY
@@ -1911,7 +1911,7 @@
     }
 
     /**
-     * Sets the the vertical alignment.
+     * Sets the vertical alignment.
      *
      * @param alignmentX  the new vertical alignment
      * @see #getAlignmentX
@@ -4799,7 +4799,7 @@
     /**
      * Notifies this component that it no longer has a parent component.
      * When this method is invoked, any <code>KeyboardAction</code>s
-     * set up in the the chain of parent components are removed.
+     * set up in the chain of parent components are removed.
      * This method is called by the toolkit internally and should
      * not be called directly by programs.
      *
@@ -5049,6 +5049,7 @@
         this.paintingChild = paintingChild;
     }
 
+    @SuppressWarnings("deprecation")
     void _paintImmediately(int x, int y, int w, int h) {
         Graphics g;
         Container c;
@@ -5575,7 +5576,7 @@
      * the UI before any of the <code>JComponent</code>'s children
      * (or its <code>LayoutManager</code> etc.) are written,
      * and we don't want to restore the UI until the most derived
-     * <code>JComponent</code> subclass has been been stored.
+     * <code>JComponent</code> subclass has been stored.
      *
      * @param s the <code>ObjectOutputStream</code> in which to write
      */
--- a/jdk/src/java.desktop/share/classes/javax/swing/JDialog.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JDialog.java	Fri Jan 09 13:28:02 2015 -0500
@@ -849,6 +849,7 @@
     *      hidden: true
     * description: The menubar for accessing pulldown menus from this dialog.
     */
+    @SuppressWarnings("deprecation")
     public void setJMenuBar(JMenuBar menu) {
         getRootPane().setMenuBar(menu);
     }
@@ -859,6 +860,7 @@
     * @return the menubar set on this dialog
     * @see #setJMenuBar
     */
+    @SuppressWarnings("deprecation")
     public JMenuBar getJMenuBar() {
         return getRootPane().getMenuBar();
     }
--- a/jdk/src/java.desktop/share/classes/javax/swing/JEditorPane.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JEditorPane.java	Fri Jan 09 13:28:02 2015 -0500
@@ -716,7 +716,7 @@
      * like fetch the stream from a cache, monitor the progress
      * of the stream, etc.
      * <p>
-     * This method is expected to have the the side effect of
+     * This method is expected to have the side effect of
      * establishing the content type, and therefore setting the
      * appropriate <code>EditorKit</code> to use for loading the stream.
      * <p>
@@ -1826,7 +1826,7 @@
              * Perform the specified Action on the object
              *
              * @param i zero-based index of actions
-             * @return true if the the action was performed; else false.
+             * @return true if the action was performed; else false.
              * @see #getAccessibleActionCount
              */
             public boolean doAccessibleAction(int i) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/JFileChooser.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JFileChooser.java	Fri Jan 09 13:28:02 2015 -0500
@@ -757,6 +757,7 @@
      * returns true.
      * @see java.awt.GraphicsEnvironment#isHeadless
      */
+    @SuppressWarnings("deprecation")
     public int showDialog(Component parent, String approveButtonText)
         throws HeadlessException {
         if (dialog != null) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/JFrame.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JFrame.java	Fri Jan 09 13:28:02 2015 -0500
@@ -494,6 +494,7 @@
     *      hidden: true
     * description: The menubar for accessing pulldown menus from this frame.
     */
+    @SuppressWarnings("deprecation")
     public void setJMenuBar(JMenuBar menubar) {
         getRootPane().setMenuBar(menubar);
     }
@@ -504,6 +505,7 @@
     *
     * @see #setJMenuBar
     */
+    @SuppressWarnings("deprecation")
     public JMenuBar getJMenuBar() {
         return getRootPane().getMenuBar();
     }
--- a/jdk/src/java.desktop/share/classes/javax/swing/JInternalFrame.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JInternalFrame.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1494,6 +1494,7 @@
      * @param width  an integer giving the component's new width in pixels
      * @param height an integer giving the component's new height in pixels
      */
+    @SuppressWarnings("deprecation")
     public void reshape(int x, int y, int width, int height) {
         super.reshape(x, y, width, height);
         validate();
@@ -1735,6 +1736,7 @@
      * @see InternalFrameEvent#INTERNAL_FRAME_OPENED
      * @see #setVisible
      */
+    @SuppressWarnings("deprecation")
     public void show() {
         // bug 4312922
         if (isVisible()) {
@@ -1766,6 +1768,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     public void hide() {
         if (isIcon()) {
             getDesktopIcon().setVisible(false);
--- a/jdk/src/java.desktop/share/classes/javax/swing/JLayer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JLayer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -131,7 +131,7 @@
  * <li>{@link Container#add(java.awt.Component, Object)}</li>
  * <li>{@link Container#add(java.awt.Component, Object, int)}</li>
  * </ul>
- * using any of of them will cause {@code UnsupportedOperationException} to be thrown,
+ * using any of them will cause {@code UnsupportedOperationException} to be thrown,
  * to add a component to {@code JLayer}
  * use {@link #setView(Component)} or {@link #setGlassPane(JPanel)}.
  *
--- a/jdk/src/java.desktop/share/classes/javax/swing/JList.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JList.java	Fri Jan 09 13:28:02 2015 -0500
@@ -140,7 +140,7 @@
  * <p>
  * The preferred way to listen for changes in list selection is to add
  * {@code ListSelectionListener}s directly to the {@code JList}. {@code JList}
- * then takes care of listening to the the selection model and notifying your
+ * then takes care of listening to the selection model and notifying your
  * listeners of change.
  * <p>
  * Responsibility for listening to selection changes in order to keep the list's
@@ -717,7 +717,7 @@
      * <p>
      * This is a JavaBeans bound property.
      *
-     * @param height the height to be used for for all cells in the list
+     * @param height the height to be used for all cells in the list
      * @see #setPrototypeCellValue
      * @see #setFixedCellWidth
      * @see JComponent#addPropertyChangeListener
@@ -3663,6 +3663,7 @@
                 }
             }
 
+            @SuppressWarnings("deprecation")
             public boolean isFocusTraversable() {
                 AccessibleContext ac = getCurrentAccessibleContext();
                 if (ac instanceof AccessibleComponent) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/JMenuItem.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JMenuItem.java	Fri Jan 09 13:28:02 2015 -0500
@@ -178,7 +178,7 @@
     }
 
     /**
-     * Inititalizes the focusability of the the <code>JMenuItem</code>.
+     * Inititalizes the focusability of the <code>JMenuItem</code>.
      * <code>JMenuItem</code>'s are focusable, but subclasses may
      * want to be, this provides them the opportunity to override this
      * and invoke something else, or nothing at all. Refer to
--- a/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java	Fri Jan 09 13:28:02 2015 -0500
@@ -566,6 +566,7 @@
      *   <code>true</code>
      * @see java.awt.GraphicsEnvironment#isHeadless
      */
+    @SuppressWarnings("deprecation")
     public static Object showInputDialog(Component parentComponent,
         Object message, String title, int messageType, Icon icon,
         Object[] selectionValues, Object initialSelectionValue)
@@ -855,6 +856,7 @@
      *   <code>true</code>
      * @see java.awt.GraphicsEnvironment#isHeadless
      */
+    @SuppressWarnings("deprecation")
     public static int showOptionDialog(Component parentComponent,
         Object message, String title, int optionType, int messageType,
         Icon icon, Object[] options, Object initialValue)
--- a/jdk/src/java.desktop/share/classes/javax/swing/JProgressBar.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JProgressBar.java	Fri Jan 09 13:28:02 2015 -0500
@@ -330,7 +330,7 @@
     public JProgressBar(int orient, int min, int max)
     {
         // Creating the model this way is a bit simplistic, but
-        //  I believe that it is the the most common usage of this
+        //  I believe that it is the most common usage of this
         //  component - it's what people will expect.
         setModel(new DefaultBoundedRangeModel(min, 0, min, max));
         updateUI();
--- a/jdk/src/java.desktop/share/classes/javax/swing/JSpinner.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JSpinner.java	Fri Jan 09 13:28:02 2015 -0500
@@ -447,7 +447,7 @@
      * Sends a <code>ChangeEvent</code>, whose source is this
      * <code>JSpinner</code>, to each <code>ChangeListener</code>.
      * When a <code>ChangeListener</code> has been added
-     * to the spinner, this method method is called each time
+     * to the spinner, this method is called each time
      * a <code>ChangeEvent</code> is received from the model.
      *
      * @see #addChangeListener
@@ -1798,7 +1798,7 @@
                 Rectangle editorRect = at.getCharacterBounds(i);
                 if (editorRect != null &&
                     sameWindowAncestor(JSpinner.this, editor)) {
-                    // return rectangle in the the JSpinner bounds
+                    // return rectangle in the JSpinner bounds
                     return SwingUtilities.convertRectangle(editor,
                                                            editorRect,
                                                            JSpinner.this);
--- a/jdk/src/java.desktop/share/classes/javax/swing/JTabbedPane.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JTabbedPane.java	Fri Jan 09 13:28:02 2015 -0500
@@ -333,6 +333,7 @@
      * @see #addChangeListener
      * @see EventListenerList
      */
+    @SuppressWarnings("deprecation")
     protected void fireStateChanged() {
         /* --- Begin code to deal with visibility --- */
 
@@ -949,6 +950,7 @@
      * @see #addTab
      * @see #insertTab
      */
+    @SuppressWarnings("deprecation")
     public void removeTabAt(int index) {
         checkIndex(index);
 
@@ -1557,6 +1559,7 @@
      *    attribute: visualUpdate true
      *  description: The component at the specified tab index.
      */
+    @SuppressWarnings("deprecation")
     public void setComponentAt(int index, Component component) {
         Page page = pages.get(index);
         if (component != page.component) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/JTable.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JTable.java	Fri Jan 09 13:28:02 2015 -0500
@@ -5810,6 +5810,7 @@
      *                where 0 is the first column
      * @return the <code>Component</code> being edited
      */
+    @SuppressWarnings("deprecation")
     public Component prepareEditor(TableCellEditor editor, int row, int column) {
         Object value = getValueAt(row, column);
         boolean isSelected = isCellSelected(row, column);
@@ -8788,6 +8789,7 @@
                 }
             }
 
+            @SuppressWarnings("deprecation")
             public boolean isFocusTraversable() {
                 AccessibleContext ac = getCurrentAccessibleContext();
                 if (ac instanceof AccessibleComponent) {
@@ -9640,6 +9642,7 @@
              * @see AccessibleState#FOCUSED
              * @see AccessibleStateSet
              */
+            @SuppressWarnings("deprecation")
             public boolean isFocusTraversable() {
                 AccessibleContext ac = getCurrentAccessibleContext();
                 if (ac instanceof AccessibleComponent) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/JTree.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JTree.java	Fri Jan 09 13:28:02 2015 -0500
@@ -5575,7 +5575,7 @@
              * object behind the TreeCellRenderer.
              *
              * @param i zero-based index of actions
-             * @return true if the the action was performed; else false.
+             * @return true if the action was performed; else false.
              */
             public boolean doAccessibleAction(int i) {
                 if (i < 0 || i >= getAccessibleActionCount()) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/JViewport.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JViewport.java	Fri Jan 09 13:28:02 2015 -0500
@@ -829,6 +829,7 @@
      *
      * @see JComponent#reshape(int, int, int, int)
      */
+    @SuppressWarnings("deprecation")
     public void reshape(int x, int y, int w, int h) {
         boolean sizeChanged = (getWidth() != w) || (getHeight() != h);
         if (sizeChanged) {
@@ -1447,6 +1448,7 @@
      * Returns true if the component needs to be completely repainted after
      * a blit and a paint is received.
      */
+    @SuppressWarnings("deprecation")
     private boolean needsRepaintAfterBlit() {
         // Find the first heavy weight ancestor. isObscured and
         // canDetermineObscurity are only appropriate for heavy weights.
--- a/jdk/src/java.desktop/share/classes/javax/swing/OverlayLayout.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/OverlayLayout.java	Fri Jan 09 13:28:02 2015 -0500
@@ -97,7 +97,7 @@
      * this class to know when to invalidate layout.
      *
      * @param name the name of the component
-     * @param comp the the component to be added
+     * @param comp the component to be added
      */
     public void addLayoutComponent(String name, Component comp) {
         invalidateLayout(comp.getParent());
--- a/jdk/src/java.desktop/share/classes/javax/swing/Popup.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/Popup.java	Fri Jan 09 13:28:02 2015 -0500
@@ -253,6 +253,7 @@
             paint(g);
         }
 
+        @SuppressWarnings("deprecation")
         public void show() {
             this.pack();
             if (getWidth() > 0 && getHeight() > 0) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/ProgressMonitor.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/ProgressMonitor.java	Fri Jan 09 13:28:02 2015 -0500
@@ -260,6 +260,7 @@
      * @see #setMaximum
      * @see #close
      */
+    @SuppressWarnings("deprecation")
     public void setProgress(int nv) {
         if (nv >= max) {
             close();
--- a/jdk/src/java.desktop/share/classes/javax/swing/RepaintManager.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/RepaintManager.java	Fri Jan 09 13:28:02 2015 -0500
@@ -401,6 +401,7 @@
      *
      * @see JComponent#repaint
      */
+    @SuppressWarnings("deprecation")
     private void addDirtyRegion0(Container c, int x, int y, int w, int h) {
         /* Special cases we don't have to bother with.
          */
--- a/jdk/src/java.desktop/share/classes/javax/swing/ScrollPaneLayout.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/ScrollPaneLayout.java	Fri Jan 09 13:28:02 2015 -0500
@@ -225,7 +225,7 @@
      * </ul>
      *
      * @param s the component identifier
-     * @param c the the component to be added
+     * @param c the component to be added
      * @exception IllegalArgumentException if <code>s</code> is an invalid key
      */
     public void addLayoutComponent(String s, Component c)
--- a/jdk/src/java.desktop/share/classes/javax/swing/SortingFocusTraversalPolicy.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/SortingFocusTraversalPolicy.java	Fri Jan 09 13:28:02 2015 -0500
@@ -195,6 +195,7 @@
         return true;
     }
 
+    @SuppressWarnings("deprecation")
     private void enumerateCycle(Container container, List<Component> cycle) {
         if (!(container.isVisible() && container.isDisplayable())) {
             return;
--- a/jdk/src/java.desktop/share/classes/javax/swing/SpinnerModel.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/SpinnerModel.java	Fri Jan 09 13:28:02 2015 -0500
@@ -53,7 +53,7 @@
  *   <dd>The preceding element or null if <code>value</code> is the
  *     first element of the sequence.
  * </dl>
- * When the the <code>value</code> property changes,
+ * When the <code>value</code> property changes,
  * <code>ChangeListeners</code> are notified.  <code>SpinnerModel</code> may
  * choose to notify the <code>ChangeListeners</code> under other circumstances.
  *
--- a/jdk/src/java.desktop/share/classes/javax/swing/SwingUtilities.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/SwingUtilities.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1929,6 +1929,7 @@
         public void windowDeactivated(WindowEvent e) {
         }
 
+        @SuppressWarnings("deprecation")
         public void show() {
             // This frame can never be shown
         }
--- a/jdk/src/java.desktop/share/classes/javax/swing/UIDefaults.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/UIDefaults.java	Fri Jan 09 13:28:02 2015 -0500
@@ -167,7 +167,7 @@
     }
 
     /**
-     * Looks up up the given key in our Hashtable and resolves LazyValues
+     * Looks up the given key in our Hashtable and resolves LazyValues
      * or ActiveValues.
      */
     private Object getFromHashtable(Object key) {
@@ -1181,7 +1181,7 @@
     /**
      * <code>LazyInputMap</code> will create a <code>InputMap</code>
      * in its <code>createValue</code>
-     * method. The bindings are passed in in the constructor.
+     * method. The bindings are passed in the constructor.
      * The bindings are an array with
      * the even number entries being string <code>KeyStrokes</code>
      * (eg "alt SPACE") and
--- a/jdk/src/java.desktop/share/classes/javax/swing/UIManager.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/UIManager.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1436,6 +1436,7 @@
     /*
      * Sets default swing focus traversal policy.
      */
+    @SuppressWarnings("deprecation")
     private static void maybeInitializeFocusPolicy(JComponent comp) {
         // Check for JRootPane which indicates that a swing toplevel
         // is coming, in which case a swing default focus policy
--- a/jdk/src/java.desktop/share/classes/javax/swing/ViewportLayout.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/ViewportLayout.java	Fri Jan 09 13:28:02 2015 -0500
@@ -66,7 +66,7 @@
     /**
      * Adds the specified component to the layout. Not used by this class.
      * @param name the name of the component
-     * @param c the the component to be added
+     * @param c the component to be added
      */
     public void addLayoutComponent(String name, Component c) { }
 
--- a/jdk/src/java.desktop/share/classes/javax/swing/package.html	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/package.html	Fri Jan 09 13:28:02 2015 -0500
@@ -3,7 +3,7 @@
 
 <HEAD>
 <!--
-Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
 This code is free software; you can redistribute it and/or modify it
@@ -68,6 +68,8 @@
 the event dispatching thread. The following two examples work equally
 well for transferring control and starting up a Swing application:
 <pre>
+import javax.swing.SwingUtilities;
+
 public class MyApp implements Runnable {
     public void run() {
         // Invoked on the event dispatching thread.
@@ -75,16 +77,18 @@
     }
 
     public static void main(String[] args) {
-        SwingUtilities.invokeLater(new MyApp(args));
+        SwingUtilities.invokeLater(new MyApp());
     }
 }
 </pre>
 Or:
 <pre>
+import javax.swing.SwingUtilities;
+
 public class MyApp {
     MyApp(String[] args) {
-        // Invoked on the event dispatching thread. Do any initialization
-        // here.
+        // Invoked on the event dispatching thread.
+        // Do any initialization here.
     }
 
     public void show() {
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicArrowButton.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicArrowButton.java	Fri Jan 09 13:28:02 2015 -0500
@@ -216,6 +216,7 @@
          *
          * @return {@code false}
          */
+        @SuppressWarnings("deprecation")
         public boolean isFocusTraversable() {
           return false;
         }
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java	Fri Jan 09 13:28:02 2015 -0500
@@ -223,6 +223,7 @@
     /**
      * Implementation of ComboPopup.show().
      */
+    @SuppressWarnings("deprecation")
     public void show() {
         comboBox.firePopupMenuWillBecomeVisible();
         setListSelection(comboBox.getSelectedIndex());
@@ -234,6 +235,7 @@
     /**
      * Implementation of ComboPopup.hide().
      */
+    @SuppressWarnings("deprecation")
     public void hide() {
         MenuSelectionManager manager = MenuSelectionManager.defaultManager();
         MenuElement [] selection = manager.getSelectedPath();
@@ -1032,6 +1034,7 @@
     /**
      * Overridden to unconditionally return false.
      */
+    @SuppressWarnings("deprecation")
     public boolean isFocusTraversable() {
         return false;
     }
@@ -1141,7 +1144,7 @@
 
 
     /**
-     * This is is a utility method that helps event handlers figure out where to
+     * This is a utility method that helps event handlers figure out where to
      * send the focus when the popup is brought up.  The standard implementation
      * delegates the focus to the editor (if the combo box is editable) or to
      * the JComboBox if it is not editable.
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java	Fri Jan 09 13:28:02 2015 -0500
@@ -502,6 +502,7 @@
         public void mouseReleased(MouseEvent evt) {
         }
 
+        @SuppressWarnings("deprecation")
         public void valueChanged(ListSelectionEvent evt) {
             if(!evt.getValueIsAdjusting()) {
                 JFileChooser chooser = getFileChooser();
@@ -1305,6 +1306,7 @@
          * @return  The representation of the data to be transfered.
          *
          */
+        @SuppressWarnings("deprecation")
         protected Transferable createTransferable(JComponent c) {
             Object[] values = null;
             if (c instanceof JList) {
@@ -1330,8 +1332,8 @@
 
             for (Object obj : values) {
                 String val = ((obj == null) ? "" : obj.toString());
-                plainBuf.append(val + "\n");
-                htmlBuf.append("  <li>" + val + "\n");
+                plainBuf.append(val).append('\n');
+                htmlBuf.append("  <li>").append(val).append('\n');
             }
 
             // remove the last newline
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java	Fri Jan 09 13:28:02 2015 -0500
@@ -926,6 +926,7 @@
      * This class should be treated as a &quot;protected&quot; inner class.
      * Instantiate it only within subclasses of <code>Foo</code>.
      */
+    @SuppressWarnings("deprecation")
     public class SystemMenuBar extends JMenuBar {
         public boolean isFocusTraversable() { return false; }
         public void requestFocus() {}
@@ -963,6 +964,7 @@
                 setOpaque(((Boolean)opacity).booleanValue());
             }
         }
+        @SuppressWarnings("deprecation")
         public boolean isFocusTraversable() { return false; }
         public void requestFocus() {}
         public AccessibleContext getAccessibleContext() {
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicListUI.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicListUI.java	Fri Jan 09 13:28:02 2015 -0500
@@ -2931,6 +2931,7 @@
          * @return  The representation of the data to be transfered.
          *
          */
+        @SuppressWarnings("deprecation")
         protected Transferable createTransferable(JComponent c) {
             if (c instanceof JList) {
                 JList<?> list = (JList) c;
@@ -2948,8 +2949,8 @@
                 for (int i = 0; i < values.length; i++) {
                     Object obj = values[i];
                     String val = ((obj == null) ? "" : obj.toString());
-                    plainStr.append(val + "\n");
-                    htmlStr.append("  <li>" + val + "\n");
+                    plainStr.append(val).append('\n');
+                    htmlStr.append("  <li>").append(val).append('\n');
                 }
 
                 // remove the last newline
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSliderUI.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSliderUI.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1449,7 +1449,7 @@
 
     /**
      * Returns the value at the y position. If {@code yPos} is beyond the
-     * track at the the bottom or the top, this method sets the value to either
+     * track at the bottom or the top, this method sets the value to either
      * the minimum or maximum value of the slider, depending on if the slider
      * is inverted or not.
      *
@@ -1927,7 +1927,7 @@
      * The recommended approach to creating bindings is to use a
      * combination of an <code>ActionMap</code>, to contain the action,
      * and an <code>InputMap</code> to contain the mapping from KeyStroke
-     * to action description. The InputMap is is usually described in the
+     * to action description. The InputMap is usually described in the
      * LookAndFeel tables.
      * <p>
      * Please refer to the key bindings specification for further details.
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java	Fri Jan 09 13:28:02 2015 -0500
@@ -441,6 +441,7 @@
                 }
             }
             // Don't want the button to participate in focus traversable.
+            @SuppressWarnings("deprecation")
             public boolean isFocusTraversable() {
                 return false;
             }
@@ -497,6 +498,7 @@
                 }
             }
             // Don't want the button to participate in focus traversable.
+            @SuppressWarnings("deprecation")
             public boolean isFocusTraversable() {
                 return false;
             }
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1191,6 +1191,7 @@
      * Should be messaged before the dragging session starts, resets
      * lastDragLocation and dividerSize.
      */
+    @SuppressWarnings("deprecation")
     protected void startDragging() {
         Component       leftC = splitPane.getLeftComponent();
         Component       rightC = splitPane.getRightComponent();
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java	Fri Jan 09 13:28:02 2015 -0500
@@ -2395,6 +2395,7 @@
             return total;
         }
 
+        @SuppressWarnings("deprecation")
         public void layoutContainer(Container parent) {
             /* Some of the code in this method deals with changing the
             * visibility of components to hide and show the contents for the
@@ -2903,6 +2904,7 @@
             return calculateMaxTabWidth(tabPlacement);
         }
 
+        @SuppressWarnings("deprecation")
         public void layoutContainer(Container parent) {
             /* Some of the code in this method deals with changing the
              * visibility of components to hide and show the contents for the
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java	Fri Jan 09 13:28:02 2015 -0500
@@ -344,7 +344,7 @@
             }
 
             // In cases where the lead is not within the search range,
-            // we need to bring it within one cell for the the search
+            // we need to bring it within one cell for the search
             // to work properly. Check these here.
             leadRow = Math.min(Math.max(leadRow, minY - 1), maxY + 1);
             leadColumn = Math.min(Math.max(leadColumn, minX - 1), maxX + 1);
@@ -2230,11 +2230,11 @@
                     for (int col = 0; col < cols.length; col++) {
                         Object obj = table.getValueAt(rows[row], cols[col]);
                         String val = ((obj == null) ? "" : obj.toString());
-                        plainStr.append(val + "\t");
-                        htmlStr.append("  <td>" + val + "</td>\n");
+                        plainStr.append(val).append('\t');
+                        htmlStr.append("  <td>").append(val).append("</td>\n");
                     }
                     // we want a newline at the end of each line and not a tab
-                    plainStr.deleteCharAt(plainStr.length() - 1).append("\n");
+                    plainStr.deleteCharAt(plainStr.length() - 1).append('\n');
                     htmlStr.append("</tr>\n");
                 }
 
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java	Fri Jan 09 13:28:02 2015 -0500
@@ -137,7 +137,7 @@
     /**
      * Fetches the name of the keymap that will be installed/used
      * by default for this UI. This is implemented to create a
-     * name based upon the classname.  The name is the the name
+     * name based upon the classname.  The name is the name
      * of the class with the package prefix removed.
      *
      * @return the name
@@ -2644,6 +2644,7 @@
             /**
              * The only richer format supported is the file list flavor
              */
+            @SuppressWarnings("deprecation")
             protected Object getRicherData(DataFlavor flavor) throws UnsupportedFlavorException {
                 if (richText == null) {
                     return null;
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java	Fri Jan 09 13:28:02 2015 -0500
@@ -421,6 +421,7 @@
      *
      * @param direction a direction
      */
+    @SuppressWarnings("deprecation")
     protected void navigateFocusedComp(int direction)
     {
         int nComp = toolBar.getComponentCount();
@@ -886,6 +887,7 @@
      * @param b {@code true} if the {@code JToolBar} is floating
      * @param p the position
      */
+    @SuppressWarnings("deprecation")
     public void setFloating(boolean b, Point p) {
         if (toolBar.isFloatable()) {
             boolean visible = false;
@@ -1080,6 +1082,7 @@
      * @param position the relative to the {@code JTollBar} position
      * @param origin the screen position of {@code JToolBar} before dragging
      */
+    @SuppressWarnings("deprecation")
     protected void dragTo(Point position, Point origin)
     {
         if (toolBar.isFloatable())
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTreeUI.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTreeUI.java	Fri Jan 09 13:28:02 2015 -0500
@@ -2363,6 +2363,7 @@
      * @param messageCancel message to cancel editing
      * @param messageTree message to tree
      */
+    @SuppressWarnings("deprecation")
     protected void completeEditing(boolean messageStop,
                                    boolean messageCancel,
                                    boolean messageTree) {
@@ -3618,8 +3619,8 @@
                     boolean leaf = model.isLeaf(node);
                     String label = getDisplayString(path, true, leaf);
 
-                    plainStr.append(label + "\n");
-                    htmlStr.append("  <li>" + label + "\n");
+                    plainStr.append(label).append('\n');
+                    htmlStr.append("  <li>").append(label).append('\n');
                 }
 
                 // remove the last newline
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalComboBoxButton.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalComboBoxButton.java	Fri Jan 09 13:28:02 2015 -0500
@@ -161,6 +161,7 @@
         iconOnly = onlyIcon;
     }
 
+    @SuppressWarnings("deprecation")
     public boolean isFocusTraversable() {
         return false;
     }
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java	Fri Jan 09 13:28:02 2015 -0500
@@ -441,6 +441,7 @@
          * @param the Container for which this layout manager is being used
          * @return a Dimension object containing the layout's preferred size
          */
+        @SuppressWarnings("deprecation")
         public Dimension preferredLayoutSize(Container parent) {
             Dimension cpd, mbd, tpd;
             int cpWidth = 0;
@@ -493,6 +494,7 @@
          * @param the Container for which this layout manager is being used
          * @return a Dimension object containing the layout's minimum size
          */
+        @SuppressWarnings("deprecation")
         public Dimension minimumLayoutSize(Container parent) {
             Dimension cpd, mbd, tpd;
             int cpWidth = 0;
@@ -544,6 +546,7 @@
          * @param the Container for which this layout manager is being used
          * @return a Dimension object containing the layout's maximum size
          */
+        @SuppressWarnings("deprecation")
         public Dimension maximumLayoutSize(Container target) {
             Dimension cpd, mbd, tpd;
             int cpWidth = Integer.MAX_VALUE;
@@ -607,6 +610,7 @@
          *
          * @param the Container for which this layout manager is being used
          */
+        @SuppressWarnings("deprecation")
         public void layoutContainer(Container parent) {
             JRootPane root = (JRootPane) parent;
             Rectangle b = root.getBounds();
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalSplitPaneDivider.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalSplitPaneDivider.java	Fri Jan 09 13:28:02 2015 -0500
@@ -185,6 +185,7 @@
             }
 
             // Don't want the button to participate in focus traversable.
+            @SuppressWarnings("deprecation")
             public boolean isFocusTraversable() {
                 return false;
             }
@@ -294,6 +295,7 @@
             }
 
             // Don't want the button to participate in focus traversable.
+            @SuppressWarnings("deprecation")
             public boolean isFocusTraversable() {
                 return false;
             }
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java	Fri Jan 09 13:28:02 2015 -0500
@@ -245,7 +245,7 @@
     }
 
     /**
-     * Returns the maximum height of the the Font from the passed in
+     * Returns the maximum height of the Font from the passed in
      * SynthContext.
      *
      * @param context SynthContext used to determine font.
--- a/jdk/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java	Fri Jan 09 13:28:02 2015 -0500
@@ -242,7 +242,7 @@
     }
 
     /**
-     * Returns the the dragged column, if and only if, a drag is in
+     * Returns the dragged column, if and only if, a drag is in
      * process, otherwise returns <code>null</code>.
      *
      * @return  the dragged column, if a drag is in
@@ -1427,6 +1427,7 @@
                 }
             }
 
+            @SuppressWarnings("deprecation")
             public boolean isFocusTraversable() {
                 AccessibleContext ac = getCurrentAccessibleContext();
                 if (ac instanceof AccessibleComponent) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/table/TableColumn.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/table/TableColumn.java	Fri Jan 09 13:28:02 2015 -0500
@@ -127,7 +127,7 @@
     /**
      *  This object is not used internally by the drawing machinery of
      *  the <code>JTable</code>; identifiers may be set in the
-     *  <code>TableColumn</code> as as an
+     *  <code>TableColumn</code> as an
      *  optional way to tag and locate table columns. The table package does
      *  not modify or invoke any methods in these identifier objects other
      *  than the <code>equals</code> method which is used in the
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/BoxView.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/BoxView.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1128,7 +1128,7 @@
      * indicating the <code>View</code>s are layed out in ascending order.
      * <p>
      * If the receiver is laying its <code>View</code>s along the
-     * <code>Y_AXIS</code>, this will will return the value from
+     * <code>Y_AXIS</code>, this will return the value from
      * invoking the same method on the <code>View</code>
      * responsible for rendering <code>position</code> and
      * <code>bias</code>. Otherwise this will return false.
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java	Fri Jan 09 13:28:02 2015 -0500
@@ -409,7 +409,7 @@
 
 
     /**
-     * Fetches the list of of style names.
+     * Fetches the list of style names.
      *
      * @return all the style names
      */
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/ElementIterator.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/ElementIterator.java	Fri Jan 09 13:28:02 2015 -0500
@@ -79,7 +79,7 @@
      * as well as a child index.  If the
      * index is -1, then the element represented
      * on the stack is the element itself.
-     * Otherwise, the index functions as as index
+     * Otherwise, the index functions as an index
      * into the vector of children of the element.
      * In this case, the item on the stack
      * represents the "index"th child of the element
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphPainter1.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphPainter1.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -218,6 +218,7 @@
         return p1;
     }
 
+    @SuppressWarnings("deprecation")
     void sync(GlyphView v) {
         Font f = v.getFont();
         if ((metrics == null) || (! f.equals(metrics.getFont()))) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java	Fri Jan 09 13:28:02 2015 -0500
@@ -403,7 +403,7 @@
      * This is implemented to try and locate a <code>TabSet</code>
      * in the paragraph element's attribute set.  If one can be
      * found, its settings will be used, otherwise a default expansion
-     * will be provided.  The base location for for tab expansion
+     * will be provided.  The base location for tab expansion
      * is the left inset from the paragraphs most recent allocation
      * (which is what the layout of the children is based upon).
      *
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/PlainView.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/PlainView.java	Fri Jan 09 13:28:02 2015 -0500
@@ -385,11 +385,11 @@
         int x = (int) fx;
         int y = (int) fy;
         if (y < alloc.y) {
-            // above the area covered by this icon, so the the position
+            // above the area covered by this icon, so the position
             // is assumed to be the start of the coverage for this view.
             return getStartOffset();
         } else if (y > alloc.y + alloc.height) {
-            // below the area covered by this icon, so the the position
+            // below the area covered by this icon, so the position
             // is assumed to be the end of the coverage for this view.
             return getEndOffset() - 1;
         } else {
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/StyleContext.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/StyleContext.java	Fri Jan 09 13:28:02 2015 -0500
@@ -279,6 +279,7 @@
      * @param f the font
      * @return the metrics
      */
+    @SuppressWarnings("deprecation")
     public FontMetrics getFontMetrics(Font f) {
         // The Toolkit implementations cache, so we just forward
         // to the default toolkit.
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/WrappedPlainView.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/WrappedPlainView.java	Fri Jan 09 13:28:02 2015 -0500
@@ -668,11 +668,11 @@
             int x = (int) fx;
             int y = (int) fy;
             if (y < alloc.y) {
-                // above the area covered by this icon, so the the position
+                // above the area covered by this icon, so the position
                 // is assumed to be the start of the coverage for this view.
                 return getStartOffset();
             } else if (y > alloc.y + alloc.height) {
-                // below the area covered by this icon, so the the position
+                // below the area covered by this icon, so the position
                 // is assumed to be the end of the coverage for this view.
                 return getEndOffset() - 1;
             } else {
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/AccessibleHTML.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/AccessibleHTML.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -916,6 +916,7 @@
              * @return the zero-based index of the character under Point p; if
              * Point is invalid returns -1.
              */
+            @SuppressWarnings("deprecation")
             public int getIndexAtPoint(Point p) {
                 View v = getView();
                 if (v != null) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/CSS.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/CSS.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1588,7 +1588,7 @@
 
                 /*
                  * HTML.Attribute.ALIGN needs special processing.
-                 * It can map to to 1 of many(3) possible CSS attributes
+                 * It can map to 1 of many(3) possible CSS attributes
                  * depending on the nature of the tag the attribute is
                  * part off and depending on the value of the attribute.
                  */
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/FormView.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/FormView.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
  * Component decorator that implements the view interface
  * for form elements, &lt;input&gt;, &lt;textarea&gt;,
  * and &lt;select&gt;.  The model for the component is stored
- * as an attribute of the the element (using StyleConstants.ModelAttribute),
+ * as an attribute of the element (using StyleConstants.ModelAttribute),
  * and is used to build the component of the view.  The type
  * of the model is assumed to of the type that would be set by
  * <code>HTMLDocument.HTMLReader.FormAction</code>.  If there are
@@ -599,6 +599,7 @@
      * @param point associated with the mouse click.
      * @return the image data.
      */
+    @SuppressWarnings("deprecation")
     private String getImageData(Point point) {
 
         String mouseCoords = point.x + ":" + point.y;
@@ -816,6 +817,7 @@
      * URLEncoder.encode() method before being added to the
      * buffer.
      */
+    @SuppressWarnings("deprecation")
     private void appendBuffer(StringBuilder buffer, String name, String value) {
         if (buffer.length() > 0) {
             buffer.append('&');
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/FrameView.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/FrameView.java	Fri Jan 09 13:28:02 2015 -0500
@@ -218,6 +218,7 @@
      * the scrolling attribute.  If not defined, the default is "auto" which
      * maps to the scrollbar's being displayed as needed.
      */
+    @SuppressWarnings("deprecation")
     private void createScrollPane() {
         AttributeSet attributes = getElement().getAttributes();
         String scrolling = (String)attributes.getAttribute(HTML.Attribute.SCROLLING);
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1345,7 +1345,7 @@
     }
 
     /**
-     * Inserts the HTML specified as a string after the the end of the
+     * Inserts the HTML specified as a string after the end of the
      * given element.
      *
      * <p>Consider the following structure (the <code>elem</code>
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/HiddenTagView.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/HiddenTagView.java	Fri Jan 09 13:28:02 2015 -0500
@@ -129,6 +129,7 @@
 
     // local methods
 
+    @SuppressWarnings("deprecation")
     void updateYAlign(Font font) {
         Container c = getContainer();
         FontMetrics fm = (c != null) ? c.getFontMetrics(font) :
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/IsindexView.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/IsindexView.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,7 @@
     }
 
     /**
-     * Creates the components necessary to to implement
+     * Creates the components necessary to implement
      * this view.  The component returned is a <code>JPanel</code>,
      * that contains the PROMPT to the left and <code>JTextField</code>
      * to the right.
@@ -88,6 +88,7 @@
      * contents of the JTextField.  The search
      * contents are URLEncoded.
      */
+    @SuppressWarnings("deprecation")
     public void actionPerformed(ActionEvent evt) {
 
         String data = textField.getText();
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/LineView.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/LineView.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -136,7 +136,7 @@
      * This is implemented to try and locate a <code>TabSet</code>
      * in the paragraph element's attribute set.  If one can be
      * found, its settings will be used, otherwise a default expansion
-     * will be provided.  The base location for for tab expansion
+     * will be provided.  The base location for tab expansion
      * is the left inset from the paragraphs most recent allocation
      * (which is what the layout of the children is based upon).
      *
@@ -161,6 +161,7 @@
     /**
      * Returns the location for the tab.
      */
+    @SuppressWarnings("deprecation")
     protected float getPreTab(float x, int tabOffset) {
         Document d = getDocument();
         View v = getViewAtPosition(tabOffset, null);
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java	Fri Jan 09 13:28:02 2015 -0500
@@ -2562,6 +2562,7 @@
             }
         }
 
+        @SuppressWarnings("deprecation")
         void paint(Graphics g, float x, float y, float w, float h, View v) {
             Rectangle clip = g.getClipRect();
             if (clip != null) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/parser/DTDConstants.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/parser/DTDConstants.java	Fri Jan 09 13:28:02 2015 -0500
@@ -27,7 +27,7 @@
 
 /**
  * SGML constants used in a DTD. The names of the
- * constants correspond the the equivalent SGML constructs
+ * constants correspond to the equivalent SGML constructs
  * as described in "The SGML Handbook" by  Charles F. Goldfarb.
  *
  * @see DTD
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/parser/Entity.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/parser/Entity.java	Fri Jan 09 13:28:02 2015 -0500
@@ -35,7 +35,7 @@
 
 /**
  * An entity is described in a DTD using the ENTITY construct.
- * It defines the type and value of the the entity.
+ * It defines the type and value of the entity.
  *
  * @see DTD
  * @author Arthur van Hoff
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/parser/Parser.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/parser/Parser.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1846,7 +1846,7 @@
 
             if (unknown) {
                 // we will not see a corresponding start tag
-                // on the the stack.  If we are seeing an
+                // on the stack.  If we are seeing an
                 // end tag, lets send this on as an empty
                 // tag with the end tag attribute set to
                 // true.
--- a/jdk/src/java.desktop/share/classes/javax/swing/undo/UndoManager.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/undo/UndoManager.java	Fri Jan 09 13:28:02 2015 -0500
@@ -283,7 +283,7 @@
 
 
     /**
-     * Returns the the next significant edit to be undone if <code>undo</code>
+     * Returns the next significant edit to be undone if <code>undo</code>
      * is invoked. This returns <code>null</code> if there are no edits
      * to be undone.
      *
@@ -302,7 +302,7 @@
     }
 
     /**
-     * Returns the the next significant edit to be redone if <code>redo</code>
+     * Returns the next significant edit to be redone if <code>redo</code>
      * is invoked. This returns <code>null</code> if there are no edits
      * to be redone.
      *
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java	Fri Jan 09 13:28:02 2015 -0500
@@ -234,6 +234,7 @@
      * Minimum size
      */
     @Override
+    @SuppressWarnings("deprecation")
     public Dimension minimumSize() {
         return new Dimension(defaultAppletSize.width,
                              defaultAppletSize.height);
@@ -243,6 +244,7 @@
      * Preferred size
      */
     @Override
+    @SuppressWarnings("deprecation")
     public Dimension preferredSize() {
         return new Dimension(currentAppletSize.width,
                              currentAppletSize.height);
@@ -700,6 +702,7 @@
      * applet event processing so that it can be gracefully interrupted from
      * things like HotJava.
      */
+    @SuppressWarnings("deprecation")
     private void runLoader() {
         if (status != APPLET_DISPOSE) {
             showAppletStatus("notdisposed");
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletProps.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletProps.java	Fri Jan 09 13:28:02 2015 -0500
@@ -44,6 +44,7 @@
     TextField proxyPort;
     Choice accessMode;
 
+    @SuppressWarnings("deprecation")
     AppletProps() {
         setTitle(amh.getMessage("title"));
         Panel p = new Panel();
@@ -100,6 +101,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     void apply() {
         String proxyHostValue = proxyHost.getText().trim();
         String proxyPortValue = proxyPort.getText().trim();
@@ -172,6 +174,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     public boolean action(Event evt, Object obj) {
         if (amh.getMessage("button.apply").equals(obj)) {
             apply();
@@ -197,6 +200,7 @@
 /* Dialog class to display property-related errors to user */
 @SuppressWarnings("serial") // JDK implementation class
 class AppletPropsErrorDialog extends Dialog {
+    @SuppressWarnings("deprecation")
     public AppletPropsErrorDialog(Frame parent, String title, String message,
                 String buttonText) {
         super(parent, title, true);
@@ -212,6 +216,7 @@
              fRect.y + ((fRect.height - dDim.height) / 2));
     }
 
+    @SuppressWarnings("deprecation")
     public boolean action(Event event, Object object) {
         hide();
         dispose();
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletSecurity.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletSecurity.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -121,6 +121,7 @@
     /**
      * get the current (first) instance of an AppletClassLoader on the stack.
      */
+    @SuppressWarnings("deprecation")
     private AppletClassLoader currentAppletClassLoader()
     {
         // try currentClassLoader first
@@ -308,6 +309,7 @@
      * @exception  SecurityException  if the caller does not have
      *             permission to access the AWT event queue.
      */
+    @SuppressWarnings("deprecation")
     public void checkAwtEventQueueAccess() {
         AppContext appContext = AppContext.getAppContext();
         AppletClassLoader appletClassLoader = currentAppletClassLoader();
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletViewer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletViewer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -48,6 +48,7 @@
     /**
      * Create the tag frame.
      */
+    @SuppressWarnings("deprecation")
     TextFrame(int x, int y, String title, String text) {
         setTitle(title);
         TextArea txt = new TextArea(20, 60);
@@ -156,6 +157,7 @@
     /**
      * Create the applet viewer.
      */
+    @SuppressWarnings("deprecation")
     public AppletViewer(int x, int y, URL doc, Hashtable<String, String> atts,
                         PrintStream statusMsgStream, AppletViewerFactory factory) {
         this.factory = factory;
@@ -228,6 +230,7 @@
             }
 
             @Override
+            @SuppressWarnings("deprecation")
             public void appletStateChanged(AppletEvent evt)
             {
                 AppletPanel src = (AppletPanel)evt.getSource();
@@ -594,6 +597,7 @@
     /**
      * Make sure the atrributes are uptodate.
      */
+    @SuppressWarnings("deprecation")
     public void updateAtts() {
         Dimension d = panel.size();
         Insets in = panel.insets();
@@ -648,6 +652,7 @@
     /**
      * Save the applet to a well known file (for now) as a serialized object
      */
+    @SuppressWarnings("deprecation")
     void appletSave() {
         AccessController.doPrivileged(new PrivilegedAction<Object>() {
 
@@ -699,6 +704,7 @@
     /**
      * Clone the viewer and the applet.
      */
+    @SuppressWarnings("deprecation")
     void appletClone() {
         Point p = location();
         updateAtts();
@@ -711,6 +717,7 @@
     /**
      * Show the applet tag.
      */
+    @SuppressWarnings("deprecation")
     void appletTag() {
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         updateAtts();
@@ -724,6 +731,7 @@
     /**
      * Show the applet info.
      */
+    @SuppressWarnings("deprecation")
     void appletInfo() {
         String str = panel.applet.getAppletInfo();
         if (str == null) {
--- a/jdk/src/java.desktop/share/classes/sun/awt/AppContext.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/awt/AppContext.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -413,6 +413,7 @@
      *                                    contained within this AppContext
      * @since      1.2
      */
+    @SuppressWarnings("deprecation")
     public void dispose() throws IllegalThreadStateException {
         // Check to be sure that the current Thread isn't in this AppContext
         if (this.threadGroup.parentOf(Thread.currentThread().getThreadGroup())) {
--- a/jdk/src/java.desktop/share/classes/sun/awt/DebugSettings.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/awt/DebugSettings.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -146,6 +146,7 @@
     /*
      * Sets up default property values
      */
+    @SuppressWarnings("deprecation")
     private void loadDefaultProperties() {
         // is there a more inefficient way to setup default properties?
         // maybe, but this has got to be close to 100% non-optimal
--- a/jdk/src/java.desktop/share/classes/sun/awt/LightweightFrame.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/awt/LightweightFrame.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -88,6 +88,7 @@
     @Override public final void toFront() {}
     @Override public final void toBack() {}
 
+    @SuppressWarnings("deprecation")
     @Override public void addNotify() {
         synchronized (getTreeLock()) {
             if (getPeer() == null) {
@@ -114,6 +115,7 @@
      * @param activate if <code>true</code>, activates the frame;
      *                 otherwise, deactivates the frame
      */
+    @SuppressWarnings("deprecation")
     public void emulateActivation(boolean activate) {
         ((FramePeer)getPeer()).emulateActivation(activate);
     }
--- a/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java	Fri Jan 09 13:28:02 2015 -0500
@@ -713,6 +713,7 @@
     }
 
 
+    @SuppressWarnings("deprecation")
     static final SoftCache imgCache = new SoftCache();
 
     static Image getImageFromHash(Toolkit tk, URL url) {
--- a/jdk/src/java.desktop/share/classes/sun/awt/datatransfer/DataTransferer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/awt/datatransfer/DataTransferer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -717,6 +717,7 @@
      * Primary translation function for translating a Transferable into
      * a byte array, given a source DataFlavor and target format.
      */
+    @SuppressWarnings("deprecation")
     public byte[] translateTransferable(Transferable contents,
                                         DataFlavor flavor,
                                         long format) throws IOException
@@ -926,6 +927,15 @@
         // bytes and dump them into a byte array. For text flavors, decode back
         // to a String and recur to reencode according to the requested format.
         } else if (flavor.isRepresentationClassInputStream()) {
+
+            // Workaround to JDK-8024061: Exception thrown when drag and drop
+            //      between two components is executed quickly.
+            // and JDK-8065098:  JColorChooser no longer supports drag and drop
+            //      between two JVM instances
+            if (!(obj instanceof InputStream)) {
+                return new byte[0];
+            }
+
             try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
                 try (InputStream is = (InputStream)obj) {
                     boolean eof = false;
@@ -1278,6 +1288,7 @@
      * an InputStream into an Object, given a source format and a target
      * DataFlavor.
      */
+    @SuppressWarnings("deprecation")
     public Object translateStream(InputStream str, DataFlavor flavor,
                                   long format, Transferable localeTransferable)
         throws IOException
--- a/jdk/src/java.desktop/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -239,13 +239,6 @@
 
         if (localTransferable != null) {
             return localTransferable.getTransferData(df);
-        } else if (df.isMimeTypeEqual(DataFlavor.javaJVMLocalObjectMimeType)) {
-            // Workaround to JDK-8024061: Exception thrown when drag and drop
-            //      between two components is executed quickly.
-            // It is expected localTransferable is not null if javaJVMLocalObjectMimeType
-            // is used. Executing further results in ClassCastException, so null is
-            // returned here as no transfer data is available in this case.
-            return null;
         }
 
         if (dropStatus != STATUS_ACCEPT || dropComplete) {
--- a/jdk/src/java.desktop/share/classes/sun/awt/im/ExecutableInputMethodManager.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/awt/im/ExecutableInputMethodManager.java	Fri Jan 09 13:28:02 2015 -0500
@@ -259,7 +259,8 @@
                 AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                     public Object run() {
                         for (InputMethodDescriptor descriptor :
-                            ServiceLoader.loadInstalled(InputMethodDescriptor.class)) {
+                            ServiceLoader.load(InputMethodDescriptor.class,
+                                               ClassLoader.getSystemClassLoader())) {
                             ClassLoader cl = descriptor.getClass().getClassLoader();
                             javaInputMethodLocatorList.add(new InputMethodLocator(descriptor, cl, null));
                         }
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/GifImageDecoder.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/GifImageDecoder.java	Fri Jan 09 13:28:02 2015 -0500
@@ -114,7 +114,7 @@
     /**
      * produce an image from the stream.
      */
-    @SuppressWarnings("fallthrough")
+    @SuppressWarnings({"fallthrough", "deprecation"})
     public void produceImage() throws IOException, ImageFormatException {
         try {
             readHeader();
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionToolkitImage.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionToolkitImage.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,6 +59,7 @@
 
     private static class ObserverCache {
 
+        @SuppressWarnings("deprecation")
         static final SoftCache INSTANCE = new SoftCache();
     }
 
@@ -80,7 +81,7 @@
         }
 
         synchronized (ObserverCache.INSTANCE) {
-            ImageObserver o = (ImageObserver) ObserverCache.INSTANCE.get(image);
+            ImageObserver o = (ImageObserver) ObserverCache.INSTANCE.get(observer);
 
             if (o == null) {
 
@@ -109,7 +110,7 @@
                                     image, flags, x, y, width, height);
                         };
 
-                ObserverCache.INSTANCE.put(image, o);
+                ObserverCache.INSTANCE.put(observer, o);
             }
             return o;
         }
--- a/jdk/src/java.desktop/share/classes/sun/font/BidiUtils.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/font/BidiUtils.java	Fri Jan 09 13:28:02 2015 -0500
@@ -47,7 +47,7 @@
      * array instead of iterating over the runs.
      *
      * @param levels the array to receive the character levels
-     * @param start the starting offset into the the array
+     * @param start the starting offset into the array
      * @throws IndexOutOfBoundsException if <code>start</code> is less than 0 or
      * <code>start + getLength()</code> is greater than <code>levels.length</code>.
      */
--- a/jdk/src/java.desktop/share/classes/sun/font/Decoration.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/font/Decoration.java	Fri Jan 09 13:28:02 2015 -0500
@@ -105,7 +105,7 @@
     }
 
     /**
-     * Return a Decoration appropriate for the the given Map.
+     * Return a Decoration appropriate for the given Map.
      * @param attributes the Map used to determine the Decoration
      */
     public static Decoration getDecoration(Map<? extends Attribute, ?> attributes) {
--- a/jdk/src/java.desktop/share/classes/sun/font/FileFontStrike.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/font/FileFontStrike.java	Fri Jan 09 13:28:02 2015 -0500
@@ -898,7 +898,7 @@
 
     /* The caller of this can be trusted to return a copy of this
      * return value rectangle to public API. In fact frequently it
-     * can't use use this return value directly anyway.
+     * can't use this return value directly anyway.
      * This returns bounds in device space. Currently the only
      * caller is SGV and it converts back to user space.
      * We could change things so that this code does the conversion so
--- a/jdk/src/java.desktop/share/classes/sun/font/FontUtilities.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/font/FontUtilities.java	Fri Jan 09 13:28:02 2015 -0500
@@ -214,7 +214,7 @@
      * char which means it may include undecoded surrogate pairs.
      * The distinction is made so that code which needs to identify all
      * cases in which we do not have a simple mapping from
-     * char->unicode character->glyph can be be identified.
+     * char->unicode character->glyph can be identified.
      * For example measurement cannot simply sum advances of 'chars',
      * the caret in editable text cannot advance one 'char' at a time, etc.
      * These callers really are asking for more than whether 'layout'
--- a/jdk/src/java.desktop/share/classes/sun/font/StandardGlyphVector.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/font/StandardGlyphVector.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1894,9 +1894,9 @@
             }
         }
         catch(Exception e) {
-            buf.append(" " + e.getMessage());
+            buf.append(' ').append(e.getMessage());
         }
-        buf.append("}");
+        buf.append('}');
 
         return buf;
     }
--- a/jdk/src/java.desktop/share/classes/sun/font/SunFontManager.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/font/SunFontManager.java	Fri Jan 09 13:28:02 2015 -0500
@@ -575,7 +575,7 @@
      * that claims to support the Microsoft Windows encoding corresponding to
      * the default file.encoding property of this JRE instance.
      * This narrow value is useful for Swing to decide if the font is useful
-     * for the the Windows Look and Feel, or, if a  composite font should be
+     * for the Windows Look and Feel, or, if a composite font should be
      * used instead.
      * The information used to make the decision is obtained from
      * the ulCodePageRange fields in the font.
@@ -1611,7 +1611,7 @@
      * all non-null file names first.
      * They are added in to a map with nominally the first
      * word in the name of the family as the key. In all the cases
-     * we are using the the family name is a single word, and as is
+     * we are using the family name is a single word, and as is
      * more or less required the family name is the initial sequence
      * in a full name. So lookup first finds the matching description,
      * then registers the whole family, returning the right font.
--- a/jdk/src/java.desktop/share/classes/sun/font/SunLayoutEngine.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/font/SunLayoutEngine.java	Fri Jan 09 13:28:02 2015 -0500
@@ -72,7 +72,7 @@
  * font tables (the selector indicates which).  Then layout is called,
  * the contents are copied (or not), and the stack is destroyed on
  * exit. So the association is between the font/script (layout engine
- * desc) and and one of a few permanent engine objects, which are
+ * desc) and one of a few permanent engine objects, which are
  * handed the key when they need to process something.  In the native
  * case, the engine holds an index, and just passes it together with
  * the key info down to native.  Some default cases are the 'default
--- a/jdk/src/java.desktop/share/classes/sun/font/TrueTypeFont.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/font/TrueTypeFont.java	Fri Jan 09 13:28:02 2015 -0500
@@ -154,7 +154,7 @@
     /* number of table entries in the directory/offsets table */
     int numTables;
 
-    /* The contents of the the directory/offsets table */
+    /* The contents of the directory/offsets table */
     DirectoryEntry []tableDirectory;
 
 //     protected byte []gposTable = null;
@@ -228,7 +228,7 @@
             return false; /* useNatives is false */
         } else if (nativeNames instanceof String) {
             String name = (String)nativeNames;
-            /* Don't do do this for Latin fonts */
+            /* Don't do this for Latin fonts */
             if (name.indexOf("8859") > 0) {
                 checkedNatives = true;
                 return false;
--- a/jdk/src/java.desktop/share/classes/sun/java2d/loops/ProcessPath.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/loops/ProcessPath.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1418,7 +1418,7 @@
                                               */
                                  );
         } else {
-            /* Clamping starting from first vertex of the the processed
+            /* Clamping starting from first vertex of the processed
              * segment
              *
              * CLIPCLAMP(xMin, xMax, x1, y1, x2, y2, x3, y3, res);
@@ -1438,7 +1438,7 @@
                 return;
             }
 
-            /* Clamping starting from last vertex of the the processed
+            /* Clamping starting from last vertex of the processed
              * segment
              *
              * CLIPCLAMP(xMin, xMax, x2, y2, x1, y1, x3, y3, res);
@@ -2062,7 +2062,7 @@
                 if (res == CRES_INVISIBLE) return;
                 lastClipped = IS_CLIPPED(res);
 
-                /* Clamping starting from first vertex of the the processed
+                /* Clamping starting from first vertex of the processed
                  * segment
                  *
                  * CLIPCLAMP(outXMin, outXMax, x1, y1, x2, y2, x3, y3, res);
@@ -2078,7 +2078,7 @@
                     return;
                 }
 
-                /* Clamping starting from last vertex of the the processed
+                /* Clamping starting from last vertex of the processed
                  * segment
                  *
                  * CLIPCLAMP(outXMin, outXMax, x2, y2, x1, y1, x3, y3, res);
--- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/BufferedContext.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/BufferedContext.java	Fri Jan 09 13:28:02 2015 -0500
@@ -451,7 +451,7 @@
     public abstract RenderQueue getRenderQueue();
 
     /**
-     * Saves the the state of this context.
+     * Saves the state of this context.
      * It may reset the current context.
      *
      * Note: must be called while the RenderQueue lock is held.
--- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/DrawImage.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/DrawImage.java	Fri Jan 09 13:28:02 2015 -0500
@@ -364,8 +364,53 @@
                                     int sx1, int sy1, int sx2, int sy2,
                                     Color bgColor)
     {
+        final AffineTransform itx;
+        try {
+            itx = tx.createInverse();
+        } catch (final NoninvertibleTransformException ignored) {
+            // Non-invertible transform means no output
+            return;
+        }
+
+        /*
+         * Find the maximum bounds on the destination that will be
+         * affected by the transformed source.  First, transform all
+         * four corners of the source and then min and max the resulting
+         * destination coordinates of the transformed corners.
+         * Note that tx already has the offset to sx1,sy1 accounted
+         * for so we use the box (0, 0, sx2-sx1, sy2-sy1) as the
+         * source coordinates.
+         */
+        final double[] coords = new double[8];
+        /* corner:  UL      UR      LL      LR   */
+        /* index:  0  1    2  3    4  5    6  7  */
+        /* coord: (0, 0), (w, 0), (0, h), (w, h) */
+        coords[2] = coords[6] = sx2 - sx1;
+        coords[5] = coords[7] = sy2 - sy1;
+        tx.transform(coords, 0, coords, 0, 4);
+        double ddx1, ddy1, ddx2, ddy2;
+        ddx1 = ddx2 = coords[0];
+        ddy1 = ddy2 = coords[1];
+        for (int i = 2; i < coords.length; i += 2) {
+            double d = coords[i];
+            if (ddx1 > d) ddx1 = d;
+            else if (ddx2 < d) ddx2 = d;
+            d = coords[i+1];
+            if (ddy1 > d) ddy1 = d;
+            else if (ddy2 < d) ddy2 = d;
+        }
+
         Region clip = sg.getCompClip();
-        SurfaceData dstData = sg.surfaceData;
+        final int dx1 = Math.max((int) Math.floor(ddx1), clip.lox);
+        final int dy1 = Math.max((int) Math.floor(ddy1), clip.loy);
+        final int dx2 = Math.min((int) Math.ceil(ddx2), clip.hix);
+        final int dy2 = Math.min((int) Math.ceil(ddy2), clip.hiy);
+        if (dx2 <= dx1 || dy2 <= dy1) {
+            // empty destination means no output
+            return;
+        }
+
+        final SurfaceData dstData = sg.surfaceData;
         SurfaceData srcData = dstData.getSourceSurfaceData(img,
                                                            SunGraphics2D.TRANSFORM_GENERIC,
                                                            sg.imageComp,
@@ -429,56 +474,13 @@
             // assert(helper != null);
         }
 
-        AffineTransform itx;
-        try {
-            itx = tx.createInverse();
-        } catch (NoninvertibleTransformException e) {
-            // Non-invertible transform means no output
-            return;
-        }
-
-        /*
-         * Find the maximum bounds on the destination that will be
-         * affected by the transformed source.  First, transform all
-         * four corners of the source and then min and max the resulting
-         * destination coordinates of the transformed corners.
-         * Note that tx already has the offset to sx1,sy1 accounted
-         * for so we use the box (0, 0, sx2-sx1, sy2-sy1) as the
-         * source coordinates.
-         */
-        double coords[] = new double[8];
-        /* corner:  UL      UR      LL      LR   */
-        /* index:  0  1    2  3    4  5    6  7  */
-        /* coord: (0, 0), (w, 0), (0, h), (w, h) */
-        coords[2] = coords[6] = sx2 - sx1;
-        coords[5] = coords[7] = sy2 - sy1;
-        tx.transform(coords, 0, coords, 0, 4);
-        double ddx1, ddy1, ddx2, ddy2;
-        ddx1 = ddx2 = coords[0];
-        ddy1 = ddy2 = coords[1];
-        for (int i = 2; i < coords.length; i += 2) {
-            double d = coords[i];
-            if (ddx1 > d) ddx1 = d;
-            else if (ddx2 < d) ddx2 = d;
-            d = coords[i+1];
-            if (ddy1 > d) ddy1 = d;
-            else if (ddy2 < d) ddy2 = d;
-        }
-        int dx1 = (int) Math.floor(ddx1);
-        int dy1 = (int) Math.floor(ddy1);
-        int dx2 = (int) Math.ceil(ddx2);
-        int dy2 = (int) Math.ceil(ddy2);
-
         SurfaceType dstType = dstData.getSurfaceType();
-        MaskBlit maskblit;
-        Blit blit;
         if (sg.compositeState <= SunGraphics2D.COMP_ALPHA) {
             /* NOTE: We either have, or we can make,
              * a MaskBlit for any alpha composite type
              */
-            maskblit = MaskBlit.getFromCache(SurfaceType.IntArgbPre,
-                                             sg.imageComp,
-                                             dstType);
+            MaskBlit maskblit = MaskBlit.getFromCache(SurfaceType.IntArgbPre,
+                                                      sg.imageComp, dstType);
 
             /* NOTE: We can only use the native TransformHelper
              * func to go directly to the dest if both the helper
@@ -496,27 +498,19 @@
                                  null, 0, 0);
                 return;
             }
-            blit = null;
-        } else {
-            /* NOTE: We either have, or we can make,
-             * a Blit for any composite type, even Custom
-             */
-            maskblit = null;
-            blit = Blit.getFromCache(SurfaceType.IntArgbPre,
-                                     sg.imageComp,
-                                     dstType);
         }
 
         // We need to transform to a temp image and then copy
         // just the pieces that are valid data to the dest.
-        BufferedImage tmpimg = new BufferedImage(dx2-dx1, dy2-dy1,
+        final int w = dx2 - dx1;
+        final int h = dy2 - dy1;
+        BufferedImage tmpimg = new BufferedImage(w, h,
                                                  BufferedImage.TYPE_INT_ARGB_PRE);
         SurfaceData tmpData = SurfaceData.getPrimarySurfaceData(tmpimg);
         SurfaceType tmpType = tmpData.getSurfaceType();
-        MaskBlit tmpmaskblit =
-            MaskBlit.getFromCache(SurfaceType.IntArgbPre,
-                                  CompositeType.SrcNoEa,
-                                  tmpType);
+        MaskBlit tmpmaskblit = MaskBlit.getFromCache(SurfaceType.IntArgbPre,
+                                                     CompositeType.SrcNoEa,
+                                                     tmpType);
         /*
          * The helper function fills a temporary edges buffer
          * for us with the bounding coordinates of each scanline
@@ -531,7 +525,7 @@
          *
          * edges thus has to be h*2+2 in length
          */
-        int edges[] = new int[(dy2-dy1)*2+2];
+        final int[] edges = new int[h * 2 + 2];
         // It is important that edges[0]=edges[1]=0 when we call
         // Transform in case it must return early and we would
         // not want to render anything on an error condition.
@@ -539,35 +533,17 @@
                          AlphaComposite.Src, null,
                          itx, interpType,
                          sx1, sy1, sx2, sy2,
-                         0, 0, dx2-dx1, dy2-dy1,
+                         0, 0, w, h,
                          edges, dx1, dy1);
 
-        /*
-         * Now copy the results, scanline by scanline, into the dest.
-         * The edges array helps us minimize the work.
+        final Region region = Region.getInstance(dx1, dy1, dx2, dy2, edges);
+        clip = clip.getIntersection(region);
+
+        /* NOTE: We either have, or we can make,
+         * a Blit for any composite type, even Custom
          */
-        int index = 2;
-        for (int y = edges[0]; y < edges[1]; y++) {
-            int relx1 = edges[index++];
-            int relx2 = edges[index++];
-            if (relx1 >= relx2) {
-                continue;
-            }
-            if (maskblit != null) {
-                maskblit.MaskBlit(tmpData, dstData,
-                                  sg.composite, clip,
-                                  relx1, y,
-                                  dx1+relx1, dy1+y,
-                                  relx2 - relx1, 1,
-                                  null, 0, 0);
-            } else {
-                blit.Blit(tmpData, dstData,
-                          sg.composite, clip,
-                          relx1, y,
-                          dx1+relx1, dy1+y,
-                          relx2 - relx1, 1);
-            }
-        }
+        final Blit blit = Blit.getFromCache(tmpType, sg.imageComp, dstType);
+        blit.Blit(tmpData, dstData, sg.composite, clip, 0, 0, dx1, dy1, w, h);
     }
 
     // Render an image using only integer translation
--- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/Region.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/Region.java	Fri Jan 09 13:28:02 2015 -0500
@@ -30,6 +30,8 @@
 import java.awt.geom.AffineTransform;
 import java.awt.geom.RectangularShape;
 
+import sun.java2d.loops.TransformHelper;
+
 /**
  * This class encapsulates a definition of a two dimensional region which
  * consists of a number of Y ranges each containing multiple X bands.
@@ -160,6 +162,15 @@
         this.hiy = hiy;
     }
 
+    private Region(int lox, int loy, int hix, int hiy, int[] bands, int end) {
+        this.lox = lox;
+        this.loy = loy;
+        this.hix = hix;
+        this.hiy = hiy;
+        this.bands = bands;
+        this.endIndex = end;
+    }
+
     /**
      * Returns a Region object covering the pixels which would be
      * touched by a fill or clip operation on a Graphics implementation
@@ -256,6 +267,44 @@
     }
 
     /**
+     * Returns a Region object with a rectangle of interest specified by the
+     * indicated rectangular area in lox, loy, hix, hiy and edges array, which
+     * is located relative to the rectangular area. Edges array - 0,1 are y
+     * range, 2N,2N+1 are x ranges, 1 per y range.
+     *
+     * @see TransformHelper
+     */
+    static Region getInstance(final int lox, final int loy, final int hix,
+                              final int hiy, final int[] edges) {
+        final int y1 = edges[0];
+        final int y2 = edges[1];
+        if (hiy <= loy || hix <= lox || y2 <= y1) {
+            return EMPTY_REGION;
+        }
+        // rowsNum * (3 + 1 * 2)
+        final int[] bands = new int[(y2 - y1) * 5];
+        int end = 0;
+        int index = 2;
+        for (int y = y1; y < y2; ++y) {
+            final int spanlox = Math.max(clipAdd(lox, edges[index++]), lox);
+            final int spanhix = Math.min(clipAdd(lox, edges[index++]), hix);
+            if (spanlox < spanhix) {
+                final int spanloy = Math.max(clipAdd(loy, y), loy);
+                final int spanhiy = Math.min(clipAdd(spanloy, 1), hiy);
+                if (spanloy < spanhiy) {
+                    bands[end++] = spanloy;
+                    bands[end++] = spanhiy;
+                    bands[end++] = 1; // 1 span per row
+                    bands[end++] = spanlox;
+                    bands[end++] = spanhix;
+                }
+            }
+        }
+        return end != 0 ? new Region(lox, loy, hix, hiy, bands, end)
+                        : EMPTY_REGION;
+    }
+
+    /**
      * Returns a Region object with a rectangle of interest specified
      * by the indicated Rectangle object.
      * <p>
--- a/jdk/src/java.desktop/share/classes/sun/print/PSPrinterJob.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/print/PSPrinterJob.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1214,6 +1214,7 @@
      * of distinct PS fonts needed to draw this text. This saves us
      * doing this processing one extra time.
      */
+    @SuppressWarnings("deprecation")
     protected int platformFontCount(Font font, String str) {
         if (mFontProps == null) {
             return 0;
@@ -1228,6 +1229,7 @@
         return (psFonts == null) ? 0 : psFonts.length;
     }
 
+    @SuppressWarnings("deprecation")
      protected boolean textOut(Graphics g, String str, float x, float y,
                                Font mLastFont, FontRenderContext frc,
                                float width) {
@@ -2123,6 +2125,7 @@
          * @param w the width of the applet panel in the browser window
          * @param h the width of the applet panel in the browser window
          */
+        @SuppressWarnings("deprecation")
         public PluginPrinter(Component applet,
                              PrintStream stream,
                              int x, int y, int w, int h) {
--- a/jdk/src/java.desktop/share/classes/sun/print/PathGraphics.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/print/PathGraphics.java	Fri Jan 09 13:28:02 2015 -0500
@@ -888,7 +888,7 @@
              * since it doesn't actually require "layout" (even though its
              * considered a layout attribute), it just requires a fractional
              * tweak to the[default]advances. So we need to specifically
-             * check for tracking until such time as as we can trust
+             * check for tracking until such time as we can trust
              * the GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS bit.
              */
             Map<TextAttribute, ?> map = font.getAttributes();
--- a/jdk/src/java.desktop/share/classes/sun/print/PeekGraphics.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/print/PeekGraphics.java	Fri Jan 09 13:28:02 2015 -0500
@@ -871,7 +871,7 @@
      * paint or color, and composite attributes.
      * For characters in script systems such as Hebrew and Arabic,
      * the glyphs may be draw from right to left, in which case the
-     * coordinate supplied is the the location of the leftmost character
+     * coordinate supplied is the location of the leftmost character
      * on the baseline.
      * @param iterator the iterator whose text is to be drawn
      * @param x,y the coordinates where the iterator's text should be drawn.
@@ -897,7 +897,7 @@
      * paint or color, and composite attributes.
      * For characters in script systems such as Hebrew and Arabic,
      * the glyphs may be draw from right to left, in which case the
-     * coordinate supplied is the the location of the leftmost character
+     * coordinate supplied is the location of the leftmost character
      * on the baseline.
      * @param iterator the iterator whose text is to be drawn
      * @param x,y the coordinates where the iterator's text should be drawn.
--- a/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java	Fri Jan 09 13:28:02 2015 -0500
@@ -837,7 +837,7 @@
      * The resolution of the page is chosen so that it
      * is similar to the screen resolution.
      * Except (since 1.3) when the application specifies a resolution.
-     * In that case it it scaled accordingly.
+     * In that case it is scaled accordingly.
      */
     public Dimension getPageDimension() {
         double wid, hgt, scale;
--- a/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java	Fri Jan 09 13:28:02 2015 -0500
@@ -744,7 +744,7 @@
      * paint or color, and composite attributes.
      * For characters in script systems such as Hebrew and Arabic,
      * the glyphs may be draw from right to left, in which case the
-     * coordinate supplied is the the location of the leftmost character
+     * coordinate supplied is the location of the leftmost character
      * on the baseline.
      * @param iterator the iterator whose text is to be drawn
      * @param x,y the coordinates where the iterator's text should be drawn.
@@ -769,7 +769,7 @@
      * paint or color, and composite attributes.
      * For characters in script systems such as Hebrew and Arabic,
      * the glyphs may be draw from right to left, in which case the
-     * coordinate supplied is the the location of the leftmost character
+     * coordinate supplied is the location of the leftmost character
      * on the baseline.
      * @param iterator the iterator whose text is to be drawn
      * @param x,y the coordinates where the iterator's text should be drawn.
--- a/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java	Fri Jan 09 13:28:02 2015 -0500
@@ -745,6 +745,7 @@
      * return a PageFormat corresponding to the updated attributes,
      * or null if the user cancelled the dialog.
      */
+    @SuppressWarnings("deprecation")
     public PageFormat pageDialog(final PrintRequestAttributeSet attributes)
         throws HeadlessException {
         if (GraphicsEnvironment.isHeadless()) {
--- a/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java	Fri Jan 09 13:28:02 2015 -0500
@@ -792,6 +792,7 @@
             return label;
         }
 
+        @SuppressWarnings("deprecation")
         public void actionPerformed(ActionEvent e) {
             Object source = e.getSource();
 
--- a/jdk/src/java.desktop/share/classes/sun/swing/AccumulativeRunnable.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/swing/AccumulativeRunnable.java	Fri Jan 09 13:28:02 2015 -0500
@@ -64,7 +64,7 @@
  * </pre>
  *
  * <p>
- * Say we want want to implement addDirtyRegion(Rectangle rect)
+ * Say we want to implement addDirtyRegion(Rectangle rect)
  * which sends this region to the
  * handleDirtyRegions(List<Rect> regiouns) on the EDT.
  * addDirtyRegions better be accumulated before handling on the EDT.
--- a/jdk/src/java.desktop/share/classes/sun/swing/CachedPainter.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/swing/CachedPainter.java	Fri Jan 09 13:28:02 2015 -0500
@@ -79,7 +79,7 @@
     }
 
     /**
-     * Renders the cached image to the the passed in <code>Graphic</code>.
+     * Renders the cached image to the passed in <code>Graphic</code>.
      * If there is no cached image <code>paintToImage</code> will be invoked.
      * <code>paintImage</code> is invoked to paint the cached image.
      *
--- a/jdk/src/java.desktop/share/classes/sun/swing/FilePane.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/swing/FilePane.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1355,6 +1355,7 @@
     /**
      * @param index visual index of the file to be edited
      */
+    @SuppressWarnings("deprecation")
     private void editFileName(int index) {
         JFileChooser chooser = getFileChooser();
         File currentDirectory = chooser.getCurrentDirectory();
@@ -1521,6 +1522,7 @@
     }
 
 
+    @SuppressWarnings("deprecation")
     void setFileSelected() {
         if (getFileChooser().isMultiSelectionEnabled() && !isDirectorySelected()) {
             File[] files = getFileChooser().getSelectedFiles(); // Should be selected
--- a/jdk/src/java.desktop/share/classes/sun/swing/JLightweightFrame.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/swing/JLightweightFrame.java	Fri Jan 09 13:28:02 2015 -0500
@@ -241,6 +241,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     public void notifyDisplayChanged(final int scaleFactor) {
         if (scaleFactor != this.scaleFactor) {
             if (!copyBufferEnabled) content.paintLock();
@@ -260,6 +261,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     public void addNotify() {
         super.addNotify();
         if (getPeer() instanceof DisplayChangedListener) {
--- a/jdk/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java	Fri Jan 09 13:28:02 2015 -0500
@@ -358,6 +358,7 @@
      * @param c Graphics Graphics
      * @param font Font to get FontMetrics for
      */
+    @SuppressWarnings("deprecation")
     public static FontMetrics getFontMetrics(JComponent c, Graphics g,
                                              Font font) {
         if (c != null) {
@@ -1706,6 +1707,7 @@
      * This is not a general-purpose method and is here only to permit
      * sharing code.
      */
+    @SuppressWarnings("deprecation")
     public static boolean tabbedPaneChangeFocusTo(Component comp) {
         if (comp != null) {
             if (comp.isFocusTraversable()) {
--- a/jdk/src/java.desktop/share/native/common/font/fontscalerdefs.h	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/native/common/font/fontscalerdefs.h	Fri Jan 09 13:28:02 2015 -0500
@@ -87,7 +87,7 @@
 #define t2kScalarAverage(a, b) (((a) + (b)) / (t2kScalar)(2))
 
   /* managed: 1 means the glyph has a hardware cached
-   * copy, and its freeing is managed by the the usual
+   * copy, and its freeing is managed by the usual
    * 2D disposer code.
    * A value of 0 means its either unaccelerated (and so has no cellInfos)
    * or we want to free this in a different way.
--- a/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLBlitLoops.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLBlitLoops.c	Fri Jan 09 13:28:02 2015 -0500
@@ -674,6 +674,9 @@
                         viaTexture = JNI_TRUE;
                         break;
 #endif
+                    case OGLC_VENDOR_INTEL:
+                        viaTexture = JNI_TRUE;
+                        break;
                     default:
                         // just use the glDrawPixels() codepath
                         viaTexture = JNI_FALSE;
--- a/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLContext.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLContext.c	Fri Jan 09 13:28:02 2015 -0500
@@ -919,8 +919,8 @@
             vcap = OGLC_VENDOR_ATI;
         } else if (strncmp(vendor, "NVIDIA", 6) == 0) {
             vcap = OGLC_VENDOR_NVIDIA;
-        } else if (strncmp(vendor, "Sun", 3) == 0) {
-            vcap = OGLC_VENDOR_SUN;
+        } else if (strncmp(vendor, "Intel", 5) == 0) {
+            vcap = OGLC_VENDOR_INTEL;
         }
         // REMIND: new in 7 - check if needs fixing
         *caps |= ((vcap & OGLC_VCAP_MASK) << OGLC_VCAP_OFFSET);
--- a/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLContext.h	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLContext.h	Fri Jan 09 13:28:02 2015 -0500
@@ -152,7 +152,7 @@
 #define OGLC_VENDOR_OTHER  0
 #define OGLC_VENDOR_ATI    1
 #define OGLC_VENDOR_NVIDIA 2
-#define OGLC_VENDOR_SUN    3
+#define OGLC_VENDOR_INTEL  3
 
 #define OGLC_VCAP_MASK     0x3
 #define OGLC_VCAP_OFFSET   24
--- a/jdk/src/java.desktop/share/native/libawt/awt/image/gif/gifdecoder.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/native/libawt/awt/image/gif/gifdecoder.c	Fri Jan 09 13:28:02 2015 -0500
@@ -399,7 +399,7 @@
          * and therefore we have to continue looping through data
          * but skip internal output loop.
          *
-         * In particular this is is possible when
+         * In particular this is possible when
          * width of the frame is set to zero. If
          * global width (i.e. width of the logical screen)
          * is zero too then zero-length scanline buffer
--- a/jdk/src/java.desktop/share/native/libawt/java2d/loops/ProcessPath.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/native/libawt/java2d/loops/ProcessPath.c	Fri Jan 09 13:28:02 2015 -0500
@@ -1418,7 +1418,7 @@
                                             */
                                );
     } else {
-        /* Clamping starting from first vertex of the the processed segment
+        /* Clamping starting from first vertex of the processed segment
          */
         CLIPCLAMP(xMin, xMax, x1, y1, x2, y2, x3, y3, jfloat, res);
         X1 = (jint)(x1*MDP_MULT);
@@ -1435,7 +1435,7 @@
             return;
         }
 
-        /* Clamping starting from last vertex of the the processed segment
+        /* Clamping starting from last vertex of the processed segment
          */
         CLIPCLAMP(xMin, xMax, x2, y2, x1, y1, x3, y3, jfloat, res);
 
@@ -2121,7 +2121,7 @@
         if (res == CRES_INVISIBLE) return;
         lastClipped = IS_CLIPPED(res);
 
-        /* Clamping starting from first vertex of the the processed segment */
+        /* Clamping starting from first vertex of the processed segment */
         CLIPCLAMP(outXMin, outXMax, x1, y1, x2, y2, x3, y3, jint, res);
 
         /* Clamping only by left boundary */
@@ -2133,7 +2133,7 @@
             return;
         }
 
-        /* Clamping starting from last vertex of the the processed segment */
+        /* Clamping starting from last vertex of the processed segment */
         CLIPCLAMP(outXMin, outXMax, x2, y2, x1, y1, x3, y3, jint, res);
 
         /* Checking if there was a clip by right boundary */
--- a/jdk/src/java.desktop/share/native/libfontmanager/freetypeScaler.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/native/libfontmanager/freetypeScaler.c	Fri Jan 09 13:28:02 2015 -0500
@@ -183,7 +183,7 @@
                                           bBuffer, offset, numBytes);
             return bread;
         } else {
-            /* We probably hit bug bug 4845371. For reasons that
+            /* We probably hit bug 4845371. For reasons that
              * are currently unclear, the call stacks after the initial
              * createScaler call that read large amounts of data seem to
              * be OK and can create the byte buffer above, but this code
@@ -253,7 +253,7 @@
        We can consider sharing freetype library between different
        scalers. However, Freetype docs suggest to use different libraries
        for different threads. Also, our architecture implies that single
-       FontScaler object is shared for for different sizes/transforms/styles
+       FontScaler object is shared for different sizes/transforms/styles
        of the same font.
 
        On other hand these methods can not be concurrently executed
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/LayoutEngine.h	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/LayoutEngine.h	Fri Jan 09 13:28:02 2015 -0500
@@ -297,7 +297,7 @@
      * This method does character to glyph mapping. The default implementation
      * uses the font instance to do the mapping. It will allocate the glyph and
      * character index arrays if they're not already allocated. If it allocates the
-     * character index array, it will fill it it.
+     * character index array, it will fill it.
      *
      * This method supports right to left
      * text with the ability to store the glyphs in reverse order, and by supporting
@@ -537,4 +537,3 @@
 
 U_NAMESPACE_END
 #endif
-
--- a/jdk/src/java.desktop/share/native/liblcms/LCMS.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/share/native/liblcms/LCMS.c	Fri Jan 09 13:28:02 2015 -0500
@@ -879,7 +879,7 @@
         cmsCloseProfile(p);
         p =  NULL;
     } else {
-        // do final check whether we can read and handle the the target tag.
+        // do final check whether we can read and handle the target tag.
         const void* pTag = cmsReadTag(pfSanity, sig);
         if (pTag == NULL) {
             // the tag can not be cooked
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/InfoWindow.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/InfoWindow.java	Fri Jan 09 13:28:02 2015 -0500
@@ -71,6 +71,7 @@
     }
 
     // Must be executed on EDT.
+    @SuppressWarnings("deprecation")
     protected void show(Point corner, int indent) {
         assert SunToolkit.isDispatchThreadForAppContext(this);
 
@@ -98,6 +99,7 @@
         closer.schedule();
     }
 
+    @SuppressWarnings("deprecation")
     public void hide() {
         closer.close();
     }
@@ -125,6 +127,7 @@
         }
 
         // WARNING: this method may be executed on Toolkit thread.
+        @SuppressWarnings("deprecation")
         private void doClose() {
             SunToolkit.executeOnEventHandlerThread(InfoWindow.this, new Runnable() {
                 public void run() {
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/ListHelper.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/ListHelper.java	Fri Jan 09 13:28:02 2015 -0500
@@ -48,7 +48,7 @@
     private final int BORDER_WIDTH; // Width of border drawn around the list
                                     // of items
     private final int ITEM_MARGIN;  // Margin between the border of the list
-                                    // of items and and item's bg, and between
+                                    // of items and item's bg, and between
                                     // items
     private final int TEXT_SPACE;   // Space between the edge of an item and
                                     // the text
@@ -225,6 +225,7 @@
         return index == focusedIndex;
     }
 
+    @SuppressWarnings("deprecation")
     void setFont(Font newFont) {
         if (newFont != font) {
             font = newFont;
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XBaseMenuWindow.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XBaseMenuWindow.java	Fri Jan 09 13:28:02 2015 -0500
@@ -326,6 +326,7 @@
      * check for adding duplicate items
      * @param item item to add
      */
+    @SuppressWarnings("deprecation")
     public void addItem(MenuItem item) {
         XMenuItemPeer mp = (XMenuItemPeer)item.getPeer();
         if (mp != null) {
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XChoicePeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XChoicePeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -499,6 +499,7 @@
     }
 
     // Stolen from TinyChoicePeer
+    @SuppressWarnings("deprecation")
     public Dimension getMinimumSize() {
         // TODO: move this impl into ListHelper?
         FontMetrics fm = getFontMetrics(target.getFont());
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XClipboard.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XClipboard.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -281,6 +281,11 @@
             }
         }
 
-        checkChange(formats);
+        XToolkit.awtUnlock();
+        try {
+            checkChange(formats);
+        } finally {
+            XToolkit.awtLock();
+        }
     }
 }
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -167,6 +167,7 @@
         return System.getProperty("sun.awt.X11.XComponentPeer.reparentNotSupported", "false").equals("false");
     }
 
+    @SuppressWarnings("deprecation")
     public boolean isObscured() {
         Container container  = (target instanceof Container) ?
             (Container)target : target.getParent();
@@ -279,6 +280,7 @@
     }
 
     // TODO: consider moving it to KeyboardFocusManagerPeerImpl
+    @SuppressWarnings("deprecation")
     final public boolean requestFocus(Component lightweightChild, boolean temporary,
                                       boolean focusedWindowChangeAllowed, long time,
                                       CausedFocusEvent.Cause cause)
@@ -388,6 +390,7 @@
     /**
      * @see java.awt.peer.ComponentPeer
      */
+    @SuppressWarnings("deprecation")
     public void setEnabled(final boolean value) {
         if (enableLog.isLoggable(PlatformLogger.Level.FINE)) {
             enableLog.fine("{0}ing {1}", (value ? "Enabl" : "Disabl"), this);
@@ -1324,6 +1327,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     private void addTree(Collection<Long> order, Set<Long> set, Container cont) {
         for (int i = 0; i < cont.getComponentCount(); i++) {
             Component comp = cont.getComponent(i);
@@ -1344,6 +1348,7 @@
 
     /****** DropTargetPeer implementation ********************/
 
+    @SuppressWarnings("deprecation")
     public void addDropTarget(DropTarget dt) {
         Component comp = target;
         while(!(comp == null || comp instanceof Window)) {
@@ -1358,6 +1363,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     public void removeDropTarget(DropTarget dt) {
         Component comp = target;
         while(!(comp == null || comp instanceof Window)) {
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDragSourceContextPeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDragSourceContextPeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -110,6 +110,7 @@
         return theInstance;
     }
 
+    @SuppressWarnings("deprecation")
     protected void startDrag(Transferable transferable,
                              long[] formats, Map<Long, DataFlavor> formatMap) {
         Component component = getTrigger().getComponent();
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDropTargetContextPeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDropTargetContextPeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -188,6 +188,7 @@
     // If source is an XEmbedCanvasPeer, passes the event to it for processing and
     // return true if the event is forwarded to the XEmbed child.
     // Otherwise, does nothing and return false.
+    @SuppressWarnings("deprecation")
     private boolean processSunDropTargetEvent(SunDropTargetEvent event) {
         Object source = event.getSource();
 
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbedChildProxyPeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbedChildProxyPeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -166,6 +166,7 @@
         XToolkit.postEvent(XToolkit.targetToAppContext(proxy), event);
     }
 
+    @SuppressWarnings("deprecation")
     boolean simulateMotifRequestFocus(Component lightweightChild, boolean temporary,
                                       boolean focusedWindowChangeAllowed, long time)
     {
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddedFrame.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddedFrame.java	Fri Jan 09 13:28:02 2015 -0500
@@ -61,6 +61,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     public void addNotify()
     {
         if (getPeer() == null) {
@@ -77,6 +78,7 @@
     /*
      * The method shouldn't be called in case of active XEmbed.
      */
+    @SuppressWarnings("deprecation")
     public boolean traverseIn(boolean direction) {
         XEmbeddedFramePeer peer = (XEmbeddedFramePeer)getPeer();
         if (peer != null) {
@@ -89,6 +91,7 @@
         return false;
     }
 
+    @SuppressWarnings("deprecation")
     protected boolean traverseOut(boolean direction) {
         XEmbeddedFramePeer xefp = (XEmbeddedFramePeer) getPeer();
         if (direction == FORWARD) {
@@ -103,6 +106,7 @@
     /*
      * The method shouldn't be called in case of active XEmbed.
      */
+    @SuppressWarnings("deprecation")
     public void synthesizeWindowActivation(boolean doActivate) {
         XEmbeddedFramePeer peer = (XEmbeddedFramePeer)getPeer();
         if (peer != null) {
@@ -114,12 +118,14 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     public void registerAccelerator(AWTKeyStroke stroke) {
         XEmbeddedFramePeer xefp = (XEmbeddedFramePeer) getPeer();
         if (xefp != null) {
             xefp.registerAccelerator(stroke);
         }
     }
+    @SuppressWarnings("deprecation")
     public void unregisterAccelerator(AWTKeyStroke stroke) {
         XEmbeddedFramePeer xefp = (XEmbeddedFramePeer) getPeer();
         if (xefp != null) {
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddedFramePeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddedFramePeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -251,7 +251,7 @@
                 embedder.registerAccelerator(iter.next(), i++);
             }
         }
-        // Now we know that the the embedder is an XEmbed server, so we
+        // Now we know that the embedder is an XEmbed server, so we
         // reregister the drop target to enable XDnD protocol support via
         // XEmbed.
         updateDropTarget();
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddingContainer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddingContainer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,6 +46,7 @@
         XToolkit.removeEventDispatcher(embedder.getWindow(), this);
     }
 
+    @SuppressWarnings("deprecation")
     void add(long child) {
         if (checkXEmbed(child)) {
             Component proxy = createChildProxy(child);
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XFileDialogPeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XFileDialogPeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -135,6 +135,7 @@
         this.target = target;
     }
 
+    @SuppressWarnings("deprecation")
     private void init(FileDialog target) {
         fileDialog = target; //new Dialog(target, target.getTitle(), false);
         this.title = target.getTitle();
@@ -414,6 +415,7 @@
     /**
      * handle the cancel event
      */
+    @SuppressWarnings("deprecation")
     void handleCancel() {
         KeyboardFocusManager.getCurrentKeyboardFocusManager()
             .removeKeyEventDispatcher(this);
@@ -435,6 +437,7 @@
     /**
      * handle the quit event
      */
+    @SuppressWarnings("deprecation")
     void handleQuitButton() {
         dir = null;
         file = null;
@@ -444,6 +447,7 @@
     /**
      * set the entry of the new dir with f
      */
+    @SuppressWarnings("deprecation")
     void setFilterEntry(String d, String f) {
         File fe = new File(d);
 
@@ -638,6 +642,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     public boolean dispatchKeyEvent(KeyEvent keyEvent) {
         int id = keyEvent.getID();
         int keyCode = keyEvent.getKeyCode();
@@ -774,6 +779,7 @@
     }
 
     // 03/02/2005 b5097243 Pressing 'ESC' on a file dlg does not dispose the dlg on Xtoolkit
+    @SuppressWarnings("deprecation")
     public void setVisible(boolean b){
         if (fileDialog == null) {
             init(target);
@@ -852,6 +858,7 @@
     public final static int VERTICAL = 1;
     int orientation;
 
+    @SuppressWarnings("deprecation")
     public Separator(int length, int thickness, int orient) {
         super();
         orientation = orient;
@@ -863,6 +870,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     public void paint(Graphics g) {
         int x1, y1, x2, y2;
         Rectangle bbox = bounds();
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XFramePeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XFramePeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -108,6 +108,7 @@
         setExtendedState(state);
     }
 
+    @SuppressWarnings("deprecation")
     public void setMenuBar(MenuBar mb) {
         // state_lock should always be the second after awt_lock
         XToolkit.awtLock();
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XInputMethod.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XInputMethod.java	Fri Jan 09 13:28:02 2015 -0500
@@ -137,6 +137,7 @@
         XToolkit.awtUnlock();
     }
 
+    @SuppressWarnings("deprecation")
     long getCurrentParentWindow() {
         return ((XWindow)clientComponentWindow.getPeer()).getContentWindow();
     }
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuBarPeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuBarPeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -163,6 +163,7 @@
         postPaintEvent();
     }
 
+    @SuppressWarnings("deprecation")
     public void addHelpMenu(Menu m) {
         XMenuPeer mp = (XMenuPeer)m.getPeer();
         synchronized(getMenuTreeLock()) {
@@ -179,6 +180,7 @@
     /**
      * called from XFramePeer.setMenuBar
      */
+    @SuppressWarnings("deprecation")
     public void init(Frame frame) {
         this.target = frame;
         this.framePeer = (XFramePeer)frame.getPeer();
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMouseInfoPeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMouseInfoPeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -75,6 +75,7 @@
         return 0;
     }
 
+    @SuppressWarnings("deprecation")
     public boolean isWindowUnderMouse(Window w) {
 
         long display = XToolkit.getDisplay();
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XPanelPeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XPanelPeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,6 +76,7 @@
 
     }
 
+    @SuppressWarnings("deprecation")
     public void setBackground(Color c) {
         Component comp;
         int i;
@@ -101,6 +102,7 @@
         setForegroundForHierarchy((Container) target, c);
     }
 
+    @SuppressWarnings("deprecation")
     private void setForegroundForHierarchy(Container cont, Color c) {
         synchronized(target.getTreeLock()) {
             int n = cont.getComponentCount();
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRepaintArea.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRepaintArea.java	Fri Jan 09 13:28:02 2015 -0500
@@ -55,6 +55,7 @@
     /**
      * Calls <code>Component.paint(Graphics)</code> with given Graphics.
      */
+    @SuppressWarnings("deprecation")
     protected void paintComponent(Component comp, Graphics g) {
         if (comp != null) {
             final XComponentPeer peer = (XComponentPeer) comp.getPeer();
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XScrollPanePeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XScrollPanePeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -141,6 +141,7 @@
         repaint();
     }
 
+    @SuppressWarnings("deprecation")
     Dimension getChildSize() {
         ScrollPane sp = (ScrollPane)target;
         if (sp.countComponents() > 0) {
@@ -151,6 +152,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     boolean setScrollbarSpace() {
         ScrollPane sp = (ScrollPane)target;
         boolean changed = false;
@@ -202,7 +204,7 @@
 
         // Check to see if we hid either of the scrollbars but left
         // ourselves scrolled off of the top and/or right of the pane.
-        // If we did, we need to scroll to the top and/or right of of
+        // If we did, we need to scroll to the top and/or right of
         // the pane to make it visible.
         //
         // Reminder: see if there is a better place to put this code.
@@ -268,6 +270,7 @@
     /**
      * Scroll the contents to position x, y
      */
+    @SuppressWarnings("deprecation")
     void scroll(int x, int y, int flag, int type) {
         checkSecurity();
         ScrollPane sp = (ScrollPane)target;
@@ -569,6 +572,7 @@
      * ToDo(aim): needs to query native motif for more accurate size and
      * color information.
      */
+    @SuppressWarnings("deprecation")
     public void print(Graphics g) {
         ScrollPane sp = (ScrollPane)target;
         Dimension d = sp.size();
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XScrollbarPeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XScrollbarPeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,7 @@
         DEFAULT_WIDTH_LINUX = XToolkit.getUIDefaults().getInt("ScrollBar.defaultWidth");
     }
 
+    @SuppressWarnings("deprecation")
     public void preInit(XCreateWindowParams params) {
         super.preInit(params);
         Scrollbar target = (Scrollbar) this.target;
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1164,6 +1164,7 @@
         }
 
         @Override
+        @SuppressWarnings("deprecation")
         public ComponentPeer getPeer() {
             return (ComponentPeer) (xwin);
         }
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -208,6 +208,7 @@
      * @see java.awt.peer.TextComponentPeer
      */
     @Override
+    @SuppressWarnings("deprecation")
     public String getText() {
         return xtext.getText();
     }
@@ -287,7 +288,7 @@
     }
 
     /**
-     * Deselects the the highlighted text.
+     * Deselects the highlighted text.
      */
     public void deselect() {
         int selStart=xtext.getSelectionStart();
@@ -564,6 +565,7 @@
         }
 
         @Override
+        @SuppressWarnings("deprecation")
         public void actionPerformed( ActionEvent actionEvent ) {
             peer.postEvent(new ActionEvent(peer.target,
                                            ActionEvent.ACTION_PERFORMED,
@@ -598,6 +600,7 @@
         }
 
         @Override
+        @SuppressWarnings("deprecation")
         public ComponentPeer getPeer() {
             return (ComponentPeer) peer;
         }
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java	Fri Jan 09 13:28:02 2015 -0500
@@ -103,11 +103,11 @@
     static TreeMap<Long, XBaseWindow> winMap = new TreeMap<>();
     static HashMap<Object, Object> specialPeerMap = new HashMap<>();
     static HashMap<Long, Collection<XEventDispatcher>> winToDispatcher = new HashMap<>();
-    private static long _display;
     static UIDefaults uidefaults;
-    static X11GraphicsEnvironment localEnv;
-    static X11GraphicsDevice device;
-    static final X11GraphicsConfig config;
+    static final X11GraphicsEnvironment localEnv;
+    private static final X11GraphicsDevice device;
+    private static final X11GraphicsConfig config;
+    private static final long display;
     static int awt_multiclick_time;
     static boolean securityWarningEnabled;
 
@@ -118,15 +118,16 @@
     static {
         initSecurityWarning();
         if (GraphicsEnvironment.isHeadless()) {
+            localEnv = null;
+            device = null;
             config = null;
+            display = 0;
         } else {
             localEnv = (X11GraphicsEnvironment) GraphicsEnvironment
                 .getLocalGraphicsEnvironment();
             device = (X11GraphicsDevice) localEnv.getDefaultScreenDevice();
-            config = (X11GraphicsConfig) (device.getDefaultConfiguration());
-            if (device != null) {
-                _display = device.getDisplay();
-            }
+            config = (X11GraphicsConfig) device.getDefaultConfiguration();
+            display = device.getDisplay();
             setupModifierMap();
             initIDs();
             setBackingStoreType();
@@ -197,10 +198,18 @@
         }
     }
 
-    static Object displayLock = new Object();
-
+    /**
+     * Returns the X11 Display of the default screen device.
+     *
+     * @return X11 Display
+     * @throws AWTError thrown if local GraphicsEnvironment is null, which
+     *         means we are in the headless environment
+     */
     public static long getDisplay() {
-        return _display;
+        if (localEnv == null) {
+            throw new AWTError("Local GraphicsEnvironment must not be null");
+        }
+        return display;
     }
 
     public static long getDefaultRootWindow() {
@@ -2429,12 +2438,14 @@
             awtUnlock();
         }
     }
+    @SuppressWarnings("deprecation")
     public void grab(Window w) {
         if (w.getPeer() != null) {
             ((XWindowPeer)w.getPeer()).setGrab(true);
         }
     }
 
+    @SuppressWarnings("deprecation")
     public void ungrab(Window w) {
         if (w.getPeer() != null) {
            ((XWindowPeer)w.getPeer()).setGrab(false);
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTrayIconPeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTrayIconPeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -347,6 +347,7 @@
     }
 
     // It's synchronized with disposal by EDT.
+    @SuppressWarnings("deprecation")
     public void showPopupMenu(int x, int y) {
         if (isDisposed())
             return;
@@ -415,6 +416,7 @@
         canvas.addMouseMotionListener(eventProxy);
     }
 
+    @SuppressWarnings("deprecation")
     long getWindow() {
         return ((XEmbeddedFramePeer)eframe.getPeer()).getWindow();
     }
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java	Fri Jan 09 13:28:02 2015 -0500
@@ -282,6 +282,7 @@
         return reparented;
     }
 
+    @SuppressWarnings("deprecation")
     static long getParentWindowID(Component target) {
 
         ComponentPeer peer = target.getParent().getPeer();
@@ -298,6 +299,7 @@
     }
 
 
+    @SuppressWarnings("deprecation")
     static XWindow getParentXWindowObject(Component target) {
         if (target == null) return null;
         Component temp = target.getParent();
@@ -374,6 +376,7 @@
                            target.getFont());
     }
 
+    @SuppressWarnings("deprecation")
     public FontMetrics getFontMetrics(Font font) {
         return Toolkit.getDefaultToolkit().getFontMetrics(font);
     }
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -210,6 +210,7 @@
     private static native String getLocalHostname();
     private static native int getJvmPID();
 
+    @SuppressWarnings("deprecation")
     void postInit(XCreateWindowParams params) {
         super.postInit(params);
 
@@ -400,6 +401,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     public void recursivelySetIcon(java.util.List<IconInfo> icons) {
         dumpIcons(winAttr.icons);
         setIconHints(icons);
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -325,6 +325,7 @@
         return (isFullScreenSupported() && (getFullScreenWindow() != null));
     }
 
+    @SuppressWarnings("deprecation")
     private static void enterFullScreenExclusive(Window w) {
         X11ComponentPeer peer = (X11ComponentPeer)w.getPeer();
         if (peer != null) {
@@ -333,6 +334,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     private static void exitFullScreenExclusive(Window w) {
         X11ComponentPeer peer = (X11ComponentPeer)w.getPeer();
         if (peer != null) {
--- a/jdk/src/java.desktop/unix/classes/sun/font/NativeFont.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/font/NativeFont.java	Fri Jan 09 13:28:02 2015 -0500
@@ -369,7 +369,7 @@
          */
 //      sb.replace(hPos[6]+1, hPos[7], "0");
 
-        /* comment out this block to the the 1.4.2 behaviour */
+        /* comment out this block to the 1.4.2 behaviour */
         if (hPos[0] == 0 && hPos[1] == 1) {
             /* null foundry name : some linux font configuration files have
              * symbol font entries like this and its just plain wrong.
--- a/jdk/src/java.desktop/unix/classes/sun/java2d/opengl/GLXVolatileSurfaceManager.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/java2d/opengl/GLXVolatileSurfaceManager.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,6 +73,7 @@
      * Create a pbuffer-based SurfaceData object (or init the backbuffer
      * of an existing window if this is a double buffered GraphicsConfig)
      */
+    @SuppressWarnings("deprecation")
     protected SurfaceData initAcceleratedSurface() {
         SurfaceData sData;
         Component comp = vImg.getComponent();
--- a/jdk/src/java.desktop/unix/native/common/awt/awt_Font.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/native/common/awt/awt_Font.c	Fri Jan 09 13:28:02 2015 -0500
@@ -587,6 +587,7 @@
         Disposer_AddRecord(env, font, pDataDisposeMethod, ptr_to_jlong(fdata));
         return fdata;
     } else {
+        JNU_CHECK_EXCEPTION_RETURN(env, NULL);
         Display *display = NULL;
         struct FontData *fdata = NULL;
         char fontSpec[1024];
@@ -722,7 +723,7 @@
     }
 
     /* AWT fonts are always "multifonts" and probably have been in
-     * all post 1.0 releases, so this test test for multi fonts is
+     * all post 1.0 releases, so this test for multi fonts is
      * probably not needed, and the singleton xfont is probably never used.
      */
     if (fdata->charset_num > 0) {
--- a/jdk/src/java.desktop/unix/native/common/awt/medialib/mlib_v_ImageCopy_f.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/native/common/awt/medialib/mlib_v_ImageCopy_f.c	Fri Jan 09 13:28:02 2015 -0500
@@ -196,7 +196,7 @@
 /***************************************************************/
 /*
  * Either source or destination data are not 8-byte aligned.
- * And size is is in bytes.
+ * And size is in bytes.
  */
 
 void mlib_ImageCopy_na(const mlib_u8 *sa,
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Event.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Event.c	Fri Jan 09 13:28:02 2015 -0500
@@ -42,7 +42,7 @@
 JNIEXPORT void JNICALL
 Java_java_awt_Event_initIDs(JNIEnv *env, jclass cls)
 {
-    eventIDs.data = (*env)->GetFieldID(env, cls, "data", "J");
-    eventIDs.consumed = (*env)->GetFieldID(env, cls, "consumed", "Z");
-    eventIDs.id = (*env)->GetFieldID(env, cls, "id", "I");
+    CHECK_NULL(eventIDs.data = (*env)->GetFieldID(env, cls, "data", "J"));
+    CHECK_NULL(eventIDs.consumed = (*env)->GetFieldID(env, cls, "consumed", "Z"));
+    CHECK_NULL(eventIDs.id = (*env)->GetFieldID(env, cls, "id", "I"));
 }
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Fri Jan 09 13:28:02 2015 -0500
@@ -23,6 +23,7 @@
  * questions.
  */
 
+#include "jni_util.h"
 #include "awt_p.h"
 #include "awt.h"
 #include "color.h"
@@ -763,6 +764,7 @@
     XSetIOErrorHandler(xioerror_handler);
     JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XErrorHandlerUtil", "init", "(J)V",
         ptr_to_jlong(awt_display));
+    JNU_CHECK_EXCEPTION_RETURN(env, NULL);
 
     /* set awt_numScreens, and whether or not we're using Xinerama */
     xineramaInit();
@@ -789,6 +791,7 @@
             x11Screens[i].root = RootWindow(awt_display, i);
         }
         x11Screens[i].defaultConfig = makeDefaultConfig(env, i);
+        JNU_CHECK_EXCEPTION_RETURN(env, NULL);
     }
 
     return dpy;
@@ -1495,7 +1498,7 @@
     if (aData == NULL) {
         return JNI_FALSE;
     }
-    return (jboolean)aData->isTranslucencySupported;
+    return aData->isTranslucencySupported ? JNI_TRUE : JNI_FALSE;
 #endif
 }
 
@@ -1575,9 +1578,9 @@
     jobject this)
 {
 #ifdef HEADLESS
-    return false;
+    return JNI_FALSE;
 #else
-    return usingXinerama;
+    return usingXinerama ? JNI_TRUE : JNI_FALSE;
 #endif /* HEADLESS */
 }
 
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/multiVis.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/multiVis.c	Fri Jan 09 13:28:02 2015 -0500
@@ -1103,7 +1103,7 @@
                                          * of those supports a transparent
                                          * pixel. */
     int32_t             *numVisuals;            /* Number of XVisualInfo struct's
-                                         * pointed to to by pVisuals. */
+                                         * pointed to by pVisuals. */
     XVisualInfo **pVisuals;             /* All of the device's visuals. */
     int32_t             *numOverlayVisuals;     /* Number of OverlayInfo's pointed
                                          * to by pOverlayVisuals.  If this
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c	Fri Jan 09 13:28:02 2015 -0500
@@ -72,6 +72,11 @@
 
 static void quit(JNIEnv * env, jobject jpeer, gboolean isSignalHandler)
 {
+    jthrowable pendingException;
+    if (pendingException = (*env)->ExceptionOccurred(env)) {
+         (*env)->ExceptionClear(env);
+    }
+
     GtkWidget * dialog = (GtkWidget*)jlong_to_ptr(
             (*env)->GetLongField(env, jpeer, widgetFieldID));
 
@@ -95,6 +100,10 @@
             fp_gdk_threads_leave();
         }
     }
+
+    if (pendingException) {
+         (*env)->Throw(env, pendingException);
+    }
 }
 
 /*
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/wsutils.h	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/wsutils.h	Fri Jan 09 13:28:02 2015 -0500
@@ -167,7 +167,7 @@
                                          * of those supports a transparent
                                          * pixel. */
     int32_t             *numVisuals,            /* Number of XVisualInfo struct's
-                                         * pointed to to by pVisuals. */
+                                         * pointed to by pVisuals. */
     XVisualInfo **pVisuals,             /* All of the device's visuals. */
     int32_t             *numOverlayVisuals,     /* Number of OverlayInfo's pointed
                                          * to by pOverlayVisuals.  If this
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c	Fri Jan 09 13:28:02 2015 -0500
@@ -77,7 +77,7 @@
 #ifndef HEADLESS
 
 extern Display* awt_init_Display(JNIEnv *env, jobject this);
-extern void freeNativeStringArray(char **array, long length);
+extern void freeNativeStringArray(char **array, jsize length);
 extern char** stringArrayToNative(JNIEnv *env, jobjectArray array, jsize * ret_length);
 
 struct XFontPeerIDs xFontPeerIDs;
--- a/jdk/src/java.desktop/unix/native/libmlib_image/mlib_v_ImageChannelExtract_43.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/unix/native/libmlib_image/mlib_v_ImageChannelExtract_43.c	Fri Jan 09 13:28:02 2015 -0500
@@ -252,7 +252,7 @@
 /***************************************************************/
 /*
  * Either source or destination data are not 8-byte aligned.
- * And dsize is is in pixels.
+ * And dsize is in pixels.
  */
 
 void mlib_v_ImageChannelExtract_U8_43R_D1(const mlib_u8 *src,
@@ -1182,7 +1182,7 @@
 /***************************************************************/
 /*
  * Either source or destination data are not 8-byte aligned.
- * And size is is in pixels.
+ * And size is in pixels.
  */
 
 void mlib_v_ImageChannelExtract_S16_43L_D1(const mlib_s16 *src,
--- a/jdk/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java	Fri Jan 09 13:28:02 2015 -0500
@@ -329,6 +329,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     public synchronized void setFullScreenWindow(Window w) {
         Window old = getFullScreenWindow();
         if (w == old) {
@@ -404,6 +405,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     public synchronized void setDisplayMode(DisplayMode dm) {
         if (!isDisplayChangeSupported()) {
             super.setDisplayMode(dm);
--- a/jdk/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java	Fri Jan 09 13:28:02 2015 -0500
@@ -251,7 +251,7 @@
                         // Get a child pidl relative to 'parent'
                         long childPIDL = copyFirstPIDLEntry(pIDL);
                         if (childPIDL != 0) {
-                            // Get a handle to the the rest of the ID list
+                            // Get a handle to the rest of the ID list
                             // i,e, parent's grandchilren and down
                             pIDL = getNextPIDLEntry(pIDL);
                             if (pIDL != 0) {
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/TranslucentWindowPainter.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/TranslucentWindowPainter.java	Fri Jan 09 13:28:02 2015 -0500
@@ -110,7 +110,7 @@
     protected abstract Image getBackBuffer(boolean clear);
 
     /**
-     * Updates the the window associated with this painter with the contents
+     * Updates the window associated with this painter with the contents
      * of the passed image.
      * The image can not be null, and NPE will be thrown if it is.
      */
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java	Fri Jan 09 13:28:02 2015 -0500
@@ -606,6 +606,7 @@
 
     // java.awt.Toolkit#getNativeContainer() is not available
     //  from this package
+    @SuppressWarnings("deprecation")
     private WComponentPeer getNearestNativePeer(Component comp)
     {
         if (comp==null)     return null;
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WKeyboardFocusManagerPeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WKeyboardFocusManagerPeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -46,6 +46,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     public void setCurrentFocusOwner(Component comp) {
         setNativeFocusOwner(comp != null ? comp.getPeer() : null);
     }
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WListPeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WListPeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -39,6 +39,7 @@
     // ListPeer implementation
 
     @Override
+    @SuppressWarnings("deprecation")
     public int[] getSelectedIndexes() {
         List l = (List)target;
         int len = l.countItems();
@@ -92,6 +93,7 @@
 
     @Override
     public native void delItems(int start, int end);
+    @SuppressWarnings("deprecation")
     public void clear() {
         List l = (List)target;
         delItems(0, l.countItems());
@@ -129,6 +131,7 @@
     native void create(WComponentPeer parent);
 
     @Override
+    @SuppressWarnings("deprecation")
     void initialize() {
         List li = (List)target;
 
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WScrollPanePeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WScrollPanePeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -199,6 +199,7 @@
         }
 
         @Override
+        @SuppressWarnings("deprecation")
         public void run() {
             if (getScrollChild() == null) {
                 return;
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java	Fri Jan 09 13:28:02 2015 -0500
@@ -183,7 +183,7 @@
     /**
      * Initializes the Toolkit for use in an embedded environment.
      *
-     * @return true if the the initialization succeeded; false if it failed.
+     * @return true if the initialization succeeded; false if it failed.
      *         The function will fail if the Toolkit was already initialized.
      * @since 1.3
      */
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WTrayIconPeer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WTrayIconPeer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -82,6 +82,7 @@
 
         SunToolkit.executeOnEventHandlerThread(target, new Runnable() {
                 @Override
+                @SuppressWarnings("deprecation")
                 public void run() {
                     PopupMenu newPopup = ((TrayIcon)target).getPopupMenu();
                     if (popup != newPopup) {
--- a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,6 +61,7 @@
     private BufferCapabilities bufferCaps;
     private D3DGraphicsDevice device;
 
+    @SuppressWarnings("deprecation")
     protected D3DGraphicsConfig(D3DGraphicsDevice device) {
         super(device, 0);
         this.device = device;
--- a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java	Fri Jan 09 13:28:02 2015 -0500
@@ -176,6 +176,7 @@
                                                                  long hwnd);
 
     @Override
+    @SuppressWarnings("deprecation")
     protected void enterFullScreenExclusive(final int screen, WindowPeer wp)
     {
         final WWindowPeer wpeer = (WWindowPeer)realFSWindow.getPeer();
@@ -246,6 +247,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     protected void addFSWindowListener(Window w) {
         // if the window is not a toplevel (has an owner) we have to use the
         // real toplevel to enter the full-screen mode with (4933099).
@@ -273,6 +275,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     protected void removeFSWindowListener(Window w) {
         realFSWindow.removeWindowListener(fsWindowListener);
         fsWindowListener = null;
@@ -337,6 +340,7 @@
                                                        int bitDepth,
                                                        int refreshRate);
     @Override
+    @SuppressWarnings("deprecation")
     protected void configDisplayMode(final int screen, final WindowPeer w,
                                      final int width, final int height,
                                      final int bitDepth, final int refreshRate)
--- a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java	Fri Jan 09 13:28:02 2015 -0500
@@ -523,6 +523,7 @@
      * @param comp component to check for hw children
      * @return true if Component has heavyweight children
      */
+    @SuppressWarnings("deprecation")
     private static boolean hasHWChildren(Component comp) {
         if (comp instanceof Container) {
             for (Component c : ((Container)comp).getComponents()) {
--- a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DVolatileSurfaceManager.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DVolatileSurfaceManager.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -79,6 +79,7 @@
      * Create a pbuffer-based SurfaceData object (or init the backbuffer
      * of an existing window if this is a double buffered GraphicsConfig).
      */
+    @SuppressWarnings("deprecation")
     protected SurfaceData initAcceleratedSurface() {
         SurfaceData sData;
         Component comp = vImg.getComponent();
--- a/jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -81,6 +81,7 @@
         wglAvailable = initWGL();
     }
 
+    @SuppressWarnings("deprecation")
     protected WGLGraphicsConfig(Win32GraphicsDevice device, int visualnum,
                                 long configInfo, ContextCapabilities oglCaps)
     {
--- a/jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,6 +73,7 @@
      * Create a pbuffer-based SurfaceData object (or init the backbuffer
      * of an existing window if this is a double buffered GraphicsConfig).
      */
+    @SuppressWarnings("deprecation")
     protected SurfaceData initAcceleratedSurface() {
         SurfaceData sData;
         Component comp = vImg.getComponent();
--- a/jdk/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -77,7 +77,7 @@
         ZeroMemory(info, sizeof(ThreadGraphicsInfo));
         TlsSetValue(threadInfoIndex, (LPVOID)info);
         J2dTraceLn2(J2D_TRACE_VERBOSE,
-                    "  current batch limit for for thread 0x%x is %d",
+                    "  current batch limit for thread 0x%x is %d",
                      GetCurrentThreadId(), ::GdiGetBatchLimit());
         J2dTraceLn(J2D_TRACE_VERBOSE, "  setting to the limit to 1");
         // Fix for bug 4374079
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Debug.h	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Debug.h	Fri Jan 09 13:28:02 2015 -0500
@@ -40,7 +40,7 @@
 
             static void AssertCallback(const char * expr, const char * file,
                                        int line);
-            /* This method signals that the VM is exiting cleanly, and thus the
+            /* This method signals that the VM is exiting cleanly, and thus
                the debug memory manager should dump a leaks report when the
                VM has finished exiting. This method should not be called for
                termination exits (such as <CTRL>-C) */
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.h	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.h	Fri Jan 09 13:28:02 2015 -0500
@@ -215,7 +215,7 @@
      * Hashtable<Thread, BlockedThreadStruct> - a table that contains all the
      * information about non-toolkit threads with modal blocked embedded
      * frames. This information includes: number of blocked embedded frames
-     * created on the the thread, and mouse and modal hooks installed for
+     * created on the thread, and mouse and modal hooks installed for
      * that thread. For every thread each hook is installed only once
      */
     static Hashtable sm_BlockedThreads;
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Palette.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Palette.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -113,7 +113,7 @@
 }
 
 /**
- * Retrieves system palette entries. Includes a workaround for for some
+ * Retrieves system palette entries. Includes a workaround for some
  * video drivers which may not support the GSPE call but may return
  * valid values from this procedure.
  */
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.h	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.h	Fri Jan 09 13:28:02 2015 -0500
@@ -553,7 +553,7 @@
         bool Terminate(bool wrongThread);
         bool InvokeAndTerminate(void(_cdecl *fn)(void *), void *param);
 
-        // waits for the the thread completion;
+        // waits for the thread completion;
         // use the method after Terminate() only if Terminate() returned true
         INLINE void Wait4Finish() {
             ::WaitForSingleObject(hFinished, INFINITE);
--- a/jdk/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp	Fri Jan 09 13:28:02 2015 -0500
@@ -426,7 +426,7 @@
 
     err = midiInStart((HMIDIIN) handle->deviceHandle);
         /* $$mp 200308-11: This method is already called in ...open(). It is
-           unclear why is is called again. The specification says that
+           unclear why it is called again. The specification says that
            MidiDevice.getMicrosecondPosition() returns the time since the
            device was opened (the spec doesn't know about start/stop).
            So I guess this call is obsolete. */
--- a/jdk/src/java.instrument/share/native/libinstrument/InvocationAdapter.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.instrument/share/native/libinstrument/InvocationAdapter.c	Fri Jan 09 13:28:02 2015 -0500
@@ -564,7 +564,7 @@
 /*
  * Evaluates all escapes in s.  Assumes that escapes are well-formed
  * syntactically, i.e., of the form %XX.
- * If the path does not require decoding the the original path is
+ * If the path does not require decoding the original path is
  * returned. Otherwise the decoded path (heap allocated) is returned,
  * along with the length of the decoded path. Note that the return
  * string will not be null terminated after decoding.
--- a/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -576,7 +576,7 @@
      * the selected MBeans.
      *
      * @param name The object name pattern identifying the MBeans to
-     *      be retrieved. If null or or no domain and key properties
+     *      be retrieved. If null or no domain and key properties
      *      are specified, all the MBeans registered will be retrieved.
      * @param query The query expression to be applied for selecting
      *      MBeans. If null no query expression will be applied for
@@ -598,7 +598,7 @@
      * the names of a set of MBeans specified by pattern matching on the
      * <CODE>ObjectName</CODE> and/or a Query expression, a specific
      * MBean name (equivalent to testing whether an MBean is registered).
-     * When the object name is null or or no domain and key properties are
+     * When the object name is null or no domain and key properties are
      * specified, all objects are selected (and filtered if a query is
      * specified). It returns the set of ObjectNames for the MBeans
      * selected.
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java	Fri Jan 09 13:28:02 2015 -0500
@@ -140,7 +140,7 @@
     }
 
     /**
-     * Called to to fetch notifications from a server.
+     * Called to fetch notifications from a server.
      */
     abstract protected NotificationResult fetchNotifs(long clientSequenceNumber,
                                                       int maxNotifications,
--- a/jdk/src/java.management/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.management/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java	Fri Jan 09 13:28:02 2015 -0500
@@ -42,7 +42,7 @@
  * The notification emitted will contain the garbage collection notification
  * information about the status of the memory:
  * <u1>
- *   <li>The name of the garbage collector used perform the collection.</li>
+ *   <li>The name of the garbage collector used to perform the collection.</li>
  *   <li>The action performed by the garbage collector.</li>
  *   <li>The cause of the garbage collection action.</li>
  *   <li>A {@link GcInfo} object containing some statistics about the GC cycle
@@ -109,7 +109,7 @@
      *
      * @param gcName The name of the garbage collector used to perform the collection
      * @param gcAction The name of the action performed by the garbage collector
-     * @param gcCause The cause the garbage collection action
+     * @param gcCause The cause of the garbage collection action
      * @param gcInfo  a GcInfo object providing statistics about the GC cycle
      */
     public GarbageCollectionNotificationInfo(String gcName,
@@ -152,18 +152,18 @@
     }
 
     /**
-     * Returns the action of the performed by the garbage collector
+     * Returns the action performed by the garbage collector
      *
-     * @return the the action of the performed by the garbage collector
+     * @return the action performed by the garbage collector
      */
     public String getGcAction() {
         return gcAction;
     }
 
     /**
-     * Returns the cause  the garbage collection
+     * Returns the cause of the garbage collection
      *
-     * @return the the cause  the garbage collection
+     * @return the cause of the garbage collection
      */
     public String getGcCause() {
         return gcCause;
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/ArrayType.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/ArrayType.java	Fri Jan 09 13:28:02 2015 -0500
@@ -570,7 +570,7 @@
         // In case this ArrayType instance describes an array of classes implementing the TabularData or CompositeData interface,
         // we first check for the assignability of obj to such an array of TabularData or CompositeData,
         // which ensures that:
-        //  . obj is of the the same dimension as this ArrayType instance,
+        //  . obj is of the same dimension as this ArrayType instance,
         //  . it is declared as an array of elements which are either all TabularData or all CompositeData.
         //
         // If the assignment check is positive,
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/SimpleType.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/SimpleType.java	Fri Jan 09 13:28:02 2015 -0500
@@ -244,7 +244,7 @@
 
     /**
      * Returns the hash code value for this <code>SimpleType</code> instance.
-     * The hash code of a <code>SimpleType</code> instance is the the hash code of
+     * The hash code of a <code>SimpleType</code> instance is the hash code of
      * the string value returned by the {@link OpenType#getClassName() getClassName} method.
      * <p>
      * As <code>SimpleType</code> instances are immutable, the hash code for this instance is calculated once,
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java	Fri Jan 09 13:28:02 2015 -0500
@@ -212,7 +212,7 @@
     /**
      * Returns <tt>true</tt> if and only if this <tt>TabularData</tt> instance contains a <tt>CompositeData</tt> value
      * (ie a row) whose index is the specified <var>key</var>. If <var>key</var> cannot be cast to a one dimension array
-     * of Object instances, this method simply returns <tt>false</tt>; otherwise it returns the the result of the call to
+     * of Object instances, this method simply returns <tt>false</tt>; otherwise it returns the result of the call to
      * <tt>this.containsKey((Object[]) key)</tt>.
      *
      * @param  key  the index value whose presence in this <tt>TabularData</tt> instance is to be tested.
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/EventSupport.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/EventSupport.java	Fri Jan 09 13:28:02 2015 -0500
@@ -260,7 +260,7 @@
         if (unsolicited == null || unsolicited.size() == 0) {
             // This shouldn't really happen, but might in case
             // there is a timing problem that removes a listener
-            // before a fired event event reaches here.
+            // before a fired event reaches here.
             return;
         }
 
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtx.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtx.java	Fri Jan 09 13:28:02 2015 -0500
@@ -989,7 +989,7 @@
     }
 
     /*
-     * Append the the second Vector onto the first Vector
+     * Append the second Vector onto the first Vector
      * (v2 must be non-null)
      */
     private static <T> Vector<T> appendVector(Vector<T> v1, Vector<T> v2) {
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapReferralException.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapReferralException.java	Fri Jan 09 13:28:02 2015 -0500
@@ -59,7 +59,7 @@
   * objects.
   * <p>
   * If an exception was recorded while processing a chain of
-  * <tt>LdapReferralException</tt> objects then is is throw once
+  * <tt>LdapReferralException</tt> objects then it is throw once
   * processing has completed.
   *
   * @author Vincent Ryan
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/toolkit/ctx/AtomicContext.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/toolkit/ctx/AtomicContext.java	Fri Jan 09 13:28:02 2015 -0500
@@ -533,7 +533,7 @@
       * This function is used when implementing a naming system that
       * supports junctions.  For example, when the a_list_nns(newobj)
       * method is invoked, that means the caller is attempting to list the
-      * the nns context of of this context.  For a context that supports
+      * the nns context of this context.  For a context that supports
       * junctions, it by default does not have any nns.  Consequently,
       * a NameNotFoundException is thrown.
       */
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/Rdn.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/Rdn.java	Fri Jan 09 13:28:02 2015 -0500
@@ -505,7 +505,7 @@
      *
      * @param val The non-null object to be escaped.
      * @return Escaped string value.
-     * @throws ClassCastException if val is is not a String or byte array.
+     * @throws ClassCastException if val is not a String or byte array.
      */
     public static String escapeValue(Object val) {
         return (val instanceof byte[])
--- a/jdk/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java	Fri Jan 09 13:28:02 2015 -0500
@@ -981,7 +981,7 @@
     private static int MAX_ATTEMPTS = 5;
 
     /**
-     * Release the the appropriate file lock (user or system).
+     * Release the appropriate file lock (user or system).
      * @throws SecurityException if file access denied.
      */
     private void unlockFile() {
--- a/jdk/src/java.rmi/share/classes/java/rmi/registry/LocateRegistry.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.rmi/share/classes/java/rmi/registry/LocateRegistry.java	Fri Jan 09 13:28:02 2015 -0500
@@ -62,7 +62,7 @@
     private LocateRegistry() {}
 
     /**
-     * Returns a reference to the the remote object <code>Registry</code> for
+     * Returns a reference to the remote object <code>Registry</code> for
      * the local host on the default registry port of 1099.
      *
      * @return reference (a stub) to the remote object registry
@@ -76,7 +76,7 @@
     }
 
     /**
-     * Returns a reference to the the remote object <code>Registry</code> for
+     * Returns a reference to the remote object <code>Registry</code> for
      * the local host on the specified <code>port</code>.
      *
      * @param port port on which the registry accepts requests
--- a/jdk/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java	Fri Jan 09 13:28:02 2015 -0500
@@ -336,13 +336,12 @@
      * Main program to start a registry. <br>
      * The port number can be specified on the command line.
      */
-    @SuppressWarnings("deprecation")
     public static void main(String args[])
     {
         // Create and install the security manager if one is not installed
         // already.
         if (System.getSecurityManager() == null) {
-            System.setSecurityManager(new RMISecurityManager());
+            System.setSecurityManager(new SecurityManager());
         }
 
         try {
--- a/jdk/src/java.rmi/share/classes/sun/rmi/server/MarshalOutputStream.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.rmi/share/classes/sun/rmi/server/MarshalOutputStream.java	Fri Jan 09 13:28:02 2015 -0500
@@ -88,7 +88,7 @@
     }
 
     /**
-     * Serializes a location from which to load the the specified class.
+     * Serializes a location from which to load the specified class.
      */
     protected void annotateClass(Class<?> cl) throws IOException {
         writeLocation(java.rmi.server.RMIClassLoader.getClassAnnotation(cl));
--- a/jdk/src/java.rmi/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.rmi/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -35,7 +35,7 @@
  * ConnectionMultiplexer manages the transparent multiplexing of
  * multiple virtual connections from one endpoint to another through
  * one given real connection to that endpoint.  The input and output
- * streams for the the underlying real connection must be supplied.
+ * streams for the underlying real connection must be supplied.
  * A callback object is also supplied to be informed of new virtual
  * connections opened by the remote endpoint.  After creation, the
  * run() method must be called in a thread created for demultiplexing
--- a/jdk/src/java.scripting/share/classes/javax/script/ScriptContext.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.scripting/share/classes/javax/script/ScriptContext.java	Fri Jan 09 13:28:02 2015 -0500
@@ -130,7 +130,7 @@
      * is determined by the numeric value of the scope parameter (lowest
      * scope values first.)
      *
-     * @param name The name of the the attribute to retrieve.
+     * @param name The name of the attribute to retrieve.
      * @return The value of the attribute in the lowest scope for
      * which an attribute with the given name is defined.  Returns
      * null if no attribute with the name exists in any scope.
--- a/jdk/src/java.scripting/share/classes/javax/script/ScriptEngineManager.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.scripting/share/classes/javax/script/ScriptEngineManager.java	Fri Jan 09 13:28:02 2015 -0500
@@ -407,7 +407,7 @@
     /** Map of script file extension to script engine factory. */
     private HashMap<String, ScriptEngineFactory> extensionAssociations;
 
-    /** Map of script script MIME type to script engine factory. */
+    /** Map of script MIME type to script engine factory. */
     private HashMap<String, ScriptEngineFactory> mimeTypeAssociations;
 
     /** Global bindings associated with script engines created by this manager. */
--- a/jdk/src/java.scripting/share/classes/javax/script/SimpleScriptContext.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.scripting/share/classes/javax/script/SimpleScriptContext.java	Fri Jan 09 13:28:02 2015 -0500
@@ -132,7 +132,7 @@
      * is determined by the numeric value of the scope parameter (lowest
      * scope values first.)
      *
-     * @param name The name of the the attribute to retrieve.
+     * @param name The name of the attribute to retrieve.
      * @return The value of the attribute in the lowest scope for
      * which an attribute with the given name is defined.  Returns
      * null if no attribute with the name exists in any scope.
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java	Fri Jan 09 13:28:02 2015 -0500
@@ -535,7 +535,7 @@
      * allowable renew time has passed. Any other error returned by the
      * KDC will also cause this method to fail.
      *
-     * Note: This method is not synchronized with the the accessor
+     * Note: This method is not synchronized with the accessor
      * methods of this object. Hence callers need to be aware of multiple
      * threads that might access this and try to renew it at the same
      * time.
--- a/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSContext.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/GSSContext.java	Fri Jan 09 13:28:02 2015 -0500
@@ -558,7 +558,7 @@
      * @param msgProp instance of MessageProp that is used by the
      * application to set the desired QOP and privacy state. Set the
      * desired QOP to 0 to request the default QOP. Upon return from this
-     * method, this object will contain the the actual privacy state that
+     * method, this object will contain the actual privacy state that
      * was applied to the message by the underlying mechanism.
      * @return a byte[] containing the token to be sent to the peer.
      *
@@ -605,7 +605,7 @@
      * @param msgProp instance of MessageProp that is used by the
      * application to set the desired QOP and privacy state. Set the
      * desired QOP to 0 to request the default QOP. Upon return from this
-     * method, this object will contain the the actual privacy state that
+     * method, this object will contain the actual privacy state that
      * was applied to the message by the underlying mechanism.
      *
      * @throws GSSException containing the following
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/TokenTracker.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/TokenTracker.java	Fri Jan 09 13:28:02 2015 -0500
@@ -368,7 +368,7 @@
 
         /**
          * Returns -1 if this interval represented by this entry precedes
-         * the number, 0 if the the number is contained in the interval,
+         * the number, 0 if the number is contained in the interval,
          * and -1 if the interval occurs after the number.
          */
         final int compareTo(int number) {
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbApReq.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbApReq.java	Fri Jan 09 13:28:02 2015 -0500
@@ -102,7 +102,7 @@
      * @param useSubkey Whether the subkey is to be used to protect this
      *        specific application session. If this is not set then the
      *        session key from the ticket will be used.
-     * @param checksum checksum of the the application data that accompanies
+     * @param checksum checksum of the application data that accompanies
      *        the KRB_AP_REQ.
      * @throws KrbException for any Kerberos protocol specific error
      * @throws IOException for any IO related errors
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java	Fri Jan 09 13:28:02 2015 -0500
@@ -390,7 +390,7 @@
          * /tmp/krb5cc_uid ; for all other platforms  we use
          * {user_home}/krb5cc_{user_name}
          * Please note that for Windows we will use LSA to get
-         * the TGT from the the default cache even before we come here;
+         * the TGT from the default cache even before we come here;
          * however when we create cache we will create a cache under
          * {user_home}/krb5cc_{user_name} for non-Unix platforms including
          * Windows.
--- a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/PlainClient.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/PlainClient.java	Fri Jan 09 13:28:02 2015 -0500
@@ -49,7 +49,7 @@
      *  for which authorization is being granted; if null, same as
      *  authenticationID
      * @param authenticationID A non-null string representing the principal
-     * being authenticated. pw is associated with with this principal.
+     * being authenticated. pw is associated with this principal.
      * @param pw A non-null byte[] containing the password.
      */
     PlainClient(String authorizationID, String authenticationID, byte[] pw)
--- a/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/CachedRowSetImpl.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/CachedRowSetImpl.java	Fri Jan 09 13:28:02 2015 -0500
@@ -431,7 +431,7 @@
      * provider to assist in determining the choice of the synchronizaton
      * provider such as:
      * <ul>
-     * <li><code>ROWSET_SYNC_PROVIDER</code> - the property specifying the the
+     * <li><code>ROWSET_SYNC_PROVIDER</code> - the property specifying the
      * <code>SyncProvider</code> class name to be instantiated by the
      * <code>SyncFacttory</code>
      * <li><code>ROWSET_SYNC_VENDOR</code> - the property specifying the software
@@ -3727,7 +3727,7 @@
 
         /*
          * Each call to internalPrevious may move the cursor
-         * over multiple rows, the absolute position moves one one row
+         * over multiple rows, the absolute position moves one row
          */
         if (ret == true)
             --absolutePos;
--- a/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Fri Jan 09 13:28:02 2015 -0500
@@ -3993,7 +3993,7 @@
 
     /**
      * Retrieves the <code>DatabaseMetaData</code> associated with
-     * the connection handle associated this this
+     * the connection handle associated with this
      * <code>JdbcRowSet</code> object.
      *
      * @return the <code>DatabaseMetadata</code> associated
@@ -4007,7 +4007,7 @@
 
     /**
      * Retrieves the <code>ParameterMetaData</code> associated with
-     * the connection handle associated this this
+     * the connection handle associated with this
      * <code>JdbcRowSet</code> object.
      *
      * @return the <code>ParameterMetadata</code> associated
@@ -4325,7 +4325,7 @@
      * the connection is created using a JDBC technology-enabled driver
      * ("JDBC driver") and the <code>DriverManager</code>.
      * The correct JDBC URL for the specific driver to be used can be found
-     * in the driver documentation.  Although there are guidelines for for how
+     * in the driver documentation.  Although there are guidelines for how
      * a JDBC URL is formed,
      * a driver vendor can specify any <code>String</code> object except
      * one with a length of <code>0</code> (an empty string).
--- a/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/JoinRowSetImpl.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/JoinRowSetImpl.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1169,7 +1169,7 @@
      * @return the column value; if the value is SQL <code>NULL</code>, the
      *         result is <code>null</code>
      * @throws SQLException if the given column index is out of bounds,
-     *            the cursor is not on a valid row, or the the value to be
+     *            the cursor is not on a valid row, or the value to be
      *            retrieved is not binary
      */
     public byte[] getBytes(int columnIndex) throws SQLException {
@@ -4129,7 +4129,7 @@
     }
 
     /**
-     * Creates an an output stream of the internal state and contents of a
+     * Creates an output stream of the internal state and contents of a
      * <code>WebRowSet</code> for XML proceessing
      *
      * @throws SQLException if a datasource access occurs
--- a/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/WebRowSetImpl.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/WebRowSetImpl.java	Fri Jan 09 13:28:02 2015 -0500
@@ -93,7 +93,7 @@
     }
 
     /**
-     * Constructs a new <code>WebRowSet</code> object initialized with the the
+     * Constructs a new <code>WebRowSet</code> object initialized with the
      * synchronization SPI provider properties as specified in the <code>Hashtable</code>. If
      * this hashtable is empty or is <code>null</code> the default constructor is invoked.
      *
@@ -234,7 +234,7 @@
     /**
      * Writes this <code>WebRowSet</code> object to the given <code> OutputStream</code>
      * object in XML format.
-     * Creates an an output stream of the internal state and contents of a
+     * Creates an output stream of the internal state and contents of a
      * <code>WebRowSet</code> for XML proceessing
      *
      * @throws SQLException if a datasource access error occurs
--- a/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java	Fri Jan 09 13:28:02 2015 -0500
@@ -843,7 +843,7 @@
                for (String pkName : primaryKeys) {
                    if (!isPKNameValid(pkName, rsmd)) {
 
-                       /* We came here as one of the the primary keys
+                       /* We came here as one of the primary keys
                         * of the table is not present in the cached
                         * rowset object, it should be an autoincrement column
                         * and not included while creating CachedRowSet
--- a/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/internal/SyncResolverImpl.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/internal/SyncResolverImpl.java	Fri Jan 09 13:28:02 2015 -0500
@@ -288,7 +288,7 @@
     }
 
     /**
-     * This passes a CachedRowSet as a row the the CachedRowSetWriter
+     * This passes a CachedRowSet as a row to the CachedRowSetWriter
      * after the values have been resolved, back to the datasource.
      *
      * @param row a <code>CachedRowSet</code> object which will hold the
--- a/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/providers/package.html	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/providers/package.html	Fri Jan 09 13:28:02 2015 -0500
@@ -137,7 +137,7 @@
  inserted or deleted. Any method that causes a change in the rowset's values
  or cursor position also notifies any object that has been registered as
 a  listener with the rowset. So, for example, a table that displays the rowset's
- data in an applet can can be notified of changes and make updates as they
+ data in an applet can be notified of changes and make updates as they
  occur.<br>
     <br>
   The changes made to a rowset can be propagated back to the original data
--- a/jdk/src/java.sql/share/classes/java/sql/DriverManager.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.sql/share/classes/java/sql/DriverManager.java	Fri Jan 09 13:28:02 2015 -0500
@@ -29,7 +29,6 @@
 import java.util.ServiceLoader;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.util.PropertyPermission;
 import java.util.concurrent.CopyOnWriteArrayList;
 import sun.reflect.CallerSensitive;
 import sun.reflect.Reflection;
@@ -89,6 +88,8 @@
     private static volatile java.io.PrintStream logStream = null;
     // Used in println() to synchronize logWriter
     private final static Object logSync = new Object();
+    // Used in ensureDriversInitialized() to synchronize driversInitialized
+    private final static Object lockForInitDrivers = new Object();
     private static volatile boolean driversInitialized;
     private static final String JDBC_DRIVERS_PROPERTY = "jdbc.drivers";
 
@@ -280,11 +281,13 @@
 
         println("DriverManager.getDriver(\"" + url + "\")");
 
+        ensureDriversInitialized();
+
         Class<?> callerClass = Reflection.getCallerClass();
 
         // Walk through the loaded registeredDrivers attempting to locate someone
         // who understands the given URL.
-        for (DriverInfo aDriver : getRegisteredDrivers()) {
+        for (DriverInfo aDriver : registeredDrivers) {
             // If the caller does not have permission to load the driver then
             // skip it.
             if (isDriverAllowed(aDriver.driver, callerClass)) {
@@ -384,8 +387,7 @@
      * @see SecurityManager#checkPermission
      */
     @CallerSensitive
-    public static synchronized void deregisterDriver(Driver driver)
-        throws SQLException {
+    public static void deregisterDriver(Driver driver) throws SQLException {
         if (driver == null) {
             return;
         }
@@ -398,22 +400,24 @@
         println("DriverManager.deregisterDriver: " + driver);
 
         DriverInfo aDriver = new DriverInfo(driver, null);
-        if (registeredDrivers.contains(aDriver)) {
-            if (isDriverAllowed(driver, Reflection.getCallerClass())) {
-                DriverInfo di = registeredDrivers.get(registeredDrivers.indexOf(aDriver));
-                 // If a DriverAction was specified, Call it to notify the
-                 // driver that it has been deregistered
-                 if (di.action() != null) {
-                     di.action().deregister();
-                 }
-                 registeredDrivers.remove(aDriver);
+        synchronized (lockForInitDrivers) {
+            if (registeredDrivers.contains(aDriver)) {
+                if (isDriverAllowed(driver, Reflection.getCallerClass())) {
+                    DriverInfo di = registeredDrivers.get(registeredDrivers.indexOf(aDriver));
+                     // If a DriverAction was specified, Call it to notify the
+                     // driver that it has been deregistered
+                     if (di.action() != null) {
+                         di.action().deregister();
+                     }
+                     registeredDrivers.remove(aDriver);
+                } else {
+                    // If the caller does not have permission to load the driver then
+                    // throw a SecurityException.
+                    throw new SecurityException();
+                }
             } else {
-                // If the caller does not have permission to load the driver then
-                // throw a SecurityException.
-                throw new SecurityException();
+                println("    couldn't find driver to unload");
             }
-        } else {
-            println("    couldn't find driver to unload");
         }
     }
 
@@ -430,10 +434,12 @@
     public static java.util.Enumeration<Driver> getDrivers() {
         java.util.Vector<Driver> result = new java.util.Vector<>();
 
+        ensureDriversInitialized();
+
         Class<?> callerClass = Reflection.getCallerClass();
 
         // Walk through the loaded registeredDrivers.
-        for (DriverInfo aDriver : getRegisteredDrivers()) {
+        for (DriverInfo aDriver : registeredDrivers) {
             // If the caller does not have permission to load the driver then
             // skip it.
             if (isDriverAllowed(aDriver.driver, callerClass)) {
@@ -558,91 +564,81 @@
     }
 
     /*
-     * Return the registered java.sql.Drivers and call loadInitialDrivers
-     * if needed
+     * Load the initial JDBC drivers by checking the System property
+     * jdbc.drivers and then use the {@code ServiceLoader} mechanism
      */
-    private static CopyOnWriteArrayList<DriverInfo> getRegisteredDrivers() {
-        // Check to see if we need to load the initial drivers
-        if (!driversInitialized) {
-            loadInitialDrivers();
-        }
-        return registeredDrivers;
-
-    }
-
-    /*
-     * Load the initial JDBC drivers by checking the System property
-     * jdbc.properties and then use the {@code ServiceLoader} mechanism
-     */
-    private synchronized static void loadInitialDrivers() {
-        String drivers;
-
+    private static void ensureDriversInitialized() {
         if (driversInitialized) {
             return;
         }
 
-        try {
-            drivers = AccessController.doPrivileged(new PrivilegedAction<String>() {
-                public String run() {
-                    return System.getProperty(JDBC_DRIVERS_PROPERTY);
+        synchronized (lockForInitDrivers) {
+            if (driversInitialized) {
+                return;
+            }
+            String drivers;
+            try {
+                drivers = AccessController.doPrivileged(new PrivilegedAction<String>() {
+                    public String run() {
+                        return System.getProperty(JDBC_DRIVERS_PROPERTY);
+                    }
+                });
+            } catch (Exception ex) {
+                drivers = null;
+            }
+            // If the driver is packaged as a Service Provider, load it.
+            // Get all the drivers through the classloader
+            // exposed as a java.sql.Driver.class service.
+            // ServiceLoader.load() replaces the sun.misc.Providers()
+
+            AccessController.doPrivileged(new PrivilegedAction<Void>() {
+                public Void run() {
+
+                    ServiceLoader<Driver> loadedDrivers = ServiceLoader.load(Driver.class);
+                    Iterator<Driver> driversIterator = loadedDrivers.iterator();
+
+                    /* Load these drivers, so that they can be instantiated.
+                     * It may be the case that the driver class may not be there
+                     * i.e. there may be a packaged driver with the service class
+                     * as implementation of java.sql.Driver but the actual class
+                     * may be missing. In that case a java.util.ServiceConfigurationError
+                     * will be thrown at runtime by the VM trying to locate
+                     * and load the service.
+                     *
+                     * Adding a try catch block to catch those runtime errors
+                     * if driver not available in classpath but it's
+                     * packaged as service and that service is there in classpath.
+                     */
+                    try {
+                        while (driversIterator.hasNext()) {
+                            driversIterator.next();
+                        }
+                    } catch (Throwable t) {
+                        // Do nothing
+                    }
+                    return null;
                 }
             });
-        } catch (Exception ex) {
-            drivers = null;
-        }
-        // If the driver is packaged as a Service Provider, load it.
-        // Get all the drivers through the classloader
-        // exposed as a java.sql.Driver.class service.
-        // ServiceLoader.load() replaces the sun.misc.Providers()
 
-        AccessController.doPrivileged(new PrivilegedAction<Void>() {
-            public Void run() {
-
-                ServiceLoader<Driver> loadedDrivers = ServiceLoader.load(Driver.class);
-                Iterator<Driver> driversIterator = loadedDrivers.iterator();
+            println("DriverManager.initialize: jdbc.drivers = " + drivers);
 
-                /* Load these drivers, so that they can be instantiated.
-                 * It may be the case that the driver class may not be there
-                 * i.e. there may be a packaged driver with the service class
-                 * as implementation of java.sql.Driver but the actual class
-                 * may be missing. In that case a java.util.ServiceConfigurationError
-                 * will be thrown at runtime by the VM trying to locate
-                 * and load the service.
-                 *
-                 * Adding a try catch block to catch those runtime errors
-                 * if driver not available in classpath but it's
-                 * packaged as service and that service is there in classpath.
-                 */
-                try{
-                    while(driversIterator.hasNext()) {
-                        driversIterator.next();
+            if (drivers != null && !drivers.equals("")) {
+                String[] driversList = drivers.split(":");
+                println("number of Drivers:" + driversList.length);
+                for (String aDriver : driversList) {
+                    try {
+                        println("DriverManager.Initialize: loading " + aDriver);
+                        Class.forName(aDriver, true,
+                                ClassLoader.getSystemClassLoader());
+                    } catch (Exception ex) {
+                        println("DriverManager.Initialize: load failed: " + ex);
                     }
-                } catch(Throwable t) {
-                // Do nothing
                 }
-                return null;
             }
-        });
 
-        println("DriverManager.initialize: jdbc.drivers = " + drivers);
-
-        if (drivers == null || drivers.equals("")) {
-            return;
+            driversInitialized = true;
+            println("JDBC DriverManager initialized");
         }
-        String[] driversList = drivers.split(":");
-        println("number of Drivers:" + driversList.length);
-        for (String aDriver : driversList) {
-            try {
-                println("DriverManager.Initialize: loading " + aDriver);
-                Class.forName(aDriver, true,
-                        ClassLoader.getSystemClassLoader());
-            } catch (Exception ex) {
-                println("DriverManager.Initialize: load failed: " + ex);
-            }
-        }
-
-        driversInitialized = true;
-        println("JDBC DriverManager initialized");
     }
 
 
@@ -666,11 +662,13 @@
 
         println("DriverManager.getConnection(\"" + url + "\")");
 
+        ensureDriversInitialized();
+
         // Walk through the loaded registeredDrivers attempting to make a connection.
         // Remember the first exception that gets raised so we can reraise it.
         SQLException reason = null;
 
-        for (DriverInfo aDriver : getRegisteredDrivers()) {
+        for (DriverInfo aDriver : registeredDrivers) {
             // If the caller does not have permission to load the driver then
             // skip it.
             if (isDriverAllowed(aDriver.driver, callerCL)) {
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionMethod.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionMethod.java	Fri Jan 09 13:28:02 2015 -0500
@@ -68,7 +68,7 @@
     void setKeySize(int size);
 
     /**
-     * Returns the OAEP parameters of the algorithm applied applied to the
+     * Returns the OAEP parameters of the algorithm applied to the
      * cipher data.
      *
      * @return the OAEP parameters.
@@ -130,4 +130,3 @@
      */
     void removeEncryptionMethodInformation(Element information);
 }
-
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyUtils.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyUtils.java	Fri Jan 09 13:28:02 2015 -0500
@@ -32,7 +32,7 @@
 import com.sun.org.apache.xml.internal.security.keys.content.X509Data;
 
 /**
- * Utility class for for <CODE>com.sun.org.apache.xml.internal.security.keys</CODE> package.
+ * Utility class for the <CODE>com.sun.org.apache.xml.internal.security.keys</CODE> package.
  *
  * @author $Author: coheigea $
  */
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java	Fri Jan 09 13:28:02 2015 -0500
@@ -571,7 +571,7 @@
     }
 
     /**
-     * This method only works works after a call to verify.
+     * This method only works after a call to verify.
      * @return the transformed output(i.e. what is going to be digested).
      */
     public XMLSignatureInput getTransformsOutput() {
--- a/jdk/src/jdk.attach/solaris/native/libattach/VirtualMachineImpl.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.attach/solaris/native/libattach/VirtualMachineImpl.c	Fri Jan 09 13:28:02 2015 -0500
@@ -320,7 +320,7 @@
         JNU_ThrowIOExceptionWithLastError(env, "door_call");
     } else {
         /*
-         * door_call succeeded but the call didn't return the the expected jint.
+         * door_call succeeded but the call didn't return the expected jint.
          */
         if (door_args.data_size < sizeof(jint)) {
             JNU_ThrowIOException(env, "Enqueue error - reason unknown as result is truncated!");
--- a/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/RSACipher.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/RSACipher.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -159,6 +159,7 @@
     }
 
     // see JCE spec
+    @SuppressWarnings("deprecation")
     protected void engineInit(int opmode, Key key,
             AlgorithmParameterSpec params, SecureRandom random)
             throws InvalidKeyException, InvalidAlgorithmParameterException {
@@ -369,6 +370,7 @@
     }
 
     // see JCE spec
+    @SuppressWarnings("deprecation")
     protected java.security.Key engineUnwrap(byte[] wrappedKey,
             String algorithm,
             int type) throws InvalidKeyException, NoSuchAlgorithmException {
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/Config.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/Config.java	Fri Jan 09 13:28:02 2015 -0500
@@ -584,16 +584,24 @@
     }
 
     private String parseLine() throws IOException {
-        String s = parseWord();
+        // allow quoted string as part of line
+        String s = null;
         while (true) {
             int token = nextToken();
             if ((token == TT_EOL) || (token == TT_EOF)) {
                 break;
             }
-            if (token != TT_WORD) {
+            if (token != TT_WORD && token != '\"') {
                 throw excToken("Unexpected value");
             }
-            s = s + " " + st.sval;
+            if (s == null) {
+                s = st.sval;
+            } else {
+                s = s + " " + st.sval;
+            }
+        }
+        if (s == null) {
+            throw excToken("Unexpected empty line");
         }
         return s;
     }
@@ -653,7 +661,9 @@
     //
 
     private String parseLibrary(String keyword) throws IOException {
-        String lib = parseStringEntry(keyword);
+        checkDup(keyword);
+        parseEquals();
+        String lib = parseLine();
         lib = expand(lib);
         int i = lib.indexOf("/$ISA/");
         if (i != -1) {
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11KeyStore.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11KeyStore.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1641,7 +1641,7 @@
 
         // If the key is a token object on this token, update it instead
         // of creating a duplicate key object.
-        // Otherwise, treat a P11Key like any other key, if is is extractable.
+        // Otherwise, treat a P11Key like any other key, if it is extractable.
         if (key instanceof P11Key) {
             P11Key p11Key = (P11Key)key;
             if (p11Key.tokenObject && (p11Key.token == this.token)) {
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeCipherWithJavaPadding.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeCipherWithJavaPadding.java	Fri Jan 09 13:28:02 2015 -0500
@@ -89,7 +89,7 @@
 
     private static class PKCS5Padding implements Padding {
         private final int blockSize;
-        // buffer for storing the the potential padding bytes
+        // buffer for storing the potential padding bytes
         private ByteBuffer trailingBytes = null;
 
         PKCS5Padding(int blockSize)
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSACipher.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSACipher.java	Fri Jan 09 13:28:02 2015 -0500
@@ -178,6 +178,7 @@
 
     // see JCE spec
     @Override
+    @SuppressWarnings("deprecation")
     protected synchronized void engineInit(int opmode, Key newKey,
             AlgorithmParameterSpec params, SecureRandom random)
             throws InvalidKeyException, InvalidAlgorithmParameterException {
@@ -331,6 +332,7 @@
 
     // see JCE spec
     @Override
+    @SuppressWarnings("deprecation")
     protected synchronized Key engineUnwrap(byte[] wrappedKey,
             String wrappedKeyAlgorithm, int wrappedKeyType)
             throws InvalidKeyException, NoSuchAlgorithmException {
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoMech.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoMech.java	Fri Jan 09 13:28:02 2015 -0500
@@ -37,6 +37,7 @@
     CRYPTO_AES_ECB(1, new String[]
         { "Cipher.AES/ECB/NoPadding;com.oracle.security.ucrypto.NativeCipher$AesEcbNoPadding",
           "Cipher.AES/ECB/PKCS5Padding;com.oracle.security.ucrypto.NativeCipherWithJavaPadding$AesEcbPKCS5",
+          "Alg.Alias.Cipher.AES;AES/ECB/PKCS5Padding",
           "Cipher.AES_128/ECB/NoPadding;com.oracle.security.ucrypto.NativeCipher$Aes128EcbNoPadding",
           "Alg.Alias.Cipher.2.16.840.1.101.3.4.1.1;AES_128/ECB/NoPadding",
           "Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.1;AES_128/ECB/NoPadding",
@@ -81,7 +82,8 @@
         { "Cipher.AES/CFB128/NoPadding;com.oracle.security.ucrypto.NativeCipher$AesCfb128NoPadding",
           "Cipher.AES/CFB128/PKCS5Padding;com.oracle.security.ucrypto.NativeCipherWithJavaPadding$AesCfb128PKCS5" }),
     CRYPTO_RSA_PKCS(31, new String[]
-        { "Cipher.RSA/ECB/PKCS1Padding;com.oracle.security.ucrypto.NativeRSACipher$PKCS1Padding" }),
+        { "Cipher.RSA/ECB/PKCS1Padding;com.oracle.security.ucrypto.NativeRSACipher$PKCS1Padding",
+          "Alg.Alias.Cipher.RSA;RSA/ECB/PKCS1Padding" }),
     CRYPTO_RSA_X_509(32, new String[]
         { "Cipher.RSA/ECB/NoPadding;com.oracle.security.ucrypto.NativeRSACipher$NoPadding" }),
     CRYPTO_MD5_RSA_PKCS(33, new String[]
--- a/jdk/src/jdk.dev/share/classes/sun/tools/native2ascii/Main.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.dev/share/classes/sun/tools/native2ascii/Main.java	Fri Jan 09 13:28:02 2015 -0500
@@ -71,11 +71,8 @@
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.Charset;
 import java.nio.charset.IllegalCharsetNameException;
-import java.nio.file.Files;
 import java.io.UnsupportedEncodingException;
 import java.nio.charset.UnsupportedCharsetException;
-import sun.tools.native2ascii.A2NFilter;
-import sun.tools.native2ascii.N2AFilter;
 
 /**
  * Main program of the native2ascii
@@ -94,7 +91,7 @@
     /**
      * Run the converter
      */
-    public synchronized boolean convert(String argv[]){
+    public synchronized boolean convert(String argv[]) {
         List<String> v = new ArrayList<>(2);
         File outputFile = null;
         boolean createOutputFile = false;
@@ -102,14 +99,14 @@
         // Parse arguments
         for (int i = 0; i < argv.length; i++) {
             if (argv[i].equals("-encoding")) {
-                if ((i + 1) < argv.length){
+                if ((i + 1) < argv.length) {
                     encodingString = argv[++i];
                 } else {
                     error(getMsg("err.bad.arg"));
                     usage();
                     return false;
                 }
-            } else if (argv[i].equals("-reverse")){
+            } else if (argv[i].equals("-reverse")) {
                 reverse = true;
             } else {
                 if (v.size() > 1) {
@@ -119,15 +116,18 @@
                 v.add(argv[i]);
             }
         }
-        if (encodingString == null)
-           defaultEncoding = Charset.defaultCharset().name();
 
+        if (encodingString == null) {
+            defaultEncoding = Charset.defaultCharset().name();
+        }
         char[] lineBreak = System.getProperty("line.separator").toCharArray();
+
         try {
             initializeConverter();
 
-            if (v.size() == 1)
+            if (v.size() == 1) {
                 inputFileName = v.get(0);
+            }
 
             if (v.size() == 2) {
                 inputFileName = v.get(0);
@@ -137,40 +137,38 @@
 
             if (createOutputFile) {
                 outputFile = new File(outputFileName);
-                    if (outputFile.exists() && !outputFile.canWrite()) {
-                        throw new Exception(formatMsg("err.cannot.write", outputFileName));
-                    }
+                if (outputFile.exists() && !outputFile.canWrite()) {
+                    throw new Exception(formatMsg("err.cannot.write", outputFileName));
+                }
             }
 
-            if (reverse){
-                BufferedReader reader = getA2NInput(inputFileName);
-                Writer osw = getA2NOutput(outputFileName);
-                String line;
-
-                while ((line = reader.readLine()) != null) {
-                    osw.write(line.toCharArray());
-                    osw.write(lineBreak);
-                    if (outputFileName == null) { // flush stdout
-                        osw.flush();
+            if (reverse) {
+                try (BufferedReader reader = getA2NInput(inputFileName);
+                        Writer osw = getA2NOutput(outputFileName);) {
+                    String line;
+                    while ((line = reader.readLine()) != null) {
+                        osw.write(line.toCharArray());
+                        osw.write(lineBreak);
+                        if (outputFileName == null) { // flush stdout
+                            osw.flush();
+                        }
                     }
                 }
-                reader.close();  // Close the stream.
-                osw.close();
             } else {
-             //N2A
-                String inLine;
-                BufferedReader in = getN2AInput(inputFileName);
-                BufferedWriter out = getN2AOutput(outputFileName);
-
-                while ((inLine = in.readLine()) != null) {
-                    out.write(inLine.toCharArray());
-                    out.write(lineBreak);
-                    if (outputFileName == null) { // flush stdout
-                        out.flush();
+                // N2A
+                try (BufferedReader in = getN2AInput(inputFileName);
+                        BufferedWriter out = getN2AOutput(outputFileName);) {
+                    String inLine;
+                    while ((inLine = in.readLine()) != null) {
+                        out.write(inLine.toCharArray());
+                        out.write(lineBreak);
+                        if (outputFileName == null) { // flush stdout
+                            out.flush();
+                        }
                     }
                 }
-                out.close();
             }
+
             // Since we are done rename temporary file to desired output file
             if (createOutputFile) {
                 if (outputFile.exists()) {
@@ -182,8 +180,7 @@
                 }
                 tempFile.renameTo(outputFile);
             }
-
-        } catch(Exception e){
+        } catch (Exception e) {
             error(e.toString());
             return false;
         }
--- a/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/Arguments.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/Arguments.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -141,8 +141,9 @@
     public Arguments(String[] args) throws IllegalArgumentException {
         int argc = 0;
 
-        if (args.length < 1) {
-            throw new IllegalArgumentException("invalid argument count");
+        if (args.length == 0) {
+            help = true;
+            return;
         }
 
         if ((args[0].compareTo("-?") == 0)
--- a/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/Plotter.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/Plotter.java	Fri Jan 09 13:28:02 2015 -0500
@@ -838,7 +838,7 @@
     private static class TimeStamps {
         // Time stamps (long) are split into offsets (long) and a
         // series of times from the offsets (int). A new offset is
-        // stored when the the time value doesn't fit in an int
+        // stored when the time value doesn't fit in an int
         // (approx every 24 days).  An array of indices is used to
         // define the starting point for each offset in the times
         // array.
--- a/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XObject.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XObject.java	Fri Jan 09 13:28:02 2015 -0500
@@ -65,7 +65,7 @@
         return object;
     }
 
-    //if true the the object.hashcode is added to the label
+    //if true the object.hashcode is added to the label
     public static void
         useHashCodeRepresentation(boolean useHashCodeRepresentation) {
         XObject.useHashCodeRepresentation = useHashCodeRepresentation;
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachineManager.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachineManager.java	Fri Jan 09 13:28:02 2015 -0500
@@ -225,7 +225,7 @@
  * file contains a provider configuration file named
  * <tt>com.sun.jdi.connect.spi.TransportService</tt> in the resource
  * directory <tt>META-INF/services</tt>, and the provider
- * configuration file lists the the full-qualified class name of the
+ * configuration file lists the full-qualified class name of the
  * TransportService implementation. A TransportService is a concrete
  * sub-class of {@link com.sun.jdi.connect.spi.TransportService
  * TransportService}. The format of the provider configuration file
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/AttachingConnector.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/AttachingConnector.java	Fri Jan 09 13:28:02 2015 -0500
@@ -38,7 +38,7 @@
 @jdk.Exported
 public interface AttachingConnector extends Connector {
     /**
-     * Attaches to a running application and and returns a
+     * Attaches to a running application and returns a
      * mirror of its VM.
      * <p>
      * The connector uses the given argument map in
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -238,7 +238,7 @@
     }
 
     public void stop(ObjectReference throwable) throws InvalidTypeException {
-        validateMirror(throwable);
+        validateMirrorOrNull(throwable);
         // Verify that the given object is a Throwable instance
         List<ReferenceType> list = vm.classesByName("java.lang.Throwable");
         ClassTypeImpl throwableClass = (ClassTypeImpl)list.get(0);
@@ -613,7 +613,7 @@
     }
 
     /**
-     * Propagate the the thread state change information
+     * Propagate the thread state change information
      * to registered listeners.
      * Must be entered while synchronized on vm.state()
      */
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1250,7 +1250,7 @@
         Long key = id;
 
         /*
-         * Attempt to retrieve an existing object object reference
+         * Attempt to retrieve an existing object reference
          */
         SoftObjectReference ref = objectsByID.get(key);
         if (ref != null) {
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/eventHandler.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/eventHandler.c	Fri Jan 09 13:28:02 2015 -0500
@@ -438,7 +438,7 @@
                 do {
                     /* The events have been reported and this
                      * thread is about to continue, but it may
-                     * have been started up up just to perform a
+                     * have been started up just to perform a
                      * requested method invocation. If so, we do
                      * the invoke now and then stop again waiting
                      * for another continue. By then another
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/monitor/BufferedMonitoredVm.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/monitor/BufferedMonitoredVm.java	Fri Jan 09 13:28:02 2015 -0500
@@ -47,7 +47,7 @@
     byte[] getBytes();
 
     /**
-     * Interface to get the the size of the instrumentation buffer
+     * Interface to get the size of the instrumentation buffer
      * for the target Java Virtual Machine.
      *
      * @return int - the size of the instrumentation buffer for the
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/monitor/HostIdentifier.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/monitor/HostIdentifier.java	Fri Jan 09 13:28:02 2015 -0500
@@ -227,7 +227,7 @@
      *
      * The necessary components of the VmIdentifier are extracted and
      * reassembled into a HostIdentifier. If a "file:" scheme (protocol)
-     * is specified, the the returned HostIdentifier will always be
+     * is specified, the returned HostIdentifier will always be
      * equivalent to HostIdentifier("file://localhost").
      *
      * @param vmid the VmIdentifier use to construct the HostIdentifier.
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/monitor/MonitoredVm.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/monitor/MonitoredVm.java	Fri Jan 09 13:28:02 2015 -0500
@@ -59,7 +59,7 @@
      *
      * @param name the name of the Instrumentation object to find.
      * @return Monitor - the {@link Monitor} object that can be used to
-     *                   monitor the the named instrumentation object, or
+     *                   monitor the named instrumentation object, or
      *                   <tt>null</tt> if the named object doesn't exist.
      * @throws MonitorException Thrown if an error occurs while communicating
      *                          with the target Java Virtual Machine.
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/monitor/MonitoredVmUtil.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/monitor/MonitoredVmUtil.java	Fri Jan 09 13:28:02 2015 -0500
@@ -58,7 +58,7 @@
      *
      * @param vm the target MonitoredVm
      * @return String - contains the command line of the target Java
-     *                  application or the the string "Unknown" if the
+     *                  application or the string "Unknown" if the
      *                  command line cannot be determined.
      */
     public static String commandLine(MonitoredVm vm) throws MonitorException {
@@ -73,7 +73,7 @@
      *
      * @param vm the target MonitoredVm
      * @return String - contains the arguments to the main class for the
-     *                  target Java application or the the string "Unknown"
+     *                  target Java application or the string "Unknown"
      *                  if the command line cannot be determined.
      */
     public static String mainArgs(MonitoredVm vm) throws MonitorException {
@@ -97,7 +97,7 @@
      * @param vm the target MonitoredVm
      * @param fullPath include the full path to Jar file, where applicable
      * @return String - contains the main class of the target Java
-     *                  application or the the string "Unknown" if the
+     *                  application or the string "Unknown" if the
      *                  command line cannot be determined.
      */
     public static String mainClass(MonitoredVm vm, boolean fullPath)
@@ -138,7 +138,7 @@
      *
      * @param vm the target MonitoredVm
      * @return String - contains the arguments passed to the JVM for the
-     *                  target Java application or the the string "Unknown"
+     *                  target Java application or the string "Unknown"
      *                  if the command line cannot be determined.
      */
     public static String jvmArgs(MonitoredVm vm) throws MonitorException {
@@ -151,7 +151,7 @@
      *
      * @param vm the target MonitoredVm
      * @return String - contains the flags passed to the JVM for the
-     *                  target Java application or the the string "Unknown"
+     *                  target Java application or the string "Unknown"
      *                  if the command line cannot be determined.
      */
     public static String jvmFlags(MonitoredVm vm) throws MonitorException {
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/monitor/remote/RemoteVm.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/monitor/remote/RemoteVm.java	Fri Jan 09 13:28:02 2015 -0500
@@ -49,7 +49,7 @@
     byte[] getBytes() throws RemoteException;
 
     /**
-     * Interface to get the the size of the instrumentation buffer
+     * Interface to get the size of the instrumentation buffer
      * for the target Java Virtual Machine.
      *
      * @return int - the size of the instrumentation buffer for the
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/AbstractPerfDataBuffer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/AbstractPerfDataBuffer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -91,7 +91,7 @@
      *
      * @param name the name of the Instrumentation object to find.
      * @return Monitor - the {@link Monitor} object that can be used to
-     *                   monitor the the named instrumentation object, or
+     *                   monitor the named instrumentation object, or
      *                   <tt>null</tt> if the named object doesn't exist.
      * @throws MonitorException Thrown if an error occurs while communicating
      *                          with the target Java Virtual Machine.
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/AliasFileParser.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/AliasFileParser.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
  */
 public class AliasFileParser {
     private static final String ALIAS = "alias";
-    private static final boolean DEBUG = false;
+    // 8028357 removed old, inefficient debug logging
 
     // other variables
     private URL inputfile;
@@ -64,21 +64,12 @@
         }
     }
 
-    private void logln(String s) {
-        if (DEBUG) {
-            System.err.println(s);
-        }
-    }
-
     /**
      * method to get the next token as a Token type
      */
     private void nextToken() throws IOException {
         st.nextToken();
         currentToken = new Token(st.ttype, st.sval);
-
-        logln("Read token: type = " + currentToken.ttype
-              + " string = " + currentToken.sval);
     }
 
     /**
@@ -90,8 +81,6 @@
 
         if ((currentToken.ttype == ttype)
                 && (currentToken.sval.compareTo(token) == 0)) {
-            logln("matched type: " + ttype + " and token = "
-                  + currentToken.sval);
             nextToken();
         } else {
             throw new SyntaxException(st.lineno());
@@ -105,7 +94,6 @@
      */
     private void match(int ttype) throws IOException, SyntaxException {
         if (currentToken.ttype == ttype) {
-            logln("matched type: " + ttype + ", token = " + currentToken.sval);
             nextToken();
         } else {
             throw new SyntaxException(st.lineno());
@@ -157,8 +145,6 @@
             } while ((currentToken.ttype != StreamTokenizer.TT_EOF)
                      && (currentToken.sval.compareTo(ALIAS) != 0));
 
-            logln("adding map entry for " + name + " values = " + aliases);
-
             map.put(name, aliases);
         }
     }
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/CountedTimerTaskUtils.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/CountedTimerTaskUtils.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,7 @@
  */
 public class CountedTimerTaskUtils {
 
-    private static final boolean DEBUG = false;
+    // 8028357 removed old, inefficient debug logging
 
     /**
      * Reschedule a CountedTimeTask at a different interval. Probably not
@@ -58,14 +58,6 @@
         long lastRun = oldTask.scheduledExecutionTime();
         long expired = now - lastRun;
 
-        if (DEBUG) {
-            System.err.println("computing timer delay: "
-                               + " oldInterval = " + oldInterval
-                               + " newInterval = " + newInterval
-                               + " samples = " + oldTask.executionCount()
-                               + " expired = " + expired);
-        }
-
         /*
          * check if original task ever ran - if not, then lastRun is
          * undefined and we simply set the delay to 0.
@@ -76,12 +68,6 @@
             delay = remainder >= 0 ? remainder : 0;
         }
 
-        if (DEBUG) {
-            System.err.println("rescheduling sampler task: interval = "
-                               + newInterval
-                               + " delay = " + delay);
-        }
-
         timer.schedule(newTask, delay, newInterval);
     }
 }
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/PerfDataBufferImpl.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/PerfDataBufferImpl.java	Fri Jan 09 13:28:02 2015 -0500
@@ -229,7 +229,7 @@
      *
      * @param name the name of the Instrumentation object to find.
      * @return Monitor - the {@link Monitor} object that can be used to
-     *                   monitor the the named instrumentation object, or
+     *                   monitor the named instrumentation object, or
      *                   <tt>null</tt> if the named object doesn't exist.
      * @throws MonitorException Thrown if an error occurs while communicating
      *                          with the target Java Virtual Machine.
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/PerfIntegerMonitor.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/PerfIntegerMonitor.java	Fri Jan 09 13:28:02 2015 -0500
@@ -63,7 +63,7 @@
      * The object returned contains an Integer object containing the
      * current value of the IntegerInstrument.
      *
-     * @return Object - the current value of the the IntegerInstrument. The
+     * @return Object - the current value of the IntegerInstrument. The
      *                   return type is guaranteed to be of type Integer.
      */
     public Object getValue() {
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/PerfLongMonitor.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/PerfLongMonitor.java	Fri Jan 09 13:28:02 2015 -0500
@@ -62,7 +62,7 @@
      * The object returned contains a Long object containing the
      * current value of the LongInstrument.
      *
-     * @return Object - the current value of the the LongInstrument. The
+     * @return Object - the current value of the LongInstrument. The
      *                  return type is guaranteed to be of type Long.
      */
     public Object getValue() {
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/v1_0/PerfDataBuffer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/v1_0/PerfDataBuffer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -44,7 +44,8 @@
  */
 public class PerfDataBuffer extends PerfDataBufferImpl {
 
-    private static final boolean DEBUG = false;
+    // 8028357 removed old, inefficient debug logging
+
     private static final int syncWaitMs =
             Integer.getInteger("sun.jvmstat.perdata.syncWaitMs", 5000);
     private static final ArrayList<Monitor> EMPTY_LIST = new ArrayList<Monitor>(0);
@@ -268,18 +269,13 @@
          * loop waiting for the ticks counter to be non zero. This is
          * an indication that the jvm is initialized.
          */
-        log("synchWithTarget: " + lvmid + " ");
         while (ticks.longValue() == 0) {
-            log(".");
-
             try { Thread.sleep(20); } catch (InterruptedException e) { }
 
             if (System.currentTimeMillis() > timeLimit) {
-                lognl("failed: " + lvmid);
                 throw new MonitorException("Could Not Synchronize with target");
             }
         }
-        lognl("success: " + lvmid);
     }
 
     /**
@@ -291,24 +287,18 @@
                       throws MonitorException {
         Monitor monitor = null;
 
-        log("polling for: " + lvmid + "," + name + " ");
-
         pollForEntry = nextEntry;
         while ((monitor = map.get(name)) == null) {
-            log(".");
 
             try { Thread.sleep(20); } catch (InterruptedException e) { }
 
             long t = System.currentTimeMillis();
             if ((t > timeLimit) || (overflow.intValue() > 0)) {
-                lognl("failed: " + lvmid + "," + name);
-                dumpAll(map, lvmid);
                 throw new MonitorException("Could not find expected counter");
             }
 
             getNewMonitors(map);
         }
-        lognl("success: " + lvmid + "," + name);
         return monitor;
     }
 
@@ -429,7 +419,7 @@
 
                 /*
                  * replace the real counters with pseudo counters that are
-                 * initialized to to the correct values. The maximum size of
+                 * initialized to the correct values. The maximum size of
                  * the eden and survivor spaces are supposed to be:
                  *    max_eden_size = new_size - (2*alignment).
                  *    max_survivor_size = new_size - (2*alignment).
@@ -481,8 +471,6 @@
 
         // check for the end of the buffer
         if (nextEntry == buffer.limit()) {
-            lognl("getNextMonitorEntry():"
-                  + " nextEntry == buffer.limit(): returning");
             return null;
         }
 
@@ -614,37 +602,4 @@
         nextEntry = entryStart + entryLength;
         return monitor;
     }
-
-    /**
-     * Method to dump debugging information
-     */
-    private void dumpAll(Map<String, Monitor> map, int lvmid) {
-        if (DEBUG) {
-            Set<String> keys = map.keySet();
-
-            System.err.println("Dump for " + lvmid);
-            int j = 0;
-            for (Iterator<String> i = keys.iterator(); i.hasNext(); j++) {
-                Monitor monitor = map.get(i.next());
-                System.err.println(j + "\t" + monitor.getName()
-                                   + "=" + monitor.getValue());
-            }
-            System.err.println("nextEntry = " + nextEntry
-                               + " pollForEntry = " + pollForEntry);
-            System.err.println("Buffer info:");
-            System.err.println("buffer = " + buffer);
-        }
-    }
-
-    private void lognl(String s) {
-        if (DEBUG) {
-            System.err.println(s);
-        }
-    }
-
-    private void log(String s) {
-        if (DEBUG) {
-            System.err.print(s);
-        }
-    }
 }
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/v2_0/PerfDataBuffer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/v2_0/PerfDataBuffer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -62,7 +62,8 @@
  */
 public class PerfDataBuffer extends PerfDataBufferImpl {
 
-    private static final boolean DEBUG = false;
+    // 8028357 removed old, inefficient debug logging
+
     private static final int syncWaitMs =
             Integer.getInteger("sun.jvmstat.perdata.syncWaitMs", 5000);
     private static final ArrayList<Monitor> EMPTY_LIST = new ArrayList<>(0);
@@ -264,20 +265,15 @@
         long timeLimit = System.currentTimeMillis() + syncWaitMs;
 
         // loop waiting for the accessible indicater to be non-zero
-        log("synchWithTarget: " + lvmid + " ");
         while (!prologue.isAccessible()) {
 
-            log(".");
-
             // give the target jvm a chance to complete initializatoin
             try { Thread.sleep(20); } catch (InterruptedException e) { }
 
             if (System.currentTimeMillis() > timeLimit) {
-                logln("failed: " + lvmid);
                 throw new MonitorException("Could not synchronize with target");
             }
         }
-        logln("success: " + lvmid);
     }
 
     /**
@@ -306,8 +302,6 @@
 
         // check for end of the buffer
         if (nextEntry == buffer.limit()) {
-            logln("getNextMonitorEntry():"
-                  + " nextEntry == buffer.limit(): returning");
             return null;
         }
 
@@ -346,9 +340,6 @@
         byte varByte = buffer.get();
         int dataOffset = buffer.getInt();
 
-        dump_entry_fixed(entryStart, nameOffset, vectorLength, typeCodeByte,
-                         flags, unitsByte, varByte, dataOffset);
-
         // convert common attributes to their object types
         Units units = Units.toUnits(unitsByte);
         Variability variability = Variability.toVariability(varByte);
@@ -439,8 +430,6 @@
         // set the position to the start of the data item
         buffer.position(entryStart + dataOffset);
 
-        dump_entry_variable(name, buffer, dataSize);
-
         if (vectorLength == 0) {
             // create a scalar Monitor object
             if (typeCode == TypeCode.LONG) {
@@ -514,103 +503,4 @@
         nextEntry = entryStart + entryLength;
         return monitor;
     }
-
-    /**
-     * Method to dump debugging information
-     */
-    private void dumpAll(Map<String, Monitor> map, int lvmid) {
-        if (DEBUG) {
-            Set<String> keys = map.keySet();
-
-            System.err.println("Dump for " + lvmid);
-            int j = 0;
-            for (Iterator<String> i = keys.iterator(); i.hasNext(); j++) {
-                Monitor monitor = map.get(i.next());
-                System.err.println(j + "\t" + monitor.getName()
-                                   + "=" + monitor.getValue());
-            }
-            System.err.println("nextEntry = " + nextEntry);
-            System.err.println("Buffer info:");
-            System.err.println("buffer = " + buffer);
-        }
-    }
-
-    /**
-     * Method to dump the fixed portion of an entry.
-     */
-    private void dump_entry_fixed(int entry_start, int nameOffset,
-                                  int vectorLength, byte typeCodeByte,
-                                  byte flags, byte unitsByte, byte varByte,
-                                  int dataOffset) {
-        if (DEBUG) {
-            System.err.println("Entry at offset: 0x"
-                               + Integer.toHexString(entry_start));
-            System.err.println("\tname_offset = 0x"
-                               + Integer.toHexString(nameOffset));
-            System.err.println("\tvector_length = 0x"
-                               + Integer.toHexString(vectorLength));
-            System.err.println("\tdata_type = 0x"
-                               + Integer.toHexString(typeCodeByte));
-            System.err.println("\tflags = 0x"
-                               + Integer.toHexString(flags));
-            System.err.println("\tdata_units = 0x"
-                               + Integer.toHexString(unitsByte));
-            System.err.println("\tdata_variability = 0x"
-                               + Integer.toHexString(varByte));
-            System.err.println("\tdata_offset = 0x"
-                               + Integer.toHexString(dataOffset));
-        }
-    }
-
-    private void dump_entry_variable(String name, ByteBuffer bb, int size) {
-        if (DEBUG) {
-            char[] toHex = new char[] { '0', '1', '2', '3',
-                                        '4', '5', '6', '7',
-                                        '8', '9', 'a', 'b',
-                                        'c', 'd', 'e', 'f' };
-
-            ByteBuffer data = bb.slice();
-            data.limit(size);
-
-            System.err.println("\tname = " + name);
-            System.err.println("\tdata = ");
-
-            int count=0;
-            while (data.hasRemaining()) {
-                byte b = data.get();
-                byte high = (byte)((b >> 8) & 0x0f);
-                byte low = (byte)(b & 0x0f);
-
-                if (count % 16 == 0) {
-                    System.err.print("\t\t" + Integer.toHexString(count / 16)
-                                     + ": ");
-                }
-
-                System.err.print(String.valueOf(toHex[high])
-                                 + String.valueOf(toHex[low]));
-
-                count++;
-                if (count % 16 == 0) {
-                    System.err.println();
-                } else {
-                    System.err.print(" ");
-                }
-            }
-            if (count % 16 != 0) {
-                System.err.println();
-            }
-        }
-    }
-
-    private void logln(String s) {
-        if (DEBUG) {
-            System.err.println(s);
-        }
-    }
-
-    private void log(String s) {
-        if (DEBUG) {
-            System.err.print(s);
-        }
-    }
 }
--- a/jdk/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/ResourceRecord.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/ResourceRecord.java	Fri Jan 09 13:28:02 2015 -0500
@@ -103,7 +103,7 @@
     int rrlen;                  // number of octets in encoded RR
     DnsName name;               // name field of RR, including root label
     int rrtype;                 // type field of RR
-    String rrtypeName;          // name of of rrtype
+    String rrtypeName;          // name of rrtype
     int rrclass;                // class field of RR
     String rrclassName;         // name of rrclass
     int ttl = 0;                // ttl field of RR
--- a/jdk/src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java	Fri Jan 09 13:28:02 2015 -0500
@@ -353,7 +353,6 @@
     /**
      * Wrap a RemoteException inside a NamingException.
      */
-    @SuppressWarnings("deprecation")
     public static NamingException wrapRemoteException(RemoteException re) {
 
         NamingException ne;
@@ -365,8 +364,7 @@
             ne = new NoPermissionException();
 
         } else if (re instanceof StubNotFoundException ||
-                   re instanceof UnknownHostException ||
-                   re instanceof SocketSecurityException) {
+                   re instanceof UnknownHostException) {
             ne = new ConfigurationException();
 
         } else if (re instanceof ExportException ||
@@ -414,11 +412,10 @@
      * Attempts to install a security manager if none is currently in
      * place.
      */
-    @SuppressWarnings("deprecation")
     private static void installSecurityMgr() {
 
         try {
-            System.setSecurityManager(new RMISecurityManager());
+            System.setSecurityManager(new SecurityManager());
         } catch (Exception e) {
         }
     }
--- a/jdk/src/jdk.rmic/share/classes/sun/tools/java/ClassDefinition.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.rmic/share/classes/sun/tools/java/ClassDefinition.java	Fri Jan 09 13:28:02 2015 -0500
@@ -295,7 +295,7 @@
     }
 
     /**
-     * Tell if the class is local or or anonymous class, or inside
+     * Tell if the class is local or anonymous class, or inside
      * such a class, which means it cannot be mentioned outside of
      * its file.
      */
@@ -770,7 +770,7 @@
     }
 
     /**
-     * We know the the field is marked protected (and not public) and that
+     * We know the field is marked protected (and not public) and that
      * the field is visible (as per canAccess).  Can we access the field as
      * <accessor>.<field>, where <accessor> has the type <accessorType>?
      *
--- a/jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpMultiChannel.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpMultiChannel.java	Fri Jan 09 13:28:02 2015 -0500
@@ -219,7 +219,7 @@
      *         bind the socket to an automatically assigned socket address
      *
      * @param  backlog
-     *         The maximum number number of pending connections
+     *         The maximum number of pending connections
      *
      * @return  This channel
      *
@@ -706,7 +706,7 @@
      *
      * @throws  SecurityException
      *          If a security manager has been installed and it does not permit
-     *          new associations to be setup with the the messages's address
+     *          new associations to be setup with the messages's address
      *
      * @throws  IOException
      *          If some other I/O error occurs
--- a/jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpServerChannel.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpServerChannel.java	Fri Jan 09 13:28:02 2015 -0500
@@ -214,7 +214,7 @@
      *         bind the socket to an automatically assigned socket address
      *
      * @param  backlog
-     *         The maximum number number of pending associations
+     *         The maximum number of pending associations
      *
      * @return  This channel
      *
--- a/jdk/src/jdk.sctp/unix/native/libsctp/SctpChannelImpl.c	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.sctp/unix/native/libsctp/SctpChannelImpl.c	Fri Jan 09 13:28:02 2015 -0500
@@ -507,7 +507,7 @@
             if (handleNotification(env, fd, resultContainerObj, snp, rv,
                                    (msg->msg_flags & MSG_EOR),
                                    (struct sockaddr*)&sa ) == JNI_TRUE) {
-                /* We have received a notification that is of interest to
+                /* We have received a notification that is of interest
                    to the Java API. The appropriate notification will be
                    set in the result container. */
                 if (allocated == JNI_TRUE) {
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTDomainPrincipal.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTDomainPrincipal.java	Fri Jan 09 13:28:02 2015 -0500
@@ -117,7 +117,7 @@
      * @param o Object to be compared for equality with this
      *          <code>NTDomainPrincipal</code>.
      *
-     * @return true if the specified Object is equal equal to this
+     * @return true if the specified Object is equal to this
      *          <code>NTDomainPrincipal</code>.
      */
     public boolean equals(Object o) {
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTNumericCredential.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTNumericCredential.java	Fri Jan 09 13:28:02 2015 -0500
@@ -88,7 +88,7 @@
      * @param o Object to be compared for equality with this
      *          <code>NTNumericCredential</code>.
      *
-     * @return true if the specified Object is equal equal to this
+     * @return true if the specified Object is equal to this
      *          <code>NTNumericCredential</code>.
      */
     public boolean equals(Object o) {
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidDomainPrincipal.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidDomainPrincipal.java	Fri Jan 09 13:28:02 2015 -0500
@@ -91,7 +91,7 @@
      * @param o Object to be compared for equality with this
      *          <code>NTSidDomainPrincipal</code>.
      *
-     * @return true if the specified Object is equal equal to this
+     * @return true if the specified Object is equal to this
      *          <code>NTSidDomainPrincipal</code>.
      */
     public boolean equals(Object o) {
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidGroupPrincipal.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidGroupPrincipal.java	Fri Jan 09 13:28:02 2015 -0500
@@ -86,7 +86,7 @@
      * @param o Object to be compared for equality with this
      *          <code>NTSidGroupPrincipal</code>.
      *
-     * @return true if the specified Object is equal equal to this
+     * @return true if the specified Object is equal to this
      *          <code>NTSidGroupPrincipal</code>.
      */
     public boolean equals(Object o) {
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidPrimaryGroupPrincipal.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidPrimaryGroupPrincipal.java	Fri Jan 09 13:28:02 2015 -0500
@@ -89,7 +89,7 @@
      * @param o Object to be compared for equality with this
      *          <code>NTSidPrimaryGroupPrincipal</code>.
      *
-     * @return true if the specified Object is equal equal to this
+     * @return true if the specified Object is equal to this
      *          <code>NTSidPrimaryGroupPrincipal</code>.
      */
     public boolean equals(Object o) {
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidUserPrincipal.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidUserPrincipal.java	Fri Jan 09 13:28:02 2015 -0500
@@ -85,7 +85,7 @@
      * @param o Object to be compared for equality with this
      *          <code>NTSidUserPrincipal</code>.
      *
-     * @return true if the specified Object is equal equal to this
+     * @return true if the specified Object is equal to this
      *          <code>NTSidUserPrincipal</code>.
      */
     public boolean equals(Object o) {
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTUserPrincipal.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTUserPrincipal.java	Fri Jan 09 13:28:02 2015 -0500
@@ -111,7 +111,7 @@
      * @param o Object to be compared for equality with this
      *          <code>NTPrincipal</code>.
      *
-     * @return true if the specified Object is equal equal to this
+     * @return true if the specified Object is equal to this
      *          <code>NTPrincipal</code>.
      */
     public boolean equals(Object o) {
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisNumericGroupPrincipal.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisNumericGroupPrincipal.java	Fri Jan 09 13:28:02 2015 -0500
@@ -184,7 +184,7 @@
      * @param o Object to be compared for equality with this
      *          <code>SolarisNumericGroupPrincipal</code>.
      *
-     * @return true if the specified Object is equal equal to this
+     * @return true if the specified Object is equal to this
      *          <code>SolarisNumericGroupPrincipal</code>.
      */
     public boolean equals(Object o) {
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisNumericUserPrincipal.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisNumericUserPrincipal.java	Fri Jan 09 13:28:02 2015 -0500
@@ -151,7 +151,7 @@
      * @param o Object to be compared for equality with this
      *          <code>SolarisNumericUserPrincipal</code>.
      *
-     * @return true if the specified Object is equal equal to this
+     * @return true if the specified Object is equal to this
      *          <code>SolarisNumericUserPrincipal</code>.
      */
     public boolean equals(Object o) {
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisPrincipal.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisPrincipal.java	Fri Jan 09 13:28:02 2015 -0500
@@ -115,7 +115,7 @@
      * @param o Object to be compared for equality with this
      *          <code>SolarisPrincipal</code>.
      *
-     * @return true if the specified Object is equal equal to this
+     * @return true if the specified Object is equal to this
      *          <code>SolarisPrincipal</code>.
      */
     public boolean equals(Object o) {
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixNumericGroupPrincipal.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixNumericGroupPrincipal.java	Fri Jan 09 13:28:02 2015 -0500
@@ -187,7 +187,7 @@
      * @param o Object to be compared for equality with this
      *          <code>UnixNumericGroupPrincipal</code>.
      *
-     * @return true if the specified Object is equal equal to this
+     * @return true if the specified Object is equal to this
      *          <code>UnixNumericGroupPrincipal</code>.
      */
     public boolean equals(Object o) {
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixNumericUserPrincipal.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixNumericUserPrincipal.java	Fri Jan 09 13:28:02 2015 -0500
@@ -147,7 +147,7 @@
      * @param o Object to be compared for equality with this
      *          <code>UnixNumericUserPrincipal</code>.
      *
-     * @return true if the specified Object is equal equal to this
+     * @return true if the specified Object is equal to this
      *          <code>UnixNumericUserPrincipal</code>.
      */
     public boolean equals(Object o) {
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixPrincipal.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixPrincipal.java	Fri Jan 09 13:28:02 2015 -0500
@@ -112,7 +112,7 @@
      * @param o Object to be compared for equality with this
      *          <code>UnixPrincipal</code>.
      *
-     * @return true if the specified Object is equal equal to this
+     * @return true if the specified Object is equal to this
      *          <code>UnixPrincipal</code>.
      */
     public boolean equals(Object o) {
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/X500Principal.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/X500Principal.java	Fri Jan 09 13:28:02 2015 -0500
@@ -130,7 +130,7 @@
      * @param o Object to be compared for equality with this
      *          <code>X500Principal</code>.
      *
-     * @return true if the specified Object is equal equal to this
+     * @return true if the specified Object is equal to this
      *          <code>X500Principal</code>.
      */
     public boolean equals(Object o) {
--- a/jdk/src/sample/share/nio/server/ChannelIOSecure.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/sample/share/nio/server/ChannelIOSecure.java	Fri Jan 09 13:28:02 2015 -0500
@@ -576,7 +576,7 @@
 
         /*
          * We ignore the return value here, we return the
-         * number of bytes actually consumed from the the file.
+         * number of bytes actually consumed from the file.
          * We'll flush the output buffer before we start shutting down.
          */
         doWrite(fileChannelBB);
--- a/jdk/src/sample/solaris/dtrace/hotspot/gc_time_stat.d	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/src/sample/solaris/dtrace/hotspot/gc_time_stat.d	Fri Jan 09 13:28:02 2015 -0500
@@ -111,8 +111,8 @@
  *  arg4: uintptr_t,    the initial size of the memory pool (in bytes)
  *  arg5: uintptr_t,    the amount of memory in use in the memory pool
  *                          (in bytes)
- *  arg6: uintptr_t,    the the number of committed pages in the memory pool
- *  arg7: uintptr_t,    the the maximum size of the memory pool
+ *  arg6: uintptr_t,    the number of committed pages in the memory pool
+ *  arg7: uintptr_t,    the maximum size of the memory pool
  */
 hotspot$target:::mem-pool-gc-begin
 {
--- a/jdk/test/ProblemList.txt	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/ProblemList.txt	Fri Jan 09 13:28:02 2015 -0500
@@ -120,6 +120,10 @@
 
 # jdk_lang
 
+# 8029891
+java/lang/ClassLoader/deadlock/GetResource.java                 generic-all
+
+
 ############################################################################
 
 # jdk_instrument
@@ -135,10 +139,6 @@
 
 # jdk_management
 
-# 8044591
-com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationContentTest.java   generic-all
-com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationTest.java          generic-all
-
 # 8058492
 java/lang/management/ThreadMXBean/FindDeadlocks.java                                      generic-all
 
@@ -243,9 +243,6 @@
 java/security/KeyPairGenerator/SolarisShortDSA.java             solaris-all
 sun/security/tools/keytool/standard.sh                          solaris-all
 
-# 8049312
-com/sun/crypto/provider/Cipher/AES/CICO.java			generic-all
-
 # 8062758
 java/security/Security/ClassLoaderDeadlock/Deadlock2.sh         generic-all
 
@@ -271,7 +268,7 @@
 
 # Tests take too long, on sparcs see 7143279
 # also see 8059906
-tools/pack200/CommandLineTests.java
+tools/pack200/CommandLineTests.java                             generic-all
 tools/pack200/Pack200Test.java                                  solaris-all,macosx-all
 
 # 8007410
@@ -303,25 +300,6 @@
 
 # jdk_util
 
-# 8051641
-sun/util/calendar/zi/TestZoneInfo310.java                        generic-all
-
-# 8062588
-java/util/Locale/LocaleProviders.sh                              generic-all
-java/util/PluggableLocale/BreakIteratorProviderTest.sh           generic-all
-java/util/PluggableLocale/CalendarDataProviderTest.sh            generic-all
-java/util/PluggableLocale/CalendarNameProviderTest.sh            generic-all
-java/util/PluggableLocale/CollatorProviderTest.sh                generic-all
-java/util/PluggableLocale/CurrencyNameProviderTest.sh            generic-all
-java/util/PluggableLocale/DateFormatProviderTest.sh              generic-all
-java/util/PluggableLocale/DateFormatSymbolsProviderTest.sh       generic-all
-java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.sh    generic-all
-java/util/PluggableLocale/GenericTest.sh                         generic-all
-java/util/PluggableLocale/LocaleNameProviderTest.sh              generic-all
-java/util/PluggableLocale/NumberFormatProviderTest.sh            generic-all
-java/util/PluggableLocale/TimeZoneNameProviderTest.sh            generic-all
-java/util/ResourceBundle/Bug6299235Test.sh                       generic-all
-
 # 8062512
 java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.java generic-all
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/oracle/security/ucrypto/TestAlias.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8043349
+ * @summary Ensure the cipher aliases of AES and RSA works correctly
+ */
+import java.io.*;
+import java.security.*;
+import java.security.spec.*;
+import java.util.*;
+import javax.crypto.*;
+import javax.crypto.spec.*;
+
+public class TestAlias extends UcryptoTest {
+
+    private static final String[] CIPHER_ALGOS = {
+        "AES/ECB/PKCS5Padding",
+        "AES",
+        "RSA/ECB/PKCS1Padding",
+        "RSA",
+    };
+
+    public static void main(String[] args) throws Exception {
+        main(new TestAlias(), null);
+    }
+
+    public void doTest(Provider prov) throws Exception {
+        Cipher c;
+        for (int i = 0; i < (CIPHER_ALGOS.length - 1); i+=2) {
+            String fullTransformation = CIPHER_ALGOS[i];
+            try {
+                c = Cipher.getInstance(fullTransformation, prov);
+            } catch (NoSuchAlgorithmException nsae) {
+                System.out.println("Skip unsupported algo: " + fullTransformation);
+                continue;
+            }
+            c = Cipher.getInstance(CIPHER_ALGOS[i+1], prov);
+        }
+
+        System.out.println("Test Passed");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/KeyAgreement/SameDHKeyStressTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,169 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8048819
+ * @summary This test stressful verifies the assertion of "The secret keys generated
+ * by all involved parties should be the same." for javax.crypto.KeyAgreement
+ * @run main SameDHKeyStressTest
+ */
+import java.security.AlgorithmParameterGenerator;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.spec.AlgorithmParameterSpec;
+import java.util.Arrays;
+import javax.crypto.KeyAgreement;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.DHGenParameterSpec;
+import javax.crypto.spec.DHParameterSpec;
+
+public class SameDHKeyStressTest {
+
+    static final String[] ALGORITHMS = {"DH", "DiffieHellman", "dh", "diffieHELLMAN"};
+    static final String[] SECRET_ALOGRITHMS = {"DES", "DESede", "blowfish"};
+    static final int[] NUMBER_OF_PARTIES = {2, 3, 4};
+    static final String[] PA_NAMES = {"Alice", "Bob", "Carol", "David"};
+
+    public static void main(String args[]) {
+        int failedCnt = 0;
+        StringBuilder failedList = new StringBuilder("Failed List:");
+
+        for (String algorithm : ALGORITHMS) {
+            for (int numOfParties : NUMBER_OF_PARTIES) {
+                for (String secretAlgorithm : SECRET_ALOGRITHMS) {
+                    if (!runTest(algorithm, numOfParties, secretAlgorithm)) {
+                        failedCnt++;
+                        failedList.append("\n Altorightm = ").append(algorithm).
+                                append(" Number of Parties = ").append(numOfParties).
+                                append(" Secret Algorithm = ").append(secretAlgorithm);
+                    }
+                }
+            }
+        } //end of for loop
+
+        if (failedCnt > 0) {
+            System.out.println(failedList);
+            throw new RuntimeException("SameDHKeyStressTest Failed");
+        }
+    }
+
+    public static boolean runTest(String algo, int numParties, String secretAlgo) {
+        KAParticipant[] parties = new KAParticipant[numParties];
+        Key[] keyArchives = new Key[numParties];
+        try {
+            // generate AlogirhtmParameterSpec
+            AlgorithmParameterGenerator apg = AlgorithmParameterGenerator.getInstance("DH","SunJCE");
+            AlgorithmParameterSpec aps = new DHGenParameterSpec(512, 64);
+            apg.init(aps);
+            DHParameterSpec spec = apg.generateParameters().
+                    getParameterSpec(DHParameterSpec.class);
+
+            //initilize all KeyAgreement participants
+            for (int i = 0; i < numParties; i++) {
+                parties[i] = new KAParticipant(PA_NAMES[i], algo);
+                parties[i].initialize(spec);
+                keyArchives[i] = parties[i].getPublicKey();
+            }
+
+            // Do all phases in the KeyAgreement for all participants
+            Key[] keyBuffer = new Key[numParties];
+            boolean lastPhase = false;
+            for (int j = 0; j < numParties - 1; j++) {
+                if (j == numParties - 2) {
+                    lastPhase = true;
+                }
+                for (int k = 0; k < numParties; k++) {
+                    if (k == numParties - 1) {
+                        keyBuffer[k] = parties[k].doPhase(keyArchives[0], lastPhase);
+                    } else {
+                        keyBuffer[k] = parties[k].doPhase(keyArchives[k + 1], lastPhase);
+                    }
+                }
+                System.arraycopy(keyBuffer, 0, keyArchives, 0, numParties);
+            }
+
+            //Comparison: The secret keys generated by all involved parties should be the same
+            SecretKey[] sKeys = new SecretKey[numParties];
+            for (int n = 0; n < numParties; n++) {
+                sKeys[n] = parties[n].generateSecret(secretAlgo);
+            }
+            for (int q = 0; q < numParties - 1; q++) {
+                if (!Arrays.equals(sKeys[q].getEncoded(), sKeys[q + 1].getEncoded())) {
+                    return false;
+                }
+            }
+            return true;
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            return false;
+        }
+
+    }
+
+}
+
+class KAParticipant {
+
+    private String name = null;
+    private String algorithm = null;
+    private KeyPairGenerator keyGen = null;
+    private KeyPair keys = null;
+    private KeyAgreement ka = null;
+
+    public KAParticipant(String pName, String algo) throws NoSuchAlgorithmException, NoSuchProviderException {
+        name = pName;
+        algorithm = algo;
+        keyGen = KeyPairGenerator.getInstance(algo,"SunJCE");
+        ka = KeyAgreement.getInstance(algo,"SunJCE");
+    }
+
+    public void initialize(AlgorithmParameterSpec spec) throws InvalidAlgorithmParameterException, InvalidKeyException {
+        keyGen.initialize(spec);
+        keys = keyGen.generateKeyPair();
+        ka.init(keys.getPrivate());
+    }
+
+    public Key doPhase(Key key, boolean lastPhase) throws InvalidKeyException {
+        return ka.doPhase(key, lastPhase);
+    }
+
+    public Key getPublicKey() {
+        return keys.getPublic();
+    }
+
+    public byte[] generateSecret() {
+        return ka.generateSecret();
+    }
+
+    public SecretKey generateSecret(String algo) throws java.lang.IllegalStateException,
+            java.security.NoSuchAlgorithmException,
+            java.security.InvalidKeyException {
+        return ka.generateSecret(algo);
+    }
+}
--- a/jdk/test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationContentTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationContentTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -26,6 +26,7 @@
  * @bug     7036199
  * @summary Check that GarbageCollectionNotification contents are reasonable
  * @author  Frederic Parain
+ * @requires vm.opt.ExplicitGCInvokesConcurrent == null | vm.opt.ExplicitGCInvokesConcurrent == false
  * @run     main/othervm GarbageCollectionNotificationContentTest
  */
 
--- a/jdk/test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -26,6 +26,7 @@
  * @bug     7036199
  * @summary Check that GarbageCollection notification are thrown by every GarbageCollectorMXBean
  * @author  Frederic Parain
+ * @requires vm.opt.ExplicitGCInvokesConcurrent == null | vm.opt.ExplicitGCInvokesConcurrent == false
  * @run     main/othervm GarbageCollectionNotificationTest
  */
 
--- a/jdk/test/com/sun/tools/attach/StartManagementAgent.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/com/sun/tools/attach/StartManagementAgent.java	Fri Jan 09 13:28:02 2015 -0500
@@ -41,7 +41,7 @@
  * @summary Test for VirtualMachine.startManagementAgent and VirtualMachine.startLocalManagementAgent
  * @library /lib/testlibrary
  * @run build Application SimpleProvider jdk.testlibrary.*
- * @run main StartManagementAgent
+ * @run main/timeout=300 StartManagementAgent
  */
 
 /*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Choice/DragMouseOutAndRelease/DragMouseOutAndRelease.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,421 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 6322625
+  @summary REG:Choice does not trigger MouseReleased when dragging and releasing the mouse outside choice, XAWT
+  @author andrei.dmitriev area=awt.choice
+  @run main DragMouseOutAndRelease
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+
+public class DragMouseOutAndRelease
+{
+    static Frame frame = new Frame("Test Frame");
+    static Choice choice1 = new Choice();
+    static Robot robot;
+    static Point pt;
+    static volatile boolean mousePressed = false;
+    static volatile boolean mouseReleased = false;
+
+    private static void init()
+    {
+        String[] instructions =
+        {
+            "This is an AUTOMATIC test, simply wait until it is done.",
+            "The result (passed or failed) will be shown in the",
+            "message window below."
+        };
+        Sysout.createDialog( );
+        Sysout.printInstructions( instructions );
+
+        frame.setLayout (new FlowLayout ());
+        for (int i = 1; i<10;i++){
+            choice1.add("item "+i);
+        }
+        frame.add(choice1);
+
+        choice1.addMouseListener(new MouseAdapter() {
+                public void mousePressed(MouseEvent me) {
+                    mousePressed = true;
+                    System.out.println(me);
+                }
+                public void mouseReleased(MouseEvent me) {
+                    mouseReleased = true;
+                    System.out.println(me);
+                }
+            });
+
+        frame.pack();
+        frame.setVisible(true);
+        frame.validate();
+
+        try {
+            robot = new Robot();
+            robot.setAutoDelay(50);
+            robot.waitForIdle();
+            testMouseDrag();
+        } catch (Throwable e) {
+            new RuntimeException("Test failed. Exception thrown: "+e);
+        }
+        DragMouseOutAndRelease.pass();
+    }//End  init()
+
+    public static void testMouseDrag(){
+        mousePressed = false;
+        mouseReleased = false;
+
+        pt = choice1.getLocationOnScreen();
+        robot.mouseMove(pt.x + choice1.getWidth()/2, pt.y + choice1.getHeight()/2);
+        robot.waitForIdle();
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.waitForIdle();
+
+
+        //move mouse outside Choice
+        robot.mouseMove(pt.x + choice1.getWidth()/2, pt.y - choice1.getHeight());
+        robot.waitForIdle();
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.waitForIdle();
+
+        if (!mousePressed || !mouseReleased)
+        {
+            System.out.println("ERROR: "+ mousePressed+","+mouseReleased);
+            // close the choice
+            robot.keyPress(KeyEvent.VK_ESCAPE);
+            robot.keyRelease(KeyEvent.VK_ESCAPE);
+            robot.waitForIdle();
+            DragMouseOutAndRelease.fail("Test failed. Choice should generate PRESSED, RELEASED events outside if pressed on Choice ");
+        } else{
+            // close the choice
+            robot.keyPress(KeyEvent.VK_ESCAPE);
+            robot.keyRelease(KeyEvent.VK_ESCAPE);
+            robot.waitForIdle();
+            System.out.println("Choice did generated PRESSED and RELEASED after Drag outside the Choice ");
+        }
+    }
+
+
+
+    /*****************************************************
+     * Standard Test Machinery Section
+     * DO NOT modify anything in this section -- it's a
+     * standard chunk of code which has all of the
+     * synchronisation necessary for the test harness.
+     * By keeping it the same in all tests, it is easier
+     * to read and understand someone else's test, as
+     * well as insuring that all tests behave correctly
+     * with the test harness.
+     * There is a section following this for test-
+     * classes
+     ******************************************************/
+    private static boolean theTestPassed = false;
+    private static boolean testGeneratedInterrupt = false;
+    private static String failureMessage = "";
+
+    private static Thread mainThread = null;
+
+    private static int sleepTime = 300000;
+
+    // Not sure about what happens if multiple of this test are
+    //  instantiated in the same VM.  Being static (and using
+    //  static vars), it aint gonna work.  Not worrying about
+    //  it for now.
+    public static void main( String args[] ) throws InterruptedException
+    {
+        mainThread = Thread.currentThread();
+        try
+        {
+            init();
+        }
+        catch( TestPassedException e )
+        {
+            //The test passed, so just return from main and harness will
+            // interepret this return as a pass
+            return;
+        }
+        //At this point, neither test pass nor test fail has been
+        // called -- either would have thrown an exception and ended the
+        // test, so we know we have multiple threads.
+
+        //Test involves other threads, so sleep and wait for them to
+        // called pass() or fail()
+        try
+        {
+            Thread.sleep( sleepTime );
+            //Timed out, so fail the test
+            throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
+        }
+        catch (InterruptedException e)
+        {
+            //The test harness may have interrupted the test.  If so, rethrow the exception
+            // so that the harness gets it and deals with it.
+            if( ! testGeneratedInterrupt ) throw e;
+
+            //reset flag in case hit this code more than once for some reason (just safety)
+            testGeneratedInterrupt = false;
+
+            if ( theTestPassed == false )
+            {
+                throw new RuntimeException( failureMessage );
+            }
+        }
+
+    }//main
+
+    public static synchronized void setTimeoutTo( int seconds )
+    {
+        sleepTime = seconds * 1000;
+    }
+
+    public static synchronized void pass()
+    {
+        Sysout.println( "The test passed." );
+        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
+        //first check if this is executing in main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //Still in the main thread, so set the flag just for kicks,
+            // and throw a test passed exception which will be caught
+            // and end the test.
+            theTestPassed = true;
+            throw new TestPassedException();
+        }
+        theTestPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }//pass()
+
+    public static synchronized void fail()
+    {
+        //test writer didn't specify why test failed, so give generic
+        fail( "it just plain failed! :-)" );
+    }
+
+    public static synchronized void fail( String whyFailed )
+    {
+        Sysout.println( "The test failed: " + whyFailed );
+        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
+        //check if this called from main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //If main thread, fail now 'cause not sleeping
+            throw new RuntimeException( whyFailed );
+        }
+        theTestPassed = false;
+        testGeneratedInterrupt = true;
+        failureMessage = whyFailed;
+        mainThread.interrupt();
+    }//fail()
+
+}// class DragMouseOutAndRelease
+
+//This exception is used to exit from any level of call nesting
+// when it's determined that the test has passed, and immediately
+// end the test.
+class TestPassedException extends RuntimeException
+{
+}
+
+//*********** End Standard Test Machinery Section **********
+
+
+//************ Begin classes defined for the test ****************
+
+// if want to make listeners, here is the recommended place for them, then instantiate
+//  them in init()
+
+/* Example of a class which may be written as part of a test
+class NewClass implements anInterface
+ {
+   static int newVar = 0;
+
+   public void eventDispatched(AWTEvent e)
+    {
+      //Counting events to see if we get enough
+      eventCount++;
+
+      if( eventCount == 20 )
+       {
+         //got enough events, so pass
+
+         DragMouseOutAndRelease.pass();
+       }
+      else if( tries == 20 )
+       {
+         //tried too many times without getting enough events so fail
+
+         DragMouseOutAndRelease.fail();
+       }
+
+    }// eventDispatched()
+
+ }// NewClass class
+
+*/
+
+
+//************** End classes defined for the test *******************
+
+
+
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+        System.out.println(messageIn);
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Choice/GetSizeTest/GetSizeTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+/*
+  @test
+  @bug 4255631
+  @summary Solaris: Size returned by Choice.getSize() does not match actual size
+  @author Andrei Dmitriev : area=Choice
+  run main GetSizeTest.html
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+
+public class GetSizeTest {
+
+    static String []s = {"Choice 1",
+                         "Choice 2",
+                         "unselected choices",
+                         "what choices do I have?",
+                         "Will I pick the same thing in the future?",
+                };
+    static boolean passed = false;
+    static Robot robot = null;
+
+    public static void main(String args[])
+    {
+        try {
+            robot = new Robot();
+            robot.setAutoDelay(50);
+
+            Frame f = new Frame("choice test");
+
+            Panel p = new Panel();
+            p.setLayout(null);
+
+            Choice c = new Choice();
+            for (int i = 0; i < s.length; i++)
+                    c.addItem(s[i]);
+
+            c.addMouseListener(new MouseAdapter() {
+                public void mouseReleased(MouseEvent e) {
+                    System.err.println("Test passed");
+                    passed = true;
+                }
+            });
+
+            p.add(c);
+
+            f.add(p);
+
+            f.setSize(300, 300);
+
+            f.addWindowListener(new WindowAdapter() {
+                public void windowClosing(WindowEvent we) {
+                    System.err.println("Test passed");
+                    passed = true;
+                }
+            });
+
+            f.setVisible(true);
+
+            c.setSize(200, 200);
+            f.validate();
+
+            robot.waitForIdle();
+
+            Point pt = c.getLocationOnScreen();
+            robot.mouseMove(pt.x + c.getWidth() - 10, pt.y + c.getHeight() / 2);
+            robot.waitForIdle();
+            robot.mousePress(InputEvent.BUTTON2_MASK);
+            robot.mouseRelease(InputEvent.BUTTON2_MASK);
+            robot.waitForIdle();
+        } catch (Throwable e) {
+            if (robot == null){
+                throw new RuntimeException( "Test failed.Unable to initialize Robot "+e);
+            }
+            throw new RuntimeException( "Test failed due to thrown exception "+e);
+        }
+        if (!passed) {
+            throw new RuntimeException( "Timeout. Choice component size is not actual size." );
+        }
+        System.err.println("Test passed.");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Choice/GrabLockTest/GrabLockTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 4800638
+  @summary Tests that Choice does not lock the Desktop
+  @run main GrabLockTest
+*/
+import java.awt.*;
+import java.awt.event.*;
+
+public class GrabLockTest
+{
+    public static void main (String args[])
+    {
+        Frame frame = new TestFrame();
+    }
+}
+
+class TestFrame extends Frame implements MouseListener {
+    public TestFrame() {
+        Choice choice = new Choice();
+        choice.addItem("Fist Item");
+        choice.addItem("Second Item");
+        add(choice,BorderLayout.NORTH);
+        Panel panel = new Panel();
+        panel.addMouseListener(this);
+        panel.setBackground(Color.RED);
+        add(panel);
+        setSize(200, 200);
+        setVisible(true);
+        toFront();
+
+        try {
+            Robot robot = new Robot();
+            robot.setAutoWaitForIdle(true);
+            robot.setAutoDelay(50);
+
+            robot.waitForIdle();
+
+            Point pt = choice.getLocationOnScreen();
+            robot.mouseMove(pt.x + choice.getWidth() - choice.getHeight()/2,
+                pt.y + choice.getHeight()/2);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.waitForIdle();
+            robot.mouseMove(pt.x + choice.getWidth()/2,
+                pt.y + choice.getHeight()*2);
+            robot.waitForIdle();
+            robot.mousePress(InputEvent.BUTTON2_MASK);
+            robot.waitForIdle();
+            Point pt1 = panel.getLocationOnScreen();
+            robot.mouseMove(pt1.x + panel.getWidth()/2,
+                pt1.y + panel.getHeight()/2);
+            robot.waitForIdle();
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            robot.mouseRelease(InputEvent.BUTTON2_MASK);
+
+            robot.waitForIdle();
+
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.delay(30);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            robot.waitForIdle();
+            if (nPressed == 0) {
+                robot.keyPress(KeyEvent.VK_ESCAPE);
+                robot.keyRelease(KeyEvent.VK_ESCAPE);
+                throw new RuntimeException("GrabLockTest failed." + nPressed);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException("The test was not completed.\n\n" + e);
+        }
+
+    }
+
+    public int nPressed = 0;
+
+    public void mouseClicked(MouseEvent e) {
+    }
+
+    public void mousePressed(MouseEvent e) {
+        nPressed++;
+        System.out.println("Pressed!");
+    }
+
+    public void mouseReleased(MouseEvent e) {
+    }
+
+    public void mouseEntered(MouseEvent e) {}
+    public void mouseExited(MouseEvent e) {}
+}// class TestFrame
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Choice/PopupPosTest/PopupPosTest.html	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+<!--
+ Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ 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.
+-->
+
+<html>
+<!--  
+  @test
+  @bug 5044150
+  @summary Tests that pupup doesn't popdown if no space to display under 
+  @author ssi@sparc.spb.su
+  @library ../../../../lib/testlibrary
+  @build jdk.testlibrary.OSInfo
+  @run applet PopupPosTest.html
+  -->
+<head>
+<title> PopupPosTest </title>
+</head>
+<body>
+
+<h1>PopupPosTest<br>Bug ID: 5044150</h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="PopupPosTest.class" WIDTH=350 HEIGHT=400></APPLET>
+</body>
+</html>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Choice/PopupPosTest/PopupPosTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 5044150
+  @summary Tests that pupup doesn't popdown if no space to display under
+  @author andrei.dmitriev area=awt.choice
+  @library ../../../../lib/testlibrary
+  @build jdk.testlibrary.OSInfo
+  @run applet PopupPosTest.html
+*/
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+
+import jdk.testlibrary.OSInfo;
+
+public class PopupPosTest extends Applet
+{
+    public void start ()
+    {
+        if(OSInfo.getOSType().equals(OSInfo.OSType.MACOSX)) {
+            // On OS X, popup isn't under the mouse
+            return;
+        }
+        Frame frame = new TestFrame();
+    }
+}
+
+class TestFrame extends Frame implements ItemListener {
+    Robot robot;
+    Toolkit tk = Toolkit.getDefaultToolkit();
+    Choice choice = new Choice();
+    boolean indexChanged = false;
+    final static int INITIAL_ITEM = 99;
+    volatile boolean stateChanged;
+
+    public TestFrame() {
+        for (int i = 0; i < 100; i++) {
+             choice.addItem("Item Item Item " + i);
+        }
+        choice.addItemListener(this);
+
+        choice.select(INITIAL_ITEM);
+        choice.setFont(new Font("Courier", Font.BOLD + Font.ITALIC, 100));
+
+        add(choice, BorderLayout.CENTER);
+        Dimension screen = tk.getScreenSize();
+        setSize(screen.width - 10, screen.height - 70);
+        setVisible(true);
+        toFront();
+        try {
+            robot = new Robot();
+            robot.setAutoDelay(50);
+            robot.waitForIdle();
+            // fix for 6175418. When we take "choice.getHeight()/2"
+            // divider 2 is not sufficiently big to hit into the
+            // small box Choice. We should use bigger divider to get
+            // smaller value choice.getHeight()/i. 4 is sufficient.
+            Point pt = choice.getLocationOnScreen();
+            // click on 1/4 of Choice's height
+            mouseMoveAndPressOnChoice(pt.x + choice.getWidth()/2,
+                              pt.y + choice.getHeight()/4);
+
+            // click on center of Choice's height
+            mouseMoveAndPressOnChoice(pt.x + choice.getWidth()/2,
+                              pt.y + choice.getHeight()/2);
+
+            // click on 3/4 of Choice's height
+            mouseMoveAndPressOnChoice(pt.x + choice.getWidth()/2,
+                              pt.y + choice.getHeight()*3/4);
+            // testing that ItemEvent doesn't generated on a simple
+            // mouse click when the dropdown appears under mouse : 6425067
+            stateChanged = false;
+            openChoice();
+            closeChoice();
+        } catch (Throwable e) {
+            throw new RuntimeException("The test was not completed.\n\n" + e);
+        }
+
+        if (!indexChanged){
+            throw new RuntimeException("Test failed. Another item wasn't selected.");
+        }
+
+        if(stateChanged){
+            throw new RuntimeException("Test failed. ItemEvent was generated on a simple mouse click when the dropdown appears under mouse");
+        }
+    }// start()
+
+    public void itemStateChanged(ItemEvent ie) {
+        System.out.println("choice.stateChanged = "+ ie);
+        stateChanged = true;
+    }
+
+    public void mouseMoveAndPressOnChoice(int x, int y){
+        openChoice();
+        robot.mouseMove(x, y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.delay(30);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.waitForIdle();
+        //should close choice after each test stage
+        closeChoice();
+        checkSelectedIndex();
+    }
+
+    public void openChoice(){
+        Point pt = choice.getLocationOnScreen();
+        robot.mouseMove(pt.x + choice.getWidth() - choice.getHeight()/4,
+                        pt.y + choice.getHeight()/2);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.delay(30);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.waitForIdle();
+    }
+    public void closeChoice(){
+        robot.keyPress(KeyEvent.VK_ESCAPE);
+        robot.keyRelease(KeyEvent.VK_ESCAPE);
+        robot.waitForIdle();
+    }
+
+    public void checkSelectedIndex(){
+        if (choice.getSelectedIndex() != INITIAL_ITEM) {
+            System.out.println("choice.getSelectedIndex = "+ choice.getSelectedIndex());
+            indexChanged = true;
+        }
+    }
+}// class TestFrame
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Choice/ResizeAutoClosesChoice/ResizeAutoClosesChoice.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 6399679
+  @summary Choice is not invalidated when the frame gets resized programmatically when the drop-down is visible
+  @author andrei.dmitriev area=awt.choice
+  @library ../../../../lib/testlibrary
+  @build jdk.testlibrary.OSInfo
+  @run main ResizeAutoClosesChoice
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+
+import jdk.testlibrary.OSInfo;
+
+public class ResizeAutoClosesChoice
+{
+    static Frame frame = new Frame("Test Frame");
+    static Choice choice1 = new Choice();
+    static Robot robot;
+    static Point pt;
+    static String passed = null;
+    static Button button = new Button("This button causes Frame to be resized on pack()");
+    public static void main(String args[]) throws Exception
+    {
+        if(OSInfo.getOSType().equals(OSInfo.OSType.MACOSX)) {
+            System.out.println("Not for OS OX");
+            return;
+        }
+
+        choice1.setForeground(Color.red);
+        choice1.setBackground(Color.red);
+
+        frame.setLayout (new BorderLayout ());
+        for (int i = 1; i<10;i++){
+            choice1.add("item "+i);
+        }
+        frame.setSize(300, 300);
+        choice1.setLocation(50, 50);
+        choice1.setSize(70, 20);
+
+        button.setLocation(150, 100);
+        button.setSize(150, 20);
+        frame.add(choice1, BorderLayout.SOUTH);
+        frame.pack();
+
+        frame.validate();
+        frame.setVisible(true);
+
+        robot = new Robot();
+        robot.waitForIdle();
+        pt = choice1.getLocationOnScreen();
+        robot.mouseMove(pt.x + choice1.getWidth()/10*9, pt.y + choice1.getHeight()/2);
+        robot.waitForIdle();
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.delay(1000);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        Color color = robot.getPixelColor(pt.x + choice1.getWidth()/2,
+                                          pt.y + 3 * choice1.getHeight());
+        //should take a color on the point on the choice's menu
+        System.out.println("Choice opened. Color got : "+color);
+        if ( !color.equals(Color.red) ){
+            passed = "Choice wasn't opened with the mouse";
+        }
+
+        Rectangle oldBounds = choice1.getBounds();
+        System.out.println("Choice's old bounds : "+oldBounds);
+
+        frame.add(button, BorderLayout.NORTH);
+        //            frame.setSize(500, 500);
+        frame.pack();
+        robot.waitForIdle();
+        System.out.println("Choice's new bounds : "+choice1.getBounds());
+
+        if (!choice1.getBounds().equals(oldBounds)){
+            pt = choice1.getLocationOnScreen();
+            color = robot.getPixelColor(pt.x + choice1.getWidth()/2,
+                                        pt.y + 3 * choice1.getHeight());
+            System.out.println("Choice opened. Color got : "+color);
+            if (color.equals(Color.red) ){
+                passed = "Choice wasn't closed when toplevel repacked.";
+            }
+        } else {
+            System.out.println("frame.pack didn't changed Choice's size - dropdown menu should remain the same. Test passed.");
+        }
+        if (passed != null){
+            throw new RuntimeException(passed);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Choice/SelectCurrentItemTest/SelectCurrentItemTest.html	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,44 @@
+<!--
+ Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ 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.
+-->
+
+<html>
+<!--  
+  @test 1.2 01/02/10
+  @bug 4902933
+  @summary Test that selecting the current item sends an ItemEvent
+  @author bchristi : area= Choice
+  @run applet SelectCurrentItemTest.html
+  -->
+<head>
+<title>  </title>
+</head>
+<body>
+
+<h1>SelectCurrentItemTest<br>Bug ID: 9999999 XXX_CHANGE_THIS </h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="SelectCurrentItemTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Choice/SelectCurrentItemTest/SelectCurrentItemTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,323 @@
+/*
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 1.3 02/06/25
+  @bug 4902933
+  @summary Test that selecting the current item sends an ItemEvent
+  @author bchristi : area= Choice
+  @run applet SelectCurrentItemTest.html
+*/
+
+// Note there is no @ in front of test above.  This is so that the
+//  harness will not mistake this file as a test file.  It should
+//  only see the html file as a test file. (the harness runs all
+//  valid test files, so it would run this test twice if this file
+//  were valid as well as the html file.)
+// Also, note the area= after Your Name in the author tag.  Here, you
+//  should put which functional area the test falls in.  See the
+//  AWT-core home page -> test areas and/or -> AWT team  for a list of
+//  areas.
+// Note also the 'SelectCurrentItemTest.html' in the run tag.  This should
+//  be changed to the name of the test.
+
+
+/**
+ * SelectCurrentItemTest.java
+ *
+ * summary:
+ */
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+
+//Automated tests should run as applet tests if possible because they
+// get their environments cleaned up, including AWT threads, any
+// test created threads, and any system resources used by the test
+// such as file descriptors.  (This is normally not a problem as
+// main tests usually run in a separate VM, however on some platforms
+// such as the Mac, separate VMs are not possible and non-applet
+// tests will cause problems).  Also, you don't have to worry about
+// synchronisation stuff in Applet tests they way you do in main
+// tests...
+
+
+public class SelectCurrentItemTest extends Applet implements ItemListener,
+ WindowListener, Runnable
+{
+    //Declare things used in the test, like buttons and labels here
+    Frame frame;
+    Choice theChoice;
+    Robot robot;
+
+    Object lock = new Object();
+    boolean passed = false;
+
+    public void init()
+    {
+        //Create instructions for the user here, as well as set up
+        // the environment -- set the layout manager, add buttons,
+        // etc.
+
+        this.setLayout (new BorderLayout ());
+
+        String[] instructions =
+        {
+            "This is an AUTOMATIC test",
+            "simply wait until it is done"
+        };
+        Sysout.createDialog( );
+        Sysout.printInstructions( instructions );
+
+        frame = new Frame("SelectCurrentItemTest");
+        theChoice = new Choice();
+        for (int i = 0; i < 10; i++) {
+            theChoice.add(new String("Choice Item " + i));
+        }
+        theChoice.addItemListener(this);
+        frame.add(theChoice);
+        frame.addWindowListener(this);
+
+        try {
+            robot = new Robot();
+            robot.setAutoDelay(500);
+        }
+        catch (AWTException e) {
+            throw new RuntimeException("Unable to create Robot.  Test fails.");
+        }
+
+    }//End  init()
+
+    public void start ()
+    {
+        //Get things going.  Request focus, set size, et cetera
+        setSize (200,200);
+        setVisible(true);
+        validate();
+
+        //What would normally go into main() will probably go here.
+        //Use System.out.println for diagnostic messages that you want
+        //to read after the test is done.
+        //Use Sysout.println for messages you want the tester to read.
+
+        frame.setLocation(1,20);
+        robot.mouseMove(10, 30);
+        frame.pack();
+        frame.setVisible(true);
+        synchronized(lock) {
+        try {
+        lock.wait(120000);
+        }
+        catch(InterruptedException e) {}
+        }
+        robot.waitForIdle();
+        if (!passed) {
+            throw new RuntimeException("TEST FAILED!");
+        }
+
+        // wait to make sure ItemEvent has been processed
+
+//        try {Thread.sleep(10000);} catch (InterruptedException e){}
+    }// start()
+
+    public void run() {
+        try {Thread.sleep(1000);} catch (InterruptedException e){}
+        // get loc of Choice on screen
+        Point loc = theChoice.getLocationOnScreen();
+        // get bounds of Choice
+        Dimension size = theChoice.getSize();
+        robot.mouseMove(loc.x + size.width - 10, loc.y + size.height / 2);
+
+        robot.setAutoDelay(250);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        robot.setAutoDelay(1000);
+        robot.mouseMove(loc.x + size.width / 2, loc.y + size.height + size.height / 2);
+        robot.setAutoDelay(250);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.waitForIdle();
+        synchronized(lock) {
+            lock.notify();
+        }
+    }
+
+    public void itemStateChanged(ItemEvent e) {
+        Sysout.println("ItemEvent received.  Test passes");
+        passed = true;
+    }
+
+    public void windowOpened(WindowEvent e) {
+        Sysout.println("windowActivated()");
+        Thread testThread = new Thread(this);
+        testThread.start();
+    }
+    public void windowActivated(WindowEvent e) {
+    }
+    public void windowDeactivated(WindowEvent e) {}
+    public void windowClosed(WindowEvent e) {}
+    public void windowClosing(WindowEvent e) {}
+    public void windowIconified(WindowEvent e) {}
+    public void windowDeiconified(WindowEvent e) {}
+
+}// class SelectCurrentItemTest
+
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setLocation(0, 400);
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        show();
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Choice/UnfocusableCB_ERR/UnfocusableCB_ERR.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,421 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 6390103
+  @summary Non-Focusable choice throws exception when selecting an item, Win32
+  @author andrei.dmitriev area=awt.choice
+  @run main UnfocusableCB_ERR
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+
+public class UnfocusableCB_ERR
+{
+    static final int delay = 100;
+    static Frame frame = new Frame("Test Frame");
+    static Choice choice1 = new Choice();
+    static Button button = new Button("Test");
+
+    static Robot robot;
+    static Point pt;
+    static String failed = "";
+
+    private static void init()
+    {
+        String[] instructions =
+        {
+            "This is an AUTOMATIC test, simply wait until it is done.",
+            "The result (passed or failed) will be shown in the",
+            "message window below."
+        };
+        Sysout.createDialog( );
+        Sysout.printInstructions( instructions );
+
+        EventQueue.invokeLater(new Runnable() {
+            public void run() {
+                Thread.currentThread().setUncaughtExceptionHandler(
+                   new Thread.UncaughtExceptionHandler(){
+                       public void uncaughtException(Thread t, Throwable exc){
+                           failed = exc.toString();
+                       }
+                   });
+            }
+        });
+
+        frame.setLayout (new FlowLayout ());
+        for (int i = 1; i<10;i++){
+            choice1.add("item "+i);
+        }
+        frame.add(button);
+        frame.add(choice1);
+
+        choice1.setFocusable(false);
+
+        frame.pack();
+        frame.setVisible(true);
+        frame.validate();
+
+        try {
+            robot = new Robot();
+            robot.setAutoDelay(50);
+            robot.waitForIdle();
+            testSpacePress();
+        } catch (Throwable e) {
+            UnfocusableCB_ERR.fail("Test failed. Exception thrown: "+e);
+        }
+        if (failed.equals("")){
+            UnfocusableCB_ERR.pass();
+        } else {
+            UnfocusableCB_ERR.fail("Test failed:");
+        }
+    }//End  init()
+
+    public static void testSpacePress(){
+
+        pt = choice1.getLocationOnScreen();
+        robot.mouseMove(pt.x + choice1.getWidth()/2, pt.y + choice1.getHeight()/2);
+        robot.waitForIdle();
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.waitForIdle();
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+
+        robot.waitForIdle();
+
+        //position mouse cursor over dropdown menu
+        robot.mouseMove(pt.x + choice1.getWidth()/2, pt.y + 2 * choice1.getHeight());
+        robot.waitForIdle();
+
+        //move mouse outside Choice
+        robot.mouseMove(pt.x + choice1.getWidth()/2, pt.y - choice1.getHeight());
+        robot.waitForIdle();
+
+        robot.keyPress(KeyEvent.VK_SPACE);
+        robot.keyRelease(KeyEvent.VK_SPACE);
+        robot.waitForIdle();
+    }
+
+
+
+    /*****************************************************
+     * Standard Test Machinery Section
+     * DO NOT modify anything in this section -- it's a
+     * standard chunk of code which has all of the
+     * synchronisation necessary for the test harness.
+     * By keeping it the same in all tests, it is easier
+     * to read and understand someone else's test, as
+     * well as insuring that all tests behave correctly
+     * with the test harness.
+     * There is a section following this for test-
+     * classes
+     ******************************************************/
+    private static boolean theTestPassed = false;
+    private static boolean testGeneratedInterrupt = false;
+    private static String failureMessage = "";
+
+    private static Thread mainThread = null;
+
+    private static int sleepTime = 300000;
+
+    // Not sure about what happens if multiple of this test are
+    //  instantiated in the same VM.  Being static (and using
+    //  static vars), it aint gonna work.  Not worrying about
+    //  it for now.
+    public static void main( String args[] ) throws InterruptedException
+    {
+        mainThread = Thread.currentThread();
+        try
+        {
+            init();
+        }
+        catch( TestPassedException e )
+        {
+            //The test passed, so just return from main and harness will
+            // interepret this return as a pass
+            return;
+        }
+        //At this point, neither test pass nor test fail has been
+        // called -- either would have thrown an exception and ended the
+        // test, so we know we have multiple threads.
+
+        //Test involves other threads, so sleep and wait for them to
+        // called pass() or fail()
+        try
+        {
+            Thread.sleep( sleepTime );
+            //Timed out, so fail the test
+            throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
+        }
+        catch (InterruptedException e)
+        {
+            //The test harness may have interrupted the test.  If so, rethrow the exception
+            // so that the harness gets it and deals with it.
+            if( ! testGeneratedInterrupt ) throw e;
+
+            //reset flag in case hit this code more than once for some reason (just safety)
+            testGeneratedInterrupt = false;
+
+            if ( theTestPassed == false )
+            {
+                throw new RuntimeException( failureMessage );
+            }
+        }
+
+    }//main
+
+    public static synchronized void setTimeoutTo( int seconds )
+    {
+        sleepTime = seconds * 1000;
+    }
+
+    public static synchronized void pass()
+    {
+        Sysout.println( "The test passed." );
+        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
+        //first check if this is executing in main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //Still in the main thread, so set the flag just for kicks,
+            // and throw a test passed exception which will be caught
+            // and end the test.
+            theTestPassed = true;
+            throw new TestPassedException();
+        }
+        theTestPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }//pass()
+
+    public static synchronized void fail()
+    {
+        //test writer didn't specify why test failed, so give generic
+        fail( "it just plain failed! :-)" );
+    }
+
+    public static synchronized void fail( String whyFailed )
+    {
+        Sysout.println( "The test failed: " + whyFailed );
+        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
+        //check if this called from main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //If main thread, fail now 'cause not sleeping
+            throw new RuntimeException( whyFailed );
+        }
+        theTestPassed = false;
+        testGeneratedInterrupt = true;
+        failureMessage = whyFailed;
+        mainThread.interrupt();
+    }//fail()
+
+}// class UnfocusableCB_ERR
+
+//This exception is used to exit from any level of call nesting
+// when it's determined that the test has passed, and immediately
+// end the test.
+class TestPassedException extends RuntimeException
+{
+}
+
+//*********** End Standard Test Machinery Section **********
+
+
+//************ Begin classes defined for the test ****************
+
+// if want to make listeners, here is the recommended place for them, then instantiate
+//  them in init()
+
+/* Example of a class which may be written as part of a test
+class NewClass implements anInterface
+ {
+   static int newVar = 0;
+
+   public void eventDispatched(AWTEvent e)
+    {
+      //Counting events to see if we get enough
+      eventCount++;
+
+      if( eventCount == 20 )
+       {
+         //got enough events, so pass
+
+         UnfocusableCB_ERR.pass();
+       }
+      else if( tries == 20 )
+       {
+         //tried too many times without getting enough events so fail
+
+         UnfocusableCB_ERR.fail();
+       }
+
+    }// eventDispatched()
+
+ }// NewClass class
+
+*/
+
+
+//************** End classes defined for the test *******************
+
+
+
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+        System.out.println(messageIn);
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
--- a/jdk/test/java/awt/Component/7097771/bug7097771.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Component/7097771/bug7097771.java	Fri Jan 09 13:28:02 2015 -0500
@@ -21,14 +21,12 @@
  * questions.
  */
 
-import sun.awt.SunToolkit;
 import test.java.awt.regtesthelpers.Util;
 
 import java.awt.AWTException;
 import java.awt.Button;
 import java.awt.Frame;
 import java.awt.Robot;
-import java.awt.Toolkit;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 
@@ -53,13 +51,14 @@
         button.addActionListener(frame);
         frame.add(button);
         frame.setVisible(true);
-        sleep();
+        Robot robot = new Robot();
+        sleep(robot);
         frame.setEnabled(false);
         button.setEnabled(false);
         button.setEnabled(true);
-        sleep();
-        Util.clickOnComp(button, new Robot());
-        sleep();
+        sleep(robot);
+        Util.clickOnComp(button, robot);
+        sleep(robot);
         frame.dispose();
         if (action) {
             throw new RuntimeException("Button is not disabled.");
@@ -71,8 +70,8 @@
         action = true;
     }
 
-    private static void sleep() {
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+    private static void sleep(Robot robot) {
+        robot.waitForIdle();
         try {
             Thread.sleep(1000);
         } catch (InterruptedException ignored) {
--- a/jdk/test/java/awt/Component/F10TopToplevel/F10TopToplevel.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Component/F10TopToplevel/F10TopToplevel.java	Fri Jan 09 13:28:02 2015 -0500
@@ -90,29 +90,26 @@
         Robot robot;
         try {
             robot = new Robot();
+            robot.setAutoDelay(5);
         } catch(AWTException e){
             throw new RuntimeException("cannot create robot.", e);
         }
-        ((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
         robot.mouseMove(dialog.getLocationOnScreen().x + dialog.getWidth()/2,
                         dialog.getLocationOnScreen().y + dialog.getHeight()/2 );
-        robot.delay(5);
+        robot.waitForIdle();
         robot.mousePress(InputEvent.BUTTON1_MASK);
-        robot.delay(5);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
-        robot.delay(5);
+        robot.waitForIdle();
         robot.keyPress(KeyEvent.VK_F10);
-        robot.delay(5);
         robot.keyRelease(KeyEvent.VK_F10);
-        robot.delay(5);
 
         robot.delay(10);
         robot.keyPress(KeyEvent.VK_ENTER);
-        robot.delay(5);
+        robot.waitForIdle();
         robot.keyRelease(KeyEvent.VK_ENTER);
-        robot.delay(5);
 
-        ((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         if(menuToggled) {
             throw new RuntimeException("Oops! Menu should not open.");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/NativeInLightShow/NativeInLightShow.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 1.0 04/05/20
+  @bug 4140484
+  @summary Heavyweight components inside invisible lightweight containers still show
+  @author Your Name: art@sparc.spb.su
+  @run main NativeInLightShow
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+
+
+// The test verifies that the mixing code correctly handles COMPONENT_SHOWN events
+// while the top-level container is invisible.
+
+public class NativeInLightShow
+{
+    //Declare things used in the test, like buttons and labels here
+    static boolean buttonPressed = false;
+    public static void main(String args[]) throws Exception {
+        Frame f = new Frame("Test");
+
+        Robot robot = null;
+        robot = new Robot();
+        robot.setAutoDelay(50);
+
+        Container c = new Container();
+        c.setLayout(new BorderLayout());
+        Button b = new Button("I'm should be visible!");
+        b.addActionListener(new ActionListener()
+        {
+            public void actionPerformed(ActionEvent e) {
+                System.out.println("Test PASSED");
+                buttonPressed = true;
+            }
+        });
+        c.add(b);
+
+        f.add(c);
+
+        f.pack();
+
+        c.setVisible(false);
+        c.setVisible(true);
+
+        // Wait for a while for COMPONENT_SHOW event to be dispatched
+        robot.waitForIdle();
+
+        f.setVisible(true);
+
+        robot.waitForIdle();
+
+        Point buttonLocation = b.getLocationOnScreen();
+
+        robot.mouseMove(buttonLocation.x + 5, buttonLocation.y + 5);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        // Wait for a while for ACTION event to be dispatched
+        robot.waitForIdle();
+        robot.delay(100);
+
+        if (!buttonPressed) {
+            System.out.println("Test FAILED");
+            throw new RuntimeException("Button was not pressed");
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/FileDialog/ISCthrownByFileListTest/ISCthrownByFileListTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 6304979
+  @summary REG: File Dialog throws ArrayIndexOutOfBounds Exception on XToolkit with b45
+  @author Dmitry Cherepanov: area=awt.filedialog
+  @run main/othervm -Dsun.awt.disableGtkFileDialogs=true ISCthrownByFileListTest
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.reflect.*;
+
+/*
+  Since the "sun.awt.exception.handler" property will be removed in a future release
+  this test will be rewritten using new future API. (<<< Done).
+  It's important that the bug 6304979 is reproducible if the bug 6299853 is reproducible.
+*/
+
+public class ISCthrownByFileListTest
+{
+    private static Frame frame = null;
+    private static FileDialog fd = null;
+
+    // The handler load the class and instantiate this class
+    // so the 'passed' variable is static
+    static boolean passed = true;
+
+    public static final void main(String args[]) {
+        // It's not true that the native file dialog will be focused on Motif & Windows
+        boolean isXToolkit = Toolkit.getDefaultToolkit().getClass().getName().equals("sun.awt.X11.XToolkit");
+        if (!isXToolkit){
+            return;
+        }
+
+        frame = new Frame("frame");
+        frame.setLayout (new FlowLayout ());
+        frame.setBounds(100, 100, 100, 100);
+        frame.setVisible(true);
+
+        fd = new FileDialog(frame, "file dialog", FileDialog.LOAD);
+
+        // In order to handle all uncaught exceptions in the EDT
+        final Thread.UncaughtExceptionHandler eh = new Thread.UncaughtExceptionHandler()
+        {
+            @Override
+            public void uncaughtException(Thread t, Throwable e)
+            {
+                e.printStackTrace();
+                ISCthrownByFileListTest.passed = false;
+            }
+        };
+
+        test();
+    }// start()
+
+    private static void test (){
+        Robot r;
+
+        try {
+            r = new Robot();
+        } catch(AWTException e) {
+            throw new RuntimeException(e.getMessage());
+        }
+
+        r.delay(500);
+        new Thread(new Runnable() {
+                public void run() {
+                    // The bug 6299853 is reproducible only if the file list is not empty
+                    // since else the focus will be set to the directory list.
+                    // But the focus index of the directory list equals 0.
+                    // So goto the source directory (the file list is non empty)
+                    fd.setDirectory(System.getProperty("test.src", "."));
+                    fd.setVisible(true);
+                }
+            }).start();
+        r.delay(2000);
+        r.waitForIdle();
+
+        Component focusedWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow();
+        if (focusedWindow != fd) {
+            throw new RuntimeException("Test failed - the file dialog isn't focused window, owner: " + focusedWindow);
+        }
+        r.waitForIdle();
+
+        r.keyPress(KeyEvent.VK_SPACE);
+        r.delay(50);
+        r.keyRelease(KeyEvent.VK_SPACE);
+        r.delay(1000);
+        fd.setVisible(false);
+        r.delay(1000);
+        r.waitForIdle();
+
+        if (!ISCthrownByFileListTest.passed){
+            throw new RuntimeException("Test failed.");
+        }
+
+    }// test()
+}// class ISCthrownByFileListTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/6378278/InputVerifierTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,413 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 6378278
+  @summary Apparent missing key events causing Bugster to break
+  @author oleg.sukhodolsky: area=awt.focus
+  @run main InputVerifierTest
+*/
+
+/**
+ * InputVerifierTest.java
+ *
+ * summary: Apparent missing key events causing Bugster to break
+ */
+
+import java.awt.AWTException;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.TextArea;
+
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+
+import javax.swing.InputVerifier;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JTextField;
+
+public class InputVerifierTest
+{
+
+    //*** test-writer defined static variables go here ***
+    static volatile boolean ivWasCalled = false;
+
+    private static void init()
+    {
+        //*** Create instructions for the user here ***
+        String[] instructions =
+        {
+            "This is an AUTOMATIC test, simply wait until it is done.",
+            "The result (passed or failed) will be shown in the",
+            "message window below."
+        };
+        Sysout.createDialog( );
+        Sysout.printInstructions( instructions );
+
+        JFrame frame = new JFrame();
+        JTextField t1 = new JTextField();
+        t1.setInputVerifier(new InputVerifier() {
+            public boolean verify(JComponent input) {
+                Sysout.println("verify(" + input + ")");
+                ivWasCalled = true;
+                return true;
+            }
+        });
+        JTextField t2 = new JTextField();
+
+        frame.getContentPane().add(t1, BorderLayout.NORTH);
+        frame.getContentPane().add(t2, BorderLayout.SOUTH);
+        frame.setSize(200, 200);
+        frame.setVisible(true);
+
+        Robot r = null;
+        try {
+            r = new Robot();
+        } catch (AWTException e) {
+            e.printStackTrace();
+            InputVerifierTest.fail(e.toString());
+        }
+
+        try {
+            r.waitForIdle();
+
+            mouseClickOnComp(r, t1);
+            r.waitForIdle();
+
+            if (!t1.isFocusOwner()) {
+                throw new RuntimeException("t1 is not a focus owner");
+            }
+            ivWasCalled = false;
+            r.keyPress(KeyEvent.VK_TAB);
+            r.delay(10);
+            r.keyRelease(KeyEvent.VK_TAB);
+            r.waitForIdle();
+
+            if (!t2.isFocusOwner()) {
+                throw new RuntimeException("t2 is not a focus owner");
+            }
+            if (!ivWasCalled) {
+                throw new RuntimeException("InputVerifier was not called after tabbing");
+            }
+
+            mouseClickOnComp(r, t1);
+            r.waitForIdle();
+
+            if (!t1.isFocusOwner()) {
+                throw new RuntimeException("t1 is not a focus owner");
+            }
+
+            ivWasCalled = false;
+            mouseClickOnComp(r, t2);
+            r.waitForIdle();
+            if (!t2.isFocusOwner()) {
+                throw new RuntimeException("t2 is not a focus owner");
+            }
+            if (!ivWasCalled) {
+                throw new RuntimeException("InputVErifier was not called after mouse press");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            InputVerifierTest.fail(e.toString());
+        }
+
+        InputVerifierTest.pass();
+
+    }//End  init()
+
+    static void mouseClickOnComp(Robot r, Component comp) {
+        Point loc = comp.getLocationOnScreen();
+        loc.x += comp.getWidth() / 2;
+        loc.y += comp.getHeight() / 2;
+        r.mouseMove(loc.x, loc.y);
+        r.delay(10);
+        r.mousePress(InputEvent.BUTTON1_MASK);
+        r.delay(10);
+        r.mouseRelease(InputEvent.BUTTON1_MASK);
+    }
+
+    /*****************************************************
+     * Standard Test Machinery Section
+     * DO NOT modify anything in this section -- it's a
+     * standard chunk of code which has all of the
+     * synchronisation necessary for the test harness.
+     * By keeping it the same in all tests, it is easier
+     * to read and understand someone else's test, as
+     * well as insuring that all tests behave correctly
+     * with the test harness.
+     * There is a section following this for test-
+     * classes
+     ******************************************************/
+    private static boolean theTestPassed = false;
+    private static boolean testGeneratedInterrupt = false;
+    private static String failureMessage = "";
+
+    private static Thread mainThread = null;
+
+    private static int sleepTime = 300000;
+
+    // Not sure about what happens if multiple of this test are
+    //  instantiated in the same VM.  Being static (and using
+    //  static vars), it aint gonna work.  Not worrying about
+    //  it for now.
+    public static void main( String args[] ) throws InterruptedException
+    {
+        mainThread = Thread.currentThread();
+        try
+        {
+            init();
+        }
+        catch( TestPassedException e )
+        {
+            //The test passed, so just return from main and harness will
+            // interepret this return as a pass
+            return;
+        }
+        //At this point, neither test pass nor test fail has been
+        // called -- either would have thrown an exception and ended the
+        // test, so we know we have multiple threads.
+
+        //Test involves other threads, so sleep and wait for them to
+        // called pass() or fail()
+        try
+        {
+            Thread.sleep( sleepTime );
+            //Timed out, so fail the test
+            throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
+        }
+        catch (InterruptedException e)
+        {
+            //The test harness may have interrupted the test.  If so, rethrow the exception
+            // so that the harness gets it and deals with it.
+            if( ! testGeneratedInterrupt ) throw e;
+
+            //reset flag in case hit this code more than once for some reason (just safety)
+            testGeneratedInterrupt = false;
+
+            if ( theTestPassed == false )
+            {
+                throw new RuntimeException( failureMessage );
+            }
+        }
+
+    }//main
+
+    public static synchronized void setTimeoutTo( int seconds )
+    {
+        sleepTime = seconds * 1000;
+    }
+
+    public static synchronized void pass()
+    {
+        Sysout.println( "The test passed." );
+        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
+        //first check if this is executing in main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //Still in the main thread, so set the flag just for kicks,
+            // and throw a test passed exception which will be caught
+            // and end the test.
+            theTestPassed = true;
+            throw new TestPassedException();
+        }
+        theTestPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }//pass()
+
+    public static synchronized void fail()
+    {
+        //test writer didn't specify why test failed, so give generic
+        fail( "it just plain failed! :-)" );
+    }
+
+    public static synchronized void fail( String whyFailed )
+    {
+        Sysout.println( "The test failed: " + whyFailed );
+        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
+        //check if this called from main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //If main thread, fail now 'cause not sleeping
+            throw new RuntimeException( whyFailed );
+        }
+        theTestPassed = false;
+        testGeneratedInterrupt = true;
+        failureMessage = whyFailed;
+        mainThread.interrupt();
+    }//fail()
+
+}// class InputVerifierTest
+
+//This exception is used to exit from any level of call nesting
+// when it's determined that the test has passed, and immediately
+// end the test.
+class TestPassedException extends RuntimeException
+{
+}
+
+//*********** End Standard Test Machinery Section **********
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+        System.out.println(messageIn);
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/6382144/EndlessLoopTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,409 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 6382144
+  @summary REGRESSION: InputVerifier and JOptionPane
+  @author oleg.sukhodolsky: area=awt.focus
+  @run main EndlessLoopTest
+*/
+
+/**
+ * EndlessLoopTest.java
+ *
+ * summary: REGRESSION: InputVerifier and JOptionPane
+ */
+
+import java.awt.AWTException;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.TextArea;
+import java.awt.Toolkit;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+
+import javax.swing.InputVerifier;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JTextField;
+
+public class EndlessLoopTest
+{
+
+    //*** test-writer defined static variables go here ***
+    static volatile int n_iv_calls;
+
+
+    private static void init()
+    {
+        //*** Create instructions for the user here ***
+
+        String[] instructions =
+        {
+            "This is an AUTOMATIC test, simply wait until it is done.",
+            "The result (passed or failed) will be shown in the",
+            "message window below."
+        };
+        Sysout.createDialog( );
+        Sysout.printInstructions( instructions );
+
+        JFrame frame = new JFrame();
+        final JDialog dialog = new JDialog(frame, true);
+        JButton button = new JButton("press me");
+        button.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent ae) {
+                    dialog.dispose();
+                }
+            });
+        dialog.getContentPane().add(button);
+        dialog.pack();
+
+        JTextField t1 = new JTextField();
+        t1.setInputVerifier(new InputVerifier() {
+            public boolean verify(JComponent input) {
+                n_iv_calls++;
+                if (n_iv_calls == 1) {
+                    dialog.setVisible(true);
+                }
+                return true;
+            }
+        });
+        JTextField t2 = new JTextField();
+
+
+        frame.getContentPane().add(t1, BorderLayout.NORTH);
+        frame.getContentPane().add(t2, BorderLayout.SOUTH);
+        frame.setSize(200, 200);
+        frame.setVisible(true);
+
+        Robot r = null;
+        try {
+            r = new Robot();
+        } catch (AWTException e) {
+            EndlessLoopTest.fail(e);
+        }
+
+        try {
+            r.waitForIdle();
+
+            mouseClickOnComp(r, t1);
+            r.waitForIdle();
+
+            if (!t1.isFocusOwner()) {
+                throw new RuntimeException("t1 is not a focus owner");
+            }
+            n_iv_calls = 0;
+            r.keyPress(KeyEvent.VK_TAB);
+            r.delay(10);
+            r.keyRelease(KeyEvent.VK_TAB);
+            r.waitForIdle();
+
+            mouseClickOnComp(r, button);
+            r.waitForIdle();
+        } catch (Exception e) {
+            EndlessLoopTest.fail(e);
+        }
+
+        if (n_iv_calls != 1) {
+            EndlessLoopTest.fail(new RuntimeException("InputVerifier was called " + n_iv_calls + " times"));
+        }
+
+        EndlessLoopTest.pass();
+
+    }//End  init()
+
+
+    static void mouseClickOnComp(Robot r, Component comp) {
+        Point loc = comp.getLocationOnScreen();
+        loc.x += comp.getWidth() / 2;
+        loc.y += comp.getHeight() / 2;
+        r.mouseMove(loc.x, loc.y);
+        r.delay(10);
+        r.mousePress(InputEvent.BUTTON1_MASK);
+        r.delay(10);
+        r.mouseRelease(InputEvent.BUTTON1_MASK);
+    }
+
+    /*****************************************************
+     * Standard Test Machinery Section
+     * DO NOT modify anything in this section -- it's a
+     * standard chunk of code which has all of the
+     * synchronisation necessary for the test harness.
+     * By keeping it the same in all tests, it is easier
+     * to read and understand someone else's test, as
+     * well as insuring that all tests behave correctly
+     * with the test harness.
+     * There is a section following this for test-
+     * classes
+     ******************************************************/
+    private static boolean theTestPassed = false;
+    private static boolean testGeneratedInterrupt = false;
+    private static String failureMessage = "";
+
+    private static Thread mainThread = null;
+
+    private static int sleepTime = 300000;
+
+    // Not sure about what happens if multiple of this test are
+    //  instantiated in the same VM.  Being static (and using
+    //  static vars), it aint gonna work.  Not worrying about
+    //  it for now.
+    public static void main( String args[] ) throws InterruptedException
+    {
+        mainThread = Thread.currentThread();
+        try
+        {
+            init();
+        }
+        catch( TestPassedException e )
+        {
+            //The test passed, so just return from main and harness will
+            // interepret this return as a pass
+            return;
+        }
+        //At this point, neither test pass nor test fail has been
+        // called -- either would have thrown an exception and ended the
+        // test, so we know we have multiple threads.
+
+        //Test involves other threads, so sleep and wait for them to
+        // called pass() or fail()
+        try
+        {
+            Thread.sleep( sleepTime );
+            //Timed out, so fail the test
+            throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
+        }
+        catch (InterruptedException e)
+        {
+            //The test harness may have interrupted the test.  If so, rethrow the exception
+            // so that the harness gets it and deals with it.
+            if( ! testGeneratedInterrupt ) throw e;
+
+            //reset flag in case hit this code more than once for some reason (just safety)
+            testGeneratedInterrupt = false;
+
+            if ( theTestPassed == false )
+            {
+                throw new RuntimeException( failureMessage );
+            }
+        }
+
+    }//main
+
+    public static synchronized void setTimeoutTo( int seconds )
+    {
+        sleepTime = seconds * 1000;
+    }
+
+    public static synchronized void pass()
+    {
+        Sysout.println( "The test passed." );
+        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
+        //first check if this is executing in main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //Still in the main thread, so set the flag just for kicks,
+            // and throw a test passed exception which will be caught
+            // and end the test.
+            theTestPassed = true;
+            throw new TestPassedException();
+        }
+        theTestPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }//pass()
+
+    public static synchronized void fail( Exception whyFailed )
+    {
+        Sysout.println( "The test failed: " + whyFailed );
+        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
+        //check if this called from main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //If main thread, fail now 'cause not sleeping
+            throw new RuntimeException( whyFailed );
+        }
+        theTestPassed = false;
+        testGeneratedInterrupt = true;
+        failureMessage = whyFailed.toString();
+        mainThread.interrupt();
+    }//fail()
+
+}// class EndlessLoopTest
+
+//This exception is used to exit from any level of call nesting
+// when it's determined that the test has passed, and immediately
+// end the test.
+class TestPassedException extends RuntimeException
+{
+}
+
+//*********** End Standard Test Machinery Section **********
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+        System.out.println(messageIn);
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/6401036/InputVerifierTest2.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,384 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 6401036
+  @summary  InputVerifier shouldn't be called when requestFocus() is called on comp from another toplevel
+  @author oleg.sukhodolsky: area=awt.focus
+  @run main InputVerifierTest2
+*/
+
+/**
+ * InputVerifierTest2.java
+ *
+ * summary: REGRESSION: InputVerifier and JOptionPane
+ */
+
+import java.awt.AWTException;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.TextArea;
+
+import java.awt.event.InputEvent;
+
+import javax.swing.InputVerifier;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JTextField;
+import javax.swing.JWindow;
+
+public class InputVerifierTest2
+{
+
+    private static void init()
+    {
+        //*** Create instructions for the user here ***
+
+        String[] instructions =
+        {
+            "This is an AUTOMATIC test, simply wait until it is done.",
+            "The result (passed or failed) will be shown in the",
+            "message window below."
+        };
+        Sysout.createDialog( );
+        Sysout.printInstructions( instructions );
+
+        JFrame frame = new JFrame();
+        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+        JTextField tf = new JTextField(10);
+        frame.getContentPane().add(tf);
+
+        final JWindow w = new JWindow(frame);
+        JButton btn1 = new JButton("window");
+        btn1.setName("bnt1");
+        w.getContentPane().add(btn1);
+        w.pack();
+        w.setVisible(true);
+
+        frame.setSize(200, 200);
+        frame.setVisible(true);
+
+
+        Robot r = null;
+        try {
+            r = new Robot();
+        } catch (AWTException e) {
+            InputVerifierTest2.fail(e);
+        }
+
+
+        try {
+            r.waitForIdle();
+            mouseClickOnComp(r, tf);
+            r.waitForIdle();
+
+            if (!tf.isFocusOwner()) {
+                throw new RuntimeException("t1 is not a focus owner");
+            }
+
+            tf.setInputVerifier(new InputVerifier() {
+                    public boolean verify(JComponent input) {
+                        System.err.println("verify on " + input);
+                        throw new RuntimeException("InputVerifier should not be called");
+                    }
+                });
+            btn1.requestFocus();
+        } catch (Exception e) {
+            InputVerifierTest2.fail(e);
+        }
+
+        InputVerifierTest2.pass();
+
+    }//End  init()
+
+
+    static void mouseClickOnComp(Robot r, Component comp) {
+        Point loc = comp.getLocationOnScreen();
+        loc.x += comp.getWidth() / 2;
+        loc.y += comp.getHeight() / 2;
+        r.mouseMove(loc.x, loc.y);
+        r.delay(10);
+        r.mousePress(InputEvent.BUTTON1_MASK);
+        r.delay(10);
+        r.mouseRelease(InputEvent.BUTTON1_MASK);
+    }
+
+    /*****************************************************
+     * Standard Test Machinery Section
+     * DO NOT modify anything in this section -- it's a
+     * standard chunk of code which has all of the
+     * synchronisation necessary for the test harness.
+     * By keeping it the same in all tests, it is easier
+     * to read and understand someone else's test, as
+     * well as insuring that all tests behave correctly
+     * with the test harness.
+     * There is a section following this for test-
+     * classes
+     ******************************************************/
+    private static boolean theTestPassed = false;
+    private static boolean testGeneratedInterrupt = false;
+    private static String failureMessage = "";
+
+    private static Thread mainThread = null;
+
+    private static int sleepTime = 300000;
+
+    // Not sure about what happens if multiple of this test are
+    //  instantiated in the same VM.  Being static (and using
+    //  static vars), it aint gonna work.  Not worrying about
+    //  it for now.
+    public static void main( String args[] ) throws InterruptedException
+    {
+        mainThread = Thread.currentThread();
+        try
+        {
+            init();
+        }
+        catch( TestPassedException e )
+        {
+            //The test passed, so just return from main and harness will
+            // interepret this return as a pass
+            return;
+        }
+        //At this point, neither test pass nor test fail has been
+        // called -- either would have thrown an exception and ended the
+        // test, so we know we have multiple threads.
+
+        //Test involves other threads, so sleep and wait for them to
+        // called pass() or fail()
+        try
+        {
+            Thread.sleep( sleepTime );
+            //Timed out, so fail the test
+            throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
+        }
+        catch (InterruptedException e)
+        {
+            //The test harness may have interrupted the test.  If so, rethrow the exception
+            // so that the harness gets it and deals with it.
+            if( ! testGeneratedInterrupt ) throw e;
+
+            //reset flag in case hit this code more than once for some reason (just safety)
+            testGeneratedInterrupt = false;
+
+            if ( theTestPassed == false )
+            {
+                throw new RuntimeException( failureMessage );
+            }
+        }
+
+    }//main
+
+    public static synchronized void setTimeoutTo( int seconds )
+    {
+        sleepTime = seconds * 1000;
+    }
+
+    public static synchronized void pass()
+    {
+        Sysout.println( "The test passed." );
+        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
+        //first check if this is executing in main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //Still in the main thread, so set the flag just for kicks,
+            // and throw a test passed exception which will be caught
+            // and end the test.
+            theTestPassed = true;
+            throw new TestPassedException();
+        }
+        theTestPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }//pass()
+
+    public static synchronized void fail( Exception whyFailed )
+    {
+        Sysout.println( "The test failed: " + whyFailed );
+        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
+        //check if this called from main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //If main thread, fail now 'cause not sleeping
+            throw new RuntimeException( whyFailed );
+        }
+        theTestPassed = false;
+        testGeneratedInterrupt = true;
+        failureMessage = whyFailed.toString();
+        mainThread.interrupt();
+    }//fail()
+
+}// class InputVerifierTest2
+
+//This exception is used to exit from any level of call nesting
+// when it's determined that the test has passed, and immediately
+// end the test.
+class TestPassedException extends RuntimeException
+{
+}
+
+//*********** End Standard Test Machinery Section **********
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+        System.out.println(messageIn);
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/ChildWindowFocusTest/ChildWindowFocusTest.html	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ 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.
+-->
+
+<html>
+<!--  
+  @test
+  @bug        5090325
+  @summary    Tests that Window's child can be focused on XAWT.
+  @author     anton.tarasov@sun.com: area=awt.focus
+  @run        applet ChildWindowFocusTest.html
+  -->
+<head>
+<title>ChildWindowFocusTest</title>
+</head>
+<body>
+
+<h1>ChildWindowFocusTest<br>Bug ID: 5090325</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="ChildWindowFocusTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/ChildWindowFocusTest/ChildWindowFocusTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,281 @@
+/*
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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        5090325
+  @summary    Tests that Window's child can be focused on XAWT.
+  @author     anton.tarasov@sun.com: area=awt.focus
+  @run        applet ChildWindowFocusTest.html
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+import java.lang.reflect.*;
+
+public class ChildWindowFocusTest extends Applet {
+    Robot robot;
+    Frame frame = new Frame("Owner");
+    Button button0 = new Button("button-0");
+    TextField text0 = new TextField("text-0");
+    TextField text1 = new TextField("text-1");
+    Window win1 = new TestWindow(frame, text0, 110);
+    Window win2 = new TestWindow(win1, text1, 220);
+    Frame outerFrame = new Frame("Outer");
+    Button button1 = new Button("button-1");
+    int shift;
+
+    public void init() {
+        try {
+            robot = new Robot();
+        } catch (AWTException e) {
+            throw new RuntimeException("Error: unable to create robot", e);
+        }
+        // Create instructions for the user here, as well as set up
+        // the environment -- set the layout manager, add buttons,
+        // etc.
+        this.setLayout (new BorderLayout ());
+        Sysout.createDialogWithInstructions(new String[]
+            {"This is an AUTOMATIC test", "simply wait until it is done"});
+
+        Rectangle bounds = Sysout.dialog.getBounds();
+        shift = (int)(bounds.x + bounds.width + 10);
+    }
+
+    public void start() {
+
+        frame.setBounds(0, 50, 400, 100);
+        frame.setLayout(new FlowLayout());
+        frame.add(button0);
+
+        outerFrame.setBounds(0, 390, 400, 100);
+        outerFrame.setLayout(new FlowLayout());
+        outerFrame.add(button1);
+
+        adjustAndShow(new Component[] {frame, win1, win2, outerFrame});
+        robot.waitForIdle();
+
+        test();
+    }
+
+    void adjustAndShow(Component[] comps) {
+        for (Component comp: comps) {
+            comp.setLocation(shift, (int)comp.getLocation().getY());
+            comp.setVisible(true);
+            robot.waitForIdle();
+        }
+    }
+
+    void test() {
+        clickOnCheckFocusOwner(button0);
+        clickOnCheckFocusOwner(text1);
+        clickOnCheckFocusOwner(button1);
+        clickOn(frame);
+        checkFocusOwner(text1);
+        clickOnCheckFocusOwner(text0);
+        clickOnCheckFocusOwner(button1);
+        clickOn(frame);
+        checkFocusOwner(text0);
+
+        Sysout.println("Test passed.");
+    }
+
+    void clickOnCheckFocusOwner(Component c) {
+        clickOn(c);
+        if (!checkFocusOwner(c)) {
+            throw new RuntimeException("Test failed: couldn't focus <" + c + "> by mouse click!");
+        }
+    }
+
+    boolean checkFocusOwner(Component comp) {
+        return (comp == KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner());
+    }
+
+    void clickOn(Component c) {
+        Point p = c.getLocationOnScreen();
+        Dimension d = c.getSize();
+
+        Sysout.println("Clicking " + c);
+
+        if (c instanceof Frame) {
+            robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + ((Frame)c).getInsets().top/2);
+        } else {
+            robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
+        }
+        robot.delay(50);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.delay(50);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.waitForIdle();
+    }
+
+}
+
+class TestWindow extends Window {
+    TestWindow(Window owner, Component comp, int x) {
+        super(owner);
+        setBackground(Color.blue);
+        setLayout(new FlowLayout());
+        add(comp);
+        comp.setBackground(Color.yellow);
+        setBounds(0, x, 100, 100);
+    }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/DisposedWindow/DisposeDialogNotActivateOwnerTest/DisposeDialogNotActivateOwnerTest.html	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ 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.
+-->
+
+<html>
+<!--
+  @test
+  @bug        6386592
+  @summary    Tests that disposing a dialog doesn't activate its invisible owner.
+  @author     anton.tarasov@sun.com: area=awt.focus
+  @run        applet DisposeDialogNotActivateOwnerTest.html
+  -->
+<head>
+<title>DisposeDialogNotActivateOwnerTest</title>
+</head>
+<body>
+ 
+<h1>DisposeDialogNotActivateOwnerTest<br>Bug ID: 6386592</h1>
+ 
+<p>See the dialog box (usually in upper left corner) for instructions</p>
+ 
+<APPLET CODE=DisposeDialogNotActivateOwnerTest.class WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/DisposedWindow/DisposeDialogNotActivateOwnerTest/DisposeDialogNotActivateOwnerTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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       6386592
+  @summary   Tests that disposing a dialog doesn't activate its invisible owner.
+  @author    anton.tarasov@sun.com: area=awt.focus
+  @run       applet DisposeDialogNotActivateOwnerTest.html
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+
+public class DisposeDialogNotActivateOwnerTest extends Applet {
+    Robot robot;
+
+    Frame frame = new Frame("Owner Frame");
+    Dialog dialog = new Dialog(new Frame(), "Owned Dialog");
+    Button frameButton = new Button("button");
+
+    static boolean passed = false;
+
+    public static void main(String[] args) {
+        DisposeDialogNotActivateOwnerTest app = new DisposeDialogNotActivateOwnerTest();
+        app.init();
+        app.start();
+    }
+
+    public void init() {
+        try {
+            robot = new Robot();
+        } catch (AWTException e) {
+            throw new RuntimeException("Error: unable to create robot", e);
+        }
+        // Create instructions for the user here, as well as set up
+        // the environment -- set the layout manager, add buttons,
+        // etc.
+        this.setLayout (new BorderLayout ());
+        Sysout.createDialogWithInstructions(new String[]
+            {"This is automatic test. Simply wait until it is done."
+            });
+
+        frame.setBounds(800, 50, 200, 100);
+        frame.add(frameButton);
+        dialog.setBounds(800, 300, 200, 100);
+    }
+
+    public void start() {
+
+        frameButton.addFocusListener(new FocusAdapter() {
+                public void focusGained(FocusEvent e) {
+                    passed = true;
+                }
+            });
+
+        frame.setVisible(true);
+        robot.waitForIdle();
+
+        // make sure the frame is focused
+        clickOn(frame);
+        if (!frame.isFocused()) {
+            throw new RuntimeException("Error: a frame didn't get initial focus.");
+        }
+
+        dialog.setVisible(true);
+        robot.waitForIdle();
+
+        // make sure the dialog is focused
+        if (!dialog.isFocused()) {
+            throw new RuntimeException("Error: a dialog didn't get initial focus.");
+        }
+
+        dialog.dispose();
+        robot.waitForIdle();
+
+        if (passed) {
+            Sysout.println("Test passed.");
+        } else {
+            throw new RuntimeException("Test failed: a dialog activates invisible owner when disposed!");
+        }
+    }
+
+    void clickOn(Component c) {
+        Point p = c.getLocationOnScreen();
+        Dimension d = c.getSize();
+
+        if (c instanceof Frame) {
+            robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + ((Frame)c).getInsets().top/2);
+        } else {
+            robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
+        }
+
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.delay(20);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        robot.waitForIdle();
+    }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
--- a/jdk/test/java/awt/Focus/FocusEmbeddedFrameTest/FocusEmbeddedFrameTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Focus/FocusEmbeddedFrameTest/FocusEmbeddedFrameTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -27,7 +27,7 @@
   @summary   Tests that EmbeddedFrame can be focused.
   @author    anton.tarasov: area=awt-focus
   @library   ../../regtesthelpers
-  @build     Util
+  @build     Util UtilInternal
   @run       main FocusEmbeddedFrameTest
 */
 
@@ -37,6 +37,7 @@
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.lang.reflect.InvocationTargetException;
 import test.java.awt.regtesthelpers.Util;
+import test.java.awt.regtesthelpers.UtilInternal;
 
 public class FocusEmbeddedFrameTest extends Applet {
     static Frame embedder = new Frame("Embedder");
@@ -71,7 +72,7 @@
         embedder.addNotify();
 
         try {
-            ef = Util.createEmbeddedFrame(embedder);
+            ef = UtilInternal.createEmbeddedFrame(embedder);
         } catch (Throwable t) {
             t.printStackTrace();
             throw new Error("Test error: couldn't create an EmbeddedFrame!");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/FocusSubRequestTest/FocusSubRequestTest.html	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ 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.
+-->
+
+<html>
+<!--  
+  @test
+  @bug        5082319
+  @summary    Tests that focus request for already focused component doesn't block key events.
+  @author     anton.tarasov@sun.com
+  @run applet FocusSubRequestTest.html
+  -->
+<head>
+<title>FocusSubRequestTest</title>
+</head>
+<body>
+
+<h1>FocusSubRequestTest<br>Bug ID: 5082319</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="FocusSubRequestTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/FocusSubRequestTest/FocusSubRequestTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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        5082319
+  @summary    Tests that focus request for already focused component doesn't block key events.
+  @author     anton.tarasov@sun.com
+  @run applet FocusSubRequestTest.html
+*/
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+
+public class FocusSubRequestTest extends Applet {
+    Frame frame = new Frame("Test Frame");
+    Button button = new Button("button");
+    boolean passed = false;
+    Robot robot;
+
+    public void init() {
+        frame.add(button);
+        button.addFocusListener(new FocusAdapter() {
+                public void focusGained(FocusEvent e) {
+                    System.out.println("FocusSubRequestTest: focusGained for: " + e.getSource());
+                    ((Component)e.getSource()).requestFocus();
+                }
+            });
+
+        button.addKeyListener(new KeyAdapter() {
+                public void keyPressed(KeyEvent e) {
+                    System.out.println("FocusSubRequestTest: keyPressed for: " + e.getSource());
+                    passed = true;
+                }
+            });
+
+        try {
+            robot = new Robot();
+        } catch(Exception e) {
+            throw new RuntimeException("Error: unable to create robot", e);
+        }
+    }
+
+    public void start() {
+        frame.pack();
+        frame.setLocation(getLocation().x + getSize().width + 20, 0);
+        frame.setVisible(true);
+
+        waitTillShown(button);
+        frame.toFront();
+
+        robot.delay(100);
+        robot.keyPress(KeyEvent.VK_K);
+        robot.delay(100);
+        robot.keyRelease(KeyEvent.VK_K);
+
+        robot.waitForIdle();
+
+        if(passed) {
+            System.out.println("Test passed.");
+        } else {
+            throw new RuntimeException("Test failed.");
+        }
+    }
+
+    private void waitTillShown(Component component) {
+        while (true) {
+            try {
+                Thread.sleep(100);
+                component.getLocationOnScreen();
+                break;
+            } catch(InterruptedException ie) {
+                throw new RuntimeException(ie);
+            } catch(IllegalComponentStateException icse) {}
+        }
+    }
+}
--- a/jdk/test/java/awt/Focus/KeyEventForBadFocusOwnerTest/KeyEventForBadFocusOwnerTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Focus/KeyEventForBadFocusOwnerTest/KeyEventForBadFocusOwnerTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -38,13 +38,11 @@
 
 
 import java.awt.Robot;
-import java.awt.Toolkit;
 
 import java.awt.event.*;
 
 import javax.swing.*;
 import javax.swing.event.*;
-import sun.awt.SunToolkit;
 
 public class KeyEventForBadFocusOwnerTest {
     final static String ITEM_ONE_TEXT = "one";
@@ -55,7 +53,6 @@
     volatile static boolean unexpectedItemSelected = false;
 
     static Robot robot;
-    static SunToolkit toolkit;
 
     public static void main(String[] args) throws Exception {
         SwingUtilities.invokeAndWait(new Runnable() {
@@ -122,16 +119,15 @@
             }
         });
 
-        toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-        toolkit.realSync();
 
         robot = new Robot();
         robot.setAutoDelay(100);
+        robot.waitForIdle();
 
         Util.hitMnemonics(robot, KeyEvent.VK_O);
         Util.hitMnemonics(robot, KeyEvent.VK_T);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         Thread.sleep(1000); // workaround for MacOS
 
         if (unexpectedItemSelected) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/ModalDialogInitialFocusTest/ModalDialogInitialFocusTest.html	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ 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.
+-->
+
+<html>
+<!--
+  @test
+  @bug        6382750
+  @summary
+  @author     anton.tarasov@sun.com: area=awt.focus
+  @run        applet ModalDialogInitialFocusTest.html
+  -->
+<head>
+<title>ModalDialogInitialFocusTest</title>
+</head>
+<body>
+ 
+<h1>ModalDialogInitialFocusTest<br>Bug ID: 6382750</h1>
+ 
+<p>See the dialog box (usually in upper left corner) for instructions</p>
+ 
+<APPLET CODE=ModalDialogInitialFocusTest.class WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/ModalDialogInitialFocusTest/ModalDialogInitialFocusTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,253 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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       6382750
+  @summary   Tests that modal dialog doesn't request extra initial focus on show.
+  @author    anton.tarasov@sun.com: area=awt.focus
+  @run       applet ModalDialogInitialFocusTest.html
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.lang.reflect.InvocationTargetException;
+
+public class ModalDialogInitialFocusTest extends Applet {
+    Robot robot;
+
+    Dialog dialog = new Dialog((Window)null, "Test Dialog", Dialog.ModalityType.TOOLKIT_MODAL);
+    Button button = new Button("button");
+
+    volatile static boolean passed = true;
+
+    public static void main(String[] args) {
+        ModalDialogInitialFocusTest app = new ModalDialogInitialFocusTest();
+        app.init();
+        app.start();
+    }
+
+    public void init() {
+        try {
+            robot = new Robot();
+        } catch (AWTException e) {
+            throw new RuntimeException("Error: unable to create robot", e);
+        }
+        // Create instructions for the user here, as well as set up
+        // the environment -- set the layout manager, add buttons,
+        // etc.
+        this.setLayout (new BorderLayout ());
+        Sysout.createDialogWithInstructions(new String[]
+            {"This is automatic test. Simply wait until it is done."
+            });
+    }
+
+    public void start() {
+
+        dialog.setLayout(new FlowLayout());
+        dialog.add(button);
+        dialog.setBounds(800, 0, 100, 100);
+
+        dialog.addFocusListener(new FocusAdapter() {
+                // The only expected FOCUS_GAINED is on the button.
+                public void focusGained(FocusEvent e) {
+                    passed = false;
+                }
+            });
+
+        test();
+    }
+
+    void test() {
+        new Thread(new Runnable() {
+                public void run() {
+                  dialog.setVisible(true);
+                }
+            }).start();
+
+        waitTillShown(dialog);
+
+        robot.waitForIdle();
+
+        dialog.dispose();
+
+        if (passed) {
+            Sysout.println("Test passed.");
+        } else {
+            throw new RuntimeException("Test failed: dialog requests extra focus on show!");
+        }
+    }
+
+    void waitTillShown(Component c) {
+        while (true) {
+            try {
+                Thread.sleep(100);
+                c.getLocationOnScreen();
+                break;
+            } catch (InterruptedException ie) {
+                ie.printStackTrace();
+                break;
+            } catch (IllegalComponentStateException e) {
+            }
+        }
+    }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/MouseClickRequestFocusRaceTest/MouseClickRequestFocusRaceTest.html	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ 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.
+-->
+
+<html>
+<!--
+  @test
+  @bug        5028014
+  @summary    Focus request & mouse click being performed nearly synchronously shouldn't break the focus subsystem
+  @author     anton.tarasov@sun.com: area=awt-focus
+  @run        applet MouseClickRequestFocusRaceTest.html
+  -->
+<head>
+<title>MouseClickRequestFocusRaceTest</title>
+</head>
+<body>
+ 
+<h1>MouseClickRequestFocusRaceTest<br>Bug ID: 5028014</h1>
+ 
+<p>See the dialog box (usually in upper left corner) for instructions</p>
+ 
+<APPLET CODE=MouseClickRequestFocusRaceTest.class WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/MouseClickRequestFocusRaceTest/MouseClickRequestFocusRaceTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,307 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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       5028014
+  @summary   Focus request & mouse click performed nearly synchronously shouldn't lead to a focus race.
+  @author    anton.tarasov@sun.com: area=awt-focus
+  @run       applet MouseClickRequestFocusRaceTest.html
+*/
+
+import java.awt.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.applet.Applet;
+
+public class MouseClickRequestFocusRaceTest extends Applet {
+    Robot robot;
+    JFrame frame1 = new JFrame("Frame-1") {
+            public String toString() { return "Frame-1";}
+        };
+    JFrame frame2 = new JFrame("Frame-2") {
+            public String toString() { return "Frame-2";}
+        };
+    JButton button1 = new JButton("button-1") {
+            public String toString() { return "button-1";}
+        };
+    JButton button2 = new JButton("button-2") {
+            public String toString() { return "button-2";}
+        };
+    JPopupMenu popup = new JPopupMenu();
+
+    public static void main(String[] args) {
+        MouseClickRequestFocusRaceTest app = new MouseClickRequestFocusRaceTest();
+        app.init();
+        app.start();
+    }
+
+    public void init() {
+        try {
+            robot = new Robot();
+        } catch (AWTException e) {
+            throw new RuntimeException("Error: unable to create robot", e);
+        }
+        // Create instructions for the user here, as well as set up
+        // the environment -- set the layout manager, add buttons,
+        // etc.
+        this.setLayout (new BorderLayout ());
+        Sysout.createDialogWithInstructions(new String[]
+            {"Automatic test. Simply wait until it is done."
+            });
+    }
+
+    public void start() {
+        frame1.add(button1);
+        frame2.add(button2);
+        frame1.setBounds(0, 0, 200, 300);
+        frame2.setBounds(300, 0, 200, 300);
+        frame1.setLayout(new FlowLayout());
+        frame2.setLayout(new FlowLayout());
+
+        popup.add(new JMenuItem("black"));
+        popup.add(new JMenuItem("yellow"));
+        popup.add(new JMenuItem("white"));
+
+        frame1.add(popup);
+
+        frame1.addMouseListener(new MouseAdapter() {
+                void popup(MouseEvent e) {
+                    if (e.isPopupTrigger()) {
+                        Point loc = button1.getLocation();
+                        popup.show(button1, e.getX() - loc.x, e.getY() - loc.y);
+                    }
+                }
+                public void mousePressed(MouseEvent e) {
+                    popup(e);
+                }
+                public void mouseReleased(MouseEvent e) {
+                    popup(e);
+                }
+            });
+
+        frame2.addMouseListener(new MouseAdapter() {
+                public void mousePressed(MouseEvent e) {
+                    button1.requestFocusInWindow();
+                }
+            });
+
+        frame2.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+
+        frame1.setVisible(true);
+        frame2.setVisible(true);
+//        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.delay(1000);
+
+        test();
+    }
+
+    public void test() {
+        // Right click Frame-1
+        robot.mouseMove(frame1.getLocation().x + 100, frame1.getLocation().y + 200);
+        robot.mousePress(InputEvent.BUTTON3_MASK);
+        robot.delay(100);
+        robot.mouseRelease(InputEvent.BUTTON3_MASK);
+
+//        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.delay(1000);
+
+        // Left click Frame-2
+        robot.mouseMove(frame2.getLocation().x + 100, frame1.getLocation().y + 200);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.delay(100);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+//        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.delay(1000);
+
+        JComponent focusOwner = (JComponent)KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
+        JFrame focusedWindow = (JFrame)KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow();
+
+        Sysout.println("focus owner: " + focusOwner);
+        Sysout.println("focused window: " + focusedWindow);
+
+        // Verify that the focused window is the ancestor of the focus owner
+        if (!focusedWindow.isAncestorOf(focusOwner)) {
+            throw new TestFailedException("The focus owner is not in the focused window!");
+        }
+
+        // Try to close native focused window
+        robot.keyPress(KeyEvent.VK_ALT);
+        robot.keyPress(KeyEvent.VK_F4);
+        robot.keyRelease(KeyEvent.VK_F4);
+        robot.keyRelease(KeyEvent.VK_ALT);
+
+//        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.delay(1000);
+
+        // Verify that the Java focused window really mapped the native focused window.
+        if (focusedWindow.isVisible()) {
+            throw new TestFailedException("The focused window is different on Java and on the native level.");
+        }
+    }
+
+    class TestFailedException extends RuntimeException {
+        public TestFailedException(String cause) {
+            super("Test failed.");
+            Sysout.println(cause);
+        }
+    }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+//        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+//        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+//        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
--- a/jdk/test/java/awt/Focus/SimpleWindowActivationTest/SimpleWindowActivationTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Focus/SimpleWindowActivationTest/SimpleWindowActivationTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -34,7 +34,6 @@
 import java.awt.event.*;
 import java.util.concurrent.Callable;
 import javax.swing.SwingUtilities;
-import sun.awt.SunToolkit;
 import test.java.awt.regtesthelpers.Util;
 
 public class SimpleWindowActivationTest {
@@ -45,7 +44,6 @@
     private static Button wbutton;
     private static Label label;
     private static Robot robot;
-    private static SunToolkit toolkit;
 
     public static void main(String[] args) throws Exception {
 
@@ -54,7 +52,6 @@
             return;
         }
 
-        toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -66,10 +63,10 @@
         }, FocusEvent.FOCUS_EVENT_MASK | WindowEvent.WINDOW_FOCUS_EVENT_MASK);
 
         createAndShowWindow();
-        toolkit.realSync();
+        robot.waitForIdle();
 
         createAndShowFrame();
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // click on Frame
         clickOn(getClickPoint(frame));
@@ -96,7 +93,7 @@
         //         won't activate it.
 
         window.setFocusableWindowState(false);
-        toolkit.realSync();
+        robot.waitForIdle();
 
 
         clickOn(getClickPoint(label));
@@ -136,11 +133,12 @@
     static void clickOn(Point point) {
 
         robot.mouseMove(point.x, point.y);
+        robot.waitForIdle();
 
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
 
-        toolkit.realSync();
+        robot.waitForIdle();
     }
 
     static Point getClickPoint(Component c) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Frame/GetBoundsResizeTest/GetBoundsResizeTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 4103095
+   @summary Test for getBounds() after a Frame resize.
+   @author andrei.dmitriev : area=awt.toplevel
+   @run main/manual GetBoundsResizeTest
+*/
+
+import java.applet.Applet;
+import java.lang.*;
+import java.awt.*;
+import java.awt.event.*;
+
+class Globals {
+  static boolean testPassed=false;
+  static Thread mainThread=null;
+}
+
+public class GetBoundsResizeTest extends Applet {
+
+  public static void main(String args[]) throws Exception {
+    GetBoundsResizeTest app = new GetBoundsResizeTest();
+    app.start();
+    Globals.mainThread = Thread.currentThread();
+    try {
+      Thread.sleep(300000);
+    } catch (InterruptedException e) {
+      if (!Globals.testPassed)
+        throw new Exception("GetBoundsResizeTest failed.");
+    }
+  }
+
+  public void start()
+  {
+    String[] message = {
+      "Resize the window using the upper left corner.",
+      "Press the button to print the result of getBounds() to the terminal.",
+      "If getBounds() prints the correct values for the window",
+      "then click Pass, else click Fail."
+    };
+    new TestDialog(new Frame(), "GetBoundsResizeTest", message).start();
+    new GetBoundsResizeTester("GetBoundsResizeTester").start();
+  }
+}
+
+////////////////////////////////////////////////////////////////////////
+//  Test Dialog
+////////////////////////////////////////////////////////////////////////
+
+class TestDialog extends Dialog
+    implements ActionListener {
+
+  static TextArea output;
+  Button passButton;
+  Button failButton;
+  String name;
+
+  public TestDialog(Frame frame, String name, String[] message)
+  {
+    super(frame, name + " Pass/Fail Dialog");
+    this.name = name;
+    int maxStringLength = 0;
+    for (int i=0; i<message.length; i++) {
+      maxStringLength = Math.max(maxStringLength, message[i].length());
+    }
+    output = new TextArea(10, maxStringLength);
+    add("North", output);
+    for (int i=0; i<message.length; i++){
+        output.append(message[i] + "\n");
+    }
+    Panel buttonPanel = new Panel();
+    passButton = new Button("Pass");
+    failButton = new Button("Fail");
+    passButton.addActionListener(this);
+    failButton.addActionListener(this);
+    buttonPanel.add(passButton);
+    buttonPanel.add(failButton);
+    add("South", buttonPanel);
+    pack();
+  }
+
+  public void start()
+  {
+    show();
+  }
+
+  public void actionPerformed(ActionEvent event)
+  {
+    if ( event.getSource() == passButton ) {
+      Globals.testPassed = true;
+      System.err.println(name + " Passed.");
+    }
+    else if ( event.getSource() == failButton ) {
+      Globals.testPassed = false;
+      System.err.println(name + " Failed.");
+    }
+    this.dispose();
+    if (Globals.mainThread != null)
+      Globals.mainThread.interrupt();
+  }
+}
+
+
+  ////////////////////////////////////////////////////////////////////////
+  //  Test Class
+  ////////////////////////////////////////////////////////////////////////
+
+class GetBoundsResizeTester extends Frame {
+    Button b = new Button("Press");
+
+  GetBoundsResizeTester(String name)
+  {
+    super(name);
+    final Frame f = this;
+    Panel p = new Panel();
+    f.add(p);
+    p.setLayout(new BorderLayout());
+    b.addActionListener(new ActionListener() {
+      public void actionPerformed(ActionEvent be){
+        Point cp = b.getLocationOnScreen();
+        TestDialog.output.append("Current Frame.getBounds() = " + f.getBounds()+"\n");
+      }
+    });
+    p.add("Center", b);
+    f.pack();
+  }
+
+  public void start ()
+  {
+      setVisible(true);
+      Robot robot;
+      try {
+          robot = new Robot();
+          robot.waitForIdle();
+      }catch(Exception ignorex) {
+      }
+      Point cp = b.getLocationOnScreen();
+      TestDialog.output.append("Original Frame.getBounds() = " + this.getBounds()+"\n");
+  }
+
+  public static void main(String[] args)
+  {
+    new GetBoundsResizeTester("GetBoundsResizeTester").start();
+  }
+
+}
--- a/jdk/test/java/awt/FullScreen/8013581/bug8013581.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/FullScreen/8013581/bug8013581.java	Fri Jan 09 13:28:02 2015 -0500
@@ -29,7 +29,6 @@
  * @run main bug8013581
  */
 
-import sun.awt.*;
 import java.awt.*;
 import java.awt.event.*;
 
@@ -42,12 +41,11 @@
                 .getLocalGraphicsEnvironment();
         final GraphicsDevice[] devices = ge.getScreenDevices();
 
-        final SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit();
         final Robot robot = new Robot();
         robot.setAutoDelay(50);
 
         createAndShowGUI();
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Exception error = null;
         for (final GraphicsDevice device : devices) {
@@ -56,14 +54,14 @@
             }
 
             device.setFullScreenWindow(frame);
-            sleep();
+            sleep(robot);
 
             robot.keyPress(KeyEvent.VK_A);
             robot.keyRelease(KeyEvent.VK_A);
-            toolkit.realSync();
+            robot.waitForIdle();
 
             device.setFullScreenWindow(null);
-            sleep();
+            sleep(robot);
 
             if (listenerCallCounter != 2) {
                 error = new Exception("Test failed: KeyListener called " + listenerCallCounter + " times instead of 2!");
@@ -98,8 +96,8 @@
         frame.setVisible(true);
     }
 
-    private static void sleep() {
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+    private static void sleep(Robot robot) {
+        robot.waitForIdle();
         try {
             Thread.sleep(2000);
         } catch (InterruptedException ignored) {
--- a/jdk/test/java/awt/FullScreen/FullScreenInsets/FullScreenInsets.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/FullScreen/FullScreenInsets/FullScreenInsets.java	Fri Jan 09 13:28:02 2015 -0500
@@ -30,12 +30,9 @@
 import java.awt.GraphicsEnvironment;
 import java.awt.Insets;
 import java.awt.Robot;
-import java.awt.Toolkit;
 import java.awt.Window;
 import java.awt.image.BufferedImage;
 
-import sun.awt.SunToolkit;
-
 /**
  * @test
  * @bug 8003173 7019055
@@ -45,6 +42,7 @@
 public final class FullScreenInsets {
 
     private static boolean passed = true;
+    private static Robot robot = null;
 
     public static void main(final String[] args) {
         final GraphicsEnvironment ge = GraphicsEnvironment
@@ -147,7 +145,15 @@
     }
 
     private static void sleep() {
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        if(robot == null) {
+            try {
+                robot = new Robot();
+            }catch(AWTException ae) {
+                ae.printStackTrace();
+                throw new RuntimeException("Cannot create Robot.");
+            }
+        }
+        robot.waitForIdle();
         try {
             Thread.sleep(2000);
         } catch (InterruptedException ignored) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Graphics2D/DrawString/DrawRotatedStringUsingRotatedFont.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+
+import static java.awt.image.BufferedImage.TYPE_INT_RGB;
+import static java.lang.Math.toRadians;
+
+/**
+ * @test
+ * @bug 8065373
+ * @summary Verifies that we get correct direction, when draw rotated string.
+ * @author Sergey Bylokhov
+ * @run main DrawRotatedStringUsingRotatedFont
+ */
+public final class DrawRotatedStringUsingRotatedFont {
+
+    private static final int SIZE = 500;
+    private static final String STR = "MMMMMMMMMMMMMMMM";
+
+    private static AffineTransform[] txs = {
+                            AffineTransform.getRotateInstance(toRadians(00)),
+                            AffineTransform.getRotateInstance(toRadians(45)),
+                            AffineTransform.getRotateInstance(toRadians(-45)),
+                            AffineTransform.getRotateInstance(toRadians(90)),
+                            AffineTransform.getRotateInstance(toRadians(-90)),
+                            AffineTransform.getRotateInstance(toRadians(135)),
+                            AffineTransform.getRotateInstance(toRadians(-135)),
+                            AffineTransform.getRotateInstance(toRadians(180)),
+                            AffineTransform.getRotateInstance(toRadians(-180)),
+                            AffineTransform.getRotateInstance(toRadians(225)),
+                            AffineTransform.getRotateInstance(toRadians(-225)),
+                            AffineTransform.getRotateInstance(toRadians(270)),
+                            AffineTransform.getRotateInstance(toRadians(-270)),
+                            AffineTransform.getRotateInstance(toRadians(315)),
+                            AffineTransform.getRotateInstance(toRadians(-315)),
+                            AffineTransform.getRotateInstance(toRadians(360)),
+                            AffineTransform.getRotateInstance(toRadians(-360))
+    };
+
+    public static void main(final String[] args) throws IOException {
+        for (final AffineTransform tx2 : txs) {
+            for (final AffineTransform tx1 : txs) {
+                for (final boolean aa : new boolean[]{true, false}) {
+                    final BufferedImage bi1 = createImage(aa, tx1, tx2);
+                    final BufferedImage bi2 = createImage(aa, tx2, tx1);
+                    compareImage(bi1, bi2);
+                    fillTextArea(bi1, tx1, tx2);
+                    fillTextArea(bi2, tx2, tx1);
+                    checkColors(bi1, bi2);
+                }
+            }
+        }
+        System.out.println("Passed");
+    }
+
+    /**
+     * Compares two images.
+     */
+    private static void compareImage(final BufferedImage bi1,
+                                     final BufferedImage bi2)
+            throws IOException {
+        for (int i = 0; i < SIZE; ++i) {
+            for (int j = 0; j < SIZE; ++j) {
+                if (bi1.getRGB(i, j) != bi2.getRGB(i, j)) {
+                    ImageIO.write(bi1, "png", new File("image1.png"));
+                    ImageIO.write(bi2, "png", new File("image2.png"));
+                    throw new RuntimeException("Failed: wrong text location");
+                }
+            }
+        }
+    }
+
+    /**
+     * Checks an image color. RED and GREEN are allowed only.
+     */
+    private static void checkColors(final BufferedImage bi1,
+                                    final BufferedImage bi2)
+            throws IOException {
+        for (int i = 0; i < SIZE; ++i) {
+            for (int j = 0; j < SIZE; ++j) {
+                final int rgb1 = bi1.getRGB(i, j);
+                final int rgb2 = bi2.getRGB(i, j);
+                if (rgb1 != rgb2 || rgb1 != 0xFFFF0000 && rgb1 != 0xFF00FF00) {
+                    ImageIO.write(bi1, "png", new File("image1.png"));
+                    ImageIO.write(bi2, "png", new File("image2.png"));
+                    throw new RuntimeException("Failed: wrong text location");
+                }
+            }
+        }
+    }
+
+    /**
+     * Creates an BufferedImage and draws a text, using two transformations,
+     * one for graphics and one for font.
+     */
+    private static BufferedImage createImage(final boolean aa,
+                                             final AffineTransform gtx,
+                                             final AffineTransform ftx) {
+        final BufferedImage bi = new BufferedImage(SIZE, SIZE, TYPE_INT_RGB);
+        final Graphics2D bg = bi.createGraphics();
+        bg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                            aa ? RenderingHints.VALUE_ANTIALIAS_ON
+                               : RenderingHints.VALUE_ANTIALIAS_OFF);
+        bg.setColor(Color.RED);
+        bg.fillRect(0, 0, SIZE, SIZE);
+        bg.translate(100, 100);
+        bg.transform(gtx);
+        bg.setColor(Color.BLACK);
+        bg.setFont(bg.getFont().deriveFont(20.0f).deriveFont(ftx));
+        bg.drawString(STR, 0, 0);
+        bg.dispose();
+        return bi;
+    }
+
+    /**
+     * Fills the area of text using green solid color.
+     */
+    private static void fillTextArea(final BufferedImage bi,
+                                     final AffineTransform tx1,
+                                     final AffineTransform tx2) {
+        final Graphics2D bg = bi.createGraphics();
+        bg.translate(100, 100);
+        bg.transform(tx1);
+        bg.transform(tx2);
+        bg.setColor(Color.GREEN);
+        final Font font = bg.getFont().deriveFont(20.0f);
+        bg.setFont(font);
+        bg.fill(font.getStringBounds(STR, bg.getFontRenderContext()));
+        bg.dispose();
+    }
+}
+
--- a/jdk/test/java/awt/GraphicsEnvironment/TestDetectHeadless/TestDetectHeadless.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/GraphicsEnvironment/TestDetectHeadless/TestDetectHeadless.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -28,7 +28,7 @@
 #
 
 # @test
-# @bug 8058930
+# @bug 8058930 7077826
 # @summary java.awt.GraphicsEnvironment.getHeadlessProperty() does not work for AIX
 #
 # @build TestDetectHeadless
@@ -36,7 +36,7 @@
 
 OS=`uname -s`
 case "$OS" in
-    Windows* | CYGWIN* )
+    Windows* | CYGWIN* | Darwin)
         echo "Passed"; exit 0 ;;
     * ) unset DISPLAY ;;
 esac
@@ -44,4 +44,14 @@
 ${TESTJAVA}/bin/java ${TESTVMOPTS} \
     -cp ${TESTCLASSES} TestDetectHeadless
 
+if [ $? -ne 0 ]; then
+	exit 1;
+fi
+
+DISPLAY=
+export DISPLAY
+
+${TESTJAVA}/bin/java ${TESTVMOPTS} \
+    -cp ${TESTCLASSES} TestDetectHeadless
+
 exit $?
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeForModalDialogTest/ConsumeForModalDialogTest.html	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ 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.
+-->
+
+<html>
+<!--
+  @test
+  @bug        6391688
+  @summary    Tests that next mnemonic KeyTyped is consumed for a modal dialog.
+  @author     anton.tarasov@sun.com: area=awt.focus
+  @run        applet ConsumeForModalDialogTest.html
+  -->
+<head>
+<title>ConsumeForModalDialogTest</title>
+</head>
+<body>
+ 
+<h1>ConsumeForModalDialogTest<br>Bug ID: 6391688</h1>
+ 
+<p>See the dialog box (usually in upper left corner) for instructions</p>
+ 
+<APPLET CODE=ConsumeForModalDialogTest.class WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeForModalDialogTest/ConsumeForModalDialogTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,281 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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       6391688
+  @summary   Tests that next mnemonic KeyTyped is consumed for a modal dialog.
+  @author    anton.tarasov@sun.com: area=awt.focus
+  @run       applet ConsumeForModalDialogTest.html
+*/
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.lang.reflect.InvocationTargetException;
+
+public class ConsumeForModalDialogTest extends Applet {
+    Robot robot;
+    JFrame frame = new JFrame("Test Frame");
+    JDialog dialog = new JDialog((Window)null, "Test Dialog", Dialog.ModalityType.DOCUMENT_MODAL);
+    JTextField text = new JTextField();
+    static boolean passed = true;
+
+    public static void main(String[] args) {
+        ConsumeForModalDialogTest app = new ConsumeForModalDialogTest();
+        app.init();
+        app.start();
+    }
+
+    public void init() {
+        try {
+            robot = new Robot();
+            robot.setAutoDelay(50);
+        } catch (AWTException e) {
+            throw new RuntimeException("Error: unable to create robot", e);
+        }
+        // Create instructions for the user here, as well as set up
+        // the environment -- set the layout manager, add buttons,
+        // etc.
+        this.setLayout (new BorderLayout ());
+        Sysout.createDialogWithInstructions(new String[]
+            {"This is automatic test. Simply wait until it is done."
+            });
+    }
+
+    public void start() {
+
+        text.addKeyListener(new KeyAdapter() {
+                public void keyTyped(KeyEvent e) {
+                    Sysout.println(e.toString());
+                    passed = false;
+                }
+            });
+
+        JMenuItem testItem = new JMenuItem();
+        testItem.setMnemonic('s');
+        testItem.setText("Test");
+
+        testItem.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent ae) {
+                    dialog.setVisible(true);
+            }
+        });
+
+        JMenu menu = new JMenu();
+        menu.setMnemonic('f');
+        menu.setText("File");
+        menu.add(testItem);
+
+        JMenuBar menuBar = new JMenuBar();
+        menuBar.add(menu);
+
+        dialog.setSize(100, 100);
+        dialog.add(text);
+
+        frame.setJMenuBar(menuBar);
+        frame.setSize(100, 100);
+        frame.setVisible(true);
+
+        robot.waitForIdle();
+
+        if (!frame.isFocusOwner()) {
+            Point loc = frame.getLocationOnScreen();
+            Dimension size = frame.getSize();
+            robot.mouseMove(loc.x + size.width/2, loc.y + size.height/2);
+            robot.delay(10);
+            robot.mousePress(MouseEvent.BUTTON1_MASK);
+            robot.delay(10);
+            robot.mouseRelease(MouseEvent.BUTTON1_MASK);
+
+            robot.waitForIdle();
+
+            int iter = 10;
+            while (!frame.isFocusOwner() && iter-- > 0) {
+                robot.delay(200);
+            }
+            if (iter <= 0) {
+                Sysout.println("Test: the frame couldn't be focused!");
+                return;
+            }
+        }
+
+        robot.keyPress(KeyEvent.VK_ALT);
+        robot.keyPress(KeyEvent.VK_F);
+        robot.delay(10);
+        robot.keyRelease(KeyEvent.VK_F);
+        robot.keyRelease(KeyEvent.VK_ALT);
+
+        robot.waitForIdle();
+
+        robot.keyPress(KeyEvent.VK_S);
+        robot.delay(10);
+        robot.keyRelease(KeyEvent.VK_S);
+
+        robot.delay(1000);
+
+        if (passed) {
+            Sysout.println("Test passed.");
+        } else {
+            throw new RuntimeException("Test failed! Enexpected KeyTyped came into the JTextField.");
+        }
+    }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.html	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ 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.
+-->
+
+<html>
+<!--
+  @test
+  @bug        6346690
+  @summary    Tests that key_typed is consumed after mnemonic key_pressed is handled for a menu item.
+  @author     anton.tarasov@sun.com: area=awt-focus
+  @library   ../../../../lib/testlibrary
+  @build jdk.testlibrary.OSInfo
+  @run        applet ConsumeNextMnemonicKeyTypedTest.html
+  -->
+<head>
+<title>ConsumeNextMnemonicKeyTypedTest</title>
+</head>
+<body>
+ 
+<h1>ConsumeNextMnemonicKeyTypedTest<br>Bug ID: 6346690</h1>
+ 
+<p>See the dialog box (usually in upper left corner) for instructions</p>
+ 
+<APPLET CODE=ConsumeNextMnemonicKeyTypedTest.class WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,300 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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       6346690
+  @summary   Tests that key_typed is consumed after mnemonic key_pressed is handled for a menu item.
+  @author    anton.tarasov@sun.com: area=awt-focus
+  @library   ../../../../lib/testlibrary
+  @build jdk.testlibrary.OSInfo
+  @run       applet ConsumeNextMnemonicKeyTypedTest.html
+*/
+
+import java.awt.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.applet.Applet;
+
+
+public class ConsumeNextMnemonicKeyTypedTest extends Applet {
+    Robot robot;
+    JFrame frame = new JFrame("Test Frame");
+    JTextField text = new JTextField();
+    JMenuBar bar = new JMenuBar();
+    JMenu menu = new JMenu("Menu");
+    JMenuItem item = new JMenuItem("item");
+
+    public static void main(String[] args) {
+        ConsumeNextMnemonicKeyTypedTest app = new ConsumeNextMnemonicKeyTypedTest();
+        app.init();
+        app.start();
+    }
+
+    public void init() {
+        try {
+            robot = new Robot();
+            robot.setAutoDelay(50);
+        } catch (AWTException e) {
+            throw new RuntimeException("Error: unable to create robot", e);
+        }
+        // Create instructions for the user here, as well as set up
+        // the environment -- set the layout manager, add buttons,
+        // etc.
+        this.setLayout (new BorderLayout ());
+        Sysout.createDialogWithInstructions(new String[]
+            {"Automatic test. Simply wait until it's done."});
+    }
+
+    public void start() {
+        menu.setMnemonic('f');
+        item.setMnemonic('i');
+        menu.add(item);
+        bar.add(menu);
+
+        frame.add(text);
+        frame.setJMenuBar(bar);
+        frame.pack();
+
+        frame.setLocation(800, 0);
+        frame.setVisible(true);
+
+        test();
+    }
+
+    void test() {
+
+        robot.waitForIdle();
+
+        if (!text.isFocusOwner()) {
+            robot.mouseMove(text.getLocationOnScreen().x + 5, text.getLocationOnScreen().y + 5);
+            robot.delay(100);
+            robot.mousePress(MouseEvent.BUTTON1_MASK);
+            robot.delay(100);
+            robot.mouseRelease(MouseEvent.BUTTON1_MASK);
+
+            int iter = 10;
+            while (!text.isFocusOwner() && iter-- > 0) {
+                robot.delay(200);
+            }
+            if (iter <= 0) {
+                Sysout.println("Test: text field couldn't be focused!");
+                return;
+            }
+        }
+
+        robot.keyPress(KeyEvent.VK_A);
+        robot.delay(100);
+        robot.keyRelease(KeyEvent.VK_A);
+
+        robot.waitForIdle();
+
+        String charA = text.getText();
+        System.err.println("Test: character typed with VK_A: " + charA);
+
+        robot.keyPress(KeyEvent.VK_BACK_SPACE);
+        robot.delay(100);
+        robot.keyRelease(KeyEvent.VK_BACK_SPACE);
+
+        robot.waitForIdle();
+
+        if (jdk.testlibrary.OSInfo.getOSType() == jdk.testlibrary.OSInfo.OSType.MACOSX) {
+            robot.keyPress(KeyEvent.VK_CONTROL);
+        }
+        robot.keyPress(KeyEvent.VK_ALT);
+        robot.keyPress(KeyEvent.VK_F);
+        robot.delay(100);
+        robot.keyRelease(KeyEvent.VK_F);
+        robot.keyRelease(KeyEvent.VK_ALT);
+        if (jdk.testlibrary.OSInfo.getOSType() == jdk.testlibrary.OSInfo.OSType.MACOSX) {
+            robot.keyRelease(KeyEvent.VK_CONTROL);
+        }
+
+        robot.waitForIdle();
+
+        String string = text.getText();
+
+        robot.keyPress(KeyEvent.VK_I);
+        robot.delay(100);
+        robot.keyRelease(KeyEvent.VK_I);
+
+        robot.waitForIdle();
+
+        Sysout.println("Test: character typed after mnemonic key press: " + text.getText());
+
+        if (!text.getText().equals(string)) {
+            throw new RuntimeException("Test failed!");
+        }
+
+        robot.keyPress(KeyEvent.VK_A);
+        robot.delay(100);
+        robot.keyRelease(KeyEvent.VK_A);
+
+        robot.waitForIdle();
+
+        System.err.println("Test: chracter typed with VK_A: " + text.getText());
+
+        if (!charA.equals(text.getText())) {
+            throw new RuntimeException("Test failed!");
+        }
+
+        Sysout.println("Test passed.");
+    }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/EnqueueWithDialogButtonTest/EnqueueWithDialogButtonTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,374 @@
+/*
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 4799136
+@summary Tests that type-ahead for dialog works and doesn't block program
+@author Dmitry.Cherepanov@SUN.COM area=awt.focus
+@run main EnqueueWithDialogButtonTest
+*/
+
+import java.awt.*;
+import java.lang.reflect.InvocationTargetException;
+import java.awt.event.*;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+/*
+ * Tests that type-ahead works correctly. That means
+ * that the key events are not delivered until a focus
+ * transfer is completed.
+ * There is another pretty similar test EnqueueWithDialogTest
+ * written in time before 6347235 resolution. We'll keep it
+ * to track quite unrelated suspicious waitForIdle behavior.
+ */
+
+public class EnqueueWithDialogButtonTest
+{
+    static Frame f;
+    static Button b;
+    static Dialog d;
+    static Button ok;
+    static CountDownLatch pressLatch = new CountDownLatch(1);
+    static CountDownLatch robotLatch = new CountDownLatch(1);
+    static volatile boolean gotFocus = false;
+    static Robot robot;
+    public static void main(String args[]) throws Exception {
+        EnqueueWithDialogButtonTest test = new EnqueueWithDialogButtonTest();
+        test.init();
+        test.start();
+    }
+    public void init()
+    {
+        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+                public void eventDispatched(AWTEvent e) {
+                    if (e instanceof InputEvent){
+                        System.err.println(e.toString()+","+((InputEvent)e).getWhen());
+                    }else{
+                        System.err.println(e.toString());
+                    }
+                 }
+            }, AWTEvent.KEY_EVENT_MASK | AWTEvent.FOCUS_EVENT_MASK);
+
+
+        f = new Frame("frame");
+        f.setPreferredSize(new Dimension(100,100));
+        f.setLocation(100,50);
+        b = new Button("press");
+        d = new Dialog(f, "dialog", true);
+        d.setPreferredSize(new Dimension(70,70));
+        ok = new Button("ok");
+        d.add(ok);
+        d.pack();
+        ok.addKeyListener(new KeyAdapter() {
+                public void keyPressed(KeyEvent e) {
+                    System.err.println("OK pressed: should arrive after got focus");
+                    d.dispose();
+                    f.dispose();
+                    // Typed-ahead key events should only be accepted if
+                    // they arrive after FOCUS_GAINED
+                    if (gotFocus) {
+                        pressLatch.countDown();
+                    }
+                }
+            });
+        ok.addFocusListener(new FocusAdapter() {
+                public void focusGained(FocusEvent e) {
+                    gotFocus = true;
+                    System.err.println("OK got focus");
+                }
+            });
+        f.add(b);
+        f.pack();
+        b.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    System.err.println(e.toString()+","+e.getWhen());
+                    System.err.println("B pressed");
+                    robotLatch.countDown();
+
+                    EventQueue.invokeLater(new Runnable() {
+                            public void run() {
+                                waitTillShown(d);
+                                EnqueueWithDialogButtonTest.this.d.toFront();
+                                EnqueueWithDialogButtonTest.this.moveMouseOver(d);
+                            }
+                        });
+
+                    // This will cause enqueue the following key events
+                    d.setVisible(true);
+                }
+            });
+
+    }//End  init()
+
+    public void start () throws Exception
+    {
+
+        robot = new Robot();
+        robot.setAutoDelay(50);
+
+        f.setVisible(true);
+        waitTillShown(b);
+        System.err.println("b is shown");
+        f.toFront();
+        moveMouseOver(f);
+        robot.waitForIdle();
+        robot.delay(100);
+        makeFocused(b);
+        robot.waitForIdle();
+        robot.delay(100);
+        System.err.println("b is focused");
+
+        robot.keyPress(KeyEvent.VK_SPACE);
+        robot.keyRelease(KeyEvent.VK_SPACE);
+        boolean ok = robotLatch.await(1, TimeUnit.SECONDS);
+        if(!ok) {
+            throw new RuntimeException("Was B button pressed?");
+        }
+
+        robot.keyPress(KeyEvent.VK_SPACE);
+        robot.keyRelease(KeyEvent.VK_SPACE);
+        robot.delay(500);
+        ok = pressLatch.await(3, TimeUnit.SECONDS);
+        if(!ok) {
+            throw new RuntimeException("Type-ahead doesn't work");
+        }
+
+    }// start()
+
+    private void moveMouseOver(Container c) {
+        Point p = c.getLocationOnScreen();
+        Dimension d = c.getSize();
+        robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
+    }
+
+    private void waitTillShown(Component c) {
+        while (true) {
+            try {
+                Thread.sleep(100);
+                c.getLocationOnScreen();
+                break;
+            } catch (InterruptedException ie) {
+                ie.printStackTrace();
+                break;
+            } catch (Exception e) {
+            }
+        }
+    }
+    private void makeFocused(Component comp) {
+        if (comp.isFocusOwner()) {
+            return;
+        }
+        final Semaphore sema = new Semaphore();
+        final FocusAdapter fa = new FocusAdapter() {
+                public void focusGained(FocusEvent fe) {
+                    sema.raise();
+                }
+            };
+        comp.addFocusListener(fa);
+        comp.requestFocusInWindow();
+        if (comp.isFocusOwner()) {
+            return;
+        }
+        try {
+            sema.doWait(3000);
+        } catch (InterruptedException ie) {
+            ie.printStackTrace();
+        }
+        comp.removeFocusListener(fa);
+        if (!comp.isFocusOwner()) {
+            throw new RuntimeException("Can't make " + comp + " focused, current owner is " + KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner());
+        }
+    }
+
+static class Semaphore {
+    boolean state = false;
+    int waiting = 0;
+    public Semaphore() {
+    }
+    public synchronized void doWait() throws InterruptedException {
+        if (state) {
+            return;
+        }
+        waiting++;
+        wait();
+        waiting--;
+    }
+    public synchronized void doWait(int timeout) throws InterruptedException {
+        if (state) {
+            return;
+        }
+        waiting++;
+        wait(timeout);
+        waiting--;
+    }
+    public synchronized void raise() {
+        state = true;
+        if (waiting > 0) {
+            notifyAll();
+        }
+    }
+    public synchronized boolean getState() {
+        return state;
+    }
+}
+}// class TestDialogTypeAhead
+
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        show();
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/EnqueueWithDialogTest/EnqueueWithDialogTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 4799136
+@summary Tests that type-ahead for dialog works and doesn't block program
+@author Dmitry.Cherepanov@SUN.COM area=awt.focus
+@run main EnqueueWithDialogTest
+*/
+
+import java.awt.*;
+import java.lang.reflect.InvocationTargetException;
+import java.awt.event.*;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+/*
+ * The purpose of this test is check that the type-head
+ * works correctly on Windows. That means that the key
+ * events are not delivered until a focus transfer is
+ * completed. Another regression test EnqueueWithDialogButton
+ * doesn't work on Windows because of the bug 6347235.
+ * This test workaround the bug by means of the removing
+ * button from the dialog.
+ */
+
+public class EnqueueWithDialogTest
+{
+    static Frame f;
+    static Button b;
+    static Dialog d;
+    static CountDownLatch pressLatch = new CountDownLatch(1);
+    static CountDownLatch robotLatch = new CountDownLatch(1);
+    static volatile boolean gotFocus = false;
+    static Robot robot;
+    public static void main(String args[]) throws Exception {
+        EnqueueWithDialogTest test = new EnqueueWithDialogTest();
+        test.init();
+        test.start();
+    }
+    public void init()
+    {
+        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+                public void eventDispatched(AWTEvent e) {
+                    if (e instanceof InputEvent){
+                        System.err.println(e.toString()+","+((InputEvent)e).getWhen());
+                    }else{
+                        System.err.println(e.toString());
+                    }
+                 }
+            }, AWTEvent.KEY_EVENT_MASK | AWTEvent.FOCUS_EVENT_MASK);
+
+
+        f = new Frame("frame");
+        f.setPreferredSize(new Dimension(100,100));
+        f.setLocation(100,50);
+        b = new Button("press");
+        d = new Dialog(f, "dialog", true);
+        d.setPreferredSize(new Dimension(70,70));
+        d.pack();
+        d.addKeyListener(new KeyAdapter() {
+                public void keyPressed(KeyEvent e) {
+                    System.err.println("DIALOG pressed: should arrive after got focus");
+                    d.dispose();
+                    f.dispose();
+                    // Typed-ahead key events should only be accepted if
+                    // they arrive after FOCUS_GAINED
+                    if (gotFocus) {
+                        pressLatch.countDown();
+                    }
+                }
+            });
+        d.addFocusListener(new FocusAdapter() {
+                public void focusGained(FocusEvent e) {
+                    gotFocus = true;
+                    System.err.println("DIALOG got focus");
+                }
+            });
+        f.add(b);
+        f.pack();
+        b.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    System.err.println(e.toString()+","+e.getWhen());
+                    System.err.println("B pressed");
+                    robotLatch.countDown();
+
+                    EventQueue.invokeLater(new Runnable() {
+                            public void run() {
+                                waitTillShown(d);
+                                EnqueueWithDialogTest.this.d.toFront();
+                                EnqueueWithDialogTest.this.moveMouseOver(d);
+                            }
+                        });
+
+                    // This will cause enqueue the following key events
+                    d.setVisible(true);
+                }
+            });
+
+    }//End  init()
+
+    public void start () throws Exception
+    {
+        try {
+            robot = new Robot();
+            //robot.setAutoDelay(50);
+        } catch (Exception e) {
+            throw new RuntimeException("Can't create robot:" + e);
+        }
+
+        f.setVisible(true);
+        waitTillShown(b);
+        System.err.println("b is shown");
+        f.toFront();
+        moveMouseOver(f);
+        robot.waitForIdle();
+        robot.delay(100);
+        makeFocused(b);
+        robot.waitForIdle();
+        robot.delay(100);
+        System.err.println("b is focused");
+
+        robot.keyPress(KeyEvent.VK_SPACE);
+        robot.keyRelease(KeyEvent.VK_SPACE);
+        System.err.println("space typed once");
+        boolean ok = robotLatch.await(1, TimeUnit.SECONDS);
+        if(!ok) {
+            throw new RuntimeException("Was B button pressed?");
+        }
+
+        robot.keyPress(KeyEvent.VK_SPACE);
+        robot.keyRelease(KeyEvent.VK_SPACE);
+        System.err.println("space typed twice");
+        robot.delay(500);
+        ok = pressLatch.await(3, TimeUnit.SECONDS);
+        if(!ok) {
+            throw new RuntimeException("Type-ahead doesn't work");
+        }
+
+    }// start()
+
+    private void moveMouseOver(Container c) {
+        Point p = c.getLocationOnScreen();
+        Dimension d = c.getSize();
+        robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
+    }
+
+    private void waitTillShown(Component c) {
+        while (true) {
+            try {
+                Thread.sleep(100);
+                c.getLocationOnScreen();
+                break;
+            } catch (InterruptedException ie) {
+                ie.printStackTrace();
+                break;
+            } catch (Exception e) {
+            }
+        }
+    }
+    private void makeFocused(Component comp) {
+        if (comp.isFocusOwner()) {
+            return;
+        }
+        final Semaphore sema = new Semaphore();
+        final FocusAdapter fa = new FocusAdapter() {
+                public void focusGained(FocusEvent fe) {
+                    sema.raise();
+                }
+            };
+        comp.addFocusListener(fa);
+        comp.requestFocusInWindow();
+        if (comp.isFocusOwner()) {
+            return;
+        }
+        try {
+            sema.doWait(3000);
+        } catch (InterruptedException ie) {
+            ie.printStackTrace();
+        }
+        comp.removeFocusListener(fa);
+        if (!comp.isFocusOwner()) {
+            throw new RuntimeException("Can't make " + comp + " focused, current owner is " + KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner());
+        }
+    }
+
+static class Semaphore {
+    boolean state = false;
+    int waiting = 0;
+    public Semaphore() {
+    }
+    public synchronized void doWait() throws InterruptedException {
+        if (state) {
+            return;
+        }
+        waiting++;
+        wait();
+        waiting--;
+    }
+    public synchronized void doWait(int timeout) throws InterruptedException {
+        if (state) {
+            return;
+        }
+        waiting++;
+        wait(timeout);
+        waiting--;
+    }
+    public synchronized void raise() {
+        state = true;
+        if (waiting > 0) {
+            notifyAll();
+        }
+    }
+    public synchronized boolean getState() {
+        return state;
+    }
+}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/FreezeTest/FreezeTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 4799136
+@summary Tests that type-ahead for dialog works and doesn't block program
+@author Dmitry.Cherepanov@SUN.COM area=awt.focus
+@run main FreezeTest
+*/
+
+import java.awt.*;
+import java.lang.reflect.InvocationTargetException;
+import java.awt.event.*;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+/*
+ * Tests that type-ahead doesn't block program.
+ */
+
+public class FreezeTest
+{
+    static Frame f;
+    static Button b;
+    static Dialog d;
+    static TextField tf;
+    static CountDownLatch robotLatch = new CountDownLatch(1);
+    static Robot robot;
+    static int click_count = 100;
+    static int deliver_count = 0;
+
+    public static void main(String args[]) throws Exception {
+        FreezeTest test = new FreezeTest();
+        test.init();
+        test.start();
+    }
+    public void init()
+    {
+        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+                public void eventDispatched(AWTEvent e) {
+                    if (e instanceof KeyEvent){
+                        deliver_count++;
+                        System.err.println("key_event# "+deliver_count);
+                    }
+
+                    if (e instanceof InputEvent){
+                        System.err.println(e.toString()+","+((InputEvent)e).getWhen());
+                    }else{
+                        System.err.println(e.toString());
+                    }
+                 }
+            }, AWTEvent.KEY_EVENT_MASK | AWTEvent.FOCUS_EVENT_MASK);
+
+
+        f = new Frame("frame");
+        b = new Button("press");
+        d = new Dialog(f, "dialog", true);
+        tf = new TextField("");
+        d.add(tf);
+        d.pack();
+
+        f.add(b);
+        f.pack();
+        b.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    System.err.println(e.toString()+","+e.getWhen());
+                    System.err.println("B pressed");
+                    robotLatch.countDown();
+
+                    EventQueue.invokeLater(new Runnable() {
+                            public void run() {
+                                waitTillShown(d);
+                                FreezeTest.this.d.toFront();
+                                FreezeTest.this.moveMouseOver(d);
+                            }
+                        });
+                    d.setVisible(true);
+                }
+            });
+
+    }//End  init()
+
+    public void start () throws Exception
+    {
+        robot = new Robot();
+
+        f.setVisible(true);
+        waitTillShown(b);
+        System.err.println("b is shown");
+        f.toFront();
+        moveMouseOver(f);
+        robot.waitForIdle();
+        makeFocused(b);
+        robot.waitForIdle();
+        System.err.println("b is focused");
+
+        robot.keyPress(KeyEvent.VK_SPACE);
+        robot.keyRelease(KeyEvent.VK_SPACE);
+        boolean ok = robotLatch.await(1, TimeUnit.SECONDS);
+        if(!ok) {
+            throw new RuntimeException("Was B button pressed?");
+        }
+
+        for (int i = 0; i < click_count; i++){
+            System.err.println("click# "+(i+1));
+            robot.keyPress(KeyEvent.VK_SPACE);
+            robot.delay(10);
+            robot.keyRelease(KeyEvent.VK_SPACE);
+            robot.delay(50);
+        }
+
+        robot.waitForIdle();
+
+        int deliver_count = this.deliver_count;
+        int expected_count = (click_count + 1) * 3;
+
+        if (deliver_count != expected_count){
+            System.err.println("deliver_count = "+deliver_count+" (!="+expected_count+")");
+            throw new RuntimeException("incorrect behaviour");
+        }
+    }// start()
+
+    private void moveMouseOver(Container c) {
+        Point p = c.getLocationOnScreen();
+        Dimension d = c.getSize();
+        robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
+    }
+
+    private void waitTillShown(Component c) {
+        while (true) {
+            try {
+                Thread.sleep(100);
+                c.getLocationOnScreen();
+                break;
+            } catch (InterruptedException ie) {
+                ie.printStackTrace();
+                break;
+            } catch (Exception e) {
+            }
+        }
+    }
+    private void makeFocused(Component comp) {
+        if (comp.isFocusOwner()) {
+            return;
+        }
+        final Semaphore sema = new Semaphore();
+        final FocusAdapter fa = new FocusAdapter() {
+                public void focusGained(FocusEvent fe) {
+                    sema.raise();
+                }
+            };
+        comp.addFocusListener(fa);
+        comp.requestFocusInWindow();
+        if (comp.isFocusOwner()) {
+            return;
+        }
+        try {
+            sema.doWait(3000);
+        } catch (InterruptedException ie) {
+            ie.printStackTrace();
+        }
+        comp.removeFocusListener(fa);
+        if (!comp.isFocusOwner()) {
+            throw new RuntimeException("Can't make " + comp + " focused, current owner is " + KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner());
+        }
+    }
+
+static class Semaphore {
+    boolean state = false;
+    int waiting = 0;
+    public Semaphore() {
+    }
+    public synchronized void doWait() throws InterruptedException {
+        if (state) {
+            return;
+        }
+        waiting++;
+        wait();
+        waiting--;
+    }
+    public synchronized void doWait(int timeout) throws InterruptedException {
+        if (state) {
+            return;
+        }
+        waiting++;
+        wait(timeout);
+        waiting--;
+    }
+    public synchronized void raise() {
+        state = true;
+        if (waiting > 0) {
+            notifyAll();
+        }
+    }
+    public synchronized boolean getState() {
+        return state;
+    }
+}
+}
--- a/jdk/test/java/awt/List/ActionAfterRemove/ActionAfterRemove.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/List/ActionAfterRemove/ActionAfterRemove.java	Fri Jan 09 13:28:02 2015 -0500
@@ -33,27 +33,29 @@
 
 import java.awt.*;
 import java.awt.event.*;
-import sun.awt.SunToolkit;
 import test.java.awt.regtesthelpers.Util;
 
 public class ActionAfterRemove
 {
     private static volatile boolean passed = true;
 
-    // handle the uncaught exception
-    public void handle(Throwable e) {
-        e.printStackTrace();
-        passed = false;
-    }
-
     public static final void main(String args[])
     {
+        // In order to handle all uncaught exceptions in the EDT
+        final Thread.UncaughtExceptionHandler eh = new Thread.UncaughtExceptionHandler()
+        {
+            @Override
+            public void uncaughtException(Thread t, Throwable e)
+            {
+                e.printStackTrace();
+                passed = false;
+            }
+        };
+
         final Frame frame = new Frame();
         final List list = new List();
         Robot robot = null;
 
-        // In order to handle all uncaught exceptions in the EDT
-        System.setProperty("sun.awt.exception.handler", "ActionAfterRemove");
 
         list.add("will be removed");
         frame.add(list);
@@ -72,9 +74,9 @@
         }
 
         Util.clickOnComp(list, robot);
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
         Util.clickOnComp(list, robot);
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         if (!passed){
             throw new RuntimeException("Test failed: exception was thrown on EDT.");
--- a/jdk/test/java/awt/List/EmptyListEventTest/EmptyListEventTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/List/EmptyListEventTest/EmptyListEventTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -33,7 +33,6 @@
 import javax.swing.JFrame;
 import javax.swing.JPanel;
 import javax.swing.SwingUtilities;
-import sun.awt.SunToolkit;
 
 public class EmptyListEventTest {
 
@@ -41,7 +40,6 @@
 
     public static void main(String[] args) throws Exception {
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -53,7 +51,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // press mouse -> ItemEvent
         Point point = getClickPoint();
@@ -61,7 +59,7 @@
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
@@ -71,7 +69,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != list) {
             throw new RuntimeException("Test failed - list isn't focus owner.");
@@ -80,12 +78,12 @@
         // press key ENTER -> ActionEvent
         robot.keyPress(KeyEvent.VK_ENTER);
         robot.keyRelease(KeyEvent.VK_ENTER);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // press key SPACE -> ItemEvent
         robot.keyPress(KeyEvent.VK_SPACE);
         robot.keyRelease(KeyEvent.VK_SPACE);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // mouse double click -> ActionEvent
         robot.setAutoDelay(10);
@@ -93,7 +91,7 @@
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
-        toolkit.realSync();
+        robot.waitForIdle();
     }
 
     private static Point getClickPoint() throws Exception {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/List/KeyEventsTest/KeyEventsTest.html	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+<!--
+ Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please 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>
+<!--  
+  @test
+  @bug 6190768 6190778
+  @summary Tests that triggering events on AWT list by pressing CTRL + HOME, CTRL + END, PG-UP, PG-DOWN similar Motif behavior
+  @author Dmitry.Cherepanov@SUN.COM area=awt.list
+  @library ../../../../lib/testlibrary
+  @build jdk.testlibrary.OSInfo
+  @run applet KeyEventsTest.html
+  -->
+<head>
+<title>  </title>
+</head>
+<body>
+
+<h1>KeyEventsTest<br>Bug ID: 6190768 6190778 </h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="KeyEventsTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/List/KeyEventsTest/KeyEventsTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,370 @@
+/*
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 6190768 6190778
+  @summary Tests that triggering events on AWT list by pressing CTRL + HOME, CTRL + END, PG-UP, PG-DOWN similar Motif behavior
+  @author Dmitry.Cherepanov@SUN.COM area=awt.list
+  @library ../../../../lib/testlibrary
+  @build jdk.testlibrary.OSInfo
+  @run applet KeyEventsTest.html
+*/
+
+/**
+ * KeyEventsTest.html
+ *
+ * summary:
+ */
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.Set;
+import java.lang.reflect.*;
+
+import jdk.testlibrary.OSInfo;
+
+public class KeyEventsTest extends Applet implements ItemListener, FocusListener, KeyListener
+{
+    TestState currentState;
+    final Object LOCK = new Object();
+    final int ACTION_TIMEOUT = 500;
+
+    List single = new List(3, false);
+    List multiple = new List(3, true);
+
+    Panel p1 = new Panel ();
+    Panel p2 = new Panel ();
+
+    public void init()
+    {
+        setLayout (new BorderLayout ());
+
+        single.add("0");
+        single.add("1");
+        single.add("2");
+        single.add("3");
+        single.add("4");
+        single.add("5");
+        single.add("6");
+        single.add("7");
+        single.add("8");
+
+        multiple.add("0");
+        multiple.add("1");
+        multiple.add("2");
+        multiple.add("3");
+        multiple.add("4");
+        multiple.add("5");
+        multiple.add("6");
+        multiple.add("7");
+        multiple.add("8");
+
+        single.addKeyListener(this);
+        single.addItemListener(this);
+        single.addFocusListener(this);
+        p1.add(single);
+        add("North", p1);
+
+        multiple.addKeyListener(this);
+        multiple.addItemListener(this);
+        multiple.addFocusListener(this);
+        p2.add(multiple);
+        add("South", p2);
+
+    }//End  init()
+
+    public void start ()
+    {
+
+        try{
+            setSize (200,200);
+            setVisible(true);
+            validate();
+
+            main(null);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("The test failed.");
+        }
+
+    }// start()
+
+    private void main(String[] args)
+      throws InterruptedException, InvocationTargetException {
+
+        doTest();
+
+        System.out.println("Test passed.");
+    }
+
+    public void itemStateChanged (ItemEvent ie) {
+        System.out.println("itemStateChanged-"+ie);
+        this.currentState.setAction(true);
+    }
+
+    public void focusGained(FocusEvent e){
+
+        synchronized (LOCK) {
+            LOCK.notifyAll();
+        }
+
+    }
+
+    public void focusLost(FocusEvent e){
+    }
+
+    public void keyPressed(KeyEvent e){
+        System.out.println("keyPressed-"+e);
+    }
+
+    public void keyReleased(KeyEvent e){
+        System.out.println("keyReleased-"+e);
+    }
+
+    public void keyTyped(KeyEvent e){
+        System.out.println("keyTyped-"+e);
+    }
+
+    private void test(TestState currentState)
+      throws InterruptedException, InvocationTargetException {
+
+        synchronized (LOCK) {
+
+            this.currentState = currentState;
+            System.out.println(this.currentState);
+
+            List list;
+            if (currentState.getMultiple()){
+                list = multiple;
+            }else{
+                list = single;
+            }
+
+            Robot r;
+            try {
+                r = new Robot();
+            } catch(AWTException e) {
+                throw new RuntimeException(e.getMessage());
+            }
+
+            r.delay(10);
+            Point loc = this.getLocationOnScreen();
+
+            r.mouseMove(loc.x+10, loc.y+10);
+            r.mousePress(InputEvent.BUTTON1_MASK);
+            r.delay(10);
+            r.mouseRelease(InputEvent.BUTTON1_MASK);
+            r.delay(10);
+
+            list.requestFocusInWindow();
+            LOCK.wait(ACTION_TIMEOUT);
+            if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != list){
+                throw new RuntimeException("Test failed - list isn't focus owner.");
+            }
+
+            list.deselect(0);
+            list.deselect(1);
+            list.deselect(2);
+            list.deselect(3);
+            list.deselect(4);
+            list.deselect(5);
+            list.deselect(6);
+            list.deselect(7);
+            list.deselect(8);
+
+            int selectIndex = 0;
+            int visibleIndex = 0;
+
+            if (currentState.getScrollMoved()){
+
+                if (currentState.getKeyID() == KeyEvent.VK_PAGE_UP ||
+                    currentState.getKeyID() == KeyEvent.VK_HOME){
+                    selectIndex = 8;
+                    visibleIndex = 8;
+                }else if (currentState.getKeyID() == KeyEvent.VK_PAGE_DOWN ||
+                    currentState.getKeyID() == KeyEvent.VK_END){
+                    selectIndex = 0;
+                    visibleIndex = 0;
+                }
+
+            }else{
+
+                if (currentState.getKeyID() == KeyEvent.VK_PAGE_UP ||
+                    currentState.getKeyID() == KeyEvent.VK_HOME){
+
+                    if (currentState.getSelectedMoved()){
+                        selectIndex = 1;
+                        visibleIndex = 0;
+                    }else{
+                        selectIndex = 0;
+                        visibleIndex = 0;
+                    }
+
+                }else if (currentState.getKeyID() == KeyEvent.VK_PAGE_DOWN ||
+                    currentState.getKeyID() == KeyEvent.VK_END){
+
+                    if (currentState.getSelectedMoved()){
+                        selectIndex = 7;
+                        visibleIndex = 8;
+                    }else{
+                        selectIndex = 8;
+                        visibleIndex = 8;
+                    }
+
+                }
+
+            }
+
+            list.select(selectIndex);
+            list.makeVisible(visibleIndex);
+
+            r.delay(10);
+
+            if (currentState.getKeyID() == KeyEvent.VK_HOME ||
+                currentState.getKeyID() == KeyEvent.VK_END){
+                r.keyPress(KeyEvent.VK_CONTROL);
+            }
+
+            r.delay(10);
+            r.keyPress(currentState.getKeyID());
+            r.delay(10);
+            r.keyRelease(currentState.getKeyID());
+            r.delay(10);
+
+            if (currentState.getKeyID() == KeyEvent.VK_HOME ||
+                currentState.getKeyID() == KeyEvent.VK_END){
+                r.keyRelease(KeyEvent.VK_CONTROL);
+            }
+
+            r.waitForIdle();
+            r.delay(200);
+
+            if (currentState.getTemplate() != currentState.getAction())
+                throw new RuntimeException("Test failed.");
+
+        }
+
+    }
+
+    private void doTest()
+      throws InterruptedException, InvocationTargetException {
+
+        boolean isWin = false;
+        if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS) {
+            isWin = true;
+        }else if(OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
+            System.out.println("Not for OS X");
+            return;
+        }
+
+        System.out.println("multiple? selectedMoved? ?scrollMoved keyID? template? action?");
+        test(new TestState(false, false, false, KeyEvent.VK_PAGE_UP, isWin?false:false));
+        // SelectedMoved (false) != ScrollMoved (true) for single list not emulated
+        test(new TestState(false, true, false, KeyEvent.VK_PAGE_UP, isWin?true:false));
+        test(new TestState(false, true, true, KeyEvent.VK_PAGE_UP, isWin?true:true));
+        test(new TestState(true, false, false, KeyEvent.VK_PAGE_UP, isWin?true:false));
+        test(new TestState(true, false, true, KeyEvent.VK_PAGE_UP, isWin?true:false));
+        test(new TestState(true, true, false, KeyEvent.VK_PAGE_UP, isWin?true:false));
+        test(new TestState(true, true, true, KeyEvent.VK_PAGE_UP, isWin?true:false));
+
+        test(new TestState(false, false, false, KeyEvent.VK_PAGE_DOWN, isWin?false:false));
+        test(new TestState(false, true, false, KeyEvent.VK_PAGE_DOWN, isWin?true:false));
+        test(new TestState(false, true, true, KeyEvent.VK_PAGE_DOWN, isWin?true:true));
+        test(new TestState(true, false, false, KeyEvent.VK_PAGE_DOWN, isWin?true:false));
+        test(new TestState(true, false, true, KeyEvent.VK_PAGE_DOWN, isWin?true:false));
+        test(new TestState(true, true, false, KeyEvent.VK_PAGE_DOWN, isWin?true:false));
+        test(new TestState(true, true, true, KeyEvent.VK_PAGE_DOWN, isWin?true:false));
+
+        test(new TestState(false, false, false, KeyEvent.VK_HOME, isWin?false:true));
+        test(new TestState(false, true, false, KeyEvent.VK_HOME, isWin?true:true));
+        test(new TestState(false, true, true, KeyEvent.VK_HOME, isWin?true:true));
+        test(new TestState(true, false, false, KeyEvent.VK_HOME, isWin?true:false));
+        test(new TestState(true, false, true, KeyEvent.VK_HOME, isWin?true:false));
+        test(new TestState(true, true, false, KeyEvent.VK_HOME, isWin?true:false));
+        test(new TestState(true, true, true, KeyEvent.VK_HOME, isWin?true:false));
+
+        test(new TestState(false, false, false, KeyEvent.VK_END, isWin?false:true));
+        test(new TestState(false, true, false, KeyEvent.VK_END, isWin?true:true));
+        test(new TestState(false, true, true, KeyEvent.VK_END, isWin?true:true));
+        test(new TestState(true, false, false, KeyEvent.VK_END, isWin?true:false));
+        test(new TestState(true, false, true, KeyEvent.VK_END, isWin?true:false));
+        test(new TestState(true, true, false, KeyEvent.VK_END, isWin?true:false));
+        test(new TestState(true, true, true, KeyEvent.VK_END, isWin?true:false));
+
+    }
+}// class KeyEventsTest
+
+class TestState{
+
+    private boolean multiple;
+    // after key pressing selected item moved
+    private final boolean selectedMoved;
+    // after key pressing scroll moved
+    private final boolean scrollMoved;
+    private final int keyID;
+    private final boolean template;
+    private boolean action;
+
+    public TestState(boolean multiple, boolean selectedMoved, boolean scrollMoved, int keyID, boolean template){
+        this.multiple = multiple;
+        this.selectedMoved = selectedMoved;
+        this.scrollMoved = scrollMoved;
+        this.keyID = keyID;
+        this.template = template;
+        this.action = false;
+    }
+
+    public boolean getMultiple(){
+        return multiple;
+    }
+    public boolean getSelectedMoved(){
+        return selectedMoved;
+    }
+
+    public boolean getScrollMoved(){
+        return scrollMoved;
+    }
+
+    public int getKeyID(){
+        return keyID;
+    }
+
+    public boolean getTemplate(){
+        return template;
+    }
+
+    public boolean getAction(){
+        return action;
+    }
+
+    public void setAction(boolean action){
+        this.action = action;
+    }
+
+    public String toString(){
+        return multiple + "," + selectedMoved + "," + scrollMoved + "," + keyID + "," + template + "," + action;
+    }
+}// TestState
--- a/jdk/test/java/awt/List/NofocusListDblClickTest/NofocusListDblClickTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/List/NofocusListDblClickTest/NofocusListDblClickTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -32,14 +32,12 @@
 import java.awt.event.*;
 import java.util.concurrent.atomic.AtomicInteger;
 import javax.swing.SwingUtilities;
-import sun.awt.SunToolkit;
 
 public class NofocusListDblClickTest {
     static final int EXPECTED_ACTION_COUNT = 2;
     static Robot robot;
     static final AtomicInteger actionPerformed = new AtomicInteger(0);
     static List lst;
-    private static final SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
 
     public static void main(String[] args) throws Exception {
         SwingUtilities.invokeAndWait(new Runnable() {
@@ -47,16 +45,16 @@
                 createAndShowGUI();
             }
         });
-        toolkit.realSync();
+        robot = new Robot();
+        robot.setAutoDelay(50);
+        robot.waitForIdle();
         Thread.sleep(1000);
 
-        robot = new Robot();
-        robot.setAutoDelay(50);
         // ACTION_PERFORMED event happens only on even clicks
         clickTwiceOn(lst);
         Thread.sleep(500);
         clickTwiceOn(lst);
-        toolkit.realSync();
+        robot.waitForIdle();
         Thread.sleep(1000);
 
         synchronized (actionPerformed) {
--- a/jdk/test/java/awt/List/ScrollOutside/ScrollOut.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/List/ScrollOutside/ScrollOut.java	Fri Jan 09 13:28:02 2015 -0500
@@ -33,7 +33,6 @@
 
 import java.awt.*;
 import java.awt.event.*;
-import sun.awt.SunToolkit;
 import test.java.awt.regtesthelpers.Util;
 
 public class ScrollOut
@@ -54,13 +53,13 @@
         frame.setLocationRelativeTo(null);
         frame.setVisible(true);
 
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
 
         try{
             robot = new Robot();
         }catch(AWTException e){
             throw new RuntimeException(e);
         }
+        robot.waitForIdle();
 
         //Drag from center to the outside on left
         Point from = new Point(list.getLocationOnScreen().x + list.getWidth()/2,
@@ -68,16 +67,16 @@
         Point to = new Point(list.getLocationOnScreen().x - 30,
                              from.y);
 
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
         Util.drag(robot, from, to, InputEvent.BUTTON1_MASK);
 
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         //Drag from center to the outside on up
         to = new Point(from.x,
                        list.getLocationOnScreen().y - 50);
 
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
         Util.drag(robot, from, to, InputEvent.BUTTON1_MASK);
 
     }//End  init()
--- a/jdk/test/java/awt/List/SetBackgroundTest/SetBackgroundTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/List/SetBackgroundTest/SetBackgroundTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -26,6 +26,8 @@
   @bug 6246467
   @summary List does not honor user specified background, foreground colors on XToolkit
   @author Dmitry Cherepanov  area=awt.list
+  @library ../../../../lib/testlibrary
+  @build ExtendedRobot
   @run main SetBackgroundTest
 */
 
@@ -37,29 +39,12 @@
 
 import java.awt.*;
 import java.awt.event.*;
-import sun.awt.SunToolkit;
 
 public class SetBackgroundTest
 {
 
-    private static void init()
-    {
-        String[] instructions =
-        {
-            "This is an AUTOMATIC test, simply wait until it is done.",
-            "The result (passed or failed) will be shown in the",
-            "message window below."
-        };
-        Sysout.createDialog( );
-        Sysout.printInstructions( instructions );
-
-        test();
-
-        SetBackgroundTest.pass();
-    }//End  init()
-
     private static boolean isXAWT = (Toolkit.getDefaultToolkit().getClass().getName().equals("sun.awt.X11.XToolkit"));
-    private static Robot robot = null;
+    private static ExtendedRobot robot = null;
     private static Frame frame = null;
 
     private static final Color color = Color.red;
@@ -71,24 +56,24 @@
         canvas.setBackground(color);
         frame.add(canvas, BorderLayout.CENTER);
         frame.validate();
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle(500);
 
         Point loc = canvas.getLocationOnScreen();
         Color robotColor = robot.getPixelColor(loc.x + canvas.getWidth()/2, loc.y + canvas.getHeight()/2);
         roughColor = robotColor;
 
-        Sysout.println(" --- init rough color ... ");
-        Sysout.println("     color = "+color);
-        Sysout.println("     roughColor = "+roughColor);
+        System.out.println(" --- init rough color ... ");
+        System.out.println("     color = "+color);
+        System.out.println("     roughColor = "+roughColor);
 
         frame.remove(canvas);
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle(500);
     }
 
 
     private static void test() {
         if (!isXAWT){
-            Sysout.println(" this is XAWT-only test. ");
+            System.out.println(" this is XAWT-only test. ");
             return;
         }
 
@@ -97,14 +82,15 @@
         frame.setLayout(new BorderLayout());
         frame.setVisible(true);
 
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
 
         try{
-            robot = new Robot();
+            robot = new ExtendedRobot();
         }catch(AWTException e){
             throw new RuntimeException(e.getMessage());
         }
 
+        robot.waitForIdle(500);
+
         initRoughColor();
         Component[] components = new Component[] {
             new Button(), new Checkbox(), new Label(), new List(3, false),
@@ -115,6 +101,7 @@
             testComponent(new Panel(), component, color);
         }
 
+        robot.waitForIdle(1500);
         frame.dispose();
     }
 
@@ -127,327 +114,31 @@
         frame.add(container, BorderLayout.CENTER);
         frame.add("Center", container);
         frame.validate();
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle(500);
 
         Point loc = component.getLocationOnScreen();
         Color robotColor = robot.getPixelColor(loc.x + component.getWidth()/2, loc.y + component.getHeight()/2);
 
-        Sysout.println(" --- test ... ");
-        Sysout.println("     container = "+container);
-        Sysout.println("     component = "+component);
-        Sysout.println("     color = "+color);
-        Sysout.println("     roughColor = "+roughColor);
-        Sysout.println("     robotColor = "+robotColor);
+        System.out.println(" --- test ... ");
+        System.out.println("     container = "+container);
+        System.out.println("     component = "+component);
+        System.out.println("     color = "+color);
+        System.out.println("     roughColor = "+roughColor);
+        System.out.println("     robotColor = "+robotColor);
 
         if(robotColor.getRGB() != roughColor.getRGB()){
             throw new RuntimeException(" the case failed. ");
         } else {
-            Sysout.println(" the case passed. ");
+            System.out.println(" the case passed. ");
         }
 
         container.remove(component);
         frame.remove(container);
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle(500);
     }
-
-
-    /*****************************************************
-     * Standard Test Machinery Section
-     * DO NOT modify anything in this section -- it's a
-     * standard chunk of code which has all of the
-     * synchronisation necessary for the test harness.
-     * By keeping it the same in all tests, it is easier
-     * to read and understand someone else's test, as
-     * well as insuring that all tests behave correctly
-     * with the test harness.
-     * There is a section following this for test-
-     * classes
-     ******************************************************/
-    private static boolean theTestPassed = false;
-    private static boolean testGeneratedInterrupt = false;
-    private static String failureMessage = "";
-
-    private static Thread mainThread = null;
-
-    private static int sleepTime = 300000;
-
-    // Not sure about what happens if multiple of this test are
-    //  instantiated in the same VM.  Being static (and using
-    //  static vars), it aint gonna work.  Not worrying about
-    //  it for now.
-    public static void main( String args[] ) throws InterruptedException
+    public static void main( String args[] ) throws Exception
     {
-        mainThread = Thread.currentThread();
-        try
-        {
-            init();
-        }
-        catch( TestPassedException e )
-        {
-            //The test passed, so just return from main and harness will
-            // interepret this return as a pass
-            return;
-        }
-        //At this point, neither test pass nor test fail has been
-        // called -- either would have thrown an exception and ended the
-        // test, so we know we have multiple threads.
-
-        //Test involves other threads, so sleep and wait for them to
-        // called pass() or fail()
-        try
-        {
-            Thread.sleep( sleepTime );
-            //Timed out, so fail the test
-            throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
-        }
-        catch (InterruptedException e)
-        {
-            //The test harness may have interrupted the test.  If so, rethrow the exception
-            // so that the harness gets it and deals with it.
-            if( ! testGeneratedInterrupt ) throw e;
-
-            //reset flag in case hit this code more than once for some reason (just safety)
-            testGeneratedInterrupt = false;
-
-            if ( theTestPassed == false )
-            {
-                throw new RuntimeException( failureMessage );
-            }
-        }
-
-    }//main
-
-    public static synchronized void setTimeoutTo( int seconds )
-    {
-        sleepTime = seconds * 1000;
+        test();
     }
-
-    public static synchronized void pass()
-    {
-        Sysout.println( "The test passed." );
-        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
-        //first check if this is executing in main thread
-        if ( mainThread == Thread.currentThread() )
-        {
-            //Still in the main thread, so set the flag just for kicks,
-            // and throw a test passed exception which will be caught
-            // and end the test.
-            theTestPassed = true;
-            throw new TestPassedException();
-        }
-        theTestPassed = true;
-        testGeneratedInterrupt = true;
-        mainThread.interrupt();
-    }//pass()
-
-    public static synchronized void fail()
-    {
-        //test writer didn't specify why test failed, so give generic
-        fail( "it just plain failed! :-)" );
-    }
-
-    public static synchronized void fail( String whyFailed )
-    {
-        Sysout.println( "The test failed: " + whyFailed );
-        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
-        //check if this called from main thread
-        if ( mainThread == Thread.currentThread() )
-        {
-            //If main thread, fail now 'cause not sleeping
-            throw new RuntimeException( whyFailed );
-        }
-        theTestPassed = false;
-        testGeneratedInterrupt = true;
-        failureMessage = whyFailed;
-        mainThread.interrupt();
-    }//fail()
-
-}// class AutomaticMainTest
-
-//This exception is used to exit from any level of call nesting
-// when it's determined that the test has passed, and immediately
-// end the test.
-class TestPassedException extends RuntimeException
-{
 }
 
-//*********** End Standard Test Machinery Section **********
-
-
-//************ Begin classes defined for the test ****************
-
-// if want to make listeners, here is the recommended place for them, then instantiate
-//  them in init()
-
-/* Example of a class which may be written as part of a test
-class NewClass implements anInterface
- {
-   static int newVar = 0;
-
-   public void eventDispatched(AWTEvent e)
-    {
-      //Counting events to see if we get enough
-      eventCount++;
-
-      if( eventCount == 20 )
-       {
-         //got enough events, so pass
-
-         AutomaticMainTest.pass();
-       }
-      else if( tries == 20 )
-       {
-         //tried too many times without getting enough events so fail
-
-         AutomaticMainTest.fail();
-       }
-
-    }// eventDispatched()
-
- }// NewClass class
-
-*/
-
-
-//************** End classes defined for the test *******************
-
-
-
-
-/****************************************************
- Standard Test Machinery
- DO NOT modify anything below -- it's a standard
-  chunk of code whose purpose is to make user
-  interaction uniform, and thereby make it simpler
-  to read and understand someone else's test.
- ****************************************************/
-
-/**
- This is part of the standard test machinery.
- It creates a dialog (with the instructions), and is the interface
-  for sending text messages to the user.
- To print the instructions, send an array of strings to Sysout.createDialog
-  WithInstructions method.  Put one line of instructions per array entry.
- To display a message for the tester to see, simply call Sysout.println
-  with the string to be displayed.
- This mimics System.out.println but works within the test harness as well
-  as standalone.
- */
-
-class Sysout
-{
-    private static TestDialog dialog;
-
-    public static void createDialogWithInstructions( String[] instructions )
-    {
-        dialog = new TestDialog( new Frame(), "Instructions" );
-        dialog.printInstructions( instructions );
-        dialog.setVisible(true);
-        println( "Any messages for the tester will display here." );
-    }
-
-    public static void createDialog( )
-    {
-        dialog = new TestDialog( new Frame(), "Instructions" );
-        String[] defInstr = { "Instructions will appear here. ", "" } ;
-        dialog.printInstructions( defInstr );
-        dialog.setVisible(true);
-        println( "Any messages for the tester will display here." );
-    }
-
-
-    public static void printInstructions( String[] instructions )
-    {
-        dialog.printInstructions( instructions );
-    }
-
-
-    public static void println( String messageIn )
-    {
-        dialog.displayMessage( messageIn );
-        System.out.println(messageIn);
-    }
-
-}// Sysout  class
-
-/**
-  This is part of the standard test machinery.  It provides a place for the
-   test instructions to be displayed, and a place for interactive messages
-   to the user to be displayed.
-  To have the test instructions displayed, see Sysout.
-  To have a message to the user be displayed, see Sysout.
-  Do not call anything in this dialog directly.
-  */
-class TestDialog extends Dialog
-{
-
-    TextArea instructionsText;
-    TextArea messageText;
-    int maxStringLength = 80;
-
-    //DO NOT call this directly, go through Sysout
-    public TestDialog( Frame frame, String name )
-    {
-        super( frame, name );
-        int scrollBoth = TextArea.SCROLLBARS_BOTH;
-        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
-        add( "North", instructionsText );
-
-        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
-        add("Center", messageText);
-
-        pack();
-
-        setVisible(true);
-    }// TestDialog()
-
-    //DO NOT call this directly, go through Sysout
-    public void printInstructions( String[] instructions )
-    {
-        //Clear out any current instructions
-        instructionsText.setText( "" );
-
-        //Go down array of instruction strings
-
-        String printStr, remainingStr;
-        for( int i=0; i < instructions.length; i++ )
-        {
-            //chop up each into pieces maxSringLength long
-            remainingStr = instructions[ i ];
-            while( remainingStr.length() > 0 )
-            {
-                //if longer than max then chop off first max chars to print
-                if( remainingStr.length() >= maxStringLength )
-                {
-                    //Try to chop on a word boundary
-                    int posOfSpace = remainingStr.
-                        lastIndexOf( ' ', maxStringLength - 1 );
-
-                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
-
-                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
-                    remainingStr = remainingStr.substring( posOfSpace + 1 );
-                }
-                //else just print
-                else
-                {
-                    printStr = remainingStr;
-                    remainingStr = "";
-                }
-
-                instructionsText.append( printStr + "\n" );
-
-            }// while
-
-        }// for
-
-    }//printInstructions()
-
-    //DO NOT call this directly, go through Sysout
-    public void displayMessage( String messageIn )
-    {
-        messageText.append( messageIn + "\n" );
-        System.out.println(messageIn);
-    }
-
-}// TestDialog  class
--- a/jdk/test/java/awt/MenuBar/8007006/bug8007006.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/MenuBar/8007006/bug8007006.java	Fri Jan 09 13:28:02 2015 -0500
@@ -26,35 +26,38 @@
  * @bug 8007006
  * @summary [macosx] Closing subwindow loses main window menus.
  * @author Leonid Romanov
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot jdk.testlibrary.OSInfo
  * @run main bug8007006
  */
 
-import sun.awt.SunToolkit;
 import java.awt.*;
 import java.awt.event.*;
 
+import jdk.testlibrary.OSInfo;
+
 public class bug8007006 {
     private static Frame frame1;
     private static Frame frame2;
 
     public static void main(String[] args) throws Exception {
-        if (sun.awt.OSInfo.getOSType() != sun.awt.OSInfo.OSType.MACOSX) {
+        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
             System.out.println("This test is for MacOS only. Automatically passed on other platforms.");
             return;
         }
 
         System.setProperty("apple.laf.useScreenMenuBar", "true");
 
+        ExtendedRobot robot = new ExtendedRobot();
+        robot.setAutoDelay(50);
+
         createAndShowGUI();
-        sleep(1500);
+        robot.waitForIdle(1500);
 
         frame2.dispose();
-        sleep(1500);
 
-        SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit();
+        robot.waitForIdle(1500);
 
-        Robot robot = new Robot();
-        robot.setAutoDelay(50);
 
         // open "Apple" menu (the leftmost one)
         robot.keyPress(KeyEvent.VK_META);
@@ -74,7 +77,7 @@
         robot.keyPress(KeyEvent.VK_ENTER);
         robot.keyRelease(KeyEvent.VK_ENTER);
 
-        sleep(0);
+        robot.waitForIdle();
 
         MenuBar mbar = frame1.getMenuBar();
         Menu menu = mbar.getMenu(0);
@@ -112,13 +115,4 @@
         return mbar;
     }
 
-    private static void sleep(int ms) {
-        SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit();
-        tk.realSync();
-
-        try {
-            Thread.sleep(ms);
-        } catch (Exception ignore) {
-        }
-    }
 }
--- a/jdk/test/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java	Fri Jan 09 13:28:02 2015 -0500
@@ -21,8 +21,6 @@
  * questions.
  */
 
-import sun.awt.SunToolkit;
-
 import java.awt.Button;
 import java.awt.CardLayout;
 import java.awt.Font;
@@ -31,16 +29,19 @@
 import java.awt.MenuBar;
 import java.awt.Point;
 import java.awt.Robot;
-import java.awt.Toolkit;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.InputEvent;
 
+import jdk.testlibrary.OSInfo;
+
 /**
  * @test
  * @bug 6263470
  * @summary Tries to change font of MenuBar. Test passes if the font has changed
  * fails otherwise.
+ * @library ../../../../lib/testlibrary
+ * @build jdk.testlibrary.OSInfo
  * @author Vyacheslav.Baranov: area=menu
  * @run main MenuBarSetFont
  */
@@ -66,7 +67,7 @@
 
     public static void main(final String[] args) throws Exception {
 
-        if (sun.awt.OSInfo.getOSType() == sun.awt.OSInfo.OSType.MACOSX) {
+        if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
             System.err.println("This test is not for OS X. Menu.setFont() is not supported on OS X.");
             return;
         }
@@ -75,13 +76,16 @@
         frame.setMenuBar(mb);
         mb.setFont(new Font("Helvetica", Font.ITALIC, 5));
 
+        final Robot r = new Robot();
+        r.setAutoDelay(200);
+
         final Button button = new Button("Click Me");
         button.addActionListener(new Listener());
         frame.setLayout(new CardLayout());
         frame.add(button, "First");
         frame.setSize(400, 400);
         frame.setVisible(true);
-        sleep();
+        sleep(r);
 
         final int fInsets = frame.getInsets().top;  //Frame insets without menu.
         addMenu();
@@ -96,24 +100,23 @@
 
         mb.remove(0);
         frame.validate();
-        sleep();
+        sleep(r);
 
         // Test execution.
         // On XToolkit, menubar font should be changed to 60.
         // On WToolkit, menubar font should be changed to default and menubar
         // should be splitted in 2 rows.
         mb.setFont(new Font("Helvetica", Font.ITALIC, 60));
-        sleep();
 
-        final Robot r = new Robot();
-        r.setAutoDelay(200);
+        sleep(r);
+
         final Point pt = frame.getLocation();
         r.mouseMove(pt.x + frame.getWidth() / 2,
                     pt.y + fMenuInsets + menuBarHeight / 2);
         r.mousePress(InputEvent.BUTTON1_MASK);
         r.mouseRelease(InputEvent.BUTTON1_MASK);
 
-        sleep();
+        sleep(r);
         frame.dispose();
 
         if (clicked) {
@@ -121,8 +124,8 @@
         }
     }
 
-    private static void sleep() {
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+    private static void sleep(Robot robot) {
+        robot.waitForIdle();
         try {
             Thread.sleep(500L);
         } catch (InterruptedException ignored) {
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java	Fri Jan 09 13:28:02 2015 -0500
@@ -29,7 +29,7 @@
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import javax.swing.*;
-import sun.awt.*;
+import sun.awt.EmbeddedFrame;
 import java.io.*;
 import test.java.awt.regtesthelpers.Util;
 
@@ -141,7 +141,6 @@
     public void getVerifyColor() {
         try {
             final int size = 200;
-            final SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
             final Point[] p = new Point[1];
             SwingUtilities.invokeAndWait(new Runnable() {
                 public void run(){
@@ -155,7 +154,7 @@
                 }
             });
             Robot robot = new Robot();
-            toolkit.realSync();
+            robot.waitForIdle();
             Thread.sleep(ROBOT_DELAY);
             AWT_VERIFY_COLOR = robot.getPixelColor(p[0].x+size/2, p[0].y+size/2);
             System.out.println("Color will be compared with " + AWT_VERIFY_COLOR + " instead of " + AWT_BACKGROUND_COLOR);
@@ -434,6 +433,11 @@
     protected Component currentAwtControl;
 
     private void testComponent(Component component) throws InterruptedException, InvocationTargetException {
+        Robot robot = null;
+        try {
+            robot = new Robot();
+        }catch(Exception ignorex) {
+        }
         currentAwtControl = component;
         System.out.println("Testing " + currentAwtControl.getClass().getSimpleName());
         SwingUtilities.invokeAndWait(new Runnable() {
@@ -444,7 +448,7 @@
         if (component != null) {
             Util.waitTillShown(component);
         }
-        Util.waitForIdle(null);
+        Util.waitForIdle(robot);
         try {
             Thread.sleep(500); // wait for graphic effects on systems like Win7
         } catch (InterruptedException ex) {
@@ -461,6 +465,11 @@
     }
 
     private void testEmbeddedFrame() throws InvocationTargetException, InterruptedException {
+        Robot robot = null;
+        try {
+            robot = new Robot();
+        }catch(Exception ignorex) {
+        }
         System.out.println("Testing EmbeddedFrame");
         currentAwtControl = null;
         SwingUtilities.invokeAndWait(new Runnable() {
@@ -468,7 +477,7 @@
                 prepareControls();
             }
         });
-        Util.waitForIdle(null);
+        Util.waitForIdle(robot);
         try {
             Thread.sleep(500); // wait for graphic effects on systems like Win7
         } catch (InterruptedException ex) {
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/SimpleOverlappingTestBase.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/SimpleOverlappingTestBase.java	Fri Jan 09 13:28:02 2015 -0500
@@ -135,7 +135,7 @@
 
         // get coord
         Point lLoc = !debug ? testedComponent.getLocationOnScreen() : new Point(70, 30);
-        Util.waitForIdle(null);
+        Util.waitForIdle(robot);
         /* this is a workaround for certain jtreg(?) focus issue:
            tests fail starting after failing mixing tests but always pass alone.
          */
@@ -152,7 +152,7 @@
         }
 
         clickAndBlink(robot, lLoc);
-        Util.waitForIdle(null);
+        Util.waitForIdle(robot);
 
         return wasLWClicked;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal1Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks an application modal Dialog
+ *          created with a null Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogAppModal1Test
+ */
+
+public class FileDialogAppModal1Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.APPLICATION_MODAL,
+            FileDialogFWDTest.DialogOwner.NULL_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal2Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks an application modal Dialog
+ *          created with a null Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogAppModal2Test
+ */
+
+public class FileDialogAppModal2Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.APPLICATION_MODAL,
+            FileDialogFWDTest.DialogOwner.NULL_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal3Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks an application modal Dialog
+ *          created with a hidden Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogAppModal3Test
+ */
+
+public class FileDialogAppModal3Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.APPLICATION_MODAL,
+            FileDialogFWDTest.DialogOwner.HIDDEN_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal4Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks an application modal Dialog
+ *          created with a hidden Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogAppModal4Test
+ */
+
+public class FileDialogAppModal4Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.APPLICATION_MODAL,
+            FileDialogFWDTest.DialogOwner.HIDDEN_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal5Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks an application modal Dialog
+ *          created with a visible Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogAppModal5Test
+ */
+
+public class FileDialogAppModal5Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.APPLICATION_MODAL,
+            FileDialogFWDTest.DialogOwner.FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal6Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks an application modal Dialog
+ *          created with a visible Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogAppModal6Test
+ */
+
+public class FileDialogAppModal6Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogDWDTest(Dialog.ModalityType.APPLICATION_MODAL)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDWDTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.*;
+
+
+// DWD: Dialog, Window, Dialog
+
+public class FileDialogDWDTest {
+
+    private volatile FileDialog fileDialog;
+    private volatile ParentDialog parent;
+    private volatile CustomDialog dialog;
+    private volatile TestWindow window;
+
+    private static final int delay = 500;
+    private final ExtendedRobot robot;
+
+    boolean setModal;
+
+    Dialog.ModalityType modalityType;
+
+    private FileDialogDWDTest(Dialog.ModalityType modType,
+                              boolean             modal) throws Exception {
+        modalityType = modType;
+        setModal = modal;
+
+        robot = new ExtendedRobot();
+        EventQueue.invokeLater(this::createGUI);
+    }
+
+    public FileDialogDWDTest(Dialog.ModalityType modalityType) throws Exception {
+        this(modalityType, false);
+    }
+
+    public FileDialogDWDTest() throws Exception {
+        this(null, true);
+    }
+
+    private void createGUI() {
+
+        parent = new ParentDialog();
+        dialog = new CustomDialog(parent);
+
+        if (setModal) {
+            dialog.setModal(true);
+            modalityType = dialog.getModalityType();
+        } else if (modalityType != null) {
+            dialog.setModalityType(modalityType);
+        }
+
+        window = new CustomWindow(parent);
+
+        int x = Toolkit.getDefaultToolkit().getScreenSize().width -
+            parent.getWidth() - 50;
+        int y = 50;
+        parent.setLocation(x, y);
+        y += (parent.getHeight() + 50);
+        window.setLocation(x, y);
+        y += (window.getHeight() + 50);
+        dialog.setLocation(x, y);
+
+        parent.setVisible(true);
+    }
+
+    private void openAll() throws Exception {
+        robot.waitForIdle(delay);
+        parent.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+        window.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+        dialog.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+    }
+
+    private void checkBlockedWindows() throws Exception {
+
+        String msg = "FileDialog should block this ";
+        parent.checkBlockedDialog(robot, msg + "Dialog.");
+        robot.waitForIdle(delay);
+        window.checkBlockedWindow(robot, msg + "Window.");
+        robot.waitForIdle(delay);
+        dialog.checkBlockedDialog(robot, msg + "Dialog.");
+        robot.waitForIdle(delay);
+    }
+
+    private void checkUnblockedWindows() throws Exception {
+
+        String msg = "Blocking dialogs were closed.";
+        parent.checkUnblockedDialog(robot, msg + "Frame.");
+        robot.waitForIdle(delay);
+        window.checkUnblockedWindow(robot, msg + "Window.");
+        robot.waitForIdle(delay);
+    }
+
+
+    private void modalTest(String type) throws Exception {
+
+        checkBlockedWindows();
+
+        EventQueue.invokeAndWait(() -> { fileDialog.dispose(); });
+        robot.waitForIdle(delay);
+
+        String msg = "FileDialog was closed, " +
+            "but the " + type + " modal dialog should block this ";
+
+        parent.checkBlockedDialog(robot, msg + "Dialog.");
+        robot.waitForIdle(delay);
+
+        window.checkBlockedWindow(robot, msg + "Window.");
+        robot.waitForIdle(delay);
+
+        dialog.checkUnblockedDialog(robot, "FileDialog was closed.");
+        robot.waitForIdle(delay);
+
+        dialog.clickCloseButton(robot);
+        robot.waitForIdle(delay);
+
+        checkUnblockedWindows();
+    }
+
+    private void nonModalTest() throws Exception {
+
+        checkBlockedWindows();
+
+        EventQueue.invokeAndWait(() -> { fileDialog.dispose(); });
+        robot.waitForIdle(delay);
+
+        dialog.checkUnblockedDialog(robot, "FileDialog was closed.");
+        robot.waitForIdle(delay);
+
+        checkUnblockedWindows();
+    }
+
+    public void doTest() throws Exception {
+
+        try {
+
+            openAll();
+
+            if (modalityType == null) {
+                nonModalTest();
+                return;
+            }
+
+            switch (modalityType) {
+                case APPLICATION_MODAL:
+                    modalTest("application");
+                    break;
+                case DOCUMENT_MODAL:
+                    modalTest("document");
+                    break;
+                case TOOLKIT_MODAL:
+                    modalTest("toolkit");
+                    break;
+                case MODELESS:
+                    nonModalTest();
+                    break;
+            }
+
+        } finally {
+            EventQueue.invokeAndWait(this::closeAll);
+        }
+    }
+
+    private void closeAll() {
+        if (parent != null) { parent.dispose(); }
+        if (dialog != null) { dialog.dispose(); }
+        if (window != null) { window.dispose(); }
+        if (fileDialog != null) { fileDialog.dispose(); }
+
+    }
+
+    class ParentDialog extends TestDialog {
+
+        public ParentDialog() { super((Frame) null); }
+
+        @Override
+        public void doOpenAction() {
+            if (window != null) { window.setVisible(true); }
+        }
+
+    }
+
+
+    class CustomDialog extends TestDialog {
+
+        public CustomDialog(Dialog d) { super(d); }
+
+        @Override
+        public void doOpenAction() {
+            fileDialog = new FileDialog((Frame) null);
+            fileDialog.setLocation(50, 50);
+            fileDialog.setVisible(true);
+        }
+
+        @Override
+        public void doCloseAction() {
+            this.dispose();
+        }
+    }
+
+    class CustomWindow extends TestWindow {
+
+        public CustomWindow(Dialog d) { super(d); }
+
+        @Override
+        public void doOpenAction() {
+            if (dialog != null) { dialog.setVisible(true); }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal1Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a document modal Dialog
+ *          created with a null Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogDocModal1Test
+ */
+
+public class FileDialogDocModal1Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.DOCUMENT_MODAL,
+            FileDialogFWDTest.DialogOwner.NULL_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal2Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a document modal Dialog
+ *          created with a null Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogDocModal2Test
+ */
+
+public class FileDialogDocModal2Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.DOCUMENT_MODAL,
+            FileDialogFWDTest.DialogOwner.NULL_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal3Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a document modal Dialog
+ *          created with a hidden Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogDocModal3Test
+ */
+
+public class FileDialogDocModal3Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.DOCUMENT_MODAL,
+            FileDialogFWDTest.DialogOwner.HIDDEN_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal4Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a document modal Dialog
+ *          created with a hidden Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogDocModal4Test
+ */
+
+public class FileDialogDocModal4Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.DOCUMENT_MODAL,
+            FileDialogFWDTest.DialogOwner.HIDDEN_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal5Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a document modal Dialog
+ *          created with a visible Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogDocModal5Test
+ */
+
+public class FileDialogDocModal5Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.DOCUMENT_MODAL,
+            FileDialogFWDTest.DialogOwner.FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal6Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a document modal Dialog
+ *          created with a visible Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogDocModal6Test
+ */
+
+public class FileDialogDocModal6Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogDWDTest(Dialog.ModalityType.DOCUMENT_MODAL)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal7Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ * @summary Check whether a FileDialog set to document modality behaves as expected.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogDocModal7Test
+ */
+
+public class FileDialogDocModal7Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogModalityTest(Dialog.ModalityType.DOCUMENT_MODAL)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogFWDTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+
+
+// FWD: Frame, Window, Dialog
+
+public class FileDialogFWDTest {
+
+    private volatile FileDialog fileDialog;
+    private volatile CustomDialog dialog;
+    private volatile TestFrame frame;
+    private volatile TestWindow window;
+
+    private static final int delay = 500;
+    private final ExtendedRobot robot;
+
+    private volatile Dialog hiddenDialog;
+    private volatile Frame  hiddenFrame;
+
+    public enum DialogOwner {
+        HIDDEN_DIALOG, NULL_DIALOG, HIDDEN_FRAME, NULL_FRAME, FRAME};
+
+    private DialogOwner owner;
+    boolean setModal;
+
+    Dialog.ModalityType modalityType;
+
+    private FileDialogFWDTest(Dialog.ModalityType modType,
+                              boolean             modal,
+                              DialogOwner         o) throws Exception {
+        modalityType = modType;
+        setModal = modal;
+        owner = o;
+
+        robot = new ExtendedRobot();
+        EventQueue.invokeLater(this::createGUI);
+    }
+
+    public FileDialogFWDTest(Dialog.ModalityType modalityType,
+                             DialogOwner         o) throws Exception {
+        this(modalityType, false, o);
+    }
+
+    public FileDialogFWDTest(DialogOwner o) throws Exception {
+        this(null, true, o);
+    }
+
+    private void createGUI() {
+
+        frame = new CustomFrame();
+
+        switch (owner) {
+            case HIDDEN_DIALOG:
+                hiddenDialog = new Dialog((Frame) null);
+                dialog = new CustomDialog(hiddenDialog);
+                break;
+            case NULL_DIALOG:
+                dialog = new CustomDialog((Dialog) null);
+                break;
+            case HIDDEN_FRAME:
+                hiddenFrame = new Frame();
+                dialog = new CustomDialog(hiddenFrame);
+                break;
+            case NULL_FRAME:
+                dialog = new CustomDialog((Frame) null);
+                break;
+            case FRAME:
+                dialog = new CustomDialog(frame);
+                break;
+        }
+
+        if (setModal) {
+            dialog.setModal(true);
+            modalityType = dialog.getModalityType();
+        } else if (modalityType != null) {
+            dialog.setModalityType(modalityType);
+        }
+
+        window = new CustomWindow(frame);
+
+        int x = Toolkit.getDefaultToolkit().getScreenSize().width -
+            frame.getWidth() - 50;
+        int y = 50;
+        frame.setLocation(x, y);
+        y += (frame.getHeight() + 50);
+        window.setLocation(x, y);
+        y += (window.getHeight() + 50);
+        dialog.setLocation(x, y);
+
+        frame.setVisible(true);
+    }
+
+    private void openAll() throws Exception {
+        robot.waitForIdle(delay);
+        frame.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+        window.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+        dialog.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+    }
+
+    private void checkBlockedWindows() throws Exception {
+
+        String msg = "FileDialog should block this ";
+        frame.checkBlockedFrame(robot, msg + "Frame.");
+        robot.waitForIdle(delay);
+        window.checkBlockedWindow(robot, msg + "Window.");
+        robot.waitForIdle(delay);
+        dialog.checkBlockedDialog(robot, msg + "Dialog.");
+        robot.waitForIdle(delay);
+    }
+
+    private void checkUnblockedWindows() throws Exception {
+
+        String msg = "Blocking dialogs were closed.";
+        frame.checkUnblockedFrame(robot, msg + "Frame.");
+        robot.waitForIdle(delay);
+        window.checkUnblockedWindow(robot, msg + "Window.");
+        robot.waitForIdle(delay);
+    }
+
+    private void modalTest(String type) throws Exception {
+
+        checkBlockedWindows();
+
+        EventQueue.invokeAndWait(() -> { fileDialog.dispose(); });
+        robot.waitForIdle(delay);
+
+        String msg = "FileDialog was closed, " +
+            "but the " + type + " modal dialog should block this ";
+
+        frame.checkBlockedFrame(robot, msg + "Frame.");
+        robot.waitForIdle(delay);
+
+        window.checkBlockedWindow(robot, msg + "Window.");
+        robot.waitForIdle(delay);
+
+        dialog.checkUnblockedDialog(robot, "FileDialog was closed.");
+        robot.waitForIdle(delay);
+
+        dialog.clickCloseButton(robot);
+        robot.waitForIdle(delay);
+
+        checkUnblockedWindows();
+    }
+
+    private void docModalTest() throws Exception {
+
+        if (owner == DialogOwner.FRAME) {
+
+            checkBlockedWindows();
+
+            EventQueue.invokeAndWait(() -> { fileDialog.dispose(); });
+            robot.waitForIdle(delay);
+
+            String msg = "FileDialog was closed.";
+
+            dialog.checkUnblockedDialog(robot, msg);
+            robot.waitForIdle(delay);
+
+            msg += " But the blocking document modal dialog is still open.";
+
+            frame.checkBlockedFrame(robot, msg);
+            robot.waitForIdle(delay);
+
+            window.checkBlockedWindow(robot, msg);
+            robot.waitForIdle(delay);
+
+            dialog.clickCloseButton(robot);
+            robot.waitForIdle(delay);
+
+            checkUnblockedWindows();
+
+        } else {
+            nonModalTest();
+        }
+    }
+
+    private void nonModalTest() throws Exception {
+
+        checkBlockedWindows();
+
+        EventQueue.invokeAndWait(() -> { fileDialog.dispose(); });
+        robot.waitForIdle(delay);
+
+        dialog.checkUnblockedDialog(robot, "FileDialog was closed.");
+        robot.waitForIdle(delay);
+
+        checkUnblockedWindows();
+    }
+
+    public void doTest() throws Exception {
+
+        try {
+            openAll();
+
+            if (modalityType == null) {
+                nonModalTest();
+                return;
+            }
+
+            switch (modalityType) {
+                case APPLICATION_MODAL:
+                    modalTest("application");
+                    break;
+                case DOCUMENT_MODAL:
+                    docModalTest();
+                    break;
+                case TOOLKIT_MODAL:
+                    modalTest("toolkit");
+                    break;
+                case MODELESS:
+                    nonModalTest();
+                    break;
+            }
+
+        } finally {
+            EventQueue.invokeAndWait(this::closeAll);
+        }
+    }
+
+    private void closeAll() {
+        if (dialog != null) { dialog.dispose(); }
+        if (frame  != null) {  frame.dispose(); }
+        if (window != null) { window.dispose(); }
+        if (fileDialog != null) { fileDialog.dispose(); }
+        if (hiddenDialog != null) { hiddenDialog.dispose(); }
+        if (hiddenFrame  != null) {  hiddenFrame.dispose(); }
+    }
+
+
+    class CustomDialog extends TestDialog {
+
+        public CustomDialog(Dialog d) { super(d); }
+        public CustomDialog(Frame  f) { super(f); }
+
+        @Override
+        public void doOpenAction() {
+            fileDialog = new FileDialog((Frame) null);
+            fileDialog.setLocation(50, 50);
+            fileDialog.setVisible(true);
+        }
+
+        @Override
+        public void doCloseAction() {
+            this.dispose();
+        }
+    }
+
+    class CustomFrame extends TestFrame {
+
+        @Override
+        public void doOpenAction() {
+            if (window != null) { window.setVisible(true); }
+        }
+    }
+
+    class CustomWindow extends TestWindow {
+
+        public CustomWindow(Frame f) { super(f); }
+
+        @Override
+        public void doOpenAction() {
+            if (dialog != null) { dialog.setVisible(true); }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal1Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a modal Dialog
+ *          created with a null Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogModal1Test
+ */
+
+public class FileDialogModal1Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(
+            FileDialogFWDTest.DialogOwner.NULL_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal2Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a modal Dialog
+ *          created with a null Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogModal2Test
+ */
+
+public class FileDialogModal2Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(
+            FileDialogFWDTest.DialogOwner.NULL_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal3Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a modal Dialog
+ *          created with a hidden Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogModal3Test
+ */
+
+public class FileDialogModal3Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(
+            FileDialogFWDTest.DialogOwner.HIDDEN_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal4Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a modal Dialog
+ *          created with a hidden Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogModal4Test
+ */
+
+public class FileDialogModal4Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(
+            FileDialogFWDTest.DialogOwner.HIDDEN_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal5Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a modal Dialog
+ *          created with a visible Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogModal5Test
+ */
+
+public class FileDialogModal5Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(
+            FileDialogFWDTest.DialogOwner.FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal6Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a modal Dialog
+ *          created with a visible Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogModal6Test
+ */
+
+public class FileDialogModal6Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogDWDTest()).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModalityTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+public class FileDialogModalityTest {
+
+    private volatile TestDialog  dialog;
+    private volatile ParentFrame parent;
+    private volatile TestWindow  window;
+    private volatile FileDialog  fileDialog;
+
+    private static final int delay = 500;
+    private final ExtendedRobot robot;
+
+    private final Dialog.ModalityType modalityType;
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogModalityTest(Dialog.ModalityType.DOCUMENT_MODAL)).doTest();
+        (new FileDialogModalityTest(Dialog.ModalityType.TOOLKIT_MODAL)).doTest();
+        (new FileDialogModalityTest(Dialog.ModalityType.MODELESS)).doTest();
+    }
+
+    public FileDialogModalityTest(Dialog.ModalityType t) throws Exception {
+        modalityType = t;
+        robot = new ExtendedRobot();
+    }
+
+    private void createGUI() {
+
+        parent = new ParentFrame();
+        dialog = new CustomDialog((Frame) null);
+        window = new CustomWindow(parent);
+
+        int x = Toolkit.getDefaultToolkit().getScreenSize().width -
+            parent.getWidth() - 50;
+        int y = 50;
+
+        parent.setLocation(x, y);
+        y += (parent.getHeight() + 50);
+        window.setLocation(x, y);
+        y += (window.getHeight() + 50);
+        dialog.setLocation(x, y);
+
+        parent.setVisible(true);
+    }
+
+    private void startTest() throws Exception {
+
+        EventQueue.invokeLater(this::createGUI);
+
+        robot.waitForIdle(delay);
+        parent.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+        window.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+        dialog.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+    }
+
+    private void checkUnblockedWindows() throws Exception {
+
+        String msg = " should not be blocked.";
+        parent.checkUnblockedFrame (robot, "This frame" + msg);
+        robot.waitForIdle(delay);
+        window.checkUnblockedWindow(robot, "This window" + msg);
+        robot.waitForIdle(delay);
+        dialog.checkUnblockedDialog(robot, "This dialog" + msg);
+        robot.waitForIdle(delay);
+    }
+
+    private void checkBlockedWindows() throws Exception {
+
+        String msg = " should be blocked by the FileDialog.";
+        parent.checkBlockedFrame (robot, "This Frame" + msg);
+        robot.waitForIdle(delay);
+        window.checkBlockedWindow(robot, "This Window" + msg);
+        robot.waitForIdle(delay);
+        dialog.checkBlockedDialog(robot, "This Dialog" + msg);
+        robot.waitForIdle(delay);
+    }
+
+    private void docModalTest() throws Exception {
+
+        String msg = "Document modal FileDialog should ";
+        parent.checkUnblockedFrame (robot, msg + "not block this Frame.");
+        robot.waitForIdle(delay);
+        window.checkUnblockedWindow(robot, msg + "not block this Window.");
+        robot.waitForIdle(delay);
+        dialog.checkBlockedDialog(robot, msg + "block its parent Dialog.");
+        robot.waitForIdle(delay);
+    }
+
+    public void doTest() throws Exception {
+
+        try {
+            startTest();
+
+            switch (modalityType) {
+                case APPLICATION_MODAL:
+                case TOOLKIT_MODAL:
+                    checkBlockedWindows();
+                    break;
+                case DOCUMENT_MODAL:
+                    docModalTest();
+                    break;
+                case MODELESS:
+                    checkUnblockedWindows();
+                    break;
+            }
+
+            EventQueue.invokeAndWait(() -> { fileDialog.dispose(); });
+            robot.waitForIdle(delay);
+
+            if (modalityType != Dialog.ModalityType.MODELESS) {
+                checkUnblockedWindows();
+            }
+        } finally {
+            EventQueue.invokeLater(this::closeAll);
+        }
+    }
+
+    private void closeAll() {
+        if (parent != null) { parent.dispose(); }
+        if (dialog != null) { dialog.dispose(); }
+        if (window != null) { window.dispose(); }
+        if (fileDialog != null) { fileDialog.dispose(); }
+    }
+
+    class ParentFrame extends TestFrame {
+
+        @Override
+        public void doOpenAction() {
+            if (window != null) { window.setVisible(true); }
+        }
+    }
+
+    class CustomDialog extends TestDialog {
+
+        public CustomDialog(Frame f) { super(f); }
+
+        @Override
+        public void doOpenAction() {
+            fileDialog = new FileDialog(this);
+            fileDialog.setModalityType(modalityType);
+            fileDialog.setLocation(50, 50);
+            fileDialog.setVisible(true);
+        }
+    }
+
+    class CustomWindow extends TestWindow {
+
+        public CustomWindow(TestFrame f) { super(f); }
+
+        @Override
+        public void doOpenAction() {
+            if (dialog != null) { dialog.setVisible(true); }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal1Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a non-modal Dialog
+ *          created with a null Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogNonModal1Test
+ */
+
+public class FileDialogNonModal1Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(null,
+            FileDialogFWDTest.DialogOwner.NULL_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal2Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359
+ *
+ * @summary Check whether FileDialog blocks a non-modal Dialog
+ *          created with a null Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogNonModal2Test
+ */
+
+public class FileDialogNonModal2Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(null,
+            FileDialogFWDTest.DialogOwner.NULL_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal3Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359
+ *
+ * @summary Check whether FileDialog blocks a non-modal Dialog
+ *          created with a hidden Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogNonModal3Test
+ */
+
+public class FileDialogNonModal3Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(null,
+            FileDialogFWDTest.DialogOwner.HIDDEN_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal4Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359
+ *
+ * @summary Check whether FileDialog blocks a non-modal Dialog
+ *          created with a hidden Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogNonModal4Test
+ */
+
+public class FileDialogNonModal4Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(null,
+            FileDialogFWDTest.DialogOwner.HIDDEN_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal5Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359
+ *
+ * @summary Check whether FileDialog blocks a non-modal Dialog
+ *          created with a visible Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogNonModal5Test
+ */
+
+public class FileDialogNonModal5Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(null,
+            FileDialogFWDTest.DialogOwner.FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal6Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359
+ *
+ * @summary Check whether FileDialog blocks a non-modal Dialog
+ *          created with a visible Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogNonModal6Test
+ */
+
+public class FileDialogNonModal6Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogDWDTest(null)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal7Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359
+ * @summary Check whether a modeless FileDialog behaves as expected.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogNonModal7Test
+ */
+
+public class FileDialogNonModal7Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogModalityTest(Dialog.ModalityType.MODELESS)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal1Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 8055752
+ *
+ * @summary Check whether FileDialog blocks a toolkit modal Dialog
+ *          created with a null Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogTKModal1Test
+ */
+
+public class FileDialogTKModal1Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.TOOLKIT_MODAL,
+            FileDialogFWDTest.DialogOwner.NULL_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal2Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 8055752
+ *
+ * @summary Check whether FileDialog blocks a toolkit modal Dialog
+ *          created with a null Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogTKModal2Test
+ */
+
+public class FileDialogTKModal2Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.TOOLKIT_MODAL,
+            FileDialogFWDTest.DialogOwner.NULL_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal3Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 8055752
+ *
+ * @summary Check whether FileDialog blocks a toolkit modal Dialog
+ *          created with a hidden Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogTKModal3Test
+ */
+
+public class FileDialogTKModal3Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.TOOLKIT_MODAL,
+            FileDialogFWDTest.DialogOwner.HIDDEN_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal4Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 8055752
+ *
+ * @summary Check whether FileDialog blocks a toolkit modal Dialog
+ *          created with a hidden Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogTKModal4Test
+ */
+
+public class FileDialogTKModal4Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.TOOLKIT_MODAL,
+            FileDialogFWDTest.DialogOwner.HIDDEN_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal5Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 8055752
+ *
+ * @summary Check whether FileDialog blocks a toolkit modal Dialog
+ *          created with a visible Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogTKModal5Test
+ */
+
+public class FileDialogTKModal5Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.TOOLKIT_MODAL,
+            FileDialogFWDTest.DialogOwner.FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal6Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 8055752
+ *
+ * @summary Check whether FileDialog blocks a toolkit modal Dialog
+ *          created with a visible Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogTKModal6Test
+ */
+
+public class FileDialogTKModal6Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogDWDTest(Dialog.ModalityType.TOOLKIT_MODAL)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal7Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ * @summary Check whether a FileDialog set to toolkit modality behaves as expected.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogTKModal7Test
+ */
+
+public class FileDialogTKModal7Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogModalityTest(Dialog.ModalityType.TOOLKIT_MODAL)).doTest();
+    }
+}
--- a/jdk/test/java/awt/Modal/ModalDialogOrderingTest/ModalDialogOrderingTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Modal/ModalDialogOrderingTest/ModalDialogOrderingTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -29,13 +29,13 @@
 import java.awt.Toolkit;
 import java.awt.event.InputEvent;
 
-import sun.awt.SunToolkit;
-
 /**
  * @test
  * @bug 8008728
  * @summary [macosx] Swing. JDialog. Modal dialog goes to background
  * @author Alexandr Scherbatiy
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
  * @run main ModalDialogOrderingTest
  */
 public class ModalDialogOrderingTest {
@@ -69,12 +69,12 @@
 
     private static void runTest(Dialog dialog, Frame frame) {
         try {
-            Robot robot = new Robot();
+            ExtendedRobot robot = new ExtendedRobot();
             robot.setAutoDelay(50);
             robot.mouseMove(300, 300);
 
             while (!dialog.isVisible()) {
-                sleep();
+                robot.waitForIdle(1000);
             }
 
             Rectangle dialogBounds = dialog.getBounds();
@@ -89,30 +89,23 @@
             robot.mouseMove(clickX, clickY);
             robot.mousePress(InputEvent.BUTTON1_MASK);
             robot.mouseRelease(InputEvent.BUTTON1_MASK);
-            sleep();
+            robot.waitForIdle(1000);
 
             int colorX = dialogBounds.x + dialogBounds.width / 2;
             int colorY = dialogBounds.y + dialogBounds.height / 2;
 
             Color color = robot.getPixelColor(colorX, colorY);
 
-            dialog.dispose();
-            frame.dispose();
 
             if (!DIALOG_COLOR.equals(color)) {
                 throw new RuntimeException("The frame is on top"
                         + " of the modal dialog!");
+            }else{
+                frame.dispose();
+                dialog.dispose();
             }
         } catch (Exception ex) {
             throw new RuntimeException(ex);
         }
     }
-
-    private static void sleep() {
-        try {
-            Thread.sleep(1000);
-        } catch (InterruptedException ignored) {
-        }
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
-    }
 }
--- a/jdk/test/java/awt/Modal/ModalInternalFrameTest/ModalInternalFrameTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Modal/ModalInternalFrameTest/ModalInternalFrameTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -34,11 +34,10 @@
 
 import javax.swing.*;
 
-import sun.awt.*;
-
 public class ModalInternalFrameTest
 {
     private boolean passed = true;
+    private static Robot r;
 
     private JDesktopPane pane1;
     private JDesktopPane pane2;
@@ -139,13 +138,12 @@
         r.mouseMove(p.x, p.y);
         r.mousePress(InputEvent.BUTTON1_MASK);
         r.mouseRelease(InputEvent.BUTTON1_MASK);
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        r.waitForIdle();
     }
 
     private void start()
         throws Exception
     {
-        Robot r = new Robot();
         r.setAutoDelay(200);
 
         unblocked1 = false;
@@ -193,6 +191,7 @@
     public static void main(String[] args)
         throws Exception
     {
+        r = new Robot();
         test = new ModalInternalFrameTest();
         SwingUtilities.invokeAndWait(new Runnable()
         {
@@ -201,7 +200,7 @@
                 test.init();
             }
         });
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        r.waitForIdle();
         SwingUtilities.invokeAndWait(new Runnable()
         {
             public void run()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/PrintDialogsTest/PrintDialogsTest.html	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,44 @@
+<!--
+Copyright (c) 2007, 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.
+-->
+
+<html>
+<head>
+<title> PrintDialogsTest </title>
+</head>
+<body>
+<applet code="PrintDialogsTest.class" width=250 height=350></applet>
+
+Please select dialog modality type and parent; also select
+the print auxiliary dialog to be displayed (Page Setup or Print dialog).
+Then click "Start test" button.
+
+When the windows will appear check if modal blocking for Dialog works as expected.
+Then push "Open" button on the Dialog to show the auxiliary dialog and check
+if it blocks the rest of the application. Then close it and check correctness
+of modal blocking behavior for the Dialog again. To close all the test
+windows please push "Finish" button.
+
+To finish the overall test push "Pass" or "Fail" button depending on result.
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/PrintDialogsTest/PrintDialogsTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8055836 8057694 8055752
+ * @summary Check if Print and Page Setup dialogs lock other windows;
+ *          check also correctness of modal behavior for other dialogs.
+ *
+ * @run applet/manual=yesno PrintDialogsTest.html
+ */
+
+
+import java.applet.Applet;
+import java.awt.*;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+
+public class PrintDialogsTest extends Applet implements ActionListener {
+
+    private Button btnTest;
+    private Checkbox  cbPage, cbPrint,
+        cbNullDlg, cbNullFrm, cbHiddDlg, cbHiddFrm, cbDlg, cbFrm,
+        cbModal, cbAppModal, cbTKModal, cbDocModal, cbModeless, cbNonModal;
+
+    private CheckboxGroup groupDialog, groupParent, groupModType;
+
+
+    public void actionPerformed(ActionEvent e) {
+
+        if (!btnTest.equals(e.getSource())) { return; }
+
+        boolean isPrintDlg = groupDialog.getSelectedCheckbox().equals(cbPrint);
+
+        Test.DialogParent p = null;
+        Checkbox cbParent = groupParent.getSelectedCheckbox();
+        if (cbParent.equals(cbNullDlg)) {
+            p = Test.DialogParent.NULL_DIALOG;
+        } else if (cbParent.equals(cbNullFrm)) {
+            p = Test.DialogParent.NULL_FRAME;
+        } else if (cbParent.equals(cbHiddDlg)) {
+            p = Test.DialogParent.HIDDEN_DIALOG;
+        } else if (cbParent.equals(cbHiddFrm)) {
+            p = Test.DialogParent.HIDDEN_FRAME;
+        } else if (cbParent.equals(cbDlg)) {
+            p = Test.DialogParent.DIALOG;
+        } else if (cbParent.equals(cbFrm)) {
+            p = Test.DialogParent.FRAME;
+        }
+
+        boolean modal = false;
+        Dialog.ModalityType type = null;
+        Checkbox cbModType = groupModType.getSelectedCheckbox();
+        if (cbModType.equals(cbModal)) {
+            modal = true;
+        } else if (cbModType.equals(cbNonModal)) {
+            modal = false;
+        } else if (cbModType.equals(cbAppModal)) {
+            type = Dialog.ModalityType.APPLICATION_MODAL;
+        } else if (cbModType.equals(cbDocModal)) {
+            type = Dialog.ModalityType.DOCUMENT_MODAL;
+        } else if (cbModType.equals(cbTKModal)) {
+            type = Dialog.ModalityType.TOOLKIT_MODAL;
+        } else if (cbModType.equals(cbModeless)) {
+            type = Dialog.ModalityType.MODELESS;
+        }
+
+        if (type == null) {
+            (new Test(isPrintDlg, modal, p)).start();
+        } else {
+            (new Test(isPrintDlg, type,  p)).start();
+        }
+    }
+
+    private void createGUI() {
+
+        setLayout(new BorderLayout());
+
+        setSize(350, 200);
+        Panel panel = new Panel();
+        panel.setLayout(new GridLayout(18, 1));
+
+        btnTest = new Button("Start test");
+        btnTest.addActionListener(this);
+        panel.add(btnTest);
+
+
+        panel.add(new Label("Dialog parent:"));
+        groupParent = new CheckboxGroup();
+        cbNullDlg = new Checkbox("NULL Dialog"  , groupParent, true );
+        cbNullFrm = new Checkbox("NULL Frame"   , groupParent, false);
+        cbHiddDlg = new Checkbox("Hidden Dialog", groupParent, false);
+        cbHiddFrm = new Checkbox("Hidden Frame" , groupParent, false);
+        cbDlg     = new Checkbox("Dialog"       , groupParent, false);
+        cbFrm     = new Checkbox("Frame"        , groupParent, false);
+
+        panel.add(cbNullDlg);
+        panel.add(cbNullFrm);
+        panel.add(cbHiddDlg);
+        panel.add(cbHiddFrm);
+        panel.add(cbDlg);
+        panel.add(cbFrm);
+
+        panel.add(new Label("Dialog modality type:"));
+        groupModType = new CheckboxGroup();
+        cbModal    = new Checkbox("Modal"            , groupModType, true );
+        cbNonModal = new Checkbox("Non-modal"        , groupModType, false);
+        cbAppModal = new Checkbox("Application modal", groupModType, false);
+        cbDocModal = new Checkbox("Document modal"   , groupModType, false);
+        cbTKModal  = new Checkbox("Toolkit modal"    , groupModType, false);
+        cbModeless = new Checkbox("Modeless"         , groupModType, false);
+
+        panel.add(cbModal);
+        panel.add(cbNonModal);
+        panel.add(cbAppModal);
+        panel.add(cbDocModal);
+        panel.add(cbTKModal);
+        panel.add(cbModeless);
+        add(panel);
+
+        panel.add(new Label("Print dialog type:"));
+        groupDialog = new CheckboxGroup();
+        cbPage   = new Checkbox("Page Setup", groupDialog, true);
+        cbPrint  = new Checkbox("Print", groupDialog, false);
+        panel.add(cbPage);
+        panel.add(cbPrint);
+
+        validate();
+        setVisible(true);
+    }
+
+    public void start() {
+        try {
+            EventQueue.invokeAndWait(this::createGUI);
+        } catch (Exception e) {}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/PrintDialogsTest/Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,217 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.print.*;
+
+
+public class Test {
+
+    class CustomFrame extends Frame {
+        public CustomFrame() {
+            super();
+            setTitle("Frame");
+            setSize(150, 100);
+            Button dummy = new Button("Dummy");
+            add(dummy);
+        }
+    }
+
+    class CustomWindow extends Window {
+
+        private void GUI() {
+            setSize(150, 100);
+            Button dummy = new Button("Dummy");
+            add(dummy);
+        }
+
+        public CustomWindow(Dialog d) {
+            super(d);
+            GUI();
+        }
+
+        public CustomWindow(Frame f) {
+            super(f);
+            GUI();
+        }
+    }
+
+    private class CustomDialog extends Dialog implements ActionListener {
+
+        private Button open, close;
+
+        private void GUI() {
+            setTitle("Dialog");
+            setSize(150, 100);
+
+            Panel p = new Panel();
+            p.setLayout(new GridLayout(1, 2));
+            open = new Button("Open");
+            open.addActionListener(this);
+            p.add(open);
+            close = new Button("Finish");
+            close.addActionListener(this);
+            p.add(close);
+            add(p);
+        }
+
+        public CustomDialog(Dialog d) {
+            super(d);
+            GUI();
+        }
+
+        public CustomDialog(Frame f) {
+            super(f);
+            GUI();
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent e) {
+            if (open.equals(e.getSource())) {
+                if (isPrintDialog) {
+                    PrinterJob.getPrinterJob().printDialog();
+                } else {
+                    PrinterJob.getPrinterJob().pageDialog(new PageFormat());
+                }
+            } else if (close.equals(e.getSource())) {
+                if (parentDialog != null) { parentDialog.dispose(); }
+                if ( parentFrame != null) {  parentFrame.dispose(); }
+                if (parent != null) { parent.dispose(); }
+                if (dialog != null) { dialog.dispose(); }
+                if ( frame != null) {  frame.dispose(); }
+                if (window != null) { window.dispose(); }
+            }
+        }
+    }
+
+    class ParentDialog extends Dialog {
+        public ParentDialog() {
+            super((Frame) null);
+            setTitle("Dialog");
+            setSize(150, 100);
+            Button dummy = new Button("Dummy");
+            add(dummy);
+        }
+    }
+
+    private CustomFrame  frame;
+    private CustomWindow window;
+    private CustomDialog dialog;
+    private ParentDialog parent;
+
+    private boolean isPrintDialog;
+
+    private final Dialog.ModalityType modalityType;
+    private final boolean setModal;
+
+    public enum DialogParent
+        {NULL_FRAME, HIDDEN_FRAME, NULL_DIALOG, HIDDEN_DIALOG, FRAME, DIALOG};
+    private final DialogParent dialogParent;
+
+    private Dialog parentDialog;
+    private Frame  parentFrame;
+
+    public Test(boolean             isPrintDlg,
+                Dialog.ModalityType type,
+                DialogParent        p){
+        isPrintDialog = isPrintDlg;
+        modalityType = type;
+        setModal = false;
+        dialogParent = p;
+        EventQueue.invokeLater( this::createGUI );
+    }
+
+    public Test(boolean      isPrintDlg,
+                boolean      modal,
+                DialogParent p) {
+        isPrintDialog = isPrintDlg;
+        modalityType = null;
+        setModal = modal;
+        dialogParent = p;
+        EventQueue.invokeLater( this::createGUI );
+    }
+
+    private void createGUI() {
+
+        Window p;
+
+        if (dialogParent == DialogParent.DIALOG) {
+            parent = new ParentDialog();
+            window = new CustomWindow(parent);
+            p = parent;
+        } else {
+            frame = new CustomFrame();
+            window = new CustomWindow(frame);
+            p = frame;
+        }
+
+        int x = 50, y = 50;
+        p.setLocation(x, y);
+
+        y += (50 + p.getHeight());
+        window.setLocation(x, y);
+
+        switch (dialogParent) {
+            case NULL_DIALOG:
+                dialog = new CustomDialog((Dialog) null);
+                break;
+            case NULL_FRAME:
+                dialog = new CustomDialog((Frame) null);
+                break;
+            case HIDDEN_DIALOG:
+                parentDialog = new Dialog((Frame) null);
+                dialog = new CustomDialog(parentDialog);
+                break;
+            case HIDDEN_FRAME:
+                parentFrame = new Frame();
+                dialog = new CustomDialog(parentFrame);
+                break;
+            case DIALOG:
+                dialog = new CustomDialog(parent);
+            case FRAME:
+                dialog = new CustomDialog(frame);
+                break;
+        }
+
+        y += (50 + dialog.getHeight());
+        dialog.setLocation(x, y);
+
+        if (modalityType == null) {
+            dialog.setModal(setModal);
+        } else {
+            dialog.setModalityType(modalityType);
+        }
+    }
+
+    public void start() {
+        EventQueue.invokeLater(() -> {
+            if (parent != null)     { parent.setVisible(true); }
+            else if (frame != null) {  frame.setVisible(true); }
+        });
+        EventQueue.invokeLater(() -> { window.setVisible(true); });
+        EventQueue.invokeLater(() -> { dialog.setVisible(true); });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackAppModal1Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether an application modal dialog having a null Frame
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackAppModal1Test
+ */
+
+public class ToBackAppModal1Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.APPLICATION_MODAL,
+            ToBackFDFTest.DialogOwner.NULL_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackAppModal2Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether an application modal dialog having a null Dialog
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackAppModal2Test
+ */
+
+public class ToBackAppModal2Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.APPLICATION_MODAL,
+            ToBackFDFTest.DialogOwner.NULL_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackAppModal3Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether an application modal dialog having a hidden Frame
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackAppModal3Test
+ */
+
+public class ToBackAppModal3Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.APPLICATION_MODAL,
+            ToBackFDFTest.DialogOwner.HIDDEN_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackAppModal4Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether an application modal dialog having a hidden Dialog
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackAppModal4Test
+ */
+
+public class ToBackAppModal4Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.APPLICATION_MODAL,
+            ToBackFDFTest.DialogOwner.HIDDEN_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackAppModal5Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether an application modal dialog having a visible Frame
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackAppModal5Test
+ */
+
+public class ToBackAppModal5Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.APPLICATION_MODAL,
+            ToBackFDFTest.DialogOwner.FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackAppModal6Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether an application modal dialog having a visible Dialog
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackAppModal6Test
+ */
+
+public class ToBackAppModal6Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackDDFTest(Dialog.ModalityType.APPLICATION_MODAL)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackDDFTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import static jdk.testlibrary.Asserts.*;
+
+
+// DDF: Dialog->Dialog->Frame
+
+public class ToBackDDFTest {
+
+    private volatile TestDialog leftDialog;
+    private volatile TestFrame  rightFrame;
+    private volatile CustomDialog dialog;
+
+    private static final int delay = 500;
+    private final ExtendedRobot robot;
+
+    private Frame hiddenFrame;
+
+    private volatile boolean setModal;
+
+    private Dialog.ModalityType modalityType;
+
+    private ToBackDDFTest(Dialog.ModalityType modType,
+                          boolean             modal) throws Exception {
+        modalityType = modType;
+        setModal = modal;
+
+        robot = new ExtendedRobot();
+        EventQueue.invokeLater(this::createGUI);
+    }
+
+    public ToBackDDFTest(Dialog.ModalityType modalityType) throws Exception {
+        this(modalityType, false);
+    }
+
+    public ToBackDDFTest(boolean modal) throws Exception { this(null, modal); }
+
+    private void createGUI() {
+
+        hiddenFrame = new Frame();
+        leftDialog = new TestDialog(hiddenFrame);
+        leftDialog.setLocation(50, 50);
+        leftDialog.setBackground(Color.BLUE);
+        leftDialog.setVisible(true);
+
+        dialog = new CustomDialog(leftDialog);
+
+        if (modalityType == null) {
+            dialog.setModal(setModal);
+            modalityType = dialog.getModalityType();
+        } else if (modalityType != null) {
+            dialog.setModalityType(modalityType);
+        }
+
+        dialog.setBackground(Color.WHITE);
+        dialog.setLocation(150, 50);
+
+        rightFrame = new TestFrame();
+        rightFrame.setLocation(250, 50);
+        rightFrame.setBackground(Color.RED);
+
+        if (modalityType == Dialog.ModalityType.APPLICATION_MODAL) {
+            rightFrame.setModalExclusionType(
+                Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
+        } else if (modalityType == Dialog.ModalityType.TOOLKIT_MODAL) {
+            rightFrame.setModalExclusionType(
+                Dialog.ModalExclusionType.TOOLKIT_EXCLUDE);
+        }
+
+        dialog.setVisible(true);
+    }
+
+    private void checkLeftDialogIsOverlapped(String msg) {
+
+        Point p = leftDialog.getLocationOnScreen();
+        int x = p.x + (int)(leftDialog.getWidth()  * 0.9);
+        int y = p.y + (int)(leftDialog.getHeight() * 0.9);
+        boolean f = robot.getPixelColor(x, y).equals(leftDialog.getBackground());
+        assertFalse(f, msg);
+    }
+
+    private void checkRightFrameIsOverlaped(String msg) {
+
+        Point p = rightFrame.getLocationOnScreen();
+        int x = p.x + (int)(rightFrame.getWidth()  * 0.1);
+        int y = p.y + (int)(rightFrame.getHeight() * 0.9);
+        boolean f = robot.getPixelColor(x, y).equals(rightFrame.getBackground());
+        assertFalse(f, msg);
+    }
+
+    public void doTest() throws Exception {
+
+        try {
+            robot.waitForIdle(delay);
+
+            dialog.clickOpenButton(robot);
+            robot.waitForIdle(delay);
+
+            dialog.clickCloseButton(robot);
+            robot.waitForIdle(delay);
+
+            EventQueue.invokeAndWait(() -> { dialog.toBack(); });
+            robot.waitForIdle(delay);
+
+            String type = modalityType.toString().toLowerCase().replace('_', ' ');
+
+            boolean isModeless = (modalityType == Dialog.ModalityType.MODELESS);
+
+            final String msg1;
+            if (isModeless) {
+                msg1 = "The modeless dialog was overlapped by the " +
+                    "parent dialog after calling toBack method.";
+            } else {
+                msg1 = "The " + type + " dialog was overlapped by the blocked dialog.";
+            }
+            EventQueue.invokeAndWait(() -> { checkLeftDialogIsOverlapped(msg1); });
+
+            if (isModeless) {
+                EventQueue.invokeAndWait(() -> { dialog.toFront(); });
+            } else {
+                EventQueue.invokeAndWait(() -> { leftDialog.toFront(); });
+            }
+            robot.waitForIdle(delay);
+
+            final String msg2 = "The dialog is still behind the right frame after " +
+                "calling toFront method for " + (isModeless ? "it." : "its parent.");
+
+            EventQueue.invokeAndWait(() -> { checkRightFrameIsOverlaped(msg2); });
+
+            final String msg3;
+            if (isModeless) {
+                msg3 = "The modeless dialog is still behind the parent dialog.";
+            } else {
+                msg3 = "The " + type + " dialog was overlapped by the blocked " +
+                "dialog after calling toFront method for the blocked dialog.";
+            }
+            EventQueue.invokeAndWait(() -> { checkLeftDialogIsOverlapped(msg3); });
+
+        } finally {
+            EventQueue.invokeAndWait(this::closeAll);
+        }
+    }
+
+    private void closeAll() {
+        if (dialog      != null) {      dialog.dispose(); }
+        if (leftDialog  != null) {  leftDialog.dispose(); }
+        if (rightFrame  != null) {  rightFrame.dispose(); }
+        if (hiddenFrame != null) { hiddenFrame.dispose(); }
+    }
+
+
+    class CustomDialog extends TestDialog {
+
+        public CustomDialog(Dialog d) { super(d); }
+
+        @Override
+        public void doOpenAction() {
+            if (rightFrame != null) { rightFrame.setVisible(true); }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackDocModal1Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check if toBack method works correctly for
+ *          a document modal dialog with null Frame parent.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackDocModal1Test
+ */
+
+public class ToBackDocModal1Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.DOCUMENT_MODAL,
+            ToBackFDFTest.DialogOwner.NULL_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackDocModal2Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check if toBack method works correctly for
+ *          a document modal dialog with null Dialog parent.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackDocModal2Test
+ */
+
+public class ToBackDocModal2Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.DOCUMENT_MODAL,
+            ToBackFDFTest.DialogOwner.NULL_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackDocModal3Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check if toBack method works correctly for
+ *          a document modal dialog with hidden Frame parent.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackDocModal3Test
+ */
+
+public class ToBackDocModal3Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.DOCUMENT_MODAL,
+            ToBackFDFTest.DialogOwner.HIDDEN_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackDocModal4Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check if toBack method works correctly for
+ *          a document modal dialog with hidden Dialog parent.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackDocModal4Test
+ */
+
+public class ToBackDocModal4Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.DOCUMENT_MODAL,
+            ToBackFDFTest.DialogOwner.HIDDEN_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackDocModal5Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a document modal dialog having a visible Frame
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackDocModal5Test
+ */
+
+public class ToBackDocModal5Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.DOCUMENT_MODAL,
+            ToBackFDFTest.DialogOwner.FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackDocModal6Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a document modal dialog having a visible Dialog
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackDocModal6Test
+ */
+
+public class ToBackDocModal6Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackDDFTest(Dialog.ModalityType.DOCUMENT_MODAL)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackFDFTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.*;
+import static jdk.testlibrary.Asserts.*;
+
+
+// FDF: Frame->Dialog->Frame
+
+public class ToBackFDFTest {
+
+    private volatile CustomDialog dialog;
+    private volatile TestFrame leftFrame, rightFrame;
+
+    private static final int delay = 500;
+    private final ExtendedRobot robot;
+
+    private Dialog hiddenDialog;
+    private Frame  hiddenFrame;
+
+    public enum DialogOwner {HIDDEN_DIALOG, NULL_DIALOG, HIDDEN_FRAME, NULL_FRAME, FRAME};
+
+    private DialogOwner owner;
+    private volatile boolean setModal;
+
+    private Dialog.ModalityType modalityType;
+
+    private ToBackFDFTest(Dialog.ModalityType modType,
+                          boolean             modal,
+                          DialogOwner         o) throws Exception {
+        modalityType = modType;
+        setModal = modal;
+        owner = o;
+
+        robot = new ExtendedRobot();
+        EventQueue.invokeLater(this::createGUI);
+    }
+
+    public ToBackFDFTest(Dialog.ModalityType modalityType,
+                         DialogOwner         o) throws Exception {
+        this(modalityType, false, o);
+    }
+
+    public ToBackFDFTest(boolean modal, DialogOwner o) throws Exception {
+        this(null, modal, o);
+    }
+
+    private void createGUI() {
+
+        leftFrame = new TestFrame();
+        leftFrame.setLocation(50, 50);
+        leftFrame.setBackground(Color.BLUE);
+        leftFrame.setVisible(true);
+
+        switch (owner) {
+            case HIDDEN_DIALOG:
+                hiddenDialog = new Dialog((Frame) null);
+                dialog = new CustomDialog(hiddenDialog);
+                break;
+            case NULL_DIALOG:
+                dialog = new CustomDialog((Dialog) null);
+                break;
+            case HIDDEN_FRAME:
+                hiddenFrame = new Frame();
+                dialog = new CustomDialog(hiddenFrame);
+                break;
+            case NULL_FRAME:
+                dialog = new CustomDialog((Frame) null);
+                break;
+            case FRAME:
+                dialog = new CustomDialog(leftFrame);
+                break;
+        }
+
+        if (modalityType == null) {
+            dialog.setModal(setModal);
+            modalityType = dialog.getModalityType();
+        } else if (modalityType != null) {
+            dialog.setModalityType(modalityType);
+        }
+
+        dialog.setBackground(Color.WHITE);
+        dialog.setLocation(150, 50);
+
+        rightFrame = new TestFrame();
+        rightFrame.setLocation(250, 50);
+        rightFrame.setBackground(Color.RED);
+
+        if (modalityType == Dialog.ModalityType.APPLICATION_MODAL) {
+            rightFrame.setModalExclusionType(
+                Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
+        } else if (modalityType == Dialog.ModalityType.TOOLKIT_MODAL) {
+            rightFrame.setModalExclusionType(
+                Dialog.ModalExclusionType.TOOLKIT_EXCLUDE);
+        }
+
+        dialog.setVisible(true);
+    }
+
+    private void checkIfLeftOnTop(boolean refState, String msg) {
+
+        Point p = leftFrame.getLocationOnScreen();
+        int x = p.x + (int)(leftFrame.getWidth()  * 0.9);
+        int y = p.y + (int)(leftFrame.getHeight() * 0.9);
+        boolean f = robot.getPixelColor(x, y).equals(leftFrame.getBackground());
+        assertEQ(refState, f, msg);
+    }
+
+    private void checkIfRightOnTop(boolean refState, String msg) {
+
+        Point p = rightFrame.getLocationOnScreen();
+        int x = p.x + (int)(rightFrame.getWidth()  * 0.1);
+        int y = p.y + (int)(rightFrame.getHeight() * 0.9);
+        boolean f = robot.getPixelColor(x, y).equals(rightFrame.getBackground());
+        assertEQ(refState, f, msg);
+    }
+
+    private void Test() throws Exception {
+
+        String type =
+            dialog.getModalityType().toString().toLowerCase().replace('_', ' ');
+
+        final String msg1 = "The " + type + "dialog was " +
+            "overlapped by the blocked frame.";
+        EventQueue.invokeAndWait(() -> { checkIfLeftOnTop(false, msg1); });
+
+        EventQueue.invokeAndWait(() -> { leftFrame.toFront(); });
+        robot.waitForIdle(delay);
+
+        final String msg2 = "The dialog is still overlapped by the right frame" +
+            " after calling toFront method for the blocked (left) frame.";
+        EventQueue.invokeAndWait(() -> { checkIfRightOnTop(false, msg2); });
+
+        final String msg3 = "The " + type + " dialog was overlapped by the " +
+            "blocked frame after calling toFront method for the blocked frame.";
+        EventQueue.invokeAndWait(() -> { checkIfLeftOnTop(false, msg3); });
+
+
+        if (owner == DialogOwner.FRAME) { return; }
+
+        EventQueue.invokeAndWait(() -> { leftFrame.toBack(); });
+        robot.waitForIdle(delay);
+
+        final String msg4 = "Calling toBack " +
+            "for the blocked frame pushed the blocking dialog to back.";
+        EventQueue.invokeAndWait(() -> { checkIfRightOnTop(false, msg4); });
+
+        final String msg5 = "The " + type + " dialog was overlapped " +
+            "by the blocked frame after toBack was called for the left frame.";
+        EventQueue.invokeAndWait(() -> { checkIfLeftOnTop(false, msg5); });
+    }
+
+    private void docTest() throws Exception {
+
+        if (owner == DialogOwner.FRAME) { Test(); }
+        else {
+
+            final String msg1 = "toBack was called for the dialog.";
+            EventQueue.invokeAndWait(() -> {  checkIfLeftOnTop(true, msg1); });
+            EventQueue.invokeAndWait(() -> { checkIfRightOnTop(true, msg1); });
+
+            EventQueue.invokeAndWait(() -> { dialog.toFront(); });
+            robot.waitForIdle(delay);
+
+            final String msg2 = "Dialog still behind " +
+                "the right frame even after calling toFront method.";
+            EventQueue.invokeAndWait(() -> { checkIfRightOnTop(false, msg2); });
+            final String msg3 = "The document modal dialog " +
+                "gone behind the blocked left frame.";
+            EventQueue.invokeAndWait(() -> { checkIfLeftOnTop(false, msg3); });
+
+            EventQueue.invokeAndWait(() -> { leftFrame.toBack(); });
+            robot.waitForIdle(delay);
+
+            final String msg4 = "Calling toBack for the left " +
+                "frame pushed the document modal dialog to back.";
+            EventQueue.invokeAndWait(() -> { checkIfRightOnTop(false, msg4); });
+            final String msg5 = "The document modal dialog " +
+                "was pushed behind the left frame when toBack called for the frame.";
+            EventQueue.invokeAndWait(() -> { checkIfRightOnTop(false, msg5); });
+        }
+    }
+
+    private void modelessTest() throws Exception {
+
+        if (owner == DialogOwner.FRAME) {
+            final String msg = "The modeless dialog was " +
+                "pushed behind the parent left frame after toBack call.";
+            EventQueue.invokeAndWait(() -> { checkIfLeftOnTop(false, msg); });
+        } else {
+            final String msg =
+                "Dialog should not overlap the frame after calling toBack.";
+            EventQueue.invokeAndWait(() -> {  checkIfLeftOnTop(true, msg); });
+            EventQueue.invokeAndWait(() -> { checkIfRightOnTop(true, msg); });
+        }
+
+        EventQueue.invokeAndWait(() -> { dialog.toFront(); });
+        robot.waitForIdle(delay);
+
+        final String msg1 = "The frames should not overlap the dialog " +
+            "after calling toFront for it.";
+        EventQueue.invokeAndWait(() -> {  checkIfLeftOnTop(false, msg1); });
+        EventQueue.invokeAndWait(() -> { checkIfRightOnTop(false, msg1); });
+
+        if (owner == DialogOwner.FRAME) { return; }
+
+        EventQueue.invokeAndWait(() -> { leftFrame.toBack(); });
+        robot.waitForIdle(delay);
+
+        final String msg2 = "Calling toBack method for the " +
+            "left frame pushed the modeless dialog to back.";
+        EventQueue.invokeAndWait(() -> { checkIfRightOnTop(false, msg2); });
+        final String msg3 = "The modeless dialog was pushed " +
+            "behind the left frame after toBack was called for the frame.";
+        EventQueue.invokeAndWait(() -> { checkIfLeftOnTop(false, msg3); });
+    }
+
+    public void doTest() throws Exception {
+
+        try {
+            robot.waitForIdle(delay);
+
+            dialog.clickOpenButton(robot);
+            robot.waitForIdle(delay);
+
+            dialog.clickCloseButton(robot);
+            robot.waitForIdle(delay);
+
+            EventQueue.invokeAndWait(() -> { dialog.toBack(); });
+            robot.waitForIdle(delay);
+
+            switch (modalityType) {
+                case APPLICATION_MODAL:
+                case TOOLKIT_MODAL:
+                    Test();
+                    break;
+                case DOCUMENT_MODAL:
+                    docTest();
+                    break;
+                case MODELESS:
+                    modelessTest();
+                    break;
+            }
+        } finally {
+            EventQueue.invokeAndWait(this::closeAll);
+        }
+    }
+
+    private void closeAll() {
+        if (dialog       != null) {       dialog.dispose(); }
+        if (leftFrame    != null) {    leftFrame.dispose(); }
+        if (rightFrame   != null) {   rightFrame.dispose(); }
+        if (hiddenDialog != null) { hiddenDialog.dispose(); }
+        if (hiddenFrame  != null) {  hiddenFrame.dispose(); }
+    }
+
+
+    class CustomDialog extends TestDialog {
+
+        public CustomDialog(Dialog d) { super(d); }
+        public CustomDialog(Frame  f) { super(f); }
+
+        @Override
+        public void doOpenAction() {
+            if (rightFrame != null) {
+                rightFrame.setVisible(true);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModal1Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a modal dialog having a null Frame
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackModal1Test
+ */
+
+public class ToBackModal1Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(
+            true, ToBackFDFTest.DialogOwner.NULL_FRAME)).doTest();
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModal2Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a modal dialog having a null Dialog
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackModal2Test
+ */
+
+public class ToBackModal2Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(
+            true, ToBackFDFTest.DialogOwner.NULL_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModal3Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a modal dialog having a hidden Frame
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackModal3Test
+ */
+
+public class ToBackModal3Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(
+            true, ToBackFDFTest.DialogOwner.HIDDEN_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModal4Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a modal dialog having a hidden Dialog
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackModal4Test
+ */
+
+public class ToBackModal4Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(
+            true, ToBackFDFTest.DialogOwner.HIDDEN_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModal5Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a modal dialog having a visible Frame
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackModal5Test
+ */
+
+public class ToBackModal5Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(
+            true, ToBackFDFTest.DialogOwner.FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModal6Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a modal dialog having a visible Dialog
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackModal6Test
+ */
+
+public class ToBackModal6Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackDDFTest(true)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModeless1Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a modeless dialog having a null Frame constructor
+ *          goes behind other windows when toBack is called for it.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackModeless1Test
+ */
+
+public class ToBackModeless1Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.MODELESS,
+            ToBackFDFTest.DialogOwner.NULL_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModeless2Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a modeless dialog having a null Dialog constructor
+ *          goes behind other windows when toBack is called for it.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackModeless2Test
+ */
+
+public class ToBackModeless2Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.MODELESS,
+            ToBackFDFTest.DialogOwner.NULL_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModeless3Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a modeless dialog having a hidden Frame constructor
+ *          goes behind other windows when toBack is called for it.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackModeless3Test
+ */
+
+public class ToBackModeless3Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.MODELESS,
+            ToBackFDFTest.DialogOwner.HIDDEN_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModeless4Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a modeless dialog having a hidden Dialog constructor
+ *          goes behind other windows when toBack is called for it.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackModeless4Test
+ */
+
+public class ToBackModeless4Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.MODELESS,
+            ToBackFDFTest.DialogOwner.HIDDEN_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModeless5Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check if toBack method works correctly for a modeless dialog
+ *          having a visible Frame constructor.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackModeless5Test
+ */
+
+public class ToBackModeless5Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.MODELESS,
+            ToBackFDFTest.DialogOwner.FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackModeless6Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check if toBack method works correctly for a modeless dialog
+ *          having a visible Dialog constructor.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackModeless6Test
+ */
+
+public class ToBackModeless6Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackDDFTest(Dialog.ModalityType.MODELESS)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal1Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a non-modal dialog having a null Frame constructor
+ *          goes behind other windows when toBack is called for it.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackNonModal1Test
+ */
+
+public class ToBackNonModal1Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(
+            false, ToBackFDFTest.DialogOwner.NULL_FRAME)).doTest();
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal2Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a non-modal dialog having a null Dialog constructor
+ *          goes behind other windows when toBack is called for it.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackNonModal2Test
+ */
+
+public class ToBackNonModal2Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(
+            false, ToBackFDFTest.DialogOwner.NULL_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal3Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a non-modal dialog having a hidden Frame constructor
+ *          goes behind other windows when toBack is called for it.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackNonModal3Test
+ */
+
+public class ToBackNonModal3Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(
+            false, ToBackFDFTest.DialogOwner.HIDDEN_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal4Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a non-modal dialog having a hidden Dialog constructor
+ *          goes behind other windows when toBack is called for it.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackNonModal4Test
+ */
+
+public class ToBackNonModal4Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(
+            false, ToBackFDFTest.DialogOwner.HIDDEN_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal5Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check if toBack method works correctly for a non-modal dialog
+ *          having a visible Frame constructor.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackNonModal5Test
+ */
+
+public class ToBackNonModal5Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(
+            false, ToBackFDFTest.DialogOwner.FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackNonModal6Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check if toBack method works correctly for a non-modal dialog
+ *          having a visible Dialog constructor.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackNonModal6Test
+ */
+
+public class ToBackNonModal6Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackDDFTest(false)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackTKModal1Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a toolkit modal dialog having a null Frame
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackTKModal1Test
+ */
+
+public class ToBackTKModal1Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.TOOLKIT_MODAL,
+            ToBackFDFTest.DialogOwner.NULL_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackTKModal2Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a toolkit modal dialog having a null Dialog
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackTKModal2Test
+ */
+
+public class ToBackTKModal2Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.TOOLKIT_MODAL,
+            ToBackFDFTest.DialogOwner.NULL_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackTKModal3Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a toolkit modal dialog having a hidden Frame
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackTKModal3Test
+ */
+
+public class ToBackTKModal3Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.TOOLKIT_MODAL,
+            ToBackFDFTest.DialogOwner.HIDDEN_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackTKModal4Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a toolkit modal dialog having a hidden Dialog
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackTKModal4Test
+ */
+
+public class ToBackTKModal4Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.TOOLKIT_MODAL,
+            ToBackFDFTest.DialogOwner.HIDDEN_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackTKModal5Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a toolkit modal dialog having a visible Frame
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackTKModal5Test
+ */
+
+public class ToBackTKModal5Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackFDFTest(Dialog.ModalityType.TOOLKIT_MODAL,
+            ToBackFDFTest.DialogOwner.FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ToBack/ToBackTKModal6Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054143
+ * @summary Check whether a toolkit modal dialog having a visible Dialog
+ *          constructor still stays on top of the blocked windows even
+ *          after calling toBack for the dialog.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main ToBackTKModal6Test
+ */
+
+public class ToBackTKModal6Test {
+
+    public static void main(String[] args) throws Exception {
+        (new ToBackDDFTest(Dialog.ModalityType.TOOLKIT_MODAL)).doTest();
+    }
+}
--- a/jdk/test/java/awt/Mouse/EnterExitEvents/DragWindowOutOfFrameTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Mouse/EnterExitEvents/DragWindowOutOfFrameTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -37,7 +37,6 @@
 import javax.swing.*;
 
 import java.util.concurrent.*;
-import sun.awt.SunToolkit;
 
 import test.java.awt.regtesthelpers.Util;
 
@@ -57,7 +56,6 @@
 
     public static void main(String[] args) throws Exception {
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -69,7 +67,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Point pointToClick = Util.invokeOnEDT(new Callable<Point>() {
 
@@ -82,7 +80,7 @@
 
         robot.mouseMove(pointToClick.x, pointToClick.y);
         robot.mousePress(InputEvent.BUTTON1_MASK);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (dragWindowMouseEnteredCount != 1 && dragWindowMouseExitedCount != 0) {
             throw new RuntimeException(
@@ -100,7 +98,7 @@
         });
 
         robot.mouseMove(450, pointToClick.y);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (labelMouseEnteredCount != 0 && labelMouseExitedCount != 1) {
             throw new RuntimeException(
@@ -108,7 +106,7 @@
         }
 
         robot.mouseMove(450, pointToDrag.y);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (labelMouseEnteredCount != 0 && labelMouseExitedCount != 1) {
             throw new RuntimeException(
@@ -121,7 +119,7 @@
         }
 
         robot.mouseMove(pointToDrag.y, pointToDrag.y);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (buttonMouseEnteredCount != 1 && buttonMouseExitedCount != 0) {
             throw new RuntimeException(
@@ -129,7 +127,7 @@
         }
 
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (labelMouseReleasedCount != 1) {
             throw new RuntimeException("No MouseReleased event on label!");
--- a/jdk/test/java/awt/Mouse/EnterExitEvents/DragWindowTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Mouse/EnterExitEvents/DragWindowTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -38,7 +38,6 @@
 import javax.swing.*;
 
 import java.util.concurrent.*;
-import sun.awt.SunToolkit;
 
 import test.java.awt.regtesthelpers.Util;
 
@@ -54,7 +53,6 @@
 
     public static void main(String[] args) throws Exception {
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -66,7 +64,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Point pointToClick = Util.invokeOnEDT(new Callable<Point>() {
 
@@ -79,7 +77,7 @@
 
         robot.mouseMove(pointToClick.x, pointToClick.y);
         robot.mousePress(InputEvent.BUTTON1_MASK);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (dragWindowMouseEnteredCount != 1) {
             throw new RuntimeException("No MouseEntered event on Drag Window!");
@@ -95,14 +93,14 @@
         });
 
         robot.mouseMove(pointToDrag.x, pointToDrag.y);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (buttonMouseEnteredCount != 0) {
             throw new RuntimeException("Extra MouseEntered event on button!");
         }
 
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (labelMouseReleasedCount != 1) {
             throw new RuntimeException("No MouseReleased event on label!");
--- a/jdk/test/java/awt/Mouse/EnterExitEvents/ResizingFrameTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Mouse/EnterExitEvents/ResizingFrameTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -28,15 +28,10 @@
  * @author  alexandr.scherbatiy area=awt.event
  * @run main ResizingFrameTest
  */
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
 
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
-import sun.awt.SunToolkit;
 
 public class ResizingFrameTest {
 
@@ -46,10 +41,10 @@
 
     public static void main(String[] args) throws Exception {
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
         robot.mouseMove(100, 100);
+        robot.delay(200);
 
         // create a frame under the mouse cursor
         SwingUtilities.invokeAndWait(new Runnable() {
@@ -61,7 +56,8 @@
         });
 
 
-        toolkit.realSync();
+        robot.waitForIdle();
+        robot.delay(1000);
 
         if (mouseEnteredCount != 1 || mouseExitedCount != 0) {
             throw new RuntimeException("No Mouse Entered/Exited events!");
@@ -76,11 +72,11 @@
             }
         });
 
-        toolkit.realSync();
-        robot.delay(200);
+        robot.waitForIdle();
+        robot.delay(1000);
 
         if (mouseEnteredCount != 1 || mouseExitedCount != 1) {
-            throw new RuntimeException("No Mouse Entered/Exited events!");
+            throw new RuntimeException("No Mouse Entered/Exited events! "+mouseEnteredCount+", "+mouseExitedCount);
         }
 
         // deiconify frame
@@ -92,8 +88,8 @@
             }
         });
 
-        toolkit.realSync();
-        robot.delay(200);
+        robot.waitForIdle();
+        robot.delay(1000);
 
         if (mouseEnteredCount != 2 || mouseExitedCount != 1) {
             throw new RuntimeException("No Mouse Entered/Exited events!");
@@ -101,8 +97,8 @@
 
         // move the mouse out of the frame
         robot.mouseMove(500, 500);
-        toolkit.realSync();
-        robot.delay(200);
+        robot.waitForIdle();
+        robot.delay(1000);
 
         if (mouseEnteredCount != 2 || mouseExitedCount != 2) {
             throw new RuntimeException("No Mouse Entered/Exited events!");
@@ -117,8 +113,8 @@
             }
         });
 
-        toolkit.realSync();
-        robot.delay(200);
+        robot.waitForIdle();
+        robot.delay(1000);
 
         if (mouseEnteredCount != 3 || mouseExitedCount != 2) {
             throw new RuntimeException("No Mouse Entered/Exited events!");
@@ -134,8 +130,8 @@
             }
         });
 
-        toolkit.realSync();
-        robot.delay(200);
+        robot.waitForIdle();
+        robot.delay(1000);
 
         if (mouseEnteredCount != 3 || mouseExitedCount != 3) {
             throw new RuntimeException("No Mouse Entered/Exited events!");
@@ -151,8 +147,8 @@
             }
         });
 
-        toolkit.realSync();
-        robot.delay(200);
+        robot.waitForIdle();
+        robot.delay(1000);
 
         if (mouseEnteredCount != 4 || mouseExitedCount != 3) {
             throw new RuntimeException("No Mouse Entered/Exited events!");
@@ -167,7 +163,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
         robot.delay(400);
 
         if (mouseEnteredCount != 4 || mouseExitedCount != 4) {
@@ -183,7 +179,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
         robot.delay(200);
 
         if (mouseEnteredCount != 5 || mouseExitedCount != 4) {
@@ -199,7 +195,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
         robot.delay(400);
 
 
@@ -229,4 +225,4 @@
 
         frame.setVisible(true);
     }
-}
\ No newline at end of file
+}
--- a/jdk/test/java/awt/Mouse/MouseComboBoxTest/MouseComboBoxTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Mouse/MouseComboBoxTest/MouseComboBoxTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -27,8 +27,6 @@
  * @summary Tests JComboBox selection via the mouse
  * @author Dmitry Markov
  */
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.plaf.basic.BasicComboPopup;
 import javax.swing.plaf.basic.ComboPopup;
@@ -41,14 +39,12 @@
 public class MouseComboBoxTest {
     private static final String[] items = {"One", "Two", "Three", "Four", "Five"};
 
-    private static SunToolkit toolkit = null;
     private static Robot robot = null;
     private static JFrame frame = null;
     private static JComboBox comboBox = null;
     private static MyComboBoxUI comboBoxUI = null;
 
     public static void main(String[] args) throws Exception {
-        toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -59,19 +55,19 @@
                 createAndShowGUI();
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
         for (int i = 0; i < items.length; i++) {
             // Open popup
             robot.keyPress(KeyEvent.VK_DOWN);
             robot.keyRelease(KeyEvent.VK_DOWN);
-            toolkit.realSync();
+            robot.waitForIdle();
 
             Point point = getItemPointToClick(i);
             robot.mouseMove(point.x, point.y);
             robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
             robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
-            toolkit.realSync();
+            robot.waitForIdle();
 
             if (i != getSelectedIndex()) {
                 throw new RuntimeException("Test Failed! Incorrect value of selected index = " + getSelectedIndex() +
--- a/jdk/test/java/awt/Multiscreen/MouseEventTest/MouseEventTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Multiscreen/MouseEventTest/MouseEventTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -28,8 +28,6 @@
   @run main MouseEventTest
  */
 
-import sun.awt.SunToolkit;
-
 import java.awt.*;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
@@ -37,8 +35,8 @@
 public class MouseEventTest {
     static volatile boolean crossed = false;
 
-    static void sleep() throws InterruptedException {
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+    static void sleep(Robot robot) throws InterruptedException {
+        robot.waitForIdle();
         Thread.sleep(500);
     }
 
@@ -64,7 +62,7 @@
             frame.setLocation(screen.x + 200, screen.y + 200);
             frame.setBackground(Color.YELLOW);
             frame.setVisible(true);
-            sleep();
+            sleep(robot);
 
             Point loc = frame.getLocationOnScreen();
             Dimension size = frame.getSize();
@@ -86,7 +84,7 @@
             robot.mouseMove(point.x - 1, point.y - 1);
             robot.mouseMove(point.x, point.y);
 
-            sleep();
+            sleep(robot);
             frame.dispose();
 
             if (!crossed) {
--- a/jdk/test/java/awt/Paint/PaintNativeOnUpdate.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Paint/PaintNativeOnUpdate.java	Fri Jan 09 13:28:02 2015 -0500
@@ -28,21 +28,22 @@
 import java.awt.Graphics;
 import java.awt.Label;
 import java.awt.Point;
-import java.awt.Robot;
-import java.awt.Toolkit;
-
-import sun.awt.SunToolkit;
 
 /**
  * @test
  * @bug 7157680
+ * @library ../../../lib/testlibrary
+ * @build ExtendedRobot
  * @author Sergey Bylokhov
+ @ @run main PaintNativeOnUpdate
  */
 public final class PaintNativeOnUpdate extends Label {
 
     private boolean fullUpdate = true;
 
     public static void main(final String[] args) throws AWTException {
+        ExtendedRobot robot = new ExtendedRobot();
+        robot.setAutoDelay(50);
         final Frame frame = new Frame();
         final Component label = new PaintNativeOnUpdate();
         frame.setBackground(Color.RED);
@@ -51,14 +52,12 @@
         frame.setUndecorated(true);
         frame.setLocationRelativeTo(null);
         frame.setVisible(true);
-        sleep();
+        robot.waitForIdle(1000);
         label.repaint();// first paint
-        sleep();
+        robot.waitForIdle(1000);
         label.repaint();// incremental paint
-        sleep();
+        robot.waitForIdle(1000);
 
-        Robot robot = new Robot();
-        robot.setAutoDelay(50);
         Point point = label.getLocationOnScreen();
         Color color = robot.getPixelColor(point.x + label.getWidth() / 2,
                                           point.y + label.getHeight() / 2);
@@ -87,12 +86,4 @@
     public void paint(final Graphics g) {
         // Do nothing
     }
-
-    private static void sleep() {
-        try {
-            ((SunToolkit) (Toolkit.getDefaultToolkit())).realSync();
-            Thread.sleep(1000);
-        } catch (InterruptedException ignored) {
-        }
-    }
 }
--- a/jdk/test/java/awt/Robot/CtorTest/CtorTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Robot/CtorTest/CtorTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -38,8 +38,6 @@
 import java.awt.*;
 import java.awt.event.*;
 
-import sun.awt.SunToolkit;
-
 public class CtorTest
 {
     public static void main(String []s) throws Exception
@@ -57,7 +55,7 @@
         frame.setBounds(100, 100, 100, 100);
         frame.setVisible(true);
 
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         // click in the middle of the frame
         robot.mouseMove(150, 150);
@@ -66,6 +64,6 @@
         robot.delay(50);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
 
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/TextArea/ScrollbarIntersectionTest/ScrollbarIntersectionTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 6429174
+  @summary Tests that mouse click at the are of intersection of two
+   scrollbars for text area doesn't trigger any scrolling
+  @author artem.ananiev@sun.com: area=awt.text
+  @library ../../../../lib/testlibrary
+  @build jdk.testlibrary.OSInfo
+  @run main ScrollbarIntersectionTest
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import jdk.testlibrary.OSInfo;
+
+
+public class ScrollbarIntersectionTest
+{
+    private static void init()
+    {
+
+        Frame f = new Frame("F");
+        f.setBounds(100, 100, 480, 360);
+        f.setLayout(new BorderLayout());
+
+        TextArea ta = new TextArea(null, 8, 24, TextArea.SCROLLBARS_BOTH);
+        // append several lines to show vertical scrollbar
+        for (int i = 0; i < 128; i++)
+        {
+            ta.append("" + i + "\n");
+        }
+        // and some characters into the last line for horizontal scrollbar
+        for (int i = 0; i < 128; i++)
+        {
+            ta.append("" + i);
+        }
+        ta.append("\n");
+        f.add(ta);
+
+        f.setVisible(true);
+
+        Robot r = null;
+        try
+        {
+            r = new Robot();
+            r.setAutoDelay(20);
+        }
+        catch (Exception z)
+        {
+            z.printStackTrace(System.err);
+            fail(z.getMessage());
+            return;
+        }
+        r.waitForIdle();
+
+        ta.setCaretPosition(0);
+        r.waitForIdle();
+
+        Point p = ta.getLocationOnScreen();
+        Dimension d = ta.getSize();
+
+        int fh = 8;
+        Graphics g = ta.getGraphics();
+        try
+        {
+            FontMetrics fm = g.getFontMetrics();
+            fh = fm.getHeight();
+        }
+        finally
+        {
+            if (g != null)
+            {
+                g.dispose();
+            }
+        };
+
+        r.mouseMove(p.x + d.width - 2, p.y + d.height - 2);
+        r.mousePress(InputEvent.BUTTON1_MASK);
+        r.mouseRelease(InputEvent.BUTTON1_MASK);
+        r.waitForIdle();
+
+        // select 1st line in the text area
+        r.mouseMove(p.x + 2, p.y + 2 + fh / 2);
+        r.mousePress(InputEvent.BUTTON1_MASK);
+        for (int i = 0; i < d.width - 4; i += 4)
+        {
+            r.mouseMove(p.x + 2 + i, p.y + 2 + fh / 2);
+        }
+        r.mouseRelease(InputEvent.BUTTON1_MASK);
+        r.waitForIdle();
+
+        String sel = ta.getSelectedText();
+        System.err.println("Selected text: " + sel);
+        if ((sel == null) || !sel.startsWith("0"))
+        {
+            fail("Test FAILED: TextArea is scrolled");
+            return;
+        }
+
+        pass();
+    }
+
+    private static boolean theTestPassed = false;
+    private static boolean testGeneratedInterrupt = false;
+    private static String failureMessage = "";
+
+    private static Thread mainThread = null;
+
+    private static int sleepTime = 300000;
+
+    public static void main( String args[] ) throws InterruptedException
+    {
+        if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
+            // On OS X, this area is commandeered by the system,
+            // and frame would be wildly resized
+            System.out.println("Not for OS X");
+            return;
+        }
+        mainThread = Thread.currentThread();
+        try
+        {
+            init();
+        }
+        catch( TestPassedException e )
+        {
+            return;
+        }
+
+        try
+        {
+            Thread.sleep( sleepTime );
+            throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
+        }
+        catch (InterruptedException e)
+        {
+            if( ! testGeneratedInterrupt ) throw e;
+
+            testGeneratedInterrupt = false;
+
+            if ( theTestPassed == false )
+            {
+                throw new RuntimeException( failureMessage );
+            }
+        }
+    }
+
+    public static synchronized void setTimeoutTo( int seconds )
+    {
+        sleepTime = seconds * 1000;
+    }
+
+    public static synchronized void pass()
+    {
+        if ( mainThread == Thread.currentThread() )
+        {
+            theTestPassed = true;
+            throw new TestPassedException();
+        }
+        theTestPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    public static synchronized void fail()
+    {
+        fail( "it just plain failed! :-)" );
+    }
+
+    public static synchronized void fail( String whyFailed )
+    {
+        if ( mainThread == Thread.currentThread() )
+        {
+            throw new RuntimeException( whyFailed );
+        }
+        theTestPassed = false;
+        testGeneratedInterrupt = true;
+        failureMessage = whyFailed;
+        mainThread.interrupt();
+    }
+}
+
+class TestPassedException extends RuntimeException
+{
+}
--- a/jdk/test/java/awt/TextField/SelectionInvisibleTest/SelectionInvisibleTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/TextField/SelectionInvisibleTest/SelectionInvisibleTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -27,9 +27,7 @@
 import java.awt.Point;
 import java.awt.Robot;
 import java.awt.TextField;
-import java.awt.Toolkit;
 import java.awt.event.InputEvent;
-import sun.awt.SunToolkit;
 
 /**
  * @test
@@ -54,19 +52,18 @@
         frame.add(panel);
         frame.setVisible(true);
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-        toolkit.realSync();
-
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
+        robot.waitForIdle();
+
         Point point = textField.getLocationOnScreen();
         int x = point.x + textField.getWidth() / 2;
         int y = point.y + textField.getHeight() / 2;
         robot.mouseMove(x, y);
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         robot.mousePress(InputEvent.BUTTON1_MASK);
         int N = 10;
@@ -76,7 +73,7 @@
             robot.mouseMove(x, y);
         }
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (!textField.getSelectedText().endsWith(LAST_WORD)) {
             throw new RuntimeException("Last word is not selected!");
--- a/jdk/test/java/awt/Toolkit/BadDisplayTest/BadDisplayTest.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Toolkit/BadDisplayTest/BadDisplayTest.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -1,4 +1,4 @@
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -21,23 +21,15 @@
 
 ${TESTJAVA}/bin/javac -cp ${TESTSRC} -d . ${TESTSRC}/BadDisplayTest.java
 
-
-DISPLAY=
-export DISPLAY
-
 OS=`uname -s`
 case "$OS" in
-  SunOS )
-    ${TESTJAVA}/bin/java ${TESTVMOPTS} BadDisplayTest
-    ;;
-  Linux )
-    ${TESTJAVA}/bin/java ${TESTVMOPTS} BadDisplayTest
-     ;;
-  * )
-    echo "Unsupported System: ${OS}"
-    exit 0;
-    ;;
+    Windows* | CYGWIN* | Darwin)
+        echo "Passed"; exit 0 ;;
 esac
 
+DISPLAY=SomeBadDisplay
+export DISPLAY
+
+${TESTJAVA}/bin/java ${TESTVMOPTS} BadDisplayTest
+
 exit $?
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Toolkit/RealSync/Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,405 @@
+/*
+ * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 6252005
+  @summary Tests that realSync feature works
+  @author denis.mikhalkin: area=awt.toolkit
+  @run main/timeout=6000 Test
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.LinkedList;
+import java.util.Collections;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import javax.swing.*;
+import java.awt.image.*;
+import javax.imageio.*;
+import java.io.*;
+
+/**
+ * Tests various problematic areas and how they are fixed using real-sync API:
+ * - requesting focus
+ * - showing and robot mouse pressing
+ * - showing and getting location on screen
+ * - showing and typing
+ */
+
+public class Test {
+    private static boolean doRealSync = true;
+    private static boolean someFailed = false;
+    private static Robot robot;
+    public static void main(String[] args) {
+        installListeners();
+
+        try {
+            robot = new Robot();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return;
+        }
+
+
+        int count = 100;
+        String method = null;
+        if (args.length != 0) {
+            try {
+                count = Integer.parseInt(args[0]);
+            } catch (NumberFormatException nfe) {
+                method = args[0];
+                count = 1;
+            }
+        }
+        while (count > 0 && !someFailed) {
+            run(method);
+            gc();
+            count--;
+        }
+
+        System.err.println("Total results: " + (someFailed? ("some tests failed (" + count + ")"): "ALL TESTS PASSED!!!"));
+    }
+
+    private static void gc() {
+        System.gc();
+        sleep(50);
+        System.gc();
+        Thread.yield();
+        System.gc();
+    }
+
+    private static void sleep(int time) {
+        try {
+            Thread.sleep(time);
+        } catch (InterruptedException ie) {
+        }
+    }
+
+    private static java.util.List<Object> events = Collections.synchronizedList(new LinkedList<Object>());
+
+    private static class TestFailureException extends RuntimeException {
+    }
+
+    public static void run(String method) {
+        Class cl = Test.class;
+        for (Method m : cl.getMethods()) {
+            if (Modifier.isStatic(m.getModifiers()) && m.getName().startsWith("test") && method == null ||
+                (method != null && method.equals(m.getName()))) {
+                realSync(null);
+                events.clear();
+                try {
+                    m.invoke(null);
+                } catch (TestFailureException e) {
+                    // Do nothing
+                } catch (Exception e) {
+                    fail(e);
+                }
+                reportErrors(m);
+            }
+        }
+    }
+
+    private static java.util.List<Object> errors = Collections.synchronizedList(new LinkedList<Object>());
+    public static void reportErrors(Method m) {
+        realSync(null);
+        if (errors.size() == 0) {
+//             System.err.println("Test passed: " + m.getName());
+//             System.err.println("------------------------------------------------------\nEvents for " + m.getName());
+//             for (Object e : events) {
+//                 System.err.println(e);
+//             }
+            return;
+        }
+
+        someFailed = true;
+        System.err.println("Test failed: " + m.getName());
+        for (Object error : errors) {
+            if (error instanceof Throwable) {
+                ((Throwable)error).printStackTrace();
+            } else {
+                System.err.println("Cause: " + error);
+            }
+        }
+        System.err.println("Events:");
+        synchronized(events) {
+            for (Object e : events) {
+                System.err.println(e);
+            }
+        }
+        errors.clear();
+        System.exit(1);
+    }
+
+    public static void asser(boolean value) {
+        if (!value) {
+            fail("Test failed");
+        }
+    }
+    public static void asser(boolean value, String msg) {
+        if (!value) {
+            fail(msg);
+        }
+    }
+    static int screenNum = 0;
+    public static void fail(Object cause) {
+        synchronized (events) {
+            events.add("FAILURE MOMENT");
+        }
+        errors.add(cause);
+        errors.add("- Focus owner: " + KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner());
+        errors.add("- Focused window: " + KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow());
+//         try {
+//             Robot r = new Robot();
+//             BufferedImage image = r.createScreenCapture(new Rectangle(0, 0, 1024, 768));
+//             ImageIO.write(image, "GIF", new File("/tmp/screen" + screenNum + ".gif"));
+//             screenNum++;
+//             image.flush();
+//         } catch (Exception e) {
+//         }
+    }
+
+    public static void _test1() {
+        Frame f = new Frame();
+        f.setLocation(100, 100);
+
+        f.setVisible(true);
+
+        Point loc = new Point(100, 100);
+        robot.mouseMove(loc.x+30, loc.y+40);
+
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        try {
+            Thread.sleep(3000);
+        } catch (InterruptedException ie) {
+        }
+    }
+
+    public static void testType() {
+        Frame f = new Frame("testType");
+        f.setLayout(new BorderLayout());
+        TextField b = new TextField();
+        f.add(b, BorderLayout.CENTER);
+        f.setBounds(100, 100, 200, 200);
+
+        f.setVisible(true);
+        realSync(f);
+
+        f.toFront();
+        realSync(f);
+        b.requestFocus();
+        realSync(f);
+        asser(b.isFocusOwner(), "Couldn't focus text field");
+
+        robot.keyPress(KeyEvent.VK_A);
+        robot.keyRelease(KeyEvent.VK_A);
+        realSync(f);
+        asser("a".equals(b.getText()), "Wrong text: " + b.getText());
+        f.dispose();
+    }
+
+    public static void testTypeSwing() {
+        JFrame f = new JFrame("testTypeSwing");
+        f.setLayout(new BorderLayout());
+        JTextField b = new JTextField();
+        f.add(b, BorderLayout.CENTER);
+        f.setBounds(100, 100, 200, 200);
+
+        f.setVisible(true);
+        realSync(f);
+
+        f.toFront();
+        realSync(f);
+        b.requestFocus();
+        realSync(f);
+        asser(b.isFocusOwner(), "Couldn't focus text field");
+
+        robot.keyPress(KeyEvent.VK_A);
+        robot.keyRelease(KeyEvent.VK_A);
+        realSync(f);
+        asser("a".equals(b.getText()), "Wrong text: " + b.getText());
+        f.dispose();
+    }
+
+    private static boolean pressed;
+    public static void testPress() {
+        Frame f = new Frame("testPress");
+        f.setLayout(new FlowLayout());
+        Button b = new Button("b");
+        b.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    pressed = true;
+                }
+            });
+        f.add(b);
+        f.setBounds(100, 100, 200, 200);
+
+        f.setVisible(true);
+        realSync(f);
+
+        Point loc = b.getLocationOnScreen();
+        events.add("Pressing at " + loc);
+        robot.mouseMove(loc.x+3, loc.y+3);
+        pressed = false;
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        realSync(f);
+        asser(pressed, "Not pressed");
+        f.dispose();
+    }
+
+    public static void testPressSwing() {
+        JFrame f = new JFrame("testPressSwing");
+        f.setLayout(new FlowLayout());
+        JButton b = new JButton("b");
+        b.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    pressed = true;
+                }
+            });
+        f.add(b);
+        f.setBounds(100, 100, 200, 200);
+
+        f.setVisible(true);
+        realSync(f);
+
+        Point loc = b.getLocationOnScreen();
+        events.add("Pressing at " + loc);
+        robot.mouseMove(loc.x+3, loc.y+3);
+        pressed = false;
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        realSync(f);
+        asser(pressed, "Not pressed");
+        f.dispose();
+    }
+
+    public static void testFocus0() {
+        Frame f = new Frame("testFocus0");
+        f.setLayout(new FlowLayout());
+        Button b1 = new Button("b1");
+        Button b2 = new Button("b2");
+        f.add(b1);
+        f.add(b2);
+        f.setBounds(100, 100, 200, 200);
+        f.setVisible(true);
+        realSync(f);
+        f.toFront();
+        realSync(f);
+        asser(b1.isFocusOwner(), "B1 didn't get focus");
+        b2.requestFocus();
+        realSync(f);
+        asser(b2.isFocusOwner(), "Couldn't focus b2");
+        f.dispose();
+    }
+
+    public static void testFocus1() {
+        Frame f = new Frame("testFocus1");
+        f.setLayout(new FlowLayout());
+        Button b1 = new Button("b1");
+        f.add(b1);
+        f.setBounds(100, 100, 200, 200);
+        f.setVisible(true);
+        realSync(f);
+        f.toFront();
+        realSync(f);
+        asser(b1.isFocusOwner(), "B1 didn't get focus");
+        f.dispose();
+    }
+
+    public static void testFocus2() {
+        Frame f = new Frame("testFocus2");
+        f.setLayout(new FlowLayout());
+        Button b1 = new Button("b1");
+        Button b2 = new Button("b2");
+        f.add(b1);
+        f.add(b2);
+        f.setBounds(100, 100, 200, 200);
+        f.setVisible(true);
+        realSync(f);
+        f.toFront();
+        realSync(f);
+        b2.requestFocus();
+        realSync(f);
+        if (!b2.isFocusOwner()) {
+            fail("1: " + KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner());
+        } else {
+            // Half passed
+            b1.requestFocus();
+            realSync(f);
+            asser(b1.isFocusOwner(), "B1 couldn't get focus");
+        }
+        f.dispose();
+    }
+
+    public static void testFocus2Swing() {
+        JFrame f = new JFrame("testFocus2Swing");
+        f.setLayout(new FlowLayout());
+        JButton b1 = new JButton("b1");
+        JButton b2 = new JButton("b2");
+        f.add(b1);
+        f.add(b2);
+        f.setBounds(100, 100, 200, 200);
+        f.setVisible(true);
+        realSync(f);
+        f.toFront();
+        realSync(f);
+        b2.requestFocus();
+        realSync(f);
+        if (!b2.isFocusOwner()) {
+            fail("1: " + KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner());
+        } else {
+            // Half passed
+            b1.requestFocus();
+            realSync(f);
+            asser(b1.isFocusOwner(), "B1 couldn't get focus");
+        }
+        f.dispose();
+    }
+
+    public static void realSync(Window w) {
+        if (doRealSync) {
+            ((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        }
+    }
+
+    public static void installListeners() {
+        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+                public void eventDispatched(AWTEvent e) {
+                    synchronized(events) {
+                        events.add(e);
+                    }
+                }
+            }, 0xffff & ~AWTEvent.HIERARCHY_EVENT_MASK);
+//         ((XToolkit)Toolkit.getDefaultToolkit()).addXEventListener(new XToolkit.XEventListener() {
+//                 public void eventProcessed(IXAnyEvent e) {
+//                     synchronized(events) {
+//                         events.add(e);
+//                     }
+//                 }
+//             });
+    }
+}
--- a/jdk/test/java/awt/Window/AlwaysOnTop/TestAlwaysOnTopBeforeShow.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Window/AlwaysOnTop/TestAlwaysOnTopBeforeShow.java	Fri Jan 09 13:28:02 2015 -0500
@@ -40,7 +40,6 @@
 import java.awt.*;
 import java.awt.event.*;
 import java.util.concurrent.atomic.AtomicBoolean;
-import sun.awt.SunToolkit;
 
 
 //*** global search and replace TestAlwaysOnTopBeforeShow with name of the test ***
@@ -53,6 +52,7 @@
     private static AtomicBoolean focused = new AtomicBoolean();
     private static AtomicBoolean pressed = new AtomicBoolean();
     private static volatile Object pressedTarget;
+    private static Robot robot = null;
     private static void init()
     {
         //*** Create instructions for the user here ***
@@ -123,10 +123,13 @@
     }//End  init()
 
     private static void waitForIdle(int mls) {
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
         try {
+            if(robot == null) {
+                robot = new Robot();
+            }
+            robot.waitForIdle();
             Thread.sleep(mls);
-        } catch (InterruptedException e) {
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
--- a/jdk/test/java/awt/Window/BackgroundIsNotUpdated/BackgroundIsNotUpdated.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Window/BackgroundIsNotUpdated/BackgroundIsNotUpdated.java	Fri Jan 09 13:28:02 2015 -0500
@@ -27,16 +27,16 @@
 import java.awt.Graphics;
 import java.awt.Point;
 import java.awt.Robot;
-import java.awt.Toolkit;
 import java.awt.Window;
 
-import sun.awt.SunToolkit;
-
 /**
  * @test
  * @bug 8001472
  * @summary Background of the window should not depend from the paint()/update()
  * @author Sergey Bylokhov
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main BackgroundIsNotUpdated
  */
 public final class BackgroundIsNotUpdated extends Window {
 
@@ -59,11 +59,12 @@
         window.setSize(300, 300);
         window.setLocationRelativeTo(null);
         window.setVisible(true);
-        sleep();
+        window.requestFocus();
+        final ExtendedRobot robot = new ExtendedRobot();
+        robot.setAutoDelay(200);
+        robot.waitForIdle(1000);
         window.setBackground(Color.GREEN);
-        sleep();
-        final Robot robot = new Robot();
-        robot.setAutoDelay(200);
+        robot.waitForIdle(1000);
         Point point = window.getLocationOnScreen();
         Color color = robot.getPixelColor(point.x + window.getWidth() / 2,
                                           point.y + window.getHeight() / 2);
@@ -73,12 +74,4 @@
                     "Expected: " + Color.GREEN + " , Actual: " + color);
         }
     }
-
-    private static void sleep() {
-        try {
-            ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
-            Thread.sleep(1000);
-        } catch (InterruptedException ignored) {
-        }
-    }
 }
--- a/jdk/test/java/awt/Window/TranslucentJAppletTest/TranslucentJAppletTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/Window/TranslucentJAppletTest/TranslucentJAppletTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -65,7 +65,6 @@
     public static void main(String[] args)
         throws Exception
     {
-        sun.awt.SunToolkit tk = (sun.awt.SunToolkit)Toolkit.getDefaultToolkit();
 
         final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
         for (GraphicsDevice gd : ge.getScreenDevices()) {
@@ -96,7 +95,7 @@
                 initAndShowGUI();
             }
         });
-        tk.realSync();
+        r.waitForIdle();
 
         if (!paintComponentCalled) {
             throw new RuntimeException("Test FAILED: panel's paintComponent() method is not called");
--- a/jdk/test/java/awt/dnd/ImageTransferTest/ImageTransferTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/dnd/ImageTransferTest/ImageTransferTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -25,16 +25,16 @@
   @test
   @bug 4397404 4720930
   @summary tests that images of all supported native image formats are transfered properly
+  @library ../../../../lib/testlibrary
   @library ../../regtesthelpers/process/
-  @build ProcessResults ProcessCommunicator
+  @build jdk.testlibrary.OSInfo ProcessResults ProcessCommunicator
   @author gas@sparc.spb.su area=Clipboard
   @run main ImageTransferTest
 */
 
-import sun.awt.OSInfo;
-import sun.awt.SunToolkit;
 import test.java.awt.regtesthelpers.process.ProcessCommunicator;
 import test.java.awt.regtesthelpers.process.ProcessResults;
+import jdk.testlibrary.OSInfo;
 
 import java.awt.*;
 import java.awt.datatransfer.DataFlavor;
@@ -105,11 +105,15 @@
 
 
 class Util {
+    private static Robot srobot = null;
     public static void sync() {
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
         try {
+            if(srobot == null) {
+                srobot = new Robot();
+            }
+            srobot.waitForIdle();
             Thread.sleep(500);
-        } catch (InterruptedException e) {
+        } catch (Exception e) {
             throw new RuntimeException(e);
         }
     }
--- a/jdk/test/java/awt/dnd/MissingDragExitEventTest/MissingDragExitEventTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/dnd/MissingDragExitEventTest/MissingDragExitEventTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -34,7 +34,6 @@
 import java.awt.Color;
 import java.awt.Point;
 import java.awt.Robot;
-import java.awt.Toolkit;
 import java.awt.dnd.DnDConstants;
 import java.awt.dnd.DropTarget;
 import java.awt.dnd.DropTargetAdapter;
@@ -49,7 +48,6 @@
 import javax.swing.JTextArea;
 import javax.swing.SwingUtilities;
 
-import sun.awt.SunToolkit;
 import test.java.awt.regtesthelpers.Util;
 
 public class MissingDragExitEventTest {
@@ -108,7 +106,7 @@
             } finally {
                 r.mouseRelease(InputEvent.BUTTON1_MASK);
             }
-            sleep();
+            sleep(r);
 
             if (FAILED || !MOUSE_ENTERED || !MOUSE_ENTERED_DT || !MOUSE_EXIT
                     || !MOUSE_EXIT_TD) {
@@ -121,12 +119,12 @@
         }
     }
 
-    private static void sleep() {
+    private static void sleep(Robot robot) {
         try {
             Thread.sleep(10000);
         } catch (InterruptedException ignored) {
         }
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
     }
 
     static class TestdropTargetListener extends DropTargetAdapter {
--- a/jdk/test/java/awt/event/InputEvent/EventWhenTest/EventWhenTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/event/InputEvent/EventWhenTest/EventWhenTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -21,8 +21,6 @@
  * questions.
  */
 
-import sun.awt.SunToolkit;
-
 import java.awt.*;
 import java.awt.event.AWTEventListener;
 import java.awt.event.InputEvent;
@@ -71,7 +69,6 @@
 
     public static void main(String[] args) throws Exception {
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Frame frame = new Frame();
 
         try {
@@ -79,9 +76,9 @@
             frame.setBounds(300, 300, 300, 300);
             frame.add(b);
             frame.setVisible(true);
-            toolkit.realSync();
 
             Robot robot = new Robot();
+            robot.waitForIdle();
             robot.mouseMove((int)frame.getLocationOnScreen().getX() + 150,
                     (int)frame.getLocationOnScreen().getY() + 150);
 
@@ -104,7 +101,7 @@
             System.out.println("Clicking mouse done: " + eventsCount + " events.");
 
             b.requestFocusInWindow();
-            toolkit.realSync();
+            robot.waitForIdle();
 
             eventsCount = 0;
             System.out.println("Typing a key...");
--- a/jdk/test/java/awt/event/KeyEvent/8020209/bug8020209.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/event/KeyEvent/8020209/bug8020209.java	Fri Jan 09 13:28:02 2015 -0500
@@ -26,13 +26,16 @@
  * @bug 8020209
  * @summary [macosx] Mac OS X key event confusion for "COMMAND PLUS"
  * @author leonid.romanov@oracle.com
+ * @library ../../../../../lib/testlibrary
+ * @build jdk.testlibrary.OSInfo
  * @run main bug8020209
  */
 
-import sun.awt.*;
 import java.awt.*;
 import java.awt.event.*;
 
+import jdk.testlibrary.OSInfo;
+
 public class bug8020209 {
     static volatile int listenerCallCounter = 0;
 
@@ -43,19 +46,18 @@
     };
 
     public static void main(String[] args) throws Exception {
-        if (sun.awt.OSInfo.getOSType() != sun.awt.OSInfo.OSType.MACOSX) {
+        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
             System.out.println("This test is for MacOS only. Automatically passed on other platforms.");
             return;
         }
 
         System.setProperty("apple.laf.useScreenMenuBar", "true");
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
         createAndShowGUI();
-        toolkit.realSync();
+        robot.waitForIdle();
 
         for (int i = 0; i < keyStrokes.length; ++i) {
             AWTKeyStroke ks = keyStrokes[i];
@@ -68,7 +70,7 @@
 
             robot.keyRelease(modKeyCode);
 
-            toolkit.realSync();
+            robot.waitForIdle();
 
             if (listenerCallCounter != 4) {
                 throw new Exception("Test failed: KeyListener for '" + ks.toString() +
--- a/jdk/test/java/awt/event/KeyEvent/DeadKey/DeadKeyMacOSXInputText.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/event/KeyEvent/DeadKey/DeadKeyMacOSXInputText.java	Fri Jan 09 13:28:02 2015 -0500
@@ -26,18 +26,19 @@
  * @bug 7199180
  * @summary [macosx] Dead keys handling for input methods
  * @author alexandr.scherbatiy area=awt.event
+ * @library ../../../../../lib/testlibrary
+ * @build jdk.testlibrary.OSInfo
  * @run main DeadKeyMacOSXInputText
  */
 import java.awt.*;
 import java.awt.event.*;
 import java.awt.event.KeyEvent;
 import javax.swing.JTextField;
-import sun.awt.OSInfo;
-import sun.awt.SunToolkit;
+
+import jdk.testlibrary.OSInfo;
 
 public class DeadKeyMacOSXInputText {
 
-    private static SunToolkit toolkit;
     private static volatile int state = 0;
 
     public static void main(String[] args) throws Exception {
@@ -46,11 +47,10 @@
             return;
         }
 
-        toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
-        createAndShowGUI();
+        createAndShowGUI(robot);
 
         // Pressed keys: Alt + E + A
         // Results:  ALT + VK_DEAD_ACUTE + a with accute accent
@@ -61,14 +61,14 @@
 
         robot.keyPress(KeyEvent.VK_A);
         robot.keyRelease(KeyEvent.VK_A);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (state != 3) {
             throw new RuntimeException("Wrong number of key events.");
         }
     }
 
-    static void createAndShowGUI() {
+    static void createAndShowGUI(Robot robot) {
         Frame frame = new Frame();
         frame.setSize(300, 300);
         Panel panel = new Panel(new BorderLayout());
@@ -77,10 +77,10 @@
         panel.add(textField, BorderLayout.CENTER);
         frame.add(panel);
         frame.setVisible(true);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         textField.requestFocusInWindow();
-        toolkit.realSync();
+        robot.waitForIdle();
 
     }
 
--- a/jdk/test/java/awt/event/KeyEvent/DeadKey/DeadKeySystemAssertionDialog.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/event/KeyEvent/DeadKey/DeadKeySystemAssertionDialog.java	Fri Jan 09 13:28:02 2015 -0500
@@ -24,9 +24,7 @@
 import java.awt.Frame;
 import java.awt.Robot;
 import java.awt.TextField;
-import java.awt.Toolkit;
 import java.awt.event.KeyEvent;
-import sun.awt.SunToolkit;
 /*
  * @test
  * @bug 8013849
@@ -39,25 +37,25 @@
 
     public static void main(String[] args) throws Exception {
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Frame frame = new Frame();
         frame.setSize(300, 200);
 
         TextField textField = new TextField();
         frame.add(textField);
 
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
         frame.setVisible(true);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         textField.requestFocus();
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // Check that the system assertion dialog does not block Java
-        Robot robot = new Robot();
-        robot.setAutoDelay(50);
         robot.keyPress(KeyEvent.VK_A);
         robot.keyRelease(KeyEvent.VK_A);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         frame.setVisible(false);
         frame.dispose();
--- a/jdk/test/java/awt/event/KeyEvent/DeadKey/deadKeyMacOSX.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/event/KeyEvent/DeadKey/deadKeyMacOSX.java	Fri Jan 09 13:28:02 2015 -0500
@@ -26,18 +26,19 @@
  * @bug 7196547
  * @summary Dead Key implementation for KeyEvent on Mac OS X
  * @author alexandr.scherbatiy area=awt.event
+ * @library ../../../../../lib/testlibrary
+ * @build  jdk.testlibrary.OSInfo
  * @run main deadKeyMacOSX
  */
 
 import java.awt.*;
 import java.awt.event.*;
 import java.awt.event.KeyEvent;
-import sun.awt.OSInfo;
-import sun.awt.SunToolkit;
+
+import jdk.testlibrary.OSInfo;
 
 public class deadKeyMacOSX {
 
-    private static SunToolkit toolkit;
     private static volatile int state = 0;
 
     public static void main(String[] args) throws Exception {
@@ -46,11 +47,10 @@
             return;
         }
 
-        toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
-        createAndShowGUI();
+        createAndShowGUI(robot);
 
         // Pressed keys: Alt + E + A
         // Results:  ALT + VK_DEAD_ACUTE + a with accute accent
@@ -67,17 +67,17 @@
         }
     }
 
-    static void createAndShowGUI() {
+    static void createAndShowGUI(Robot robot) {
         Frame frame = new Frame();
         frame.setSize(300, 300);
         Panel panel = new Panel();
         panel.addKeyListener(new DeadKeyListener());
         frame.add(panel);
         frame.setVisible(true);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         panel.requestFocusInWindow();
-        toolkit.realSync();
+        robot.waitForIdle();
     }
 
     static class DeadKeyListener extends KeyAdapter {
--- a/jdk/test/java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -23,17 +23,16 @@
 
 import java.awt.Frame;
 import java.awt.Robot;
-import java.awt.Toolkit;
 import java.awt.event.KeyEvent;
 import java.awt.event.KeyAdapter;
-import sun.awt.ExtendedKeyCodes;
-import sun.awt.SunToolkit;
 
 /*
  * @test
  * @bug 8007156 8025126
  * @summary Extended key code is not set for a key event
  * @author Alexandr Scherbatiy
+ * @library ../../../../../lib/testlibrary
+ * @build ExtendedRobot
  * @run main ExtendedKeyCodeTest
  */
 public class ExtendedKeyCodeTest {
@@ -42,8 +41,7 @@
     private static volatile int eventsCount = 0;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-        Robot robot = new Robot();
+        ExtendedRobot robot = new ExtendedRobot();
         robot.setAutoDelay(50);
 
         Frame frame = new Frame();
@@ -55,23 +53,23 @@
             public void keyPressed(KeyEvent e) {
                 eventsCount++;
                 setExtendedKeyCode = setExtendedKeyCode && (e.getExtendedKeyCode()
-                        == ExtendedKeyCodes.getExtendedKeyCodeForChar(e.getKeyChar()));
+                        == KeyEvent.getExtendedKeyCodeForChar(e.getKeyChar()));
             }
 
             @Override
             public void keyReleased(KeyEvent e) {
                 eventsCount++;
                 setExtendedKeyCode = setExtendedKeyCode && (e.getExtendedKeyCode()
-                        == ExtendedKeyCodes.getExtendedKeyCodeForChar(e.getKeyChar()));
+                        == KeyEvent.getExtendedKeyCodeForChar(e.getKeyChar()));
             }
         });
 
         frame.setVisible(true);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         robot.keyPress(KeyEvent.VK_D);
         robot.keyRelease(KeyEvent.VK_D);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         frame.dispose();
 
@@ -92,11 +90,11 @@
         });
 
         frame.setVisible(true);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         robot.keyPress(KeyEvent.VK_LEFT);
         robot.keyRelease(KeyEvent.VK_LEFT);
-        toolkit.realSync();
+        robot.waitForIdle();
         frame.dispose();
 
         if (!setExtendedKeyCode) {
--- a/jdk/test/java/awt/event/KeyEvent/KeyChar/KeyCharTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/event/KeyEvent/KeyChar/KeyCharTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -28,7 +28,6 @@
 import java.awt.event.AWTEventListener;
 import java.awt.event.KeyEvent;
 import java.util.Locale;
-import sun.awt.SunToolkit;
 
 /*
  * @test
@@ -59,18 +58,18 @@
 
     public static void main(String[] args) throws Exception {
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
 
         Frame frame = new Frame();
         frame.setSize(300, 300);
         frame.setVisible(true);
-        toolkit.realSync();
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+        robot.waitForIdle();
 
-        Robot robot = new Robot();
 
         robot.keyPress(KeyEvent.VK_DELETE);
         robot.keyRelease(KeyEvent.VK_DELETE);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         frame.dispose();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/MouseEvent/ClickDuringKeypress/ClickDuringKeypress.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 1.2 98/08/05
+  @bug 4515763
+  @summary Tests that clicking mouse and pressing keys generates correct amount of click-counts
+  @author andrei.dmitriev: area=awt.mouse
+  @run main ClickDuringKeypress
+*/
+
+/**
+ * ClickDuringKeypress.java
+ *
+ * summary:
+ */
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+
+public class ClickDuringKeypress implements MouseListener
+ {
+   //Declare things used in the test, like buttons and labels here
+   final static int CLICKCOUNT = 10;
+   final static int DOUBLE_CLICK_AUTO_DELAY = 10;
+   volatile int lastClickCount = 0;
+   volatile boolean clicked = false;
+   volatile boolean ready = false;
+
+   Frame frame;
+   Robot robot;
+
+   public void init()
+    {
+      //Create instructions for the user here, as well as set up
+      // the environment -- set the layout manager, add buttons,
+      // etc.
+
+      frame = new Frame("ClickDuringKeypress");
+      frame.addMouseListener(this);
+      frame.addWindowListener(new WindowAdapter() {
+          public void windowActivated(WindowEvent e) {
+              synchronized(ClickDuringKeypress.this) {
+                  ready = true;
+                  ClickDuringKeypress.this.notifyAll();
+              }
+          }
+      });
+      frame.setBounds(0, 0, 400, 400);
+
+      start();
+
+    }//End  init()
+
+   public void start ()
+    {
+      try {
+        robot = new Robot();
+      } catch (AWTException e) {
+        System.out.println("Could not create Robot.");
+        throw new RuntimeException("Couldn't create Robot.  Test fails");
+      }
+
+      robot.mouseMove(200, 200);
+      frame.show();
+
+      synchronized(this) {
+          try {
+              if (!ready) {
+                  wait(10000);
+              }
+          } catch (InterruptedException ex) {
+          }
+          if (!ready) {
+              System.out.println("Not Activated. Test fails");
+              throw new RuntimeException("Not Activated. Test fails");
+          }
+      }
+
+      doTest();
+
+      //What would normally go into main() will probably go here.
+      //Use System.out.println for diagnostic messages that you want
+      //to read after the test is done.
+      //Use Sysout.println for messages you want the tester to read.
+
+    }// start()
+
+    // Mouse should be over the Frame by this point
+    private void doTest() {
+      robot.setAutoDelay(2000);
+      robot.waitForIdle();
+      robot.keyPress(KeyEvent.VK_B);
+      robot.mousePress(InputEvent.BUTTON1_MASK);
+      robot.delay(10);
+      robot.mouseRelease(InputEvent.BUTTON1_MASK);
+      // Should trigger mouseClicked
+      robot.keyRelease(KeyEvent.VK_B);
+      robot.delay(1000);
+
+      robot.setAutoDelay(DOUBLE_CLICK_AUTO_DELAY);
+      for (int i = 0; i < CLICKCOUNT / 2; i++) {
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.delay(10);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.keyPress(KeyEvent.VK_B);
+        robot.delay(10);
+        robot.keyRelease(KeyEvent.VK_B);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.delay(10);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+      }
+      robot.waitForIdle();
+      // check results
+      robot.delay(200);
+      if (!clicked) {
+          System.out.println("No MOUSE_CLICKED events received.  Test fails.");
+          throw new RuntimeException("No MOUSE_CLICKED events received.  Test fails.");
+      }
+      if (lastClickCount != CLICKCOUNT) {
+          System.out.println("Actual click count: " + lastClickCount + " does not match expected click count: " + CLICKCOUNT + ".  Test fails");
+          throw new RuntimeException("Actual click count: " + lastClickCount + " does not match expected click count: " + CLICKCOUNT + ".  Test fails");
+
+      }
+      // else test passes.
+    }
+
+    public void mouseEntered(MouseEvent e) {}
+    public void mouseExited(MouseEvent e) {}
+    public void mousePressed(MouseEvent e) {}
+    public void mouseReleased(MouseEvent e) {}
+    public void mouseClicked(MouseEvent e) {
+        System.out.println(e.toString());
+        clicked = true;
+        lastClickCount = e.getClickCount();
+    }
+
+     public static void main(String[] args) {
+         new ClickDuringKeypress().init();
+     }
+
+ }// class ClickDuringKeypress
--- a/jdk/test/java/awt/event/MouseWheelEvent/DisabledComponent/DisabledComponent.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/event/MouseWheelEvent/DisabledComponent/DisabledComponent.java	Fri Jan 09 13:28:02 2015 -0500
@@ -24,9 +24,9 @@
 /*
   @test
   @bug 6847958
-  @library ../../../regtesthelpers
   @summary MouseWheel event is getting triggered for the disabled Textarea in jdk7 b60 pit build.
   @author Dmitry Cherepanov: area=awt.event
+  @library ../../../regtesthelpers
   @build Util
   @run main DisabledComponent
 */
@@ -40,8 +40,6 @@
 import java.awt.*;
 import java.awt.event.*;
 
-import sun.awt.SunToolkit;
-
 import test.java.awt.regtesthelpers.Util;
 
 public class DisabledComponent
@@ -72,21 +70,21 @@
                 }
             };
 
+        Robot robot = new Robot();
+
 
         list.addMouseWheelListener(listener);
         textArea.addMouseWheelListener(listener);
 
         frame.setVisible(true);
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
-
-        Robot robot = new Robot();
+        robot.waitForIdle();
 
         // point and wheel on the list
         Util.pointOnComp(list, robot);
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         robot.mouseWheel(2);
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         // disable the text area
         System.err.println(" disable text area ");
@@ -95,10 +93,10 @@
 
         // point and wheel on the text area
         Util.pointOnComp(textArea, robot);
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         robot.mouseWheel(2);
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         if (!passed) {
             throw new RuntimeException(" wrong wheel events ");
--- a/jdk/test/java/awt/grab/EmbeddedFrameTest1/EmbeddedFrameTest1.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/grab/EmbeddedFrameTest1/EmbeddedFrameTest1.java	Fri Jan 09 13:28:02 2015 -0500
@@ -27,7 +27,7 @@
   @summary REGRESSION: Popup menus dont respond to selections when extend outside Applet
   @author oleg.sukhodolsky area=awt.grab
   @library ../../regtesthelpers
-  @build Util
+  @build Util UtilInternal
   @run main EmbeddedFrameTest1
 */
 
@@ -44,6 +44,7 @@
 import java.awt.Robot;
 import java.awt.TextArea;
 import java.awt.Toolkit;
+import java.awt.AWTException;
 
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -51,40 +52,21 @@
 import javax.swing.JButton;
 import javax.swing.JPopupMenu;
 
-import sun.awt.SunToolkit;
-
 import test.java.awt.regtesthelpers.Util;
+import test.java.awt.regtesthelpers.UtilInternal;
 
 public class EmbeddedFrameTest1
 {
-    private static void init()
+    public static void main( String args[] ) throws AWTException
     {
-        //*** Create instructions for the user here ***
-
-        String[] instructions = {
-            "This is an AUTOMATIC test, simply wait until it is done.",
-            "The result (passed or failed) will be shown in the",
-            "message window below."
-        };
-
-        Sysout.createDialog( );
-        Sysout.printInstructions( instructions );
-
-        SunToolkit tk = (SunToolkit) Toolkit.getDefaultToolkit();
-        if ("sun.awt.motif.MToolkit".equals(tk.getClass().getName())) {
-            System.out.println("We shouldn't test MToolkit.");
-            EmbeddedFrameTest1.pass();
-            return;
-        }
-
         try {
             final Frame frame = new Frame("AWT Frame");
             frame.pack();
             frame.setSize(200,200);
 
-            final Frame embedded_frame = Util.createEmbeddedFrame(frame);
+            final Frame embedded_frame = UtilInternal.createEmbeddedFrame(frame);
             embedded_frame.setSize(200, 200);
-            Sysout.println("embedded_frame = " + embedded_frame);
+            System.out.println("embedded_frame = " + embedded_frame);
 
             final JPopupMenu menu = new JPopupMenu();
             JButton item = new JButton("A button in popup");
@@ -110,12 +92,12 @@
             p.validate();
             frame.setVisible(true);
             Robot robot = new Robot();
-            tk.realSync();
+            robot.waitForIdle();
             Util.clickOnComp(btn, robot);
-            tk.realSync();
+            robot.waitForIdle();
 
             Util.clickOnComp(item, robot);
-            tk.realSync();
+            robot.waitForIdle();
             if (item.getMousePosition() == null) {
                 throw new RuntimeException("Popup was not closed (mouse above it)");
             }
@@ -124,268 +106,7 @@
             frame.dispose();
         } catch (Throwable thr) {
             thr.printStackTrace();
-            EmbeddedFrameTest1.fail("TEST FAILED: " + thr);
-        }
-        EmbeddedFrameTest1.pass();
-    }//End  init()
-
-    /*****************************************************
-     * Standard Test Machinery Section
-     * DO NOT modify anything in this section -- it's a
-     * standard chunk of code which has all of the
-     * synchronisation necessary for the test harness.
-     * By keeping it the same in all tests, it is easier
-     * to read and understand someone else's test, as
-     * well as insuring that all tests behave correctly
-     * with the test harness.
-     * There is a section following this for test-
-     * classes
-     ******************************************************/
-    private static boolean theTestPassed = false;
-    private static boolean testGeneratedInterrupt = false;
-    private static String failureMessage = "";
-
-    private static Thread mainThread = null;
-
-    private static int sleepTime = 300000;
-
-    // Not sure about what happens if multiple of this test are
-    //  instantiated in the same VM.  Being static (and using
-    //  static vars), it aint gonna work.  Not worrying about
-    //  it for now.
-    public static void main( String args[] ) throws InterruptedException
-    {
-        mainThread = Thread.currentThread();
-        try
-        {
-            init();
-        }
-        catch( TestPassedException e )
-        {
-            //The test passed, so just return from main and harness will
-            // interepret this return as a pass
-            return;
-        }
-        //At this point, neither test pass nor test fail has been
-        // called -- either would have thrown an exception and ended the
-        // test, so we know we have multiple threads.
-
-        //Test involves other threads, so sleep and wait for them to
-        // called pass() or fail()
-        try
-        {
-            Thread.sleep( sleepTime );
-            //Timed out, so fail the test
-            throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
+            throw new RuntimeException("TEST FAILED: " + thr);
         }
-        catch (InterruptedException e)
-        {
-            //The test harness may have interrupted the test.  If so, rethrow the exception
-            // so that the harness gets it and deals with it.
-            if( ! testGeneratedInterrupt ) throw e;
-
-            //reset flag in case hit this code more than once for some reason (just safety)
-            testGeneratedInterrupt = false;
-
-            if ( theTestPassed == false )
-            {
-                throw new RuntimeException( failureMessage );
-            }
-        }
-
-    }//main
-
-    public static synchronized void setTimeoutTo( int seconds )
-    {
-        sleepTime = seconds * 1000;
     }
-
-    public static synchronized void pass()
-    {
-        Sysout.println( "The test passed." );
-        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
-        //first check if this is executing in main thread
-        if ( mainThread == Thread.currentThread() )
-        {
-            //Still in the main thread, so set the flag just for kicks,
-            // and throw a test passed exception which will be caught
-            // and end the test.
-            theTestPassed = true;
-            throw new TestPassedException();
-        }
-        theTestPassed = true;
-        testGeneratedInterrupt = true;
-        mainThread.interrupt();
-    }//pass()
-
-    public static synchronized void fail()
-    {
-        //test writer didn't specify why test failed, so give generic
-        fail( "it just plain failed! :-)" );
-    }
-
-    public static synchronized void fail( String whyFailed )
-    {
-        Sysout.println( "The test failed: " + whyFailed );
-        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
-        //check if this called from main thread
-        if ( mainThread == Thread.currentThread() )
-        {
-            //If main thread, fail now 'cause not sleeping
-            throw new RuntimeException( whyFailed );
-        }
-        theTestPassed = false;
-        testGeneratedInterrupt = true;
-        failureMessage = whyFailed;
-        mainThread.interrupt();
-    }//fail()
-
-}// class EmbeddedFrameTest1
-
-//This exception is used to exit from any level of call nesting
-// when it's determined that the test has passed, and immediately
-// end the test.
-class TestPassedException extends RuntimeException
-{
 }
-
-//*********** End Standard Test Machinery Section **********
-
-
-/****************************************************
- Standard Test Machinery
- DO NOT modify anything below -- it's a standard
-  chunk of code whose purpose is to make user
-  interaction uniform, and thereby make it simpler
-  to read and understand someone else's test.
- ****************************************************/
-
-/**
- This is part of the standard test machinery.
- It creates a dialog (with the instructions), and is the interface
-  for sending text messages to the user.
- To print the instructions, send an array of strings to Sysout.createDialog
-  WithInstructions method.  Put one line of instructions per array entry.
- To display a message for the tester to see, simply call Sysout.println
-  with the string to be displayed.
- This mimics System.out.println but works within the test harness as well
-  as standalone.
- */
-
-class Sysout
-{
-    private static TestDialog dialog;
-
-    public static void createDialogWithInstructions( String[] instructions )
-    {
-        dialog = new TestDialog( new Frame(), "Instructions" );
-        dialog.printInstructions( instructions );
-        dialog.setVisible(true);
-        println( "Any messages for the tester will display here." );
-    }
-
-    public static void createDialog( )
-    {
-        dialog = new TestDialog( new Frame(), "Instructions" );
-        String[] defInstr = { "Instructions will appear here. ", "" } ;
-        dialog.printInstructions( defInstr );
-        dialog.setVisible(true);
-        println( "Any messages for the tester will display here." );
-    }
-
-
-    public static void printInstructions( String[] instructions )
-    {
-        dialog.printInstructions( instructions );
-    }
-
-
-    public static void println( String messageIn )
-    {
-        dialog.displayMessage( messageIn );
-        System.out.println(messageIn);
-    }
-
-}// Sysout  class
-
-/**
-  This is part of the standard test machinery.  It provides a place for the
-   test instructions to be displayed, and a place for interactive messages
-   to the user to be displayed.
-  To have the test instructions displayed, see Sysout.
-  To have a message to the user be displayed, see Sysout.
-  Do not call anything in this dialog directly.
-  */
-class TestDialog extends Dialog
-{
-
-    TextArea instructionsText;
-    TextArea messageText;
-    int maxStringLength = 80;
-
-    //DO NOT call this directly, go through Sysout
-    public TestDialog( Frame frame, String name )
-    {
-        super( frame, name );
-        int scrollBoth = TextArea.SCROLLBARS_BOTH;
-        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
-        add( "North", instructionsText );
-
-        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
-        add("Center", messageText);
-
-        pack();
-
-        setVisible(true);
-    }// TestDialog()
-
-    //DO NOT call this directly, go through Sysout
-    public void printInstructions( String[] instructions )
-    {
-        //Clear out any current instructions
-        instructionsText.setText( "" );
-
-        //Go down array of instruction strings
-
-        String printStr, remainingStr;
-        for( int i=0; i < instructions.length; i++ )
-        {
-            //chop up each into pieces maxSringLength long
-            remainingStr = instructions[ i ];
-            while( remainingStr.length() > 0 )
-            {
-                //if longer than max then chop off first max chars to print
-                if( remainingStr.length() >= maxStringLength )
-                {
-                    //Try to chop on a word boundary
-                    int posOfSpace = remainingStr.
-                        lastIndexOf( ' ', maxStringLength - 1 );
-
-                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
-
-                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
-                    remainingStr = remainingStr.substring( posOfSpace + 1 );
-                }
-                //else just print
-                else
-                {
-                    printStr = remainingStr;
-                    remainingStr = "";
-                }
-
-                instructionsText.append( printStr + "\n" );
-
-            }// while
-
-        }// for
-
-    }//printInstructions()
-
-    //DO NOT call this directly, go through Sysout
-    public void displayMessage( String messageIn )
-    {
-        messageText.append( messageIn + "\n" );
-        System.out.println(messageIn);
-    }
-
-}// TestDialog  class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/grab/MenuDragEvents/MenuDragEvents.html	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,44 @@
+<!--
+ Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ 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.
+-->
+
+<html>
+<!--
+  @test
+  @bug 6390326
+  @summary REGRESSION: Broken mouse behaviour of menus partially outside the main window.
+  @author oleg.sukhodolsky: area=awt-drab
+  @run applet MenuDragEvents.html
+  -->
+<head>
+<title>  </title>
+</head>
+<body>
+
+<h1>MenuDragEvents<br>Bug ID: 6390326 </h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="MenuDragEvents.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/grab/MenuDragEvents/MenuDragEvents.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 6390326
+  @summary REGRESSION: Broken mouse behaviour of menus partially outside the main window.
+  @author oleg.sukhodolsky: area=awt-drab
+  @run applet AutomaticAppletTest.html
+*/
+
+/**
+ * MenuDragEvents.java
+ *
+ * summary: REGRESSION: Broken mouse behaviour of menus partially outside the main window.
+ */
+
+import java.applet.Applet;
+import java.awt.AWTEvent;
+import java.awt.AWTException;
+import java.awt.BorderLayout;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Toolkit;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.AWTEventListener;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.WindowConstants;
+
+import javax.swing.event.MenuDragMouseEvent;
+import javax.swing.event.MenuDragMouseListener;
+
+public class MenuDragEvents extends Applet
+{
+    //Declare things used in the test, like buttons and labels here
+    boolean mouseDragged = false;
+    boolean mouseEntered = false;
+    boolean mouseReleased = false;
+    boolean actionReceived = false;
+
+    public void init()
+    {
+        // Set up the environment -- set the layout manager, add
+        // buttons, etc.
+
+        setLayout (new BorderLayout ());
+
+    }//End  init()
+
+    public void start ()
+    {
+        //Get things going.  Request focus, set size, et cetera
+        setSize (200,200);
+        setVisible(true);
+        validate();
+
+        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+                public void eventDispatched(AWTEvent event) {
+                    int id = event.getID();
+                    if (id == MouseEvent.MOUSE_ENTERED || id == MouseEvent.MOUSE_EXITED) {
+                        System.err.println(event);
+                    }
+                }
+            }, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK);
+        JMenuBar mb = new JMenuBar();
+
+        JMenu m = new JMenu("A Menu");
+        mb.add(m);
+
+        JMenuItem i = new JMenuItem("A menu item",KeyEvent.VK_A);
+        m.add(i);
+
+        m = new JMenu("Another Menu");
+        mb.add(m);
+        i = new JMenuItem("Yet another menu item",KeyEvent.VK_Y);
+        m.add(i);
+        i.addMenuDragMouseListener(new MenuDragMouseListener() {
+                public void menuDragMouseDragged(MenuDragMouseEvent e) {
+                    System.err.println(e);
+                    mouseDragged = true;
+                }
+                public void menuDragMouseEntered(MenuDragMouseEvent e) {
+                    System.err.println(e);
+                    mouseEntered = true;
+                }
+                public void menuDragMouseReleased(MenuDragMouseEvent e) {
+                    System.err.println(e);
+                    mouseReleased = true;
+                }
+                // perhaps we need to test mouse exited too
+                // but this doesn't work even with tiger
+                public void menuDragMouseExited(MenuDragMouseEvent e) {
+                    System.err.println(e);
+                }
+            });
+
+        i.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent ae) {
+                    System.err.println(ae);
+                    actionReceived = true;
+                }
+            });
+
+        JFrame frame = new JFrame("Menu");
+        frame.setJMenuBar(mb);
+        frame.setSize(200, 200);
+        frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+        frame.setVisible(true);
+
+        Robot r = null;
+        try {
+            r = new Robot();
+            r.setAutoDelay(50);
+        }
+        catch (AWTException ae) {
+            throw new RuntimeException(ae);
+        }
+
+        r.waitForIdle();
+
+        Point loc = m.getLocationOnScreen();
+        loc.x += m.getWidth() / 2;
+        loc.y += m.getHeight() / 2;
+        r.mouseMove(loc.x, loc.y);
+        r.mousePress(InputEvent.BUTTON1_MASK);
+
+        r.waitForIdle();
+        r.delay(1000);
+
+        Point loc2 = i.getLocationOnScreen();
+        loc2.x += i.getWidth() / 2;
+        loc2.y += i.getHeight() / 2;
+
+        // move from menu on menubar to menu item
+        dragMouse(r, loc, loc2);
+        r.mouseRelease(InputEvent.BUTTON1_MASK);
+        r.waitForIdle();
+        r.delay(1000);
+
+        if (!mouseEntered || !mouseDragged || !mouseReleased || !actionReceived) {
+            throw new RuntimeException("we expected to receive both mouseEntered and MouseDragged ("
+                                       + mouseEntered + ", " + mouseDragged + ", " + mouseReleased
+                                       + ", " + actionReceived + ")");
+        }
+
+        System.out.println("Test passed");
+    }// start()
+
+    void dragMouse(Robot r, Point from, Point to) {
+        final int n_step = 10;
+        int step_x = (to.x - from.x) / n_step;
+        int step_y = (to.y - from.y) / n_step;
+        int x = from.x;
+        int y = from.y;
+        for (int idx = 0; idx < n_step; idx++) {
+            x += step_x;
+            y += step_y;
+            r.mouseMove(x, y);
+            r.delay(10);
+        }
+        if (x != to.x || y != to.y) {
+            r.mouseMove(to.x, to.y);
+            r.delay(10);
+        }
+    }
+
+}// class MenuDragEvents
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/DrawImage/IncorrectUnmanagedImageRotatedClip.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.AlphaComposite;
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsEnvironment;
+import java.awt.Image;
+import java.awt.Rectangle;
+import java.awt.image.BufferedImage;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+import java.awt.image.DataBufferInt;
+import java.awt.image.DataBufferShort;
+import java.awt.image.VolatileImage;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+
+import static java.awt.Transparency.TRANSLUCENT;
+import static java.awt.image.BufferedImage.TYPE_INT_ARGB;
+
+/**
+ * @test
+ * @bug 8059942
+ * @summary Tests rotated clip when unmanaged image is drawn to VI.
+ *          Results of the blit to compatibleImage are used for comparison.
+ * @author Sergey Bylokhov
+ */
+public final class IncorrectUnmanagedImageRotatedClip {
+
+    public static void main(final String[] args) throws IOException {
+        BufferedImage bi = makeUnmanagedBI();
+        fill(bi);
+        test(bi);
+    }
+
+    private static void test(final BufferedImage bi) throws IOException {
+        GraphicsEnvironment ge = GraphicsEnvironment
+                .getLocalGraphicsEnvironment();
+        GraphicsConfiguration gc = ge.getDefaultScreenDevice()
+                                     .getDefaultConfiguration();
+        VolatileImage vi = gc.createCompatibleVolatileImage(500, 200,
+                                                            TRANSLUCENT);
+        BufferedImage gold = gc.createCompatibleImage(500, 200, TRANSLUCENT);
+        // draw to compatible Image
+        draw(bi, gold);
+        // draw to volatile image
+        int attempt = 0;
+        BufferedImage snapshot;
+        while (true) {
+            if (++attempt > 10) {
+                throw new RuntimeException("Too many attempts: " + attempt);
+            }
+            vi.validate(gc);
+            if (vi.validate(gc) != VolatileImage.IMAGE_OK) {
+                continue;
+            }
+            draw(bi, vi);
+            snapshot = vi.getSnapshot();
+            if (vi.contentsLost()) {
+                continue;
+            }
+            break;
+        }
+        // validate images
+        for (int x = 0; x < gold.getWidth(); ++x) {
+            for (int y = 0; y < gold.getHeight(); ++y) {
+                if (gold.getRGB(x, y) != snapshot.getRGB(x, y)) {
+                    ImageIO.write(gold, "png", new File("gold.png"));
+                    ImageIO.write(snapshot, "png", new File("bi.png"));
+                    throw new RuntimeException("Test failed.");
+                }
+            }
+        }
+    }
+
+    private static void draw(final BufferedImage from,final Image to) {
+        final Graphics2D g2d = (Graphics2D) to.getGraphics();
+        g2d.setComposite(AlphaComposite.Src);
+        g2d.setColor(Color.ORANGE);
+        g2d.fillRect(0, 0, to.getWidth(null), to.getHeight(null));
+        g2d.rotate(Math.toRadians(45));
+        g2d.clip(new Rectangle(41, 42, 43, 44));
+        g2d.drawImage(from, 50, 50, Color.blue, null);
+        g2d.dispose();
+    }
+
+    private static BufferedImage makeUnmanagedBI() {
+        final BufferedImage bi = new BufferedImage(500, 200, TYPE_INT_ARGB);
+        final DataBuffer db = bi.getRaster().getDataBuffer();
+        if (db instanceof DataBufferInt) {
+            ((DataBufferInt) db).getData();
+        } else if (db instanceof DataBufferShort) {
+            ((DataBufferShort) db).getData();
+        } else if (db instanceof DataBufferByte) {
+            ((DataBufferByte) db).getData();
+        } else {
+            try {
+                bi.setAccelerationPriority(0.0f);
+            } catch (final Throwable ignored) {
+            }
+        }
+        return bi;
+    }
+
+    private static void fill(final Image image) {
+        final Graphics2D graphics = (Graphics2D) image.getGraphics();
+        graphics.setComposite(AlphaComposite.Src);
+        for (int i = 0; i < image.getHeight(null); ++i) {
+            graphics.setColor(new Color(i, 0, 0));
+            graphics.fillRect(0, i, image.getWidth(null), 1);
+        }
+        graphics.dispose();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/MultiResolutionImage/MultiResolutionImageObserverTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.Toolkit;
+import java.awt.image.BufferedImage;
+import java.awt.image.ImageObserver;
+import static java.awt.image.ImageObserver.*;
+import java.io.File;
+import javax.imageio.ImageIO;
+/*
+ * @test
+ * @bug 8065627
+ * @summary Animated GIFs fail to display on a HiDPI display
+ * @author Alexander Scherbatiy
+ * @run main MultiResolutionImageObserverTest
+ */
+
+public class MultiResolutionImageObserverTest {
+
+    private static final int TIMEOUT = 500;
+
+    public static void main(String[] args) throws Exception {
+
+        generateImages();
+        Toolkit toolkit = Toolkit.getDefaultToolkit();
+        Image image = Toolkit.getDefaultToolkit().getImage(IMAGE_NAME_1X);
+
+        LoadImageObserver sizeObserver
+                = new LoadImageObserver(WIDTH | HEIGHT);
+        toolkit.prepareImage(image, -1, -1, sizeObserver);
+        waitForImageLoading(sizeObserver, "The first observer is not called");
+
+        LoadImageObserver bitsObserver
+                = new LoadImageObserver(SOMEBITS | FRAMEBITS | ALLBITS);
+
+        BufferedImage buffImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g2d = (Graphics2D) buffImage.createGraphics();
+        g2d.scale(2, 2);
+        g2d.drawImage(image, 0, 0, bitsObserver);
+        waitForImageLoading(bitsObserver, "The second observer is not called!");
+        g2d.dispose();
+    }
+
+    private static void waitForImageLoading(LoadImageObserver observer,
+            String errorMessage) throws Exception {
+
+        long endTime = System.currentTimeMillis() + TIMEOUT;
+
+        while (!observer.loaded && System.currentTimeMillis() < endTime) {
+            Thread.sleep(TIMEOUT / 10);
+        }
+
+        if (!observer.loaded) {
+            throw new RuntimeException(errorMessage);
+        }
+    }
+
+    private static final String IMAGE_NAME_1X = "image.png";
+    private static final String IMAGE_NAME_2X = "image@2x.png";
+
+    private static void generateImages() throws Exception {
+        generateImage(1);
+        generateImage(2);
+    }
+
+    private static void generateImage(int scale) throws Exception {
+        BufferedImage image = new BufferedImage(
+                scale * 200, scale * 300,
+                BufferedImage.TYPE_INT_RGB);
+        Graphics g = image.createGraphics();
+        g.setColor(scale == 1 ? Color.GREEN : Color.BLUE);
+        g.fillRect(0, 0, scale * 200, scale * 300);
+        File file = new File(scale == 1 ? IMAGE_NAME_1X : IMAGE_NAME_2X);
+        ImageIO.write(image, "png", file);
+        g.dispose();
+    }
+
+    private static class LoadImageObserver implements ImageObserver {
+
+        private final int infoflags;
+        private boolean loaded;
+
+        public LoadImageObserver(int flags) {
+            this.infoflags = flags;
+        }
+
+        @Override
+        public boolean imageUpdate(Image img, int flags, int x, int y, int width, int height) {
+
+            if ((flags & infoflags) != 0) {
+                loaded = true;
+            }
+
+            return !loaded;
+        }
+    }
+}
--- a/jdk/test/java/awt/regtesthelpers/Util.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/awt/regtesthelpers/Util.java	Fri Jan 09 13:28:02 2015 -0500
@@ -63,8 +63,6 @@
 import java.awt.event.FocusListener;
 import java.awt.event.ActionListener;
 
-import java.awt.peer.FramePeer;
-
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
@@ -89,40 +87,6 @@
         }
     }
 
-    public static Frame createEmbeddedFrame(final Frame embedder)
-        throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException, NoSuchMethodException,
-               InstantiationException, InvocationTargetException
-    {
-        Toolkit tk = Toolkit.getDefaultToolkit();
-        FramePeer frame_peer = (FramePeer) embedder.getPeer();
-        System.out.println("frame's peer = " + frame_peer);
-        if ("sun.awt.windows.WToolkit".equals(tk.getClass().getName())) {
-            Class comp_peer_class =
-                Class.forName("sun.awt.windows.WComponentPeer");
-            System.out.println("comp peer class = " + comp_peer_class);
-            Field hwnd_field = comp_peer_class.getDeclaredField("hwnd");
-            hwnd_field.setAccessible(true);
-            System.out.println("hwnd_field =" + hwnd_field);
-            long hwnd = hwnd_field.getLong(frame_peer);
-            System.out.println("hwnd = " + hwnd);
-
-            Class clazz = Class.forName("sun.awt.windows.WEmbeddedFrame");
-            Constructor constructor = clazz.getConstructor (new Class [] {Long.TYPE});
-            return (Frame) constructor.newInstance (new Object[] {hwnd});
-        } else if ("sun.awt.X11.XToolkit".equals(tk.getClass().getName())) {
-            Class x_base_window_class = Class.forName("sun.awt.X11.XBaseWindow");
-            System.out.println("x_base_window_class = " + x_base_window_class);
-            Method get_window = x_base_window_class.getMethod("getWindow", new Class[0]);
-            System.out.println("get_window = " + get_window);
-            long window = (Long) get_window.invoke(frame_peer, new Object[0]);
-            System.out.println("window = " + window);
-            Class clazz = Class.forName("sun.awt.X11.XEmbeddedFrame");
-            Constructor constructor = clazz.getConstructor (new Class [] {Long.TYPE, Boolean.TYPE});
-            return (Frame) constructor.newInstance (new Object[] {window, true});
-        }
-
-        throw new RuntimeException("Unexpected toolkit - " + tk);
-    }
 
     /**
      * Makes the window visible and waits until it's shown.
@@ -237,8 +201,7 @@
     }
 
     public static void waitForIdle(final Robot robot) {
-        // we do not use robot for now, use SunToolkit.realSync() instead
-        ((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
     }
 
     public static Field getField(final Class klass, final String fieldName) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/regtesthelpers/UtilInternal.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package test.java.awt.regtesthelpers;
+
+import java.awt.peer.FramePeer;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.awt.Toolkit;
+import java.awt.Frame;
+
+
+
+/**
+   Class with static methods using internal/proprietary API by necessity.
+*/
+public final class UtilInternal {
+
+    private UtilInternal () {} // this is a helper class with static methods :)
+
+    public static Frame createEmbeddedFrame(final Frame embedder)
+        throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException, NoSuchMethodException,
+               InstantiationException, InvocationTargetException
+    {
+        Toolkit tk = Toolkit.getDefaultToolkit();
+        FramePeer frame_peer = (FramePeer) embedder.getPeer();
+        System.out.println("frame's peer = " + frame_peer);
+        if ("sun.awt.windows.WToolkit".equals(tk.getClass().getName())) {
+            Class comp_peer_class =
+                Class.forName("sun.awt.windows.WComponentPeer");
+            System.out.println("comp peer class = " + comp_peer_class);
+            Field hwnd_field = comp_peer_class.getDeclaredField("hwnd");
+            hwnd_field.setAccessible(true);
+            System.out.println("hwnd_field =" + hwnd_field);
+            long hwnd = hwnd_field.getLong(frame_peer);
+            System.out.println("hwnd = " + hwnd);
+
+            Class clazz = Class.forName("sun.awt.windows.WEmbeddedFrame");
+            Constructor constructor = clazz.getConstructor (new Class [] {Long.TYPE});
+            return (Frame) constructor.newInstance (new Object[] {hwnd});
+        } else if ("sun.awt.X11.XToolkit".equals(tk.getClass().getName())) {
+            Class x_base_window_class = Class.forName("sun.awt.X11.XBaseWindow");
+            System.out.println("x_base_window_class = " + x_base_window_class);
+            Method get_window = x_base_window_class.getMethod("getWindow", new Class[0]);
+            System.out.println("get_window = " + get_window);
+            long window = (Long) get_window.invoke(frame_peer, new Object[0]);
+            System.out.println("window = " + window);
+            Class clazz = Class.forName("sun.awt.X11.XEmbeddedFrame");
+            Constructor constructor = clazz.getConstructor (new Class [] {Long.TYPE, Boolean.TYPE});
+            return (Frame) constructor.newInstance (new Object[] {window, true});
+        }
+
+        throw new RuntimeException("Unexpected toolkit - " + tk);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/InputStream/TransferTo.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,326 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.ByteArrayOutputStream;
+import java.io.FilterInputStream;
+import java.io.FilterOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.Random;
+
+import static java.lang.String.format;
+
+/*
+ * @test
+ * @bug 8066867
+ * @summary tests whether java.io.InputStream.transferTo conforms to its
+ *          contract defined in the javadoc
+ */
+public class TransferTo {
+
+    public static void main(String[] args) throws IOException {
+        ifOutIsNullThenNpeIsThrown();
+        ifExceptionInInputNeitherStreamIsClosed();
+        ifExceptionInOutputNeitherStreamIsClosed();
+        onReturnNeitherStreamIsClosed();
+        onReturnInputIsAtEnd();
+        contents();
+    }
+
+    private static void ifOutIsNullThenNpeIsThrown() throws IOException {
+        try (InputStream in = input()) {
+            assertThrowsNPE(() -> in.transferTo(null), "out");
+        }
+
+        try (InputStream in = input((byte) 1)) {
+            assertThrowsNPE(() -> in.transferTo(null), "out");
+        }
+
+        try (InputStream in = input((byte) 1, (byte) 2)) {
+            assertThrowsNPE(() -> in.transferTo(null), "out");
+        }
+
+        InputStream in = null;
+        try {
+            InputStream fin = in = new ThrowingInputStream();
+            // null check should precede everything else:
+            // InputStream shouldn't be touched if OutputStream is null
+            assertThrowsNPE(() -> fin.transferTo(null), "out");
+        } finally {
+            if (in != null)
+                try {
+                    in.close();
+                } catch (IOException ignored) { }
+        }
+    }
+
+    private static void ifExceptionInInputNeitherStreamIsClosed()
+            throws IOException {
+        transferToThenCheckIfAnyClosed(input(0, new byte[]{1, 2, 3}), output());
+        transferToThenCheckIfAnyClosed(input(1, new byte[]{1, 2, 3}), output());
+        transferToThenCheckIfAnyClosed(input(2, new byte[]{1, 2, 3}), output());
+    }
+
+    private static void ifExceptionInOutputNeitherStreamIsClosed()
+            throws IOException {
+        transferToThenCheckIfAnyClosed(input(new byte[]{1, 2, 3}), output(0));
+        transferToThenCheckIfAnyClosed(input(new byte[]{1, 2, 3}), output(1));
+        transferToThenCheckIfAnyClosed(input(new byte[]{1, 2, 3}), output(2));
+    }
+
+    private static void transferToThenCheckIfAnyClosed(InputStream input,
+                                                       OutputStream output)
+            throws IOException {
+        try (CloseLoggingInputStream in = new CloseLoggingInputStream(input);
+             CloseLoggingOutputStream out =
+                     new CloseLoggingOutputStream(output)) {
+            boolean thrown = false;
+            try {
+                in.transferTo(out);
+            } catch (IOException ignored) {
+                thrown = true;
+            }
+            if (!thrown)
+                throw new AssertionError();
+
+            if (in.wasClosed() || out.wasClosed()) {
+                throw new AssertionError();
+            }
+        }
+    }
+
+    private static void onReturnNeitherStreamIsClosed()
+            throws IOException {
+        try (CloseLoggingInputStream in =
+                     new CloseLoggingInputStream(input(new byte[]{1, 2, 3}));
+             CloseLoggingOutputStream out =
+                     new CloseLoggingOutputStream(output())) {
+
+            in.transferTo(out);
+
+            if (in.wasClosed() || out.wasClosed()) {
+                throw new AssertionError();
+            }
+        }
+    }
+
+    private static void onReturnInputIsAtEnd() throws IOException {
+        try (InputStream in = input(new byte[]{1, 2, 3});
+             OutputStream out = output()) {
+
+            in.transferTo(out);
+
+            if (in.read() != -1) {
+                throw new AssertionError();
+            }
+        }
+    }
+
+    private static void contents() throws IOException {
+        checkTransferredContents(new byte[0]);
+        checkTransferredContents(createRandomBytes(1024, 4096));
+        // to span through several batches
+        checkTransferredContents(createRandomBytes(16384, 16384));
+    }
+
+    private static void checkTransferredContents(byte[] bytes)
+            throws IOException {
+        try (InputStream in = input(bytes);
+             ByteArrayOutputStream out = new ByteArrayOutputStream()) {
+            in.transferTo(out);
+
+            byte[] outBytes = out.toByteArray();
+            if (!Arrays.equals(bytes, outBytes)) {
+                throw new AssertionError(
+                        format("bytes.length=%s, outBytes.length=%s",
+                                bytes.length, outBytes.length));
+            }
+        }
+    }
+
+    private static byte[] createRandomBytes(int min, int maxRandomAdditive) {
+        Random rnd = new Random();
+        byte[] bytes = new byte[min + rnd.nextInt(maxRandomAdditive)];
+        rnd.nextBytes(bytes);
+        return bytes;
+    }
+
+    private static OutputStream output() {
+        return output(-1);
+    }
+
+    private static OutputStream output(int exceptionPosition) {
+        return new OutputStream() {
+
+            int pos;
+
+            @Override
+            public void write(int b) throws IOException {
+                if (pos++ == exceptionPosition)
+                    throw new IOException();
+            }
+        };
+    }
+
+    private static InputStream input(byte... bytes) {
+        return input(-1, bytes);
+    }
+
+    private static InputStream input(int exceptionPosition, byte... bytes) {
+        return new InputStream() {
+
+            int pos;
+
+            @Override
+            public int read() throws IOException {
+                if (pos == exceptionPosition) {
+                    // because of the pesky IOException swallowing in
+                    // java.io.InputStream.read(byte[], int, int)
+                    // pos++;
+                    throw new IOException();
+                }
+
+                if (pos >= bytes.length)
+                    return -1;
+                return bytes[pos++] & 0xff;
+            }
+        };
+    }
+
+    private static class ThrowingInputStream extends InputStream {
+
+        boolean closed;
+
+        @Override
+        public int read(byte[] b) throws IOException {
+            throw new IOException();
+        }
+
+        @Override
+        public int read(byte[] b, int off, int len) throws IOException {
+            throw new IOException();
+        }
+
+        @Override
+        public long skip(long n) throws IOException {
+            throw new IOException();
+        }
+
+        @Override
+        public int available() throws IOException {
+            throw new IOException();
+        }
+
+        @Override
+        public void close() throws IOException {
+            if (!closed) {
+                closed = true;
+                throw new IOException();
+            }
+        }
+
+        @Override
+        public void reset() throws IOException {
+            throw new IOException();
+        }
+
+        @Override
+        public int read() throws IOException {
+            throw new IOException();
+        }
+    }
+
+    private static class CloseLoggingInputStream extends FilterInputStream {
+
+        boolean closed;
+
+        CloseLoggingInputStream(InputStream in) {
+            super(in);
+        }
+
+        @Override
+        public void close() throws IOException {
+            closed = true;
+            super.close();
+        }
+
+        boolean wasClosed() {
+            return closed;
+        }
+    }
+
+    private static class CloseLoggingOutputStream extends FilterOutputStream {
+
+        boolean closed;
+
+        CloseLoggingOutputStream(OutputStream out) {
+            super(out);
+        }
+
+        @Override
+        public void close() throws IOException {
+            closed = true;
+            super.close();
+        }
+
+        boolean wasClosed() {
+            return closed;
+        }
+    }
+
+    public interface Thrower {
+        public void run() throws Throwable;
+    }
+
+    public static void assertThrowsNPE(Thrower thrower, String message) {
+        assertThrows(thrower, NullPointerException.class, message);
+    }
+
+    public static <T extends Throwable> void assertThrows(Thrower thrower,
+                                                          Class<T> throwable,
+                                                          String message) {
+        Throwable thrown;
+        try {
+            thrower.run();
+            thrown = null;
+        } catch (Throwable caught) {
+            thrown = caught;
+        }
+
+        if (!throwable.isInstance(thrown)) {
+            String caught = thrown == null ?
+                    "nothing" : thrown.getClass().getCanonicalName();
+            throw new AssertionError(
+                    format("Expected to catch %s, but caught %s",
+                            throwable, caught), thrown);
+        }
+
+        if (thrown != null && !message.equals(thrown.getMessage())) {
+            throw new AssertionError(
+                    format("Expected exception message to be '%s', but it's '%s'",
+                            message, thrown.getMessage()));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/ObjectInputStream/PeekInputStreamTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+/*
+ * @test
+ * @bug 8067870
+ * @summary verifies java.io.ObjectInputStream.PeekInputStream.skip works
+ *          as intended
+ */
+public class PeekInputStreamTest {
+
+    public static void main(String[] args) throws ReflectiveOperationException,
+            IOException {
+
+        InputStream pin = createPeekInputStream(
+                new ByteArrayInputStream(new byte[]{1, 2, 3, 4}));
+        peek(pin);
+        if (pin.skip(1) != 1 || pin.read() != 2)
+            throw new AssertionError();
+
+        InputStream pin1 = createPeekInputStream(
+                new ByteArrayInputStream(new byte[]{1, 2, 3, 4}));
+        if (pin1.skip(1) != 1 || pin1.read() != 2)
+            throw new AssertionError();
+
+        InputStream pin2 = createPeekInputStream(
+                new ByteArrayInputStream(new byte[]{1, 2, 3, 4}));
+        if (pin2.skip(0) != 0 || pin2.read() != 1)
+            throw new AssertionError();
+
+        InputStream pin3 = createPeekInputStream(
+                new ByteArrayInputStream(new byte[]{1, 2, 3, 4}));
+        if (pin3.skip(2) != 2 || pin3.read() != 3)
+            throw new AssertionError();
+
+        InputStream pin4 = createPeekInputStream(
+                new ByteArrayInputStream(new byte[]{1, 2, 3, 4}));
+        if (pin4.skip(3) != 3 || pin4.read() != 4)
+            throw new AssertionError();
+
+        InputStream pin5 = createPeekInputStream(
+                new ByteArrayInputStream(new byte[]{1, 2, 3, 4}));
+        if (pin5.skip(16) != 4 || pin5.read() != -1)
+            throw new AssertionError();
+    }
+
+    private static InputStream createPeekInputStream(InputStream underlying)
+            throws ReflectiveOperationException {
+        Class<? extends InputStream> clazz =
+                Class.forName("java.io.ObjectInputStream$PeekInputStream")
+                        .asSubclass(InputStream.class);
+
+        Constructor<? extends InputStream> ctr =
+                clazz.getDeclaredConstructor(InputStream.class);
+        ctr.setAccessible(true);
+        return ctr.newInstance(underlying);
+    }
+
+    private static void peek(InputStream pin)
+            throws ReflectiveOperationException {
+        Method p = pin.getClass().getDeclaredMethod("peek");
+        p.setAccessible(true);
+        p.invoke(pin);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,384 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.FilePermission;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.lang.reflect.ReflectPermission;
+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.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.PropertyPermission;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Stream;
+
+/**
+ * @test
+ * @bug 8065552
+ * @summary test that all fields returned by getDeclaredFields() can be
+ *          set accessible if the right permission is granted; this test
+ *          loads all the classes in the BCL, get their declared fields,
+ *          and call setAccessible(false) followed by setAccessible(true);
+ * @run main/othervm FieldSetAccessibleTest UNSECURE
+ * @run main/othervm FieldSetAccessibleTest SECURE
+ *
+ * @author danielfuchs
+ */
+public class FieldSetAccessibleTest {
+
+    static final List<String> skipped = new ArrayList<>();
+    static final List<String> cantread = new ArrayList<>();
+    static final List<String> failed = new ArrayList<>();
+    static final AtomicLong classCount = new AtomicLong();
+    static final AtomicLong fieldCount = new AtomicLong();
+    static long startIndex = 0;
+    static long maxSize = Long.MAX_VALUE;
+    static long maxIndex = Long.MAX_VALUE;
+    static final ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
+
+
+    // Test that all fields for any given class can be made accessibles
+    static void testSetFieldsAccessible(Class<?> c) {
+        for (Field f : c.getDeclaredFields()) {
+            fieldCount.incrementAndGet();
+            f.setAccessible(false);
+            f.setAccessible(true);
+        }
+    }
+
+    // Performs a series of test on the given class.
+    // At this time, we only call testSetFieldsAccessible(c)
+    public static boolean test(Class<?> c) {
+        //System.out.println(c.getName());
+        classCount.incrementAndGet();
+
+        // Call getDeclaredFields() and try to set their accessible flag.
+        testSetFieldsAccessible(c);
+
+        // add more tests here...
+
+        return c == Class.class;
+    }
+
+    // Prints a summary at the end of the test.
+    static void printSummary(long secs, long millis, long nanos) {
+        System.out.println("Tested " + fieldCount.get() + " fields of "
+                + classCount.get() + " classes in "
+                + secs + "s " + millis + "ms " + nanos + "ns");
+    }
+
+
+    /**
+     * @param args the command line arguments:
+     *
+     *     SECURE|UNSECURE [startIndex (default=0)] [maxSize (default=Long.MAX_VALUE)]
+     *
+     * @throws java.lang.Exception if the test fails
+     */
+    public static void main(String[] args) throws Exception {
+        if (args == null || args.length == 0) {
+            args = new String[] {"SECURE", "0"};
+        } else if (args.length > 3) {
+            throw new RuntimeException("Expected at most one argument. Found "
+                    + Arrays.asList(args));
+        }
+        try {
+            if (args.length > 1) {
+                startIndex = Long.parseLong(args[1]);
+                if (startIndex < 0) {
+                    throw new IllegalArgumentException("startIndex args[1]: "
+                            + startIndex);
+                }
+            }
+            if (args.length > 2) {
+                maxSize = Long.parseLong(args[2]);
+                if (maxSize <= 0) {
+                    maxSize = Long.MAX_VALUE;
+                }
+                maxIndex = (Long.MAX_VALUE - startIndex) < maxSize
+                        ? Long.MAX_VALUE : startIndex + maxSize;
+            }
+            TestCase.valueOf(args[0]).run();
+        } catch (OutOfMemoryError oome) {
+            System.err.println(classCount.get());
+            throw oome;
+        }
+    }
+
+    public static void run(TestCase test) {
+        System.out.println("Testing " + test);
+        test(listAllClassNames());
+        System.out.println("Passed " + test);
+    }
+
+    static Iterable<String> listAllClassNames() {
+        return new ClassNameJrtStreamBuilder();
+    }
+
+    static void test(Iterable<String> iterable) {
+        final long start = System.nanoTime();
+        boolean classFound = false;
+        int index = 0;
+        for (String s: iterable) {
+            if (index == maxIndex) break;
+            try {
+                if (index < startIndex) continue;
+                if (test(s)) {
+                    classFound = true;
+                }
+            } finally {
+                index++;
+            }
+        }
+        long elapsed = System.nanoTime() - start;
+        long secs = elapsed / 1000_000_000;
+        long millis = (elapsed % 1000_000_000) / 1000_000;
+        long nanos  = elapsed % 1000_000;
+        System.out.println("Unreadable path elements: " + cantread);
+        System.out.println("Skipped path elements: " + skipped);
+        System.out.println("Failed path elements: " + failed);
+        printSummary(secs, millis, nanos);
+
+        if (!failed.isEmpty()) {
+            throw new RuntimeException("Test failed for the following classes: " + failed);
+        }
+        if (!classFound && startIndex == 0 && index < maxIndex) {
+            // this is just to verify that we have indeed parsed rt.jar
+            // (or the java.base module)
+            throw  new RuntimeException("Test failed: Class.class not found...");
+        }
+        if (classCount.get() == 0 && startIndex == 0) {
+            throw  new RuntimeException("Test failed: no class found?");
+        }
+    }
+
+    static boolean test(String s) {
+        try {
+            if (s.startsWith("WrapperGenerator")) {
+                System.out.println("Skipping "+ s);
+                return false;
+            }
+            final Class<?> c = Class.forName(
+                    s.replace('/', '.').substring(0, s.length() - 6),
+                    false,
+                    systemClassLoader);
+            return test(c);
+        } catch (Exception t) {
+            t.printStackTrace(System.err);
+            failed.add(s);
+        } catch (NoClassDefFoundError e) {
+            e.printStackTrace(System.err);
+            failed.add(s);
+        }
+        return false;
+    }
+
+    static class ClassNameJrtStreamBuilder implements Iterable<String>{
+
+        final FileSystem jrt;
+        final List<Path> roots = new ArrayList<>();
+        ClassNameJrtStreamBuilder() {
+             jrt = FileSystems.getFileSystem(URI.create("jrt:/"));
+             for (Path root : jrt.getRootDirectories()) {
+                 roots.add(root);
+             }
+        }
+
+        Stream<String> build() {
+            return roots.stream().flatMap(this::toStream)
+                    .filter(x -> x.getNameCount() > 1)
+                    .map( x-> x.subpath(1, x.getNameCount()))
+                    .map( x -> x.toString())
+                    .filter(s -> s.endsWith(".class"));
+        }
+
+        @Override
+        public Iterator<String> iterator() {
+            return build().iterator();
+        }
+
+        private Stream<Path> toStream(Path root) {
+            try {
+                return Files.walk(root);
+            } catch(IOException x) {
+                x.printStackTrace(System.err);
+                skipped.add(root.toString());
+            }
+            return Collections.<Path>emptyList().stream();
+        }
+
+    }
+
+    // Test with or without a security manager
+    public static enum TestCase {
+        UNSECURE, SECURE;
+        public void run() throws Exception {
+            System.out.println("Running test case: " + name());
+            Configure.setUp(this);
+            FieldSetAccessibleTest.run(this);
+        }
+    }
+
+    // A helper class to configure the security manager for the test,
+    // and bypass it when needed.
+    static class Configure {
+        static Policy policy = null;
+        static final ThreadLocal<AtomicBoolean> allowAll = new ThreadLocal<AtomicBoolean>() {
+            @Override
+            protected AtomicBoolean initialValue() {
+                return  new AtomicBoolean(false);
+            }
+        };
+        static void setUp(TestCase test) {
+            switch (test) {
+                case SECURE:
+                    if (policy == null && System.getSecurityManager() != null) {
+                        throw new IllegalStateException("SecurityManager already set");
+                    } else if (policy == null) {
+                        policy = new SimplePolicy(TestCase.SECURE, allowAll);
+                        Policy.setPolicy(policy);
+                        System.setSecurityManager(new SecurityManager());
+                    }
+                    if (System.getSecurityManager() == null) {
+                        throw new IllegalStateException("No SecurityManager.");
+                    }
+                    if (policy == null) {
+                        throw new IllegalStateException("policy not configured");
+                    }
+                    break;
+                case UNSECURE:
+                    if (System.getSecurityManager() != null) {
+                        throw new IllegalStateException("SecurityManager already set");
+                    }
+                    break;
+                default:
+                    throw new InternalError("No such testcase: " + test);
+            }
+        }
+        static void doPrivileged(Runnable run) {
+            allowAll.get().set(true);
+            try {
+                run.run();
+            } finally {
+                allowAll.get().set(false);
+            }
+        }
+    }
+
+    // A Helper class to build a set of permissions.
+    final static class PermissionsBuilder {
+        final Permissions perms;
+        public PermissionsBuilder() {
+            this(new Permissions());
+        }
+        public PermissionsBuilder(Permissions perms) {
+            this.perms = perms;
+        }
+        public PermissionsBuilder add(Permission p) {
+            perms.add(p);
+            return this;
+        }
+        public PermissionsBuilder addAll(PermissionCollection col) {
+            if (col != null) {
+                for (Enumeration<Permission> e = col.elements(); e.hasMoreElements(); ) {
+                    perms.add(e.nextElement());
+                }
+            }
+            return this;
+        }
+        public Permissions toPermissions() {
+            final PermissionsBuilder builder = new PermissionsBuilder();
+            builder.addAll(perms);
+            return builder.perms;
+        }
+    }
+
+    // Policy for the test...
+    public static class SimplePolicy extends Policy {
+
+        final Permissions permissions;
+        final Permissions allPermissions;
+        final ThreadLocal<AtomicBoolean> allowAll;
+        public SimplePolicy(TestCase test, ThreadLocal<AtomicBoolean> allowAll) {
+            this.allowAll = allowAll;
+
+            // Permission needed by the tested code exercised in the test
+            permissions = new Permissions();
+            permissions.add(new RuntimePermission("fileSystemProvider"));
+            permissions.add(new RuntimePermission("createClassLoader"));
+            permissions.add(new RuntimePermission("closeClassLoader"));
+            permissions.add(new RuntimePermission("getClassLoader"));
+            permissions.add(new RuntimePermission("accessDeclaredMembers"));
+            permissions.add(new ReflectPermission("suppressAccessChecks"));
+            permissions.add(new PropertyPermission("*", "read"));
+            permissions.add(new FilePermission("<<ALL FILES>>", "read"));
+
+            // these are used for configuring the test itself...
+            allPermissions = new Permissions();
+            allPermissions.add(new java.security.AllPermission());
+        }
+
+        @Override
+        public boolean implies(ProtectionDomain domain, Permission permission) {
+            if (allowAll.get().get()) return allPermissions.implies(permission);
+            if (permissions.implies(permission)) return true;
+            if (permission instanceof java.lang.RuntimePermission) {
+                if (permission.getName().startsWith("accessClassInPackage.")) {
+                    // add these along to the set of permission we have, when we
+                    // discover that we need them.
+                    permissions.add(permission);
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        @Override
+        public PermissionCollection getPermissions(CodeSource codesource) {
+            return new PermissionsBuilder().addAll(allowAll.get().get()
+                    ? allPermissions : permissions).toPermissions();
+        }
+
+        @Override
+        public PermissionCollection getPermissions(ProtectionDomain domain) {
+            return new PermissionsBuilder().addAll(allowAll.get().get()
+                    ? allPermissions : permissions).toPermissions();
+        }
+    }
+
+}
--- a/jdk/test/java/lang/ClassLoader/EndorsedDirs.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/lang/ClassLoader/EndorsedDirs.java	Fri Jan 09 13:28:02 2015 -0500
@@ -23,25 +23,48 @@
 
 /*
  * @test
- * @bug 8060206
+ * @bug 8060206 8067366
  * @summary Endorsed standards and override mechanism is removed
  */
 
 import java.io.*;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 
 public class EndorsedDirs {
-    public static void main(String arg[]) throws Exception {
+    private static String[] VALUES = new String[] {
+            null,
+            "",
+            "\"\""
+    };
+    public static void main(String... args) throws Exception {
         String value = System.getProperty("java.endorsed.dirs");
+        System.out.format("java.endorsed.dirs = '%s'%n", value);
+        if (args.length > 0) {
+            int index = Integer.valueOf(args[0]);
+            String expectedValue = VALUES[index];
+            if (!(expectedValue == value ||
+                    (value != null && value.isEmpty()) ||
+                    (expectedValue != null & expectedValue.equals(value)))) {
+                throw new RuntimeException("java.endorsed.dirs (" +
+                        value + ") != " + expectedValue);
+            }
+            // launched by subprocess.
+            return;
+        }
+
         if (value != null) {
             throw new RuntimeException("java.endorsed.dirs not removed: " + value);
         }
 
-        fatalError("-Djava.endorsed.dirs=foo");
+        fatalError(0, "-Djava.endorsed.dirs=foo");
+        start(0);
+        start(1, "-Djava.endorsed.dirs=");
+        start(2, "-Djava.endorsed.dirs=\"\"");
     }
 
-    static void fatalError(String... args) throws Exception {
+    static ProcessBuilder newProcessBuilder(int testParam, String... args) throws Exception {
         List<String> commands = new ArrayList<>();
         String java = System.getProperty("java.home") + "/bin/java";
         commands.add(java);
@@ -52,9 +75,22 @@
         commands.add("-cp");
         commands.add(cpath);
         commands.add("EndorsedDirs");
+        commands.add(String.valueOf(testParam));
 
-        ProcessBuilder processBuilder = new ProcessBuilder(commands);
-        final Process process = processBuilder.start();
+        System.out.println("Testing " + commands.stream().collect(Collectors.joining(" ")));
+        return new ProcessBuilder(commands);
+    }
+
+    static void start(int testParam, String... args) throws Exception {
+        start(newProcessBuilder(testParam, args), false);
+    }
+
+    static void fatalError(int testParam, String... args) throws Exception {
+        start(newProcessBuilder(testParam, args), true);
+    }
+
+    static void start(ProcessBuilder pb, boolean fatalError) throws Exception {
+        final Process process = pb.start();
         BufferedReader errorStream = new BufferedReader(
                 new InputStreamReader(process.getErrorStream()));
         BufferedReader outStream = new BufferedReader(
@@ -72,11 +108,15 @@
         System.err.println(errorLine);
         process.waitFor(1000, TimeUnit.MILLISECONDS);
         int exitStatus = process.exitValue();
-        if (exitStatus == 0) {
-            throw new RuntimeException("Expect fatal error");
-        }
-        if (!errorLine.contains("Could not create the Java Virtual Machine")) {
-            throw new RuntimeException(errorLine);
+        if (fatalError) {
+            if (exitStatus == 0) {
+                throw new RuntimeException("Expected fatal error");
+            }
+            if (!errorLine.contains("Could not create the Java Virtual Machine")) {
+                throw new RuntimeException(errorLine);
+            }
+        } else if (exitStatus != 0) {
+            throw new RuntimeException("Failed: " + errorLine);
         }
     }
 }
--- a/jdk/test/java/lang/ClassLoader/ExtDirs.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/lang/ClassLoader/ExtDirs.java	Fri Jan 09 13:28:02 2015 -0500
@@ -23,25 +23,49 @@
 
 /*
  * @test
- * @bug 8060206
+ * @bug 8060206 8067366
  * @summary Extension mechanism is removed
  */
 
 import java.io.*;
+import java.lang.Integer;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 
 public class ExtDirs {
-    public static void main(String arg[]) throws Exception {
+    private static String[] VALUES = new String[] {
+            null,
+            "",
+            "\"\""
+    };
+    public static void main(String... args) throws Exception {
         String value = System.getProperty("java.ext.dirs");
+        System.out.format("java.ext.dirs = '%s'%n", value);
+        if (args.length > 0) {
+            int index = Integer.valueOf(args[0]);
+            String expectedValue = VALUES[index];
+            if (!(expectedValue == value ||
+                    (value != null && value.isEmpty()) ||
+                    (expectedValue != null & expectedValue.equals(value)))) {
+                throw new RuntimeException("java.ext.dirs (" +
+                        value + ") != " + expectedValue);
+            }
+            // launched by subprocess.
+            return;
+        }
+
         if (value != null) {
             throw new RuntimeException("java.ext.dirs not removed: " + value);
         }
 
-        fatalError("-Djava.ext.dirs=foo");
+        fatalError(0, "-Djava.ext.dirs=foo");
+        start(0);
+        start(1, "-Djava.ext.dirs=");
+        start(2, "-Djava.ext.dirs=\"\"");
     }
 
-    static void fatalError(String... args) throws Exception {
+    static ProcessBuilder newProcessBuilder(int testParam, String... args) throws Exception {
         List<String> commands = new ArrayList<>();
         String java = System.getProperty("java.home") + "/bin/java";
         commands.add(java);
@@ -52,9 +76,22 @@
         commands.add("-cp");
         commands.add(cpath);
         commands.add("ExtDirs");
+        commands.add(String.valueOf(testParam));
 
-        ProcessBuilder processBuilder = new ProcessBuilder(commands);
-        final Process process = processBuilder.start();
+        System.out.println("Testing " + commands.stream().collect(Collectors.joining(" ")));
+        return new ProcessBuilder(commands);
+    }
+
+    static void start(int testParam, String... args) throws Exception {
+        start(newProcessBuilder(testParam, args), false);
+    }
+
+    static void fatalError(int testParam, String... args) throws Exception {
+        start(newProcessBuilder(testParam, args), true);
+    }
+
+    static void start(ProcessBuilder pb, boolean fatalError) throws Exception {
+        final Process process = pb.start();
         BufferedReader errorStream = new BufferedReader(
                 new InputStreamReader(process.getErrorStream()));
         BufferedReader outStream = new BufferedReader(
@@ -72,11 +109,15 @@
         System.err.println(errorLine);
         process.waitFor(1000, TimeUnit.MILLISECONDS);
         int exitStatus = process.exitValue();
-        if (exitStatus == 0) {
-            throw new RuntimeException("Expect fatal error");
-        }
-        if (!errorLine.contains("Could not create the Java Virtual Machine")) {
-            throw new RuntimeException(errorLine);
+        if (fatalError) {
+            if (exitStatus == 0) {
+                throw new RuntimeException("Expected fatal error");
+            }
+            if (!errorLine.contains("Could not create the Java Virtual Machine")) {
+                throw new RuntimeException(errorLine);
+            }
+        } else if (exitStatus != 0) {
+            throw new RuntimeException("Failed: " + errorLine);
         }
     }
 }
--- a/jdk/test/java/lang/Runtime/exec/SleepyCat.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/lang/Runtime/exec/SleepyCat.java	Fri Jan 09 13:28:02 2015 -0500
@@ -22,7 +22,7 @@
  */
 
 /* @test
-   @bug 4843136 4763384
+   @bug 4843136 4763384 8044841
    @summary Various race conditions caused exec'ed processes to have
    extra unused file descriptors, which caused hard-to-reproduce hangs.
    @author Martin Buchholz
@@ -50,6 +50,8 @@
         }
 
         public void run() {
+            dumpState(deathRow);        // before killing the processes dump all the state
+
             timedOut = true;
             destroy(deathRow);
         }
@@ -59,6 +61,37 @@
         }
     }
 
+    /**
+     * Temporary debugging code for intermittent failures.
+     * @param pids the processes to dump status for
+     */
+    static void dumpState(Process... pids) {
+        if (!System.getProperty("os.name").contains("SunOS")) {
+            return;
+        }
+        try {
+            String[] psArgs = {"ps", "-elf"};
+            Process ps = new ProcessBuilder(psArgs).inheritIO().start();
+            ps.waitFor();
+            String[] sfiles = {"pfiles", "self"};
+            Process fds = new ProcessBuilder(sfiles).inheritIO().start();
+            fds.waitFor();
+
+            for (Process p : pids) {
+                if (p == null)
+                    continue;
+                String[] pfiles = {"pfiles", Long.toString(p.getPid())};
+                fds = new ProcessBuilder(pfiles).inheritIO().start();
+                fds.waitFor();
+                String[] pstack = {"pstack", Long.toString(p.getPid())};
+                fds = new ProcessBuilder(pstack).inheritIO().start();
+                fds.waitFor();
+            }
+        } catch (IOException | InterruptedException i) {
+            i.printStackTrace();
+        }
+    }
+
     private static boolean hang1() throws IOException, InterruptedException {
         // Time out was reproducible on Solaris 50% of the time;
         // on Linux 80% of the time.
--- a/jdk/test/java/lang/instrument/ParallelTransformerLoaderAgent.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/lang/instrument/ParallelTransformerLoaderAgent.java	Fri Jan 09 13:28:02 2015 -0500
@@ -79,24 +79,15 @@
                         throws IllegalClassFormatException
                 {
                         String tName = Thread.currentThread().getName();
-                        // In 160_03 and older, transform() is called
-                        // with the "system_loader_lock" held and that
-                        // prevents the bootstrap class loaded from
-                        // running in parallel. If we add a slight sleep
-                        // delay here when the transform() call is not
-                        // main or TestThread, then the deadlock in
-                        // 160_03 and older is much more reproducible.
-                        if (!tName.equals("main") && !tName.equals("TestThread")) {
-                            System.out.println("Thread '" + tName +
-                                "' has called transform()");
-                            try {
-                                Thread.sleep(500);
-                            } catch (InterruptedException ie) {
-                            }
-                        }
 
-                        // load additional classes when called from other threads
-                        if (!tName.equals("main"))
+                        // Load additional classes when called from thread 'TestThread'
+                        // When a class is loaded during a callback handling the boot loader, we can
+                        // run into ClassCircularityError if the ClassFileLoadHook is set early enough
+                        // to catch classes needed during class loading, e.g.
+                        //          sun.misc.URLClassPath$JarLoader$2.
+                        // The goal of the test is to stress class loading on the test class loaders.
+
+                        if (tName.equals("TestThread") && loader != null)
                         {
                                 loadClasses(3);
                         }
--- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,11 +35,13 @@
  * @run main/timeout=600 LowMemoryTest
  */
 
+import com.sun.management.DiagnosticCommandMBean;
 import java.lang.management.*;
 import java.util.*;
 import java.util.concurrent.Phaser;
 import javax.management.*;
 import javax.management.openmbean.CompositeData;
+import sun.management.ManagementFactoryHelper;
 
 public class LowMemoryTest {
     private static final MemoryMXBean mm = ManagementFactory.getMemoryMXBean();
@@ -94,9 +96,15 @@
     }
 
     static class TestListener implements NotificationListener {
+        private boolean isRelaxed = false;
         private int triggers = 0;
         private final long[] count = new long[NUM_TRIGGERS * 2];
         private final long[] usedMemory = new long[NUM_TRIGGERS * 2];
+
+        public TestListener() {
+            isRelaxed = ManagementFactory.getRuntimeMXBean().getInputArguments().contains("-XX:+UseConcMarkSweepGC");
+        }
+
         @Override
         public void handleNotification(Notification notif, Object handback) {
             MemoryNotificationInfo minfo = MemoryNotificationInfo.
@@ -106,7 +114,8 @@
             triggers++;
         }
         public void checkResult() throws Exception {
-            if (triggers != NUM_TRIGGERS) {
+            if ((!isRelaxed && triggers != NUM_TRIGGERS) ||
+                (isRelaxed && triggers < NUM_TRIGGERS)) {
                 throw new RuntimeException("Unexpected number of triggers = " +
                     triggers + " but expected to be " + NUM_TRIGGERS);
             }
--- a/jdk/test/java/lang/management/ThreadMXBean/Locks.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/lang/management/ThreadMXBean/Locks.java	Fri Jan 09 13:28:02 2015 -0500
@@ -29,17 +29,21 @@
  * @author  Mandy Chung
  * @author  Jaroslav Bachorik
  *
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.*
  * @run main/othervm Locks
  */
 
 import java.lang.management.*;
 import java.util.concurrent.Phaser;
+import jdk.testlibrary.LockFreeLogManager;
 
 public class Locks {
     private static final Object objA = new Object();
     private static final Object objB = new Object();
     private static final Object objC = new Object();
     private static final ThreadMXBean tm = ManagementFactory.getThreadMXBean();
+    private static final LockFreeLogManager logger = new LockFreeLogManager();
 
     private static boolean testFailed = false;
 
@@ -126,14 +130,14 @@
         public void run() {
             synchronized(objA) {
                 // stop here  for LockBThread to hold objB
-                System.out.println("LockAThread about to block on objB");
+                log("LockAThread about to block on objB");
                 p.arriveAndAwaitAdvance(); // Phase 1 (blocking)
                 synchronized(objB) {
                     dummyCounter++;
                 };
             }
             p.arriveAndAwaitAdvance(); // Phase 2 (blocking)
-            System.out.println("LockAThread about to exit");
+            log("LockAThread about to exit");
             // Make sure the current thread is not holding any lock
             assertNoLock(this);
         }
@@ -147,7 +151,7 @@
         }
         public void run() {
             synchronized(objB) {
-                System.out.println("LockBThread about to block on objC");
+                log("LockBThread about to block on objC");
                 p.arriveAndAwaitAdvance(); // Phase 1 (blocking)
                 // Signal main thread about to block on objC
                 synchronized(objC) {
@@ -155,14 +159,14 @@
                 };
             }
             p.arriveAndAwaitAdvance(); // Phase 2 (blocking)
-            System.out.println("LockBThread about to exit");
+            log("LockBThread about to exit");
             // Make sure the current thread is not holding any lock
             assertNoLock(this);
         }
     }
 
     private static WaitingThread waiter;
-    private static Object ready = new Object();
+    private static final Object ready = new Object();
     private static CheckerThread checker;
     static class WaitingThread extends Thread {
         private final Phaser p;
@@ -173,9 +177,10 @@
             super("WaitingThread");
             this.p = p;
         }
+        @Override
         public void run() {
             synchronized(objC) {
-                System.out.println("WaitingThread about to wait on objC");
+                log("WaitingThread about to wait on objC");
                 try {
                     // Signal checker thread, about to wait on objC.
                     waiting = false;
@@ -188,13 +193,13 @@
                 }
 
                 // block until CheckerThread finishes checking
-                System.out.println("WaitingThread about to block on ready");
+                log("WaitingThread about to block on ready");
                 // signal checker thread that it is about acquire
                 // object ready.
                 p.arriveAndAwaitAdvance(); // Phase 2 (waiting)
                 synchronized(ready) {
                     dummyCounter++;
-                };
+                }
             }
             synchronized(objC) {
                 try {
@@ -208,7 +213,7 @@
                     testFailed = true;
                 }
             }
-            System.out.println("WaitingThread about to exit waiting on objC 2");
+            log("WaitingThread about to exit waiting on objC 2");
         }
 
         public void waitForWaiting() {
@@ -321,10 +326,10 @@
     private static ThreadInfo findOwnerInfo(ThreadInfo[] infos, String lock)
             throws Exception {
         ThreadInfo ownerInfo = null;
-        for (int i = 0; i < infos.length; i++) {
-            String blockedLock = infos[i].getLockName();
+        for (ThreadInfo info : infos) {
+            String blockedLock = info.getLockName();
             if (lock.equals(blockedLock)) {
-                long threadId = infos[i].getLockOwnerId();
+                long threadId = info.getLockOwnerId();
                 if (threadId == -1) {
                     throw new RuntimeException("TEST FAILED: " +
                             lock + " expected to have owner");
@@ -355,14 +360,17 @@
             throws Exception {
         ThreadInfo ownerInfo = null;
         // Find the thread who is blocking on lock
-        for (int i = 0; i < infos.length;  i++) {
-            String blockedLock = infos[i].getLockName();
+        for (ThreadInfo info : infos) {
+            String blockedLock = info.getLockName();
             if (lock.equals(blockedLock)) {
-                System.out.print(infos[i].getThreadName() +
-                        " blocked on " + blockedLock);
-                ownerInfo = infos[i];
+                log("%s blocked on %s", info.getThreadName(), blockedLock);
+                ownerInfo = info;
             }
         }
+        if (ownerInfo == null) {
+            throw new RuntimeException("TEST FAILED: " +
+                    "Can't retrieve ThreadInfo for the blocked thread");
+        }
 
         long[] threads = new long[10];
         int count = 0;
@@ -370,14 +378,18 @@
         while (ownerInfo != null && ownerInfo.getThreadState() == Thread.State.BLOCKED) {
             ownerInfo = findOwnerInfo(infos, lock);
             threads[count++] = ownerInfo.getThreadId();
-            System.out.println(" Owner = " + ownerInfo.getThreadName() +
-                    " id = " + ownerInfo.getThreadId());
+            log(" Owner = %s  id = %d",
+                    ownerInfo.getThreadName(),
+                    ownerInfo.getThreadId()
+            );
             lock = ownerInfo.getLockName();
-            System.out.print(ownerInfo.getThreadName() + " Id = " +
-                    ownerInfo.getThreadId() +
-                    " blocked on " + lock);
+            log("%s Id = %d  blocked on %s",
+                    ownerInfo.getThreadName(),
+                    ownerInfo.getThreadId(),
+                    lock
+            );
         }
-        System.out.println();
+        log("");
 
         if (count != expectedThreads.length) {
             throw new RuntimeException("TEST FAILED: " +
@@ -385,10 +397,15 @@
         }
         for (int i = 0; i < count; i++) {
             if (threads[i] != expectedThreads[i]) {
-                System.out.println("TEST FAILED: " +
-                        "Unexpected thread in the chain " + threads[i] +
-                        " expected to be " + expectedThreads[i]);
+                log("TEST FAILED: Unexpected thread in the chain %s expected to be %s",
+                    threads[i],
+                    expectedThreads[i]
+                );
             }
         }
     }
+
+    private static void log(String format, Object ... args) {
+        logger.log(format + "%n", args);
+    }
 }
--- a/jdk/test/java/net/ResponseCache/ResponseCacheTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/net/ResponseCache/ResponseCacheTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,6 @@
 import java.net.*;
 import java.util.*;
 import java.io.*;
-import sun.net.www.ParseUtil;
 import javax.net.ssl.*;
 
 /**
@@ -178,11 +177,16 @@
     }
 
     static class MyResponseCache extends ResponseCache {
-        public CacheResponse
-        get(URI uri, String rqstMethod, Map<String,List<String>> rqstHeaders)
-            throws IOException {
-            if (uri.equals(ParseUtil.toURI(url1))) {
-                return new MyCacheResponse(FNPrefix+"file1.cache");
+        public CacheResponse get(URI uri, String rqstMethod,
+                                 Map<String,List<String>> rqstHeaders)
+            throws IOException
+        {
+            try {
+                if (uri.equals(url1.toURI())) {
+                    return new MyCacheResponse(FNPrefix+"file1.cache");
+                }
+            } catch (URISyntaxException ex) {
+                throw new RuntimeException (ex);
             }
             return null;
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/channels/FileChannel/GetClosedChannel.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8025619
+ * @summary Verify that a channel obtained from a closed stream is truly closed.
+ */
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.channels.ClosedChannelException;
+import java.nio.channels.FileChannel;
+
+public class GetClosedChannel {
+    private static final int NUM_CHANNELS = 3;
+    private static final int NUM_EXCEPTIONS = 2*NUM_CHANNELS;
+
+    public static void main(String[] args) throws IOException {
+        int exceptions = 0;
+        int openChannels = 0;
+
+        for (int i = 0; i < NUM_CHANNELS; i++) {
+            File f = File.createTempFile("fcbug", ".tmp");
+            f.deleteOnExit();
+
+            FileChannel fc = null;
+            boolean shared = false;
+            switch (i) {
+                case 0:
+                    System.out.print("FileInputStream...");
+                    FileInputStream fis = new FileInputStream(f);
+                    fis.close();
+                    fc = fis.getChannel();
+                    if (fc.isOpen()) {
+                        System.err.println("FileInputStream channel should not be open");
+                        openChannels++;
+                    }
+                    shared = true;
+                    break;
+                case 1:
+                    System.out.print("FileOutputStream...");
+                    FileOutputStream fos = new FileOutputStream(f);
+                    fos.close();
+                    fc = fos.getChannel();
+                    if (fc.isOpen()) {
+                        System.err.println("FileOutputStream channel should not be open");
+                        openChannels++;
+                    }
+                    break;
+                case 2:
+                    System.out.print("RandomAccessFile...");
+                    RandomAccessFile raf = new RandomAccessFile(f, "rw");
+                    raf.close();
+                    fc = raf.getChannel();
+                    if (fc.isOpen()) {
+                        System.err.println("RandomAccessFile channel should not be open");
+                        openChannels++;
+                    }
+                    break;
+                default:
+                    assert false : "Should not get here";
+            }
+
+            try {
+                long position = fc.position();
+                System.err.println("Channel "+i+" position is "+position);
+            } catch (ClosedChannelException cce) {
+                exceptions++;
+            }
+
+            try {
+                fc.tryLock(0, Long.MAX_VALUE, shared);
+            } catch (ClosedChannelException e) {
+                System.out.println("OK");
+                exceptions++;
+            } catch (Error err) {
+                System.err.println(err);
+            }
+        }
+
+        if (exceptions != NUM_EXCEPTIONS || openChannels != 0) {
+            throw new RuntimeException("FAILED:" +
+                    " ClosedChannelExceptions: expected: " + NUM_EXCEPTIONS +
+                    " actual: " + exceptions + ";" + System.lineSeparator() +
+                    " number of open channels: expected: 0 " +
+                    " actual: " + openChannels + ".");
+        }
+    }
+}
--- a/jdk/test/java/rmi/server/RemoteObject/notExtending/NotExtending.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/rmi/server/RemoteObject/notExtending/NotExtending.java	Fri Jan 09 13:28:02 2015 -0500
@@ -30,7 +30,7 @@
  * @author Peter Jones
  *
  * @build NotExtending_Stub NotExtending_Skel
- * @run main/othervm/timeout=240 NotExtending
+ * @run main/othervm NotExtending
  */
 
 
@@ -46,9 +46,16 @@
     /** true if the hashValue field has been initialized */
     private boolean hashValueInitialized = false;
 
-    public NotExtending() throws RemoteException {
+    // no declared constructor - rely on implicit no-arg contructor
+
+    public Remote export() throws RemoteException {
         stub = UnicastRemoteObject.exportObject(this);
         setHashValue(stub.hashCode());
+        return stub;
+    }
+
+    public void unexport() throws RemoteException {
+        UnicastRemoteObject.unexportObject(this, true);
     }
 
     private void setHashValue(int value) {
@@ -58,12 +65,11 @@
 
     public int hashCode() {
         /*
-         * Test fails with a RuntimeException if the hashCode() method is
-         * called (during the export procedure) before the correct hash
-         * value has been initialized.
+         * Test fails if the hashCode() method is called (during export)
+         * before the correct hash value has been initialized.
          */
         if (!hashValueInitialized) {
-            throw new RuntimeException(
+            throw new AssertionError(
                 "hashCode() invoked before hashValue initialized");
         }
         return hashValue;
@@ -74,69 +80,40 @@
     }
 
     public static void main(String[] args) throws Exception {
-        /*
-         * The following line is required with the JDK 1.2 VM so that the
-         * VM can exit gracefully when this test completes.  Otherwise, the
-         * conservative garbage collector will find a handle to the server
-         * object on the native stack and not clear the weak reference to
-         * it in the RMI runtime's object table.
-         */
-        Object dummy = new Object();
+        NotExtending server = null;
 
-        NotExtending server;
         try {
             /*
              * Verify that hashCode() is not invoked before it is
              * initialized.  Tests bugid 4102938.
              */
             server = new NotExtending();
+            Remote stub = server.export();
             System.err.println("Server exported without invoking hashCode().");
 
             /*
              * Verify that passing stub to server's equals() method
              * returns true.
              */
-            if (server.equals(server.stub)) {
-                System.err.println(
-                    "Passing stub to server's equals() method succeeded.");
+            if (server.equals(stub)) {
+                System.err.println("server.equals(stub) returns true");
             } else {
-                throw new RuntimeException(
-                    "passing stub to server's equals() method failed");
+                throw new AssertionError("server.equals(stub) returns false");
             }
 
             /*
              * Verify that passing server to stub's equals() method
              * returns true.  Tests bugid 4099660.
              */
-            if (server.stub.equals(server)) {
-                System.err.println(
-                    "Passing server to stub's equals() method succeeded.");
+            if (stub.equals(server)) {
+                System.err.println("stub.equals(server) returns true");
             } else {
-                throw new RuntimeException(
-                    "passing server to stub's equals() method failed");
+                throw new AssertionError("stub.equals(server) returns false");
             }
-
         } finally {
-            server = null;
-            flushCachedRefs();
-        }
-    }
-
-    /**
-     * Force desperate garbage collection so that soft references
-     * will be cleared.
-     *
-     * This method is required with the JDK 1.1.x RMI runtime so that the
-     * VM can exit gracefully when this test completes.  See bugid 4006356.
-     */
-    public static void flushCachedRefs() {
-        java.util.Vector chain = new java.util.Vector();
-        try {
-            while (true) {
-                int[] hungry = new int[65536];
-                chain.addElement(hungry);
+            if (server != null) {
+                server.unexport();
             }
-        } catch (OutOfMemoryError e) {
         }
     }
 }
--- a/jdk/test/java/security/KeyStore/PKCS12/ReadP12Test.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/security/KeyStore/PKCS12/ReadP12Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003,2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,8 +65,7 @@
 
 public class ReadP12Test {
 
-    private final static String IN_KETYSTORE_TYPE = "pkcs12";
-    private final static String IN_KEYSTORE_PRV = "SunJSSE";
+    private final static String IN_KEYSTORE_TYPE = "pkcs12";
     private final static String IN_STORE_PASS = "pass";
 
     public static void main(String args[]) throws Exception {
@@ -124,8 +123,7 @@
         String dir = System.getProperty("test.src", ".");
         String keystorePath = dir + File.separator + "certs" + File.separator
                 + "readP12";
-        inputKeyStore = KeyStore
-                .getInstance(IN_KETYSTORE_TYPE, IN_KEYSTORE_PRV);
+        inputKeyStore = KeyStore.getInstance(IN_KEYSTORE_TYPE);
         // KeyStore have encoded by Base64.getMimeEncoder().encode(),need decode
         // first.
         byte[] input = Files.readAllBytes(Paths.get(keystorePath, inKeyStore));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/KeyStore/ProbeKeystores.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8044445
+ * @summary test new methods from JEP-229: Create PKCS12 Keystores by Default
+ */
+
+import java.io.*;
+import java.security.*;
+import java.security.KeyStore.*;
+import java.security.cert.*;
+import javax.crypto.*;
+import javax.security.auth.callback.*;
+
+public class ProbeKeystores {
+    private static final char[] PASSWORD = "changeit".toCharArray();
+    private static final char[] BAD_PASSWORD = "badpasword".toCharArray();
+    private static final String DIR = System.getProperty("test.src", ".");
+    private static final String CERT_FILE = "trusted.pem";
+
+    public static final void main(String[] args) throws Exception {
+        try {
+            test();
+        } finally {
+            cleanup();
+        }
+    }
+
+    private static final void test() throws Exception {
+        cleanup();
+
+        // Testing empty keystores
+
+        init("empty.jks", "JKS");
+        init("empty.jceks", "JCEKS");
+        init("empty.p12", "PKCS12");
+
+        load("empty.jks", "JKS");
+        load("empty.jceks", "JCEKS");
+        load("empty.p12", "PKCS12");
+        load("empty.jks", "PKCS12"); // test compatibility mode
+        load("empty.p12", "JKS"); // test compatibility mode
+        load("empty.jks", "PKCS12", true); // test without compatibility mode
+        load("empty.jks", "JKS", false); // test without compatibility mode
+        load("empty.p12", "JKS", true); // test without compatibility mode
+        load("empty.p12", "PKCS12", false); // test without compatibility mode
+
+        probe("empty.jks", "JKS");
+        probe("empty.jceks", "JCEKS");
+        probe("empty.p12", "PKCS12");
+
+        build("empty.jks", "JKS", true);
+        build("empty.jks", "JKS", false);
+        build("empty.jceks", "JCEKS", true);
+        build("empty.jceks", "JCEKS", false);
+        build("empty.p12", "PKCS12", true);
+        build("empty.p12", "PKCS12", false);
+
+        // Testing keystores containing an X.509 certificate
+
+        X509Certificate cert = loadCertificate(CERT_FILE);
+        init("onecert.jks", "JKS", cert);
+        init("onecert.jceks", "JCEKS", cert);
+        init("onecert.p12", "PKCS12", cert);
+
+        load("onecert.jks", "JKS");
+        load("onecert.jceks", "JCEKS");
+        load("onecert.p12", "PKCS12");
+        load("onecert.jks", "PKCS12"); // test compatibility mode
+        load("onecert.p12", "JKS"); // test compatibility mode
+        load("onecert.jks", "PKCS12", true); // test without compatibility mode
+        load("onecert.jks", "JKS", false); // test without compatibility mode
+        load("onecert.p12", "JKS", true); // test without compatibility mode
+        load("onecert.p12", "PKCS12", false); // test without compatibility mode
+
+        probe("onecert.jks", "JKS");
+        probe("onecert.jceks", "JCEKS");
+        probe("onecert.p12", "PKCS12");
+
+        build("onecert.jks", "JKS", true);
+        build("onecert.jks", "JKS", false);
+        build("onecert.jceks", "JCEKS", true);
+        build("onecert.jceks", "JCEKS", false);
+        build("onecert.p12", "PKCS12", true);
+        build("onecert.p12", "PKCS12", false);
+
+        // Testing keystores containing a secret key
+
+        SecretKey key = generateSecretKey("AES", 128);
+        init("onekey.jceks", "JCEKS", key);
+        init("onekey.p12", "PKCS12", key);
+
+        load("onekey.jceks", "JCEKS");
+        load("onekey.p12", "PKCS12");
+        load("onekey.p12", "JKS"); // test compatibility mode
+        load("onekey.p12", "JKS", true); // test without compatibility mode
+        load("onekey.p12", "PKCS12", false); // test without compatibility mode
+
+        probe("onekey.jceks", "JCEKS");
+        probe("onekey.p12", "PKCS12");
+
+        build("onekey.jceks", "JCEKS", true);
+        build("onekey.jceks", "JCEKS", false);
+        build("onekey.p12", "PKCS12", true);
+        build("onekey.p12", "PKCS12", false);
+
+        System.out.println("OK.");
+    }
+
+    private static void cleanup() {
+        new File("empty.jks").delete();
+        new File("empty.jceks").delete();
+        new File("empty.p12").delete();
+        new File("onecert.jks").delete();
+        new File("onecert.jceks").delete();
+        new File("onecert.p12").delete();
+        new File("onekey.jceks").delete();
+        new File("onekey.p12").delete();
+    }
+
+    // Instantiate an empty keystore using the supplied keystore type
+    private static void init(String file, String type) throws Exception {
+        KeyStore ks = KeyStore.getInstance(type);
+        ks.load(null, null);
+        try (OutputStream stream = new FileOutputStream(DIR + "/" + file)) {
+            ks.store(stream, PASSWORD);
+        }
+        System.out.println("Created a " + type + " keystore named '" + file + "'");
+    }
+
+    // Instantiate a keystore using the supplied keystore type & create an entry
+    private static void init(String file, String type, X509Certificate cert)
+        throws Exception {
+        KeyStore ks = KeyStore.getInstance(type);
+        ks.load(null, null);
+        ks.setEntry("mycert", new KeyStore.TrustedCertificateEntry(cert), null);
+        try (OutputStream stream = new FileOutputStream(DIR + "/" + file)) {
+            ks.store(stream, PASSWORD);
+        }
+        System.out.println("Created a " + type + " keystore named '" + file + "'");
+    }
+
+    // Instantiate a keystore using the supplied keystore type & create an entry
+    private static void init(String file, String type, SecretKey key)
+        throws Exception {
+        KeyStore ks = KeyStore.getInstance(type);
+        ks.load(null, null);
+        ks.setEntry("mykey", new KeyStore.SecretKeyEntry(key),
+            new PasswordProtection(PASSWORD));
+        try (OutputStream stream = new FileOutputStream(DIR + "/" + file)) {
+            ks.store(stream, PASSWORD);
+        }
+        System.out.println("Created a " + type + " keystore named '" + file + "'");
+    }
+
+    // Instantiate a keystore by probing the supplied file for the keystore type
+    private static void probe(String file, String type) throws Exception {
+        // First try with the correct password
+        KeyStore ks = KeyStore.getInstance(new File(DIR, file), PASSWORD);
+        if (!type.equalsIgnoreCase(ks.getType())) {
+            throw new Exception("ERROR: expected a " + type + " keystore, " +
+                "got a " + ks.getType() + " keystore instead");
+        } else {
+            System.out.println("Probed a " + type + " keystore named '" + file + "'");
+        }
+
+        // Next try with an incorrect password
+        try {
+            ks = KeyStore.getInstance(new File(DIR, file), BAD_PASSWORD);
+            throw new Exception("ERROR: expected an exception but got success");
+        } catch (IOException e) {
+            System.out.println("Failed to load a " + type + " keystore named '" + file + "' (as expected)");
+        }
+    }
+
+    // Instantiate a keystore by probing the supplied file for the keystore type
+    private static void build(String file, String type, boolean usePassword)
+        throws Exception {
+
+        Builder builder;
+        if (usePassword) {
+            builder = Builder.newInstance(new File(DIR, file),
+                new PasswordProtection(PASSWORD));
+        } else {
+            builder = Builder.newInstance(new File(DIR, file),
+                new CallbackHandlerProtection(new DummyHandler()));
+        }
+        KeyStore ks = builder.getKeyStore();
+        if (!type.equalsIgnoreCase(ks.getType())) {
+            throw new Exception("ERROR: expected a " + type + " keystore, " +
+                "got a " + ks.getType() + " keystore instead");
+        } else {
+            System.out.println("Built a " + type + " keystore named '" + file + "'");
+        }
+    }
+
+    // Load the keystore entries
+    private static void load(String file, String type) throws Exception {
+        KeyStore ks = KeyStore.getInstance(type);
+        try (InputStream stream = new FileInputStream(DIR + "/" + file)) {
+            ks.load(stream, PASSWORD);
+        }
+        if (!type.equalsIgnoreCase(ks.getType())) {
+            throw new Exception("ERROR: expected a " + type + " keystore, " +
+                "got a " + ks.getType() + " keystore instead");
+        } else {
+            System.out.println("Loaded a " + type + " keystore named '" + file + "'");
+        }
+    }
+
+    // Load the keystore entries (with compatibility mode disabled)
+    private static void load(String file, String type, boolean expectFailure)
+        throws Exception {
+        Security.setProperty("keystore.type.compat", "false");
+        try {
+            load(file, type);
+            if (expectFailure) {
+                throw new Exception("ERROR: expected load to fail but it didn't");
+            }
+        } catch (IOException e) {
+            if (expectFailure) {
+                System.out.println("Failed to load a " + type + " keystore named '" + file + "' (as expected)");
+            } else {
+                throw e;
+            }
+        } finally {
+            Security.setProperty("keystore.type.compat", "true");
+        }
+    }
+
+    // Read an X.509 certificate from the supplied file
+    private static X509Certificate loadCertificate(String certFile)
+        throws Exception {
+        X509Certificate cert = null;
+        try (FileInputStream certStream =
+            new FileInputStream(DIR + "/" + certFile)) {
+            CertificateFactory factory =
+                CertificateFactory.getInstance("X.509");
+            return (X509Certificate) factory.generateCertificate(certStream);
+        }
+    }
+
+    // Generate a secret key using the supplied algorithm name and key size
+    private static SecretKey generateSecretKey(String algorithm, int size)
+        throws NoSuchAlgorithmException {
+        KeyGenerator generator = KeyGenerator.getInstance(algorithm);
+        generator.init(size);
+        return generator.generateKey();
+    }
+
+    private static class DummyHandler implements CallbackHandler {
+        public void handle(Callback[] callbacks)
+            throws IOException, UnsupportedCallbackException {
+            System.out.println("** Callbackhandler invoked");
+            for (int i = 0; i < callbacks.length; i++) {
+                Callback cb = callbacks[i];
+                if (cb instanceof PasswordCallback) {
+                    PasswordCallback pcb = (PasswordCallback)cb;
+                    pcb.setPassword(PASSWORD);
+                    break;
+                }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/KeyStore/trusted.pem	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,29 @@
+-----BEGIN CERTIFICATE-----
+MIIF5DCCBMygAwIBAgIQGVCD3zqdD1ZMZZ/zLAPnQzANBgkqhkiG9w0BAQUFADCBvDELMAkGA1UE
+BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
+ZXR3b3JrMTswOQYDVQQLEzJUZXJtcyBvZiB1c2UgYXQgaHR0cHM6Ly93d3cudmVyaXNpZ24uY29t
+L3JwYSAoYykxMDE2MDQGA1UEAxMtVmVyaVNpZ24gQ2xhc3MgMyBJbnRlcm5hdGlvbmFsIFNlcnZl
+ciBDQSAtIEczMB4XDTEyMDcxMDAwMDAwMFoXDTEzMDczMTIzNTk1OVowgbgxCzAJBgNVBAYTAlVT
+MRMwEQYDVQQIEwpDYWxpZm9ybmlhMRcwFQYDVQQHFA5SZWR3b29kIFNob3JlczEbMBkGA1UEChQS
+T3JhY2xlIENvcnBvcmF0aW9uMRIwEAYDVQQLFAlHbG9iYWwgSVQxMzAxBgNVBAsUKlRlcm1zIG9m
+IHVzZSBhdCB3d3cudmVyaXNpZ24uY29tL3JwYSAoYykwNTEVMBMGA1UEAxQMKi5vcmFjbGUuY29t
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz/dOCGrWzPj62q0ZkF59Oj9Fli4wHAuX
+U4/S0yBXF8j6K7TKWFTQkGZt3+08KUhmLm1CE1DbbyRJT292YNXYXunNaKdABob8kaBO/NESUOEJ
+0SZh7fd0xCSJAAPiwOMrM5jLeb/dEpU6nP74Afrhu5ffvKdcvTRGguj9H2oVsisTK8Z1HsiiwcJG
+JXcrjvdCZoPU4FHvK03XZPAqPHKNSaJOrux6kRIWYjQMlmL+qDOb0nNHa6gBdi+VqqJHJHeAM677
+dcUd0jn2m2OWtUnrM3MJZQof7/z27RTdX5J8np0ChkUgm63biDgRZO7uZP0DARQ0I6lZMlrarT8/
+sct3twIDAQABo4IB4jCCAd4wFwYDVR0RBBAwDoIMKi5vcmFjbGUuY29tMAkGA1UdEwQCMAAwCwYD
+VR0PBAQDAgWgMEQGA1UdIAQ9MDswOQYLYIZIAYb4RQEHFwMwKjAoBggrBgEFBQcCARYcaHR0cHM6
+Ly93d3cudmVyaXNpZ24uY29tL3JwYTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwbgYI
+KwYBBQUHAQwEYjBgoV6gXDBaMFgwVhYJaW1hZ2UvZ2lmMCEwHzAHBgUrDgMCGgQUS2u5KJYGDLvQ
+UjibKaxLB4shBRgwJhYkaHR0cDovL2xvZ28udmVyaXNpZ24uY29tL3ZzbG9nbzEuZ2lmMHIGCCsG
+AQUFBwEBBGYwZDAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AudmVyaXNpZ24uY29tMDwGCCsGAQUF
+BzAChjBodHRwOi8vc3ZyaW50bC1nMy1haWEudmVyaXNpZ24uY29tL1NWUkludGxHMy5jZXIwQQYD
+VR0fBDowODA2oDSgMoYwaHR0cDovL3N2cmludGwtZzMtY3JsLnZlcmlzaWduLmNvbS9TVlJJbnRs
+RzMuY3JsMB8GA1UdIwQYMBaAFNebfNgioBX33a1fzimbWMO8RgC1MA0GCSqGSIb3DQEBBQUAA4IB
+AQAITRBlEo+qXLwCL53Db2BGnhDgnSomjne8aCmU7Yt4Kp91tzJdhNuaC/wwDuzD2dPJqzemae3s
+wKiOXrmDQZDj9NNTdkrXHnCvDR4TpOynWe3zBa0bwKnV2cIRKcv482yV53u0kALyFZbagYPwOOz3
+YJA/2SqdcDn9Ztc/ABQ1SkyXyA5j4LJdf2g7BtYrFxjy0RG6We2iM781WSB/9MCNKyHgiwd3KpLf
+urdSKLzy1elNAyt1P3UHwBIIvZ6sJIr/eeELc54Lxt6PtQCXx8qwxYTYXWPXbLgKBHdebgrmAbPK
+TfD69wysvjk6vwSHjmvaqB4R4WRcgkuT+1gxx+ve
+-----END CERTIFICATE-----
--- a/jdk/test/java/util/Collections/EmptyIterator.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/util/Collections/EmptyIterator.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,40 +33,35 @@
 public class EmptyIterator {
 
     void test(String[] args) throws Throwable {
-        testEmptyCollection(Collections.<Object>emptyList());
-        testEmptyCollection(Collections.<Object>emptySet());
+        testEmptyCollection(emptyList());
+        testEmptyCollection(emptySet());
 
-        testEmptyMap(Collections.<Object, Object>emptyMap());
+        testEmptyMap(emptyMap());
 
-        Hashtable<Object, Object> emptyTable = new Hashtable<Object, Object>();
+        Hashtable<?,?> emptyTable = new Hashtable<>();
         testEmptyEnumeration(emptyTable.keys());
         testEmptyEnumeration(emptyTable.elements());
         testEmptyIterator(emptyTable.keySet().iterator());
         testEmptyIterator(emptyTable.values().iterator());
         testEmptyIterator(emptyTable.entrySet().iterator());
 
-        final Enumeration<EmptyIterator> finalEmptyTyped =
-            Collections.emptyEnumeration();
+        final Enumeration<EmptyIterator> finalEmptyTyped = emptyEnumeration();
         testEmptyEnumeration(finalEmptyTyped);
 
-        final Enumeration finalEmptyAbstract =
-            Collections.emptyEnumeration();
+        final Enumeration<?> finalEmptyAbstract = emptyEnumeration();
         testEmptyEnumeration(finalEmptyAbstract);
 
-        @SuppressWarnings("unchecked") Iterator<?> x =
-            new sun.tools.java.MethodSet()
-            .lookupName(sun.tools.java.Identifier.lookup(""));
-        testEmptyIterator(x);
+        testEmptyIterator(emptyIterator());
     }
 
-    <T> void testEmptyEnumeration(final Enumeration<T> e) {
+    void testEmptyEnumeration(final Enumeration<?> e) {
         check(e == emptyEnumeration());
-        check(! e.hasMoreElements());
+        check(!e.hasMoreElements());
         THROWS(NoSuchElementException.class,
                new F(){void f(){ e.nextElement(); }});
     }
 
-    <T> void testEmptyIterator(final Iterator<T> it) {
+    void testEmptyIterator(final Iterator<?> it) {
         check(it == emptyIterator());
         check(! it.hasNext());
         THROWS(NoSuchElementException.class,
@@ -75,10 +70,10 @@
                new F(){void f(){ it.remove(); }});
     }
 
-    void testEmptyMap(Map<Object, Object> m) {
+    void testEmptyMap(Map<?,?> m) {
         check(m == emptyMap());
         check(m.entrySet().iterator() ==
-              Collections.<Map.Entry<Object,Object>>emptyIterator());
+              Collections.<Map.Entry<?,?>>emptyIterator());
         check(m.values().iterator() == emptyIterator());
         check(m.keySet().iterator() == emptyIterator());
         equal(m, unmodifiableMap(m));
@@ -88,7 +83,7 @@
         testEmptyCollection(m.values());
     }
 
-    <E> void testToArray(final Collection<E> c) {
+    void testToArray(final Collection<?> c) {
         Object[] a = c.toArray();
         equal(a.length, 0);
         equal(a.getClass().getComponentType(), Object.class);
@@ -109,7 +104,7 @@
         }
     }
 
-    <E> void testEmptyCollection(final Collection<E> c) {
+    void testEmptyCollection(final Collection<?> c) {
         testEmptyIterator(c.iterator());
 
         check(c.iterator() == emptyIterator());
--- a/jdk/test/java/util/Locale/LocaleProviders.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/util/Locale/LocaleProviders.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -137,7 +137,7 @@
 
 runTest()
 {
-    RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSES} -Djava.locale.providers=$PREFLIST LocaleProviders $METHODNAME $PARAM1 $PARAM2 $PARAM3"
+    RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSES}${PS}${SPICLASSES} -Djava.locale.providers=$PREFLIST LocaleProviders $METHODNAME $PARAM1 $PARAM2 $PARAM3"
     echo ${RUNCMD}
     ${RUNCMD}
     result=$?
@@ -189,6 +189,7 @@
   PARAM2=zh
   PARAM3=CN
 fi
+SPICLASSES=
 runTest
 
 # testing SPI is NOT selected, as there is none.
@@ -197,6 +198,7 @@
 PARAM1=JRE
 PARAM2=en
 PARAM3=US
+SPICLASSES=
 runTest
 
 # testing the order, variaton #1. This assumes en_GB DateFormat data are available both in JRE & CLDR
@@ -205,6 +207,7 @@
 PARAM1=CLDR
 PARAM2=en
 PARAM3=GB
+SPICLASSES=
 runTest
 
 # testing the order, variaton #2. This assumes en_GB DateFormat data are available both in JRE & CLDR
@@ -213,6 +216,7 @@
 PARAM1=JRE
 PARAM2=en
 PARAM3=GB
+SPICLASSES=
 runTest
 
 # testing the order, variaton #3 for non-existent locale in JRE assuming "haw" is not in JRE.
@@ -221,6 +225,7 @@
 PARAM1=CLDR
 PARAM2=haw
 PARAM3=GB
+SPICLASSES=
 runTest
 
 # testing the order, variaton #4 for the bug 7196799. CLDR's "zh" data should be used in "zh_CN"
@@ -229,6 +234,7 @@
 PARAM1=CLDR
 PARAM2=zh
 PARAM3=CN
+SPICLASSES=
 runTest
 
 # testing FALLBACK provider. SPI and invalid one cases.
@@ -237,16 +243,19 @@
 PARAM1=FALLBACK
 PARAM2=en
 PARAM3=US
+SPICLASSES=
 runTest
 PREFLIST=FOO
 PARAM1=JRE
 PARAM2=en
 PARAM3=US
+SPICLASSES=
 runTest
 PREFLIST=BAR,SPI
 PARAM1=FALLBACK
 PARAM2=en
 PARAM3=US
+SPICLASSES=
 runTest
 
 # testing 7198834 fix. Only works on Windows Vista or upper.
@@ -255,22 +264,25 @@
 PARAM1=
 PARAM2=
 PARAM3=
+SPICLASSES=
 runTest
 
 # testing 8000245 fix.
 METHODNAME=tzNameTest
-PREFLIST="JRE -Djava.ext.dirs=${SPIDIR}"
+PREFLIST=JRE
 PARAM1=Europe/Moscow
 PARAM2=
 PARAM3=
+SPICLASSES=${SPIDIR}
 runTest
 
 # testing 8000615 fix.
 METHODNAME=tzNameTest
-PREFLIST="JRE -Djava.ext.dirs=${SPIDIR}"
+PREFLIST=JRE
 PARAM1=America/Los_Angeles
 PARAM2=
 PARAM3=
+SPICLASSES=${SPIDIR}
 runTest
 
 # testing 8001440 fix.
@@ -279,6 +291,7 @@
 PARAM1=
 PARAM2=
 PARAM3=
+SPICLASSES=
 runTest
 
 # testing 8010666 fix.
@@ -289,15 +302,17 @@
   PARAM1=
   PARAM2=
   PARAM3=
+  SPICLASSES=
   runTest
 fi
 
 # testing 8013086 fix.
 METHODNAME=bug8013086Test
-PREFLIST="JRE,SPI -Djava.ext.dirs=${SPIDIR}"
+PREFLIST=JRE,SPI
 PARAM1=ja
 PARAM2=JP
 PARAM3=
+SPICLASSES=${SPIDIR}
 runTest
 
 # testing 8013903 fix. (Windows only)
@@ -306,12 +321,14 @@
 PARAM1=
 PARAM2=
 PARAM3=
+SPICLASSES=
 runTest
 METHODNAME=bug8013903Test
 PREFLIST=HOST
 PARAM1=
 PARAM2=
 PARAM3=
+SPICLASSES=
 runTest
 
 # testing 8027289 fix, if the platform format default is zh_CN
@@ -323,12 +340,14 @@
   PARAM1=FFE5
   PARAM2=
   PARAM3=
+  SPICLASSES=
   runTest
   METHODNAME=bug8027289Test
   PREFLIST=HOST
   PARAM1=00A5
   PARAM2=
   PARAM3=
+  SPICLASSES=
   runTest
 fi
 
--- a/jdk/test/java/util/PluggableLocale/BreakIteratorProviderTest.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/util/PluggableLocale/BreakIteratorProviderTest.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440
+# @bug 4052440 8062588
 # @summary BreakIteratorProvider tests
-# @run shell ExecTest.sh foo BreakIteratorProviderTest true
+# @run shell ExecTest.sh foo BreakIteratorProviderTest
--- a/jdk/test/java/util/PluggableLocale/CalendarDataProviderTest.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/util/PluggableLocale/CalendarDataProviderTest.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 7058207 8000986
+# @bug 7058207 8000986 8062588
 # @summary CalendarDataProvider tests
-# @run shell ExecTest.sh bar CalendarDataProviderTest true
+# @run shell ExecTest.sh bar CalendarDataProviderTest
--- a/jdk/test/java/util/PluggableLocale/CalendarNameProviderTest.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/util/PluggableLocale/CalendarNameProviderTest.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -22,6 +22,6 @@
 #
 
 # @test
-# @bug 8000986
+# @bug 8000986 8062588
 # @summary CalendarNameProvider tests
-# @run shell ExecTest.sh bar CalendarNameProviderTest true
+# @run shell ExecTest.sh bar CalendarNameProviderTest
--- a/jdk/test/java/util/PluggableLocale/ClasspathTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/util/PluggableLocale/ClasspathTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -36,13 +36,13 @@
 
     ClasspathTest() {
         /*
-         * Since providers can only be loaded from the extension directory,
-         * this test will fail if they are loaded from classpath.
+         * Since providers can be loaded from the application's classpath,
+         * this test will fail if they are NOT loaded from classpath.
          */
         Locale OSAKA = new Locale("ja", "JP", "osaka");
         List<Locale> availableLocales = Arrays.asList(Locale.getAvailableLocales());
-        if (availableLocales.contains(OSAKA)) {
-            throw new RuntimeException("LSS providers were loaded from the class path.");
+        if (!availableLocales.contains(OSAKA)) {
+            throw new RuntimeException("LSS providers were NOT loaded from the class path.");
         }
     }
 }
--- a/jdk/test/java/util/PluggableLocale/ClasspathTest.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/util/PluggableLocale/ClasspathTest.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -23,7 +23,6 @@
 #
 #
 # @test
-# @bug 6388652
-# @summary  Checks whether providers can only be loaded from extension directories, 
-#     not from classpath.
-# @run shell ExecTest.sh bar ClasspathTest false
+# @bug 6388652 8062588
+# @summary  Checks whether providers can be loaded from classpath.
+# @run shell ExecTest.sh bar ClasspathTest
--- a/jdk/test/java/util/PluggableLocale/CollatorProviderTest.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/util/PluggableLocale/CollatorProviderTest.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440
+# @bug 4052440 8062588 
 # @summary CollatorProvider tests
-# @run shell ExecTest.sh foo CollatorProviderTest true
+# @run shell ExecTest.sh foo CollatorProviderTest
--- a/jdk/test/java/util/PluggableLocale/CurrencyNameProviderTest.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/util/PluggableLocale/CurrencyNameProviderTest.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440 7199750 8000997
+# @bug 4052440 7199750 8000997 8062588
 # @summary CurrencyNameProvider tests
-# @run shell ExecTest.sh bar CurrencyNameProviderTest true
+# @run shell ExecTest.sh bar CurrencyNameProviderTest
--- a/jdk/test/java/util/PluggableLocale/DateFormatProviderTest.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/util/PluggableLocale/DateFormatProviderTest.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440 7003643
+# @bug 4052440 7003643 8062588 
 # @summary DateFormatProvider tests
-# @run shell ExecTest.sh foo DateFormatProviderTest true
+# @run shell ExecTest.sh foo DateFormatProviderTest
--- a/jdk/test/java/util/PluggableLocale/DateFormatSymbolsProviderTest.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/util/PluggableLocale/DateFormatSymbolsProviderTest.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440 7200341
+# @bug 4052440 7200341 8062588
 # @summary DateFormatSymbolsProvider tests
-# @run shell ExecTest.sh foo DateFormatSymbolsProviderTest true
+# @run shell ExecTest.sh foo DateFormatSymbolsProviderTest
--- a/jdk/test/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440
+# @bug 4052440 8062588
 # @summary DecimalFormatSymbolsProvider tests
-# @run shell ExecTest.sh foo DecimalFormatSymbolsProviderTest true
+# @run shell ExecTest.sh foo DecimalFormatSymbolsProviderTest
--- a/jdk/test/java/util/PluggableLocale/ExecTest.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/util/PluggableLocale/ExecTest.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -76,14 +76,6 @@
     ;;
 esac
 
-# set classpath and extension directory variables
-if [ -d ${TESTJAVA}${FS}lib${FS}ext ]
-then
-    EXTDIRS="${TESTJAVA}${FS}lib${FS}ext${PS}${TESTCLASSES}"
-else
-    EXTDIRS="${TESTJAVA}${FS}jre${FS}lib${FS}ext${PS}${TESTCLASSES}"
-fi
-
 case "$1" in
   "foo" )
     cp ${TESTSRC}${FS}fooprovider.jar ${TESTCLASSES}
@@ -122,12 +114,7 @@
 fi
 
 # run
-if [ "$3" = "true" ]
-then
-  RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Djava.ext.dirs=${EXTDIRS} $2 "
-else
-  RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${CLASSPATHARG} $2 "
-fi
+RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${CLASSPATHARG} $2 "
 
 echo ${RUNCMD}
 ${RUNCMD}
--- a/jdk/test/java/util/PluggableLocale/GenericTest.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/util/PluggableLocale/GenericTest.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440
+# @bug 4052440 8062588
 # @summary Generic tests for the pluggable locales feature
-# @run shell ExecTest.sh foobar GenericTest true
+# @run shell ExecTest.sh foobar GenericTest
--- a/jdk/test/java/util/PluggableLocale/LocaleNameProviderTest.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/util/PluggableLocale/LocaleNameProviderTest.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440 8000273
+# @bug 4052440 8000273 8062588
 # @summary LocaleNameProvider tests
-# @run shell ExecTest.sh bar LocaleNameProviderTest true
+# @run shell ExecTest.sh bar LocaleNameProviderTest
--- a/jdk/test/java/util/PluggableLocale/NumberFormatProviderTest.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/util/PluggableLocale/NumberFormatProviderTest.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440 7003643
+# @bug 4052440 7003643 8062588
 # @summary NumberFormatProvider tests
-# @run shell ExecTest.sh foo NumberFormatProviderTest true
+# @run shell ExecTest.sh foo NumberFormatProviderTest
--- a/jdk/test/java/util/PluggableLocale/TimeZoneNameProviderTest.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/util/PluggableLocale/TimeZoneNameProviderTest.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440 8003267
+# @bug 4052440 8003267 8062588
 # @summary TimeZoneNameProvider tests
-# @run shell ExecTest.sh bar TimeZoneNameProviderTest true
+# @run shell ExecTest.sh bar TimeZoneNameProviderTest
--- a/jdk/test/java/util/ResourceBundle/Bug6299235Test.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/java/util/ResourceBundle/Bug6299235Test.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -55,27 +55,14 @@
   exit 1
 fi
 
-# See if TESTJAVA points to JRE or JDK
-if [ -d "${TESTJAVA}${FILESEP}jre" ]; then
-    JRE_EXT_DIR=${TESTJAVA}${FILESEP}jre${FILESEP}lib${FILESEP}ext
-else
-    JRE_EXT_DIR=${TESTJAVA}${FILESEP}lib${FILESEP}ext
-fi
-
-if [ -d "${JRE_EXT_DIR}" ]; then
-    NEW_EXT_DIR="${JRE_EXT_DIR}${PATHSEP}${TESTSRC}"
-else
-    NEW_EXT_DIR=${TESTSRC}
-fi
-
 echo "TESTJAVA=${TESTJAVA}"
 echo "TESTSRC=${TESTSRC}"
 echo "TESTCLASSES=${TESTCLASSES}"
 echo "NEW_EXT_DIR=${NEW_EXT_DIR}"
 
 cd ${TESTSRC}
-
-${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTCLASSES} -Djava.ext.dirs=${NEW_EXT_DIR} Bug6299235Test
+echo 
+${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}awtres.jar Bug6299235Test
 
 if [ $? -ne 0 ]
     then
--- a/jdk/test/javax/management/monitor/CounterMonitorTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/management/monitor/CounterMonitorTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -68,7 +68,7 @@
                 observedValue = count;
                 CounterMonitorTest.class.notifyAll();
             }
-            return count;
+            return observedValue;
         }
         public void setNbObjects(Object n) {
             echo(">>> StdObservedObject.setNbObjects: " + n);
--- a/jdk/test/javax/management/standardmbean/DeadlockTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/management/standardmbean/DeadlockTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 6331746
- * @summary Deadlock on synchronization problem
+ * @summary Test a deadlock and will be blocked forever if the deadlock is present.
  * @author Shanliang JIANG
  * @run main DeadlockTest
  */
@@ -55,43 +55,25 @@
         BadBoy bb = new BadBoy(dt);
         bb.start();
 
-        final long timeout = 2000;
-        long stopTime = System.currentTimeMillis() + timeout;
-        long timeToWait = timeout;
         synchronized(bb) {
-            while(!bb.gotLock || timeToWait > 0) {
-                bb.wait(timeToWait);
-
-                timeToWait = stopTime - System.currentTimeMillis();
+            while(!bb.gotLock) {
+                bb.wait(); // if blocked here, means failing to get lock, impossible.
             }
         }
 
-        if (!bb.gotLock) {
-            throw new RuntimeException("Failed to get lock, impossible!");
-        }
-
         System.out.println("main: The BadBay is holding the lock forever.");
 
         System.out.println("main: Create a WorkingBoy to see blocking ...");
         WorkingBoy wb = new WorkingBoy(dt);
 
-        stopTime = System.currentTimeMillis() + timeout;
-        timeToWait = timeout;
-
         synchronized(wb) {
             wb.start();
 
-            while(!wb.done || timeToWait > 0) {
-                wb.wait(timeToWait);
-
-                timeToWait = stopTime - System.currentTimeMillis();
+            while(!wb.done) {
+                wb.wait(); // if blocked here, the deadlock happends
             }
         }
 
-        if (!wb.done) {
-            throw new RuntimeException("It is blocked!");
-        }
-
         System.out.println("main: OK, bye bye.");
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/smartcardio/CommandAPDUTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8049021
+ * @summary Test different constructors for CommandAPDU and check CLA,INS,NC,NE,
+ * P1,and P2
+ * @run testng CommandAPDUTest
+ */
+import java.nio.ByteBuffer;
+import javax.smartcardio.CommandAPDU;
+import static org.testng.Assert.*;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+public class CommandAPDUTest {
+
+    static final byte[] C1 = {(byte) 0x00, (byte) 0xA4, (byte) 0x04,
+        (byte) 0x00, (byte) 0x07, (byte) 0xA0, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x62, (byte) 0x81, (byte) 0x01, (byte) 0x00};
+    static int cla, ins, nc, ne, p1, p2;
+    static byte[] apdu, data;
+    static CommandAPDU cm1, cm2, cm3, cm4, cm5, cm6, cm7, cm8, cm9;
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+        //expected values of apdu, data, headers, nc, ne
+        CommandAPDU capdu = new CommandAPDU(C1);
+        apdu = capdu.getBytes();
+        data = capdu.getData();
+
+        cla = capdu.getCLA();
+        if (cla != (C1[0] & 0xff)) {
+            throw new RuntimeException("Failure: cla is not right");
+        }
+
+        ins = capdu.getINS();
+        if (ins != (C1[1] & 0xff)) {
+            throw new RuntimeException("Failure: ins is not right");
+        }
+
+        p1 = capdu.getP1();
+        if (p1 != (C1[2] & 0xff)) {
+            throw new RuntimeException("Failure: p1 is not right");
+        }
+
+        p2 = capdu.getP2();
+        if (p2 != (C1[3] & 0xff)) {
+            throw new RuntimeException("Failure: p2 is not right");
+        }
+
+        nc = capdu.getNc();
+        ne = capdu.getNe();
+
+        //Test on following constructors
+        cm1 = new CommandAPDU(apdu);
+        cm2 = new CommandAPDU(cla, ins, p1, p2);
+        cm3 = new CommandAPDU(cla, ins, p1, p2, data);
+        cm4 = new CommandAPDU(cla, ins, p1, p2, data, ne);
+        cm5 = new CommandAPDU(cla, ins, p1, p2, ne);
+        cm6 = new CommandAPDU(ByteBuffer.wrap(apdu));
+        cm7 = new CommandAPDU(apdu, 0, apdu.length);
+        cm8 = new CommandAPDU(cla, ins, p1, p2, data, 0, nc);
+        cm9 = new CommandAPDU(cla, ins, p1, p2, data, 0, nc, ne);
+    }
+
+    @Test(dataProvider = "provider1")
+    public static void testHeaders(CommandAPDU cm) {
+        assertEquals(cla, cm.getCLA());
+        assertEquals(ins, cm.getINS());
+        assertEquals(p1, cm.getP1());
+        assertEquals(p2, cm.getP2());
+    }
+
+    @Test(dataProvider = "provider2")
+    public static void testAPDU(CommandAPDU cm) {
+        assertEquals(apdu, cm.getBytes());
+    }
+
+    @Test(dataProvider = "provider3")
+    public static void testData(CommandAPDU cm) {
+        assertEquals(data, cm.getData());
+    }
+
+    @Test(dataProvider = "provider3")
+    public static void testNC(CommandAPDU cm) {
+        assertEquals(nc, cm.getNc());
+    }
+
+    @Test(dataProvider = "provider4")
+    public static void testNE(CommandAPDU cm) {
+        assertEquals(ne, cm.getNe());
+    }
+
+    @DataProvider
+    public Object[][] provider1() {
+        return new Object[][]{{cm1}, {cm2}, {cm3}, {cm4}, {cm5}, {cm6}, {cm7},
+        {cm8}, {cm9}};
+    }
+
+    @DataProvider
+    public Object[][] provider2() {
+        return new Object[][]{{cm1}, {cm6}, {cm7}};
+    }
+
+    @DataProvider
+    public Object[][] provider3() {
+        return new Object[][]{{cm1}, {cm3}, {cm4}, {cm6}, {cm7}, {cm8}, {cm9}};
+    }
+
+    @DataProvider
+    public Object[][] provider4() {
+        return new Object[][]{{cm1}, {cm4}, {cm5}, {cm6}, {cm7}, {cm9}};
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/smartcardio/ResponseAPDUTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8049021
+ * @summary Construct ResponseAPDU from byte array and check NR< SW, SW1 and SW2
+ * @run testng ResponseAPDUTest
+ */
+import javax.smartcardio.ResponseAPDU;
+import static org.testng.Assert.*;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+public class ResponseAPDUTest {
+
+    static final byte[] R1 = {(byte) 0x07, (byte) 0xA0, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x62, (byte) 0x81, (byte) 0x01,
+        (byte) 0x04, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x24,
+        (byte) 0x05, (byte) 0x00, (byte) 0x0B, (byte) 0x04, (byte) 0xB0,
+        (byte) 0x25, (byte) 0x90, (byte) 0x00};
+    static final ResponseAPDU RAPDU = new ResponseAPDU(R1);
+    static byte[] expectedData;
+    static int expectedNr, expectedSw1, expectedSw2, expectedSw;
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+        //expected values for data,nr,sw1,sw2 and sw
+
+        int apduLen = R1.length;
+        expectedData = new byte[apduLen - 2];
+        for (int i = 0; i < (apduLen - 2); i++) {
+            expectedData[i] = R1[i];
+        }
+
+        expectedNr = expectedData.length;
+        expectedSw1 = R1[apduLen - 2] & 0xff;
+        expectedSw2 = R1[apduLen - 1] & 0xff;
+        expectedSw = (expectedSw1 << 8) | expectedSw2;
+    }
+
+    @Test
+    public static void test() {
+        assertEquals(RAPDU.getBytes(), R1);
+        assertEquals(RAPDU.getData(), expectedData);
+        assertEquals(RAPDU.getNr(), expectedNr);
+        assertEquals(RAPDU.getSW(), expectedSw);
+        assertEquals(RAPDU.getSW1(), expectedSw1);
+        assertEquals(RAPDU.getSW2(), expectedSw2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/smartcardio/TerminalFactorySpiTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8049021
+ * @summary Test if we can write new provider for smart card
+ * @run main/othervm/policy=policy TerminalFactorySpiTest
+ */
+import java.security.Provider;
+import java.security.Security;
+import java.util.Arrays;
+import javax.smartcardio.CardTerminals;
+import javax.smartcardio.TerminalFactory;
+import javax.smartcardio.TerminalFactorySpi;
+
+public class TerminalFactorySpiTest {
+
+    static boolean callMethod = false;
+
+    public static void main(String[] args) throws Exception {
+        Provider myProvider = new MyProvider();
+        Security.addProvider(myProvider);
+        System.out.println(Arrays.asList(Security.getProviders()));
+
+        TerminalFactory.getInstance("MyType", new Object()).terminals();
+        if (!callMethod) {
+            throw new RuntimeException("Expected engineTerminals() not called");
+        }
+    }
+
+    public static class MyProvider extends Provider {
+
+        MyProvider() {
+            super("MyProvider", 1.0d, "smart Card Example");
+            put("TerminalFactory.MyType", "TerminalFactorySpiTest$MyTerminalFactorySpi");
+        }
+    }
+
+    public static class MyTerminalFactorySpi extends TerminalFactorySpi {
+
+        public MyTerminalFactorySpi(Object ob) {
+        }
+
+        protected CardTerminals engineTerminals() {
+            System.out.println("MyTerminalFactory.engineTerminals()");
+            callMethod = true;
+            return null;
+        }
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/smartcardio/policy	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,4 @@
+grant {
+        permission java.security.SecurityPermission "insertProvider.MyProvider";
+        permission java.security.SecurityPermission "putProviderProperty.MyProvider";
+};
--- a/jdk/test/javax/swing/AbstractButton/6711682/bug6711682.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/AbstractButton/6711682/bug6711682.java	Fri Jan 09 13:28:02 2015 -0500
@@ -28,8 +28,6 @@
    @run main bug6711682
 */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.event.CellEditorListener;
 import javax.swing.table.TableCellEditor;
@@ -47,13 +45,12 @@
     public static void main(String[] args) throws Exception {
         Robot robot = new Robot();
         robot.setAutoDelay(50);
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 createAndShowGUI();
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
         Point l = table.getLocationOnScreen();
         int h = table.getRowHeight();
         for (int i = 0; i < 3; i++) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JButton/4368790/bug4368790.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+   @bug 4368790
+   @summary JButton stays pressed when focus stolen
+   @author Alexander Potochkin
+   @run main bug4368790
+*/
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.KeyEvent;
+
+public class bug4368790 {
+    private static JButton b1;
+
+    private static void createGui() {
+        final JFrame frame = new JFrame();
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setLayout(new FlowLayout());
+
+        b1 = new JButton("Button1");
+        frame.add(b1);
+        frame.add(new JButton("Button2"));
+
+        frame.setSize(200, 200);
+        frame.setLocationRelativeTo(null);
+        frame.setVisible(true);
+        b1.requestFocus();
+    }
+
+    public static void main(String[] args) throws Exception {
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                bug4368790.createGui();
+            }
+        });
+        robot.waitForIdle();
+        robot.keyPress(KeyEvent.VK_SPACE);
+        robot.keyPress(KeyEvent.VK_TAB);
+        robot.keyRelease(KeyEvent.VK_TAB);
+        robot.keyRelease(KeyEvent.VK_SPACE);
+        robot.waitForIdle();
+        if (b1.getModel().isPressed()) {
+            throw new RuntimeException("The button is unexpectedly pressed");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JColorChooser/8065098/JColorChooserDnDTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import javax.swing.BorderFactory;
+import javax.swing.JColorChooser;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+/*
+ * @bug 8065098
+ * @summary JColorChooser no longer supports drag and drop
+ *     between two JVM instances
+ */
+public class JColorChooserDnDTest {
+
+    public static void main(String[] args) {
+        SwingUtilities.invokeLater(new Runnable() {
+
+            @Override
+            public void run() {
+                JFrame frame = new JFrame();
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                JPanel panel = new JPanel();
+                JColorChooser colorChooser = new JColorChooser();
+                colorChooser.setDragEnabled(true);
+                panel.setBorder(BorderFactory.createTitledBorder("JColorChoosers"));
+                panel.add(colorChooser);
+                frame.setContentPane(panel);
+                frame.pack();
+                frame.setVisible(true);
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JColorChooser/8065098/bug8065098.html	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,40 @@
+<!--
+ Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+    <body>
+        1. Compile the java test JColorChooserDnDTest.java: 
+            > <path-to-the-tested-jdk>/bin/javac JColorChooserDnDTest.java
+        2. Run the first instance of the java test: 
+            > <path-to-the-tested-jdk>/bin/java JColorChooserDnDTest
+        3. Select a color in the color chooser
+        4. Run the second instance of the java test: 
+            > <path-to-the-tested-jdk>/bin/java JColorChooserDnDTest
+        5. Drag and drop the selected color from the first color chooser
+           preview panel to the second color chooser preview panel
+        6. If the color is dragged to the second color chooser then the test passes.
+
+    <applet width="500" height="1" code="bug8065098.class">
+    </applet>        
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JColorChooser/8065098/bug8065098.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import javax.swing.JApplet;
+
+/*
+ * @test
+ * @bug 8065098
+ * @summary JColorChooser no longer supports drag and drop
+ *     between two JVM instances
+ * @run applet/manual=yesno bug8065098.html
+ */
+public class bug8065098 extends JApplet {
+
+}
--- a/jdk/test/javax/swing/JColorChooser/Test6541987.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JColorChooser/Test6541987.java	Fri Jan 09 13:28:02 2015 -0500
@@ -39,10 +39,7 @@
 import javax.swing.JFrame;
 import javax.swing.SwingUtilities;
 
-import sun.awt.SunToolkit;
-
 public class Test6541987 implements Runnable {
-    private static final SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
     private static Robot robot;
 
     public static void main(String[] args) throws AWTException {
@@ -50,14 +47,14 @@
         // test escape after selection
         start();
         click(KeyEvent.VK_ESCAPE);
-        toolkit.realSync();
+        robot.waitForIdle();
         // test double escape after editing
         start();
         click(KeyEvent.VK_1);
         click(KeyEvent.VK_0);
         click(KeyEvent.VK_ESCAPE);
         click(KeyEvent.VK_ESCAPE);
-        toolkit.realSync();
+        robot.waitForIdle();
         // all windows should be closed
         for (Window window : Window.getWindows()) {
             if (window.isVisible()) {
@@ -76,7 +73,7 @@
     }
 
     private static void click(int...keys) {
-        toolkit.realSync();
+        robot.waitForIdle();
         for (int key : keys) {
             robot.keyPress(key);
         }
--- a/jdk/test/javax/swing/JColorChooser/Test6827032.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JColorChooser/Test6827032.java	Fri Jan 09 13:28:02 2015 -0500
@@ -29,8 +29,6 @@
  * @library ../regtesthelpers
  */
 
-import sun.awt.SunToolkit;
-
 import java.awt.*;
 import java.awt.event.*;
 
@@ -49,7 +47,6 @@
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
@@ -57,7 +54,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
--- a/jdk/test/javax/swing/JColorChooser/Test7194184.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JColorChooser/Test7194184.java	Fri Jan 09 13:28:02 2015 -0500
@@ -39,7 +39,6 @@
 import java.awt.AWTException;
 import java.awt.Color;
 import java.awt.Robot;
-import java.awt.Toolkit;
 import java.awt.event.KeyEvent;
 
 import javax.swing.JColorChooser;
@@ -47,7 +46,6 @@
 import javax.swing.SwingUtilities;
 
 import java.util.concurrent.Callable;
-import sun.awt.SunToolkit;
 
 public class Test7194184 implements Runnable {
     private static JFrame frame;
@@ -60,10 +58,9 @@
 
     private static void testKeyBoardAccess() throws Exception {
         Robot robot = new Robot();
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
 
         SwingUtilities.invokeLater(new Test7194184());
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeLater(new Runnable() {
             @Override
@@ -78,7 +75,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // Tab to move the focus to MainSwatch
         Util.hitKeys(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
@@ -87,7 +84,7 @@
         Util.hitKeys(robot, KeyEvent.VK_RIGHT);
         Util.hitKeys(robot, KeyEvent.VK_RIGHT);
         Util.hitKeys(robot, KeyEvent.VK_SPACE);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
--- a/jdk/test/javax/swing/JComboBox/4199622/bug4199622.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JComboBox/4199622/bug4199622.java	Fri Jan 09 13:28:02 2015 -0500
@@ -25,12 +25,13 @@
    @bug 4199622
    @summary RFE: JComboBox shouldn't send ActionEvents for keyboard navigation
    @author Vladislav Karnaukhov
+   @library ../../../../lib/testlibrary
+   @build jdk.testlibrary.OSInfo
    @run main bug4199622
 */
 
 import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
-import sun.awt.OSInfo;
-import sun.awt.SunToolkit;
+import jdk.testlibrary.OSInfo;
 
 import javax.swing.*;
 import javax.swing.plaf.metal.MetalLookAndFeel;
@@ -74,7 +75,6 @@
     }
 
     static Robot robot = null;
-    static SunToolkit toolkit = null;
 
     static void doTest() {
         if (robot == null) {
@@ -86,11 +86,7 @@
             }
         }
 
-        toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-        if (toolkit == null) {
-            throw new RuntimeException("Can't get the toolkit. Test failed");
-        }
-        toolkit.realSync();
+        robot.waitForIdle();
 
         doActualTest();
 
@@ -109,7 +105,7 @@
             throw new RuntimeException("Test failed", e);
         }
 
-        toolkit.realSync();
+        robot.waitForIdle();
         doActualTest();
     }
 
@@ -144,12 +140,14 @@
         } catch (InvocationTargetException e) {
             throw new RuntimeException("Test failed", e);
         }
-        toolkit.realSync();
+        robot.waitForIdle();
 
         robot.keyPress(KeyEvent.VK_END);
-        toolkit.realSync();
+        robot.keyRelease(KeyEvent.VK_END);
+        robot.waitForIdle();
         robot.keyPress(KeyEvent.VK_HOME);
-        toolkit.realSync();
+        robot.keyRelease(KeyEvent.VK_HOME);
+        robot.waitForIdle();
     }
 
     static void doTestUpDown() {
@@ -166,16 +164,18 @@
         } catch (InvocationTargetException e) {
             throw new RuntimeException("Test failed", e);
         }
-        toolkit.realSync();
+        robot.waitForIdle();
 
         for (int i = 0; i < nElems; i++) {
             robot.keyPress(KeyEvent.VK_DOWN);
-            toolkit.realSync();
+            robot.keyRelease(KeyEvent.VK_DOWN);
+            robot.waitForIdle();
         }
 
         for (int i = 0; i < nElems; i++) {
             robot.keyPress(KeyEvent.VK_UP);
-            toolkit.realSync();
+            robot.keyRelease(KeyEvent.VK_UP);
+            robot.waitForIdle();
         }
     }
 
@@ -193,17 +193,19 @@
         } catch (InvocationTargetException e) {
             throw new RuntimeException("Test failed", e);
         }
-        toolkit.realSync();
+        robot.waitForIdle();
 
         int listHeight = cb.getMaximumRowCount();
         for (int i = 0; i < nElems; i += listHeight) {
             robot.keyPress(KeyEvent.VK_PAGE_DOWN);
-            toolkit.realSync();
+            robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+            robot.waitForIdle();
         }
 
         for (int i = 0; i < nElems; i += listHeight) {
             robot.keyPress(KeyEvent.VK_PAGE_UP);
-            toolkit.realSync();
+            robot.keyRelease(KeyEvent.VK_PAGE_UP);
+            robot.waitForIdle();
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JComboBox/4515752/DefaultButtonTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.awt.*;
+import java.awt.event.*;
+
+import javax.swing.*;
+
+/**
+ * @test
+ * @bug 4515752 4337071
+ * @author Mark Davidson
+ * @summary Tests the invocation of the default button within the JComboBox.
+ */
+public class DefaultButtonTest extends JFrame implements ActionListener {
+
+    private static boolean defaultButtonPressed = false;
+    private static boolean editChanged = false;
+
+    private static String[] strData =  {
+        "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"
+    };
+
+    private static String[] strData2 =  {
+        "One", "Two", "Three", "Four", "Five", "Six", "Seven"
+    };
+
+    public static void main(String[] args) throws Throwable {
+        SwingUtilities.invokeAndWait(new Runnable(){
+            public void run() {
+                new DefaultButtonTest();
+            }
+        });
+        test();
+        System.out.println("Test Passed");
+    }
+
+    public DefaultButtonTest() {
+        getContentPane().add(new DefaultPanel(this));
+        pack();
+        setVisible(true);
+    }
+
+    public static void test() {
+        // Use Robot to automate the test
+        Robot robot = null;
+        try {
+            robot = new Robot();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        robot.setAutoDelay(125);
+
+        for (int i = 0; i < 3; i++) {
+            // Test ENTER press on the non editable combo.
+            robot.waitForIdle();
+            robot.keyPress(KeyEvent.VK_ENTER);
+            robot.waitForIdle();
+            robot.keyRelease(KeyEvent.VK_ENTER);
+            robot.waitForIdle();
+            testDefaultButton(true);
+
+            // Test the ENTER press on the editable combo box
+            robot.keyPress(KeyEvent.VK_TAB);
+            robot.waitForIdle();
+            robot.keyRelease(KeyEvent.VK_TAB);
+            robot.waitForIdle();
+            robot.keyPress(KeyEvent.VK_ENTER);
+            robot.waitForIdle();
+            robot.keyRelease(KeyEvent.VK_ENTER);
+            robot.waitForIdle();
+            testDefaultButton(true);
+
+            // Change the value, should generate a change but not a Default Button press.
+            robot.waitForIdle();
+            robot.keyPress(KeyEvent.VK_D);
+            robot.waitForIdle();
+            robot.keyRelease(KeyEvent.VK_D);
+            robot.waitForIdle();
+            robot.keyPress(KeyEvent.VK_ENTER);
+            robot.waitForIdle();
+            robot.keyRelease(KeyEvent.VK_ENTER);
+            robot.waitForIdle();
+            testEditChange(true);
+            robot.waitForIdle();
+            testDefaultButton(true);
+
+            // Change value, changing focus should fire an ActionEvent.
+            robot.waitForIdle();
+            robot.keyPress(KeyEvent.VK_BACK_SPACE);
+            robot.waitForIdle();
+            robot.keyRelease(KeyEvent.VK_BACK_SPACE);
+            robot.waitForIdle();
+            robot.keyPress(KeyEvent.VK_SHIFT);
+            robot.waitForIdle();
+            robot.keyPress(KeyEvent.VK_TAB);
+            robot.waitForIdle();
+            robot.keyRelease(KeyEvent.VK_SHIFT);
+            robot.waitForIdle();
+            robot.keyRelease(KeyEvent.VK_TAB);
+            robot.waitForIdle();
+            testEditChange(true);
+            robot.waitForIdle();
+            testDefaultButton(false);
+        }
+    }
+
+    public void actionPerformed(ActionEvent evt) {
+        String cmd = evt.getActionCommand();
+        System.out.println("ActionEvent: " + cmd);
+
+        if (cmd.equals("OK")) {
+            defaultButtonPressed = true;
+        }
+
+        if (cmd.equals("comboBoxChanged")) {
+            editChanged = true;
+        }
+    }
+
+    public static void testDefaultButton(boolean flag) {
+        if (defaultButtonPressed != flag) {
+            new RuntimeException("defaultButtonPressed unexpectedly = " + defaultButtonPressed);
+        }
+        // reset
+        defaultButtonPressed = false;
+    }
+
+    public static void testEditChange(boolean flag) {
+        if (editChanged != flag) {
+            new RuntimeException("editChanged unexpectedly = " + editChanged);
+        }
+        // reset
+        editChanged = false;
+    }
+
+    class DefaultPanel extends JPanel {
+
+        public JComboBox combo;
+        public JComboBox combo2;
+
+        private JButton okButton = new JButton("OK");
+        private JButton cancelButton = new JButton("Cancel");
+
+        public DefaultPanel(JFrame root) {
+            setLayout(new BorderLayout());
+            add(createPanel(), BorderLayout.NORTH);
+            add(createInfoPanel(), BorderLayout.CENTER);
+            add(createButtonPanel(root), BorderLayout.SOUTH);
+        }
+
+        private JPanel createPanel() {
+            combo = new JComboBox(strData);
+            combo.addActionListener(DefaultButtonTest.this);
+            combo2 = new JComboBox(strData2);
+            combo2.setEditable(true);
+            combo2.addActionListener(DefaultButtonTest.this);
+
+            JPanel panel = new JPanel();
+
+            panel.add(combo);
+            panel.add(combo2);
+
+            return panel;
+        }
+
+        private JScrollPane createInfoPanel() {
+            StringBuffer txt = new StringBuffer("Test for 4337071:\n");
+            txt.append("ENTER pressed in NON-EDITABLE combo box should be passed to the OK button.\n");
+            txt.append("For an EDITABLE combo box, the combo box should fire an action event.");
+            txt.append("\n\nTest for 4515752:\n");
+            txt.append("ENTER on an EDITABLE combo box in which the contents has not changed\n");
+            txt.append("should be passed to the default button");
+
+            JTextArea text = new JTextArea(txt.toString());
+            text.setEditable(false);
+
+            return new JScrollPane(text);
+        }
+
+
+        private JPanel createButtonPanel(JFrame frame) {
+            frame.getRootPane().setDefaultButton(okButton);
+
+            // This is just to check when the OK Button was pressed.
+            okButton.addActionListener(DefaultButtonTest.this);
+
+            JPanel panel = new JPanel();
+            panel.add(okButton);
+            panel.add(cancelButton);
+            return panel;
+        }
+    }
+
+}
--- a/jdk/test/javax/swing/JComboBox/4743225/bug4743225.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JComboBox/4743225/bug4743225.java	Fri Jan 09 13:28:02 2015 -0500
@@ -27,8 +27,6 @@
  * @author Alexander Potochkin
  */
 
-import sun.awt.SunToolkit;
-
 import javax.accessibility.AccessibleContext;
 import javax.swing.JComboBox;
 import javax.swing.JFrame;
@@ -39,7 +37,6 @@
 import java.awt.FlowLayout;
 import java.awt.Point;
 import java.awt.Robot;
-import java.awt.Toolkit;
 import java.awt.event.InputEvent;
 
 public class bug4743225 extends JFrame {
@@ -80,21 +77,20 @@
 
         Robot robot = new Robot();
         robot.setAutoDelay(20);
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 new bug4743225().setVisible(true);
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // calling this method from main thread is ok
         Point point = cb.getLocationOnScreen();
         robot.mouseMove(point.x + 10, point.y + 10);
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
--- a/jdk/test/javax/swing/JComboBox/6236162/bug6236162.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JComboBox/6236162/bug6236162.java	Fri Jan 09 13:28:02 2015 -0500
@@ -31,8 +31,6 @@
    @run main bug6236162
 */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.plaf.basic.*;
 import javax.swing.plaf.metal.MetalComboBoxUI;
@@ -40,7 +38,6 @@
 import java.awt.event.KeyEvent;
 
 public class bug6236162 {
-    private static final SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
     private static JFrame frame;
     private static JComboBox combo;
     private static MyComboUI comboUI;
@@ -52,7 +49,6 @@
                 createAndShowGUI();
             }
         });
-        toolkit.realSync();
         test();
         System.out.println("Test passed");
     }
@@ -78,11 +74,11 @@
         robot.setAutoDelay(50);
 
         // Open popup menu
-        realSync();
+        robot.waitForIdle();
         Util.hitKeys(robot, KeyEvent.VK_DOWN);
 
         // Move mouse to the first popup menu item
-        realSync();
+        robot.waitForIdle();
         Point p = combo.getLocationOnScreen();
         Dimension size = combo.getSize();
         p.x += size.width / 2;
@@ -94,10 +90,10 @@
         }
 
         // Select the second popup menu item
-        realSync();
+        robot.waitForIdle();
         Util.hitKeys(robot, KeyEvent.VK_DOWN);
 
-        realSync();
+        robot.waitForIdle();
         JList list = comboUI.getComboPopup().getList();
         if (list.getSelectedIndex() != 1) {
             throw new RuntimeException("There is an inconsistence in combo box " +
@@ -106,9 +102,6 @@
         }
     }
 
-    private static void realSync() {
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
-    }
 
     // Gives access to BasicComboBoxUI.popup field
     private static class MyComboUI extends MetalComboBoxUI {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JComboBox/6559152/bug6559152.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 6559152
+   @summary Checks that you can select an item in JComboBox with keyboard
+            when it is a JTable cell editor.
+   @author Mikhail Lapshin
+   @library ../../../../lib/testlibrary
+   @build ExtendedRobot
+   @run main bug6559152
+*/
+
+import javax.swing.*;
+import javax.swing.table.DefaultTableModel;
+import java.awt.*;
+import java.awt.event.KeyEvent;
+
+public class bug6559152 {
+    private JFrame frame;
+    private JComboBox cb;
+    private ExtendedRobot robot;
+
+    public static void main(String[] args) throws Exception {
+        final bug6559152 test = new bug6559152();
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    test.setupUI();
+                }
+            });
+            test.test();
+        } finally {
+            if (test.frame != null) {
+                test.frame.dispose();
+            }
+        }
+    }
+
+    private void setupUI() {
+        frame = new JFrame();
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+        DefaultTableModel model = new DefaultTableModel(1, 1);
+        JTable table = new JTable(model);
+
+        cb = new JComboBox(new String[]{"one", "two", "three"});
+        cb.setEditable(true);
+        table.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb));
+        frame.add(cb);
+
+        frame.pack();
+        frame.setLocationRelativeTo(null);
+        frame.setVisible(true);
+    }
+
+    private void test() throws Exception {
+        robot = new ExtendedRobot();
+        robot.waitForIdle();
+        testImpl();
+        robot.waitForIdle();
+        checkResult();
+    }
+
+    private void testImpl() throws Exception {
+        robot.type(KeyEvent.VK_DOWN);
+        robot.waitForIdle();
+        robot.type(KeyEvent.VK_DOWN);
+        robot.waitForIdle();
+        robot.type(KeyEvent.VK_ENTER);
+    }
+
+    private void checkResult() {
+        if (cb.getSelectedItem().equals("two")) {
+            System.out.println("Test passed");
+        } else {
+            System.out.println("Test failed");
+            throw new RuntimeException("Cannot select an item " +
+                    "from popup with the ENTER key.");
+        }
+    }
+}
--- a/jdk/test/javax/swing/JComboBox/6607130/bug6607130.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JComboBox/6607130/bug6607130.java	Fri Jan 09 13:28:02 2015 -0500
@@ -30,8 +30,6 @@
  * @author Mikhail Lapshin
  */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.table.DefaultTableModel;
 import java.awt.*;
@@ -79,44 +77,44 @@
     }
 
     private void test() throws Exception {
-        realSync();
+        robot.waitForIdle();
         test1();
-        realSync();
+        robot.waitForIdle();
         checkResult("First test");
         test2();
-        realSync();
+        robot.waitForIdle();
         checkResult("Second test");
     }
 
     private void test1() throws Exception {
         // Select 'one'
         hitKey(KeyEvent.VK_TAB);
-        realSync();
+        robot.waitForIdle();
         hitKey(KeyEvent.VK_F2);
-        realSync();
+        robot.waitForIdle();
         hitKey(KeyEvent.VK_DOWN);
-        realSync();
+        robot.waitForIdle();
         hitKey(KeyEvent.VK_DOWN);
-        realSync();
+        robot.waitForIdle();
         hitKey(KeyEvent.VK_ENTER);
-        realSync();
+        robot.waitForIdle();
 
         // Select 'one' again
         hitKey(KeyEvent.VK_F2);
-        realSync();
+        robot.waitForIdle();
         hitKey(KeyEvent.VK_DOWN);
-        realSync();
+        robot.waitForIdle();
         hitKey(KeyEvent.VK_ENTER);
-        realSync();
+        robot.waitForIdle();
     }
 
     private void test2() throws Exception {
         // Press F2 and then press ENTER
         // Editor should be shown and then closed
         hitKey(KeyEvent.VK_F2);
-        realSync();
+        robot.waitForIdle();
         hitKey(KeyEvent.VK_ENTER);
-        realSync();
+        robot.waitForIdle();
     }
 
     private void checkResult(String testName) {
@@ -129,10 +127,6 @@
         }
     }
 
-    private static void realSync() {
-        ((SunToolkit) (Toolkit.getDefaultToolkit())).realSync();
-    }
-
     public void hitKey(int keycode) {
         robot.keyPress(keycode);
         robot.keyRelease(keycode);
--- a/jdk/test/javax/swing/JComboBox/8032878/bug8032878.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JComboBox/8032878/bug8032878.java	Fri Jan 09 13:28:02 2015 -0500
@@ -29,6 +29,7 @@
  * @library ../../regtesthelpers
  * @build Util
  * @author Alexey Ivanov
+ * @run main bug8032878
  */
 
 import java.awt.*;
@@ -36,8 +37,6 @@
 import javax.swing.*;
 import javax.swing.text.JTextComponent;
 
-import sun.awt.SunToolkit;
-
 public class bug8032878 implements Runnable {
     private static final String ONE = "one";
     private static final String TWO = "two";
@@ -99,15 +98,15 @@
     }
 
     private void runTest() throws Exception {
-        realSync();
+        robot.waitForIdle();
         // Select 'one'
         Util.hitKeys(robot, KeyEvent.VK_TAB);
-        realSync();
+        robot.waitForIdle();
         Util.hitKeys(robot, KeyEvent.VK_1);
         Util.hitKeys(robot, KeyEvent.VK_2);
         Util.hitKeys(robot, KeyEvent.VK_3);
         Util.hitKeys(robot, KeyEvent.VK_ENTER);
-        realSync();
+        robot.waitForIdle();
     }
 
     private void checkResult() throws Exception {
@@ -125,9 +124,6 @@
         }
     }
 
-    private static void realSync() {
-        ((SunToolkit) (Toolkit.getDefaultToolkit())).realSync();
-    }
 
     @Override
     public void run() {
--- a/jdk/test/javax/swing/JComboBox/8057893/bug8057893.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JComboBox/8057893/bug8057893.java	Fri Jan 09 13:28:02 2015 -0500
@@ -30,7 +30,6 @@
 import javax.swing.JComboBox;
 import javax.swing.JFrame;
 import javax.swing.WindowConstants;
-import sun.awt.SunToolkit;
 
 /**
  * @test
@@ -47,7 +46,6 @@
     public static void main(String[] args) throws Exception {
         Robot robot = new Robot();
         robot.setAutoDelay(50);
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
 
         EventQueue.invokeAndWait(() -> {
             JFrame frame = new JFrame();
@@ -69,13 +67,13 @@
             comboBox.requestFocusInWindow();
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         robot.keyPress(KeyEvent.VK_A);
         robot.keyRelease(KeyEvent.VK_A);
         robot.keyPress(KeyEvent.VK_ENTER);
         robot.keyRelease(KeyEvent.VK_ENTER);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if(!isComboBoxEdited){
             throw new RuntimeException("ComboBoxEdited event is not fired!");
--- a/jdk/test/javax/swing/JComboBox/ConsumedEscTest/ConsumedEscTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import javax.swing.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
-
-/*
-  @test
-  @bug 8031485
-  @summary Combo box consuming escape and enter key events
-  @author Petr Pchelko
-  @library ../../../../lib/testlibrary/
-  @build ExtendedRobot
-  @run main ConsumedEscTest
-*/
-public class ConsumedEscTest {
-    private static volatile JFrame frame;
-    private static volatile boolean passed = false;
-
-    public static void main(String... args) throws Exception {
-        try {
-            SwingUtilities.invokeAndWait(() -> {
-                frame = new JFrame();
-                JComboBox<String> combo = new JComboBox<>(new String[]{"one", "two", "three"});
-                JPanel panel = new JPanel();
-                panel.add(combo);
-                combo.requestFocusInWindow();
-                frame.setBounds(100, 150, 300, 100);
-                addAction(panel);
-                frame.add(panel);
-                frame.setVisible(true);
-            });
-
-            ExtendedRobot robot = new ExtendedRobot();
-            robot.waitForIdle();
-            robot.type(KeyEvent.VK_ESCAPE);
-            robot.waitForIdle();
-            if (!passed) {
-                throw new RuntimeException("FAILED: ESC was consumed by combo box");
-            }
-        } finally {
-            if (frame != null) {
-                frame.dispose();
-            }
-        }
-    }
-
-    private static void addAction(JComponent comp) {
-        KeyStroke k = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
-        Object actionKey = "cancel";
-        comp.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(k, actionKey);
-        Action cancelAction = new AbstractAction() {
-            @Override
-            public void actionPerformed(ActionEvent ev) {
-                passed = true;
-            }
-        };
-        comp.getActionMap().put(actionKey, cancelAction);
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JComboBox/ConsumedKeyTest/ConsumedKeyTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+
+/*
+  @test
+  @bug 8031485 8058193
+  @summary Combo box consuming escape and enter key events
+  @author Petr Pchelko
+  @library ../../../../lib/testlibrary/
+  @build ExtendedRobot
+  @run main ConsumedKeyTest
+*/
+public class ConsumedKeyTest {
+    private static volatile JFrame frame;
+    private static volatile boolean passed;
+
+    public static void main(String... args) throws Exception {
+        test(KeyEvent.VK_ESCAPE);
+        test(KeyEvent.VK_ENTER);
+    }
+
+    private static void test(final int key) throws Exception {
+        passed = false;
+        try {
+            SwingUtilities.invokeAndWait(() -> {
+                frame = new JFrame();
+                JComboBox<String> combo = new JComboBox<>(new String[]{"one", "two", "three"});
+                JPanel panel = new JPanel();
+                panel.add(combo);
+                combo.requestFocusInWindow();
+                frame.setBounds(100, 150, 300, 100);
+                addAction(panel, key);
+                frame.add(panel);
+                frame.setVisible(true);
+            });
+
+            ExtendedRobot robot = new ExtendedRobot();
+            robot.waitForIdle();
+            robot.type(key);
+            robot.waitForIdle();
+            if (!passed) {
+                throw new RuntimeException("FAILED: " + KeyEvent.getKeyText(key) + " was consumed by combo box");
+            }
+        } finally {
+            if (frame != null) {
+                frame.dispose();
+            }
+        }
+
+    }
+
+    private static void addAction(JComponent comp, final int key) {
+        KeyStroke k = KeyStroke.getKeyStroke(key, 0);
+        Object actionKey = "cancel";
+        comp.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(k, actionKey);
+        Action cancelAction = new AbstractAction() {
+            @Override
+            public void actionPerformed(ActionEvent ev) {
+                passed = true;
+            }
+        };
+        comp.getActionMap().put(actionKey, cancelAction);
+    }
+
+}
--- a/jdk/test/javax/swing/JComponent/6683775/bug6683775.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JComponent/6683775/bug6683775.java	Fri Jan 09 13:28:02 2015 -0500
@@ -38,8 +38,8 @@
 public class bug6683775 {
     public static void main(String[] args) throws Exception {
         GraphicsConfiguration gc = getGC();
-        if (!AWTUtilities.isTranslucencySupported(
-                AWTUtilities.Translucency.PERPIXEL_TRANSLUCENT)
+       if (!AWTUtilities.isTranslucencySupported(
+               AWTUtilities.Translucency.PERPIXEL_TRANSLUCENT)
                 || gc == null) {
             return;
         }
--- a/jdk/test/javax/swing/JComponent/7154030/bug7154030.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JComponent/7154030/bug7154030.java	Fri Jan 09 13:28:02 2015 -0500
@@ -29,7 +29,6 @@
 import javax.swing.JDesktopPane;
 import javax.swing.JFrame;
 import javax.swing.SwingUtilities;
-import sun.awt.SunToolkit;
 
 import java.awt.AWTException;
 import java.awt.AlphaComposite;
@@ -46,7 +45,9 @@
  * @summary Swing components fail to hide after calling hide()
  * @author Jonathan Lu
  * @library ../../regtesthelpers/
+ * @library ../../../../lib/testlibrary/
  * @build Util
+ * @build ExtendedRobot
  * @run main bug7154030
  */
 
@@ -61,9 +62,7 @@
 
         BufferedImage imageHide = null;
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-
-        Robot robot = new Robot();
+        ExtendedRobot robot = new ExtendedRobot();
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
@@ -89,7 +88,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle(500);
         imageInit = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
 
         SwingUtilities.invokeAndWait(new Runnable() {
@@ -100,13 +99,13 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle(500);
         imageShow = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
         if (Util.compareBufferedImages(imageInit, imageShow)) {
             throw new Exception("Failed to show opaque button");
         }
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
@@ -116,7 +115,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle(500);
         imageHide = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
 
         if (!Util.compareBufferedImages(imageInit, imageHide)) {
@@ -133,7 +132,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle(500);
         imageInit = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
 
         SwingUtilities.invokeAndWait(new Runnable() {
@@ -144,7 +143,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle(500);
         imageShow = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
 
         SwingUtilities.invokeAndWait(new Runnable() {
@@ -159,7 +158,7 @@
             throw new Exception("Failed to show non-opaque button");
         }
 
-        toolkit.realSync();
+        robot.waitForIdle(500);
         imageHide = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
 
         if (!Util.compareBufferedImages(imageInit, imageHide)) {
--- a/jdk/test/javax/swing/JEditorPane/6917744/bug6917744.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JEditorPane/6917744/bug6917744.java	Fri Jan 09 13:28:02 2015 -0500
@@ -33,8 +33,6 @@
 import java.io.IOException;
 import javax.swing.*;
 
-import sun.awt.SunToolkit;
-
 public class bug6917744 {
     private static JFrame frame;
 
@@ -45,7 +43,6 @@
     private static Robot robot;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
 
         robot = new Robot();
         robot.setAutoDelay(100);
@@ -70,13 +67,14 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         for (int i = 0; i < 50; i++) {
             robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+            robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
         }
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // Check that we at the end of document
         SwingUtilities.invokeAndWait(new Runnable() {
@@ -89,13 +87,14 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         for (int i = 0; i < 50; i++) {
             robot.keyPress(KeyEvent.VK_PAGE_UP);
+            robot.keyRelease(KeyEvent.VK_PAGE_UP);
         }
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // Check that we at the begin of document
         SwingUtilities.invokeAndWait(new Runnable() {
--- a/jdk/test/javax/swing/JFileChooser/4524490/bug4524490.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JFileChooser/4524490/bug4524490.java	Fri Jan 09 13:28:02 2015 -0500
@@ -25,24 +25,23 @@
  * @test
  * @bug 4524490
  * @summary Tests if in JFileChooser, ALT+L does not bring focus to 'Files' selection list in Motif LAF
+ * @author Konstantin Eremin
  * @library ../../regtesthelpers
- * @build Util
- * @author Konstantin Eremin
+ * @library ../../../../lib/testlibrary
+ * @build Util jdk.testlibrary.OSInfo
  * @run main bug4524490
  */
 import java.awt.Robot;
 import java.awt.Toolkit;
 import java.awt.event.KeyEvent;
 import javax.swing.*;
-import sun.awt.OSInfo;
-import sun.awt.SunToolkit;
+import jdk.testlibrary.OSInfo;
 
 public class bug4524490 {
 
     private static JFileChooser fileChooser;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -56,7 +55,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (OSInfo.OSType.MACOSX.equals(OSInfo.getOSType())) {
             Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_L);
--- a/jdk/test/javax/swing/JFileChooser/7199708/bug7199708.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JFileChooser/7199708/bug7199708.java	Fri Jan 09 13:28:02 2015 -0500
@@ -37,7 +37,6 @@
 import javax.swing.AbstractButton;
 import javax.swing.JTable;
 import javax.swing.UIManager;
-import sun.awt.SunToolkit;
 
 /**
  * @test
@@ -56,7 +55,6 @@
 
     public static void main(String[] args) throws Exception {
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -70,7 +68,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeLater(new Runnable() {
             public void run() {
@@ -108,14 +106,14 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         int d = 25;
         for (int i = 0; i < width / d; i++) {
             robot.mouseMove(locationX + i * d, locationY + 5);
             robot.mousePress(InputEvent.BUTTON1_MASK);
             robot.mouseRelease(InputEvent.BUTTON1_MASK);
-            toolkit.realSync();
+            robot.waitForIdle();
         }
 
         robot.keyPress(KeyEvent.VK_ESCAPE);
--- a/jdk/test/javax/swing/JFileChooser/8002077/bug8002077.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JFileChooser/8002077/bug8002077.java	Fri Jan 09 13:28:02 2015 -0500
@@ -28,7 +28,6 @@
 import javax.swing.SwingUtilities;
 import javax.swing.UIManager;
 import javax.swing.UIManager.LookAndFeelInfo;
-import sun.awt.SunToolkit;
 
 /**
  * @test
@@ -54,7 +53,6 @@
     }
 
     private static void runTest() throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -63,17 +61,17 @@
                 fileChooserState = new JFileChooser().showSaveDialog(null);
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Util.hitMnemonics(robot, KeyEvent.VK_N);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         robot.keyPress(KeyEvent.VK_A);
         robot.keyRelease(KeyEvent.VK_A);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Util.hitMnemonics(robot, KeyEvent.VK_S);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (fileChooserState != JFileChooser.APPROVE_OPTION) {
             throw new RuntimeException("Save button is not pressed!");
--- a/jdk/test/javax/swing/JFileChooser/8021253/bug8021253.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JFileChooser/8021253/bug8021253.java	Fri Jan 09 13:28:02 2015 -0500
@@ -32,7 +32,6 @@
 import javax.swing.JFileChooser;
 import javax.swing.JFrame;
 import javax.swing.SwingUtilities;
-import sun.awt.SunToolkit;
 
 /**
  * @test
@@ -50,7 +49,6 @@
 
     public static void main(String[] args) throws Exception {
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -60,7 +58,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
@@ -68,11 +66,11 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         robot.keyPress(KeyEvent.VK_ENTER);
         robot.keyRelease(KeyEvent.VK_ENTER);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (!defaultKeyPressed) {
             throw new RuntimeException("Default button is not pressed");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/FileFilterDescription/FileFilterDescription.html	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,40 @@
+<html>
+<!--
+ Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<!--
+ @test
+ @bug 8029536
+ @author Sergey Bylokhov
+ @run applet/manual=yesno FileFilterDescription.html
+-->
+
+<body>
+<applet  code="FileFilterDescription.class" width=200 height=200></applet>
+Follow the instructions below.
+1) Check that current filter in the opened JFileChooser is a "CustomFileFilter".
+2) Close the JFileChooser.
+3) Test will repeat steps 1 - 2 for all supported look and feels.
+4) If it's true for all look and feels then the test passed, otherwise it failed.
+</body>
+</html> 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/FileFilterDescription/FileFilterDescription.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.applet.Applet;
+import java.io.File;
+
+import javax.swing.JFileChooser;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+import javax.swing.filechooser.FileFilter;
+
+public final class FileFilterDescription extends Applet {
+
+    @Override
+    public void init() {
+    }
+
+    @Override
+    public void start() {
+        try {
+            test();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+
+    public static void test() throws Exception {
+        final UIManager.LookAndFeelInfo[] infos = UIManager
+                .getInstalledLookAndFeels();
+        for (final UIManager.LookAndFeelInfo info : infos) {
+            SwingUtilities.invokeAndWait(() -> {
+                final JFileChooser chooser = new JFileChooser();
+                setLookAndFeel(info);
+                chooser.setAcceptAllFileFilterUsed(false);
+                chooser.setFileFilter(new CustomFileFilter());
+                SwingUtilities.updateComponentTreeUI(chooser);
+                chooser.showDialog(null, "Open");
+            });
+        }
+    }
+
+    private static void setLookAndFeel(final UIManager.LookAndFeelInfo info) {
+        try {
+            UIManager.setLookAndFeel(info.getClassName());
+        } catch (ClassNotFoundException | InstantiationException |
+                UnsupportedLookAndFeelException | IllegalAccessException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private static class CustomFileFilter extends FileFilter {
+
+        @Override
+        public boolean accept(final File f) {
+            return false;
+        }
+
+        @Override
+        public String getDescription() {
+            return "CustomFileFilter";
+        }
+    }
+}
\ No newline at end of file
--- a/jdk/test/javax/swing/JFrame/4962534/bug4962534.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JFrame/4962534/bug4962534.java	Fri Jan 09 13:28:02 2015 -0500
@@ -33,7 +33,6 @@
 import java.awt.event.*;
 import java.util.Random;
 import javax.swing.*;
-import sun.awt.SunToolkit;
 
 public class bug4962534 extends Applet {
 
@@ -45,7 +44,6 @@
     Component titleComponent;
     JLayeredPane lPane;
     volatile boolean titleFound = false;
-    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
     public static Object LOCK = new Object();
 
     @Override
@@ -91,13 +89,13 @@
                 robot = new Robot();
                 robot.setAutoDelay(70);
 
-                toolkit.realSync();
+                robot.waitForIdle();
 
                 robot.mouseMove(framePosition.x + getJFrameWidthEDT() / 2,
                         framePosition.y + titleComponent.getHeight() / 2);
                 robot.mousePress(InputEvent.BUTTON1_MASK);
 
-                toolkit.realSync();
+                robot.waitForIdle();
 
                 gcBounds =
                         GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()[0].getConfigurations()[0].getBounds();
@@ -105,7 +103,7 @@
                 robot.mouseMove(framePosition.x + getJFrameWidthEDT() / 2,
                         framePosition.y + titleComponent.getHeight() / 2);
 
-                toolkit.realSync();
+                robot.waitForIdle();
 
                 int multier = gcBounds.height / 2 - 10; //we will not go out the borders
                 for (int i = 0; i < 10; i++) {
@@ -113,7 +111,7 @@
                 }
                 robot.mouseRelease(InputEvent.BUTTON1_MASK);
 
-                toolkit.realSync();
+                robot.waitForIdle();
 
             } catch (AWTException e) {
                 throw new RuntimeException("Test Failed. AWTException thrown." + e.getMessage());
--- a/jdk/test/javax/swing/JFrame/NSTexturedJFrame/NSTexturedJFrame.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JFrame/NSTexturedJFrame/NSTexturedJFrame.java	Fri Jan 09 13:28:02 2015 -0500
@@ -22,21 +22,21 @@
  */
 
 import java.awt.Rectangle;
-import java.awt.Robot;
 import java.awt.Toolkit;
 import java.awt.image.BufferedImage;
 
 import javax.swing.JFrame;
 import javax.swing.SwingUtilities;
-
-import sun.awt.OSInfo;
-import sun.awt.SunToolkit;
+import jdk.testlibrary.OSInfo;
 
 /**
  * @test
  * @bug 7124513
  * @summary We should support NSTexturedBackgroundWindowMask style on OSX.
  * @author Sergey Bylokhov
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot jdk.testlibrary.OSInfo
+ * @run main NSTexturedJFrame
  */
 public final class NSTexturedJFrame {
 
@@ -46,12 +46,15 @@
     private static Rectangle bounds;
     private static volatile int step;
     private static JFrame frame;
+    private static ExtendedRobot robot;
 
     public static void main(final String[] args) throws Exception {
         if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
             System.out.println("This test is for OSX, considered passed.");
             return;
         }
+        robot = new ExtendedRobot();
+        robot.setAutoDelay(50);
         // Default window appearance
         showFrame();
         step++;
@@ -84,12 +87,10 @@
     }
 
     private static void showFrame() throws Exception {
-        final Robot robot = new Robot();
-        robot.setAutoDelay(50);
         createUI();
         images[step] = robot.createScreenCapture(bounds);
         SwingUtilities.invokeAndWait(frame::dispose);
-        sleep();
+        robot.waitForIdle(1000);
     }
 
     private static void createUI() throws Exception {
@@ -107,15 +108,11 @@
             }
             frame.setVisible(true);
         });
-        sleep();
+        robot.waitForIdle(1000);
         SwingUtilities.invokeAndWait(() -> {
             bounds = frame.getBounds();
         });
-        sleep();
+        robot.waitForIdle(1000);
     }
 
-    private static void sleep() throws InterruptedException {
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
-        Thread.sleep(1000);
-    }
 }
--- a/jdk/test/javax/swing/JInternalFrame/5066752/bug5066752.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JInternalFrame/5066752/bug5066752.java	Fri Jan 09 13:28:02 2015 -0500
@@ -32,21 +32,19 @@
 
 import java.awt.*;
 import javax.swing.*;
-import sun.awt.*;
 
 public class bug5066752
 {
     private static JFrame frame;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit();
         Robot r = new Robot();
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 createAndShowGUI();
             }
         });
-        tk.realSync();
+        r.waitForIdle();
 
         r.delay(600);
 
--- a/jdk/test/javax/swing/JInternalFrame/8020708/bug8020708.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JInternalFrame/8020708/bug8020708.java	Fri Jan 09 13:28:02 2015 -0500
@@ -32,7 +32,6 @@
 import javax.swing.JInternalFrame;
 import javax.swing.SwingUtilities;
 import javax.swing.UIManager;
-import sun.awt.SunToolkit;
 
 /**
  * @test
@@ -79,7 +78,6 @@
     }
 
     static void testInternalFrameMnemonic() throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -103,25 +101,26 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Point clickPoint = Util.getCenterPoint(internalFrame);
         robot.mouseMove(clickPoint.x, clickPoint.y);
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_SPACE);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Util.hitKeys(robot, KeyEvent.VK_C);
-        toolkit.realSync();
+        robot.waitForIdle();
+        robot.delay(500);
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
             public void run() {
                 if (internalFrame.isVisible()) {
-                    throw new RuntimeException("Close mnemonic does not work");
+                    throw new RuntimeException("Close mnemonic does not work in "+UIManager.getLookAndFeel());
                 }
                 frame.dispose();
             }
--- a/jdk/test/javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -27,8 +27,6 @@
     @author mcherkas
     @run main InternalFrameIsNotCollectedTest
  */
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import java.awt.*;
 import java.beans.PropertyVetoException;
@@ -41,12 +39,6 @@
     private static Robot robot;
     private static CustomInternalFrame iFrame;
 
-    public static void sync() {
-
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-        toolkit.realSync();
-    }
-
     public static void main(String[] args) throws Exception {
         initRobot();
         SwingUtilities.invokeAndWait(new Runnable() {
@@ -60,7 +52,7 @@
                 }
             }
         });
-        sync();
+        robot.waitForIdle();
         invokeGC();
         System.runFinalization();
         Thread.sleep(1000); // it's better to wait 1 sec now then 10 sec later
@@ -134,4 +126,4 @@
             waiter.notifyAll();
         }
     }
-}
\ No newline at end of file
+}
--- a/jdk/test/javax/swing/JLabel/6596966/bug6596966.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JLabel/6596966/bug6596966.java	Fri Jan 09 13:28:02 2015 -0500
@@ -25,16 +25,19 @@
    @bug 6596966
    @summary Some JFileChooser mnemonics do not work with sticky keys
    @library ../../regtesthelpers
-   @build Util
+   @library ../../../../lib/testlibrary
+   @build Util jdk.testlibrary.OSInfo
    @run main bug6596966
    @author Pavel Porvatov
 */
 
 import java.awt.*;
 import java.awt.event.KeyEvent;
+import java.awt.event.InputEvent;
 import java.util.ArrayList;
 import javax.swing.*;
-import sun.awt.SunToolkit;
+
+import jdk.testlibrary.OSInfo;
 
 public class bug6596966 {
     private static JFrame frame;
@@ -45,7 +48,6 @@
 
     public static void main(String[] args) throws Exception {
         Robot robot = new Robot();
-        SunToolkit toolkit = (SunToolkit) SunToolkit.getDefaultToolkit();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
@@ -70,20 +72,25 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
+
 
-        ArrayList<Integer> keys = Util.getSystemMnemonicKeyCodes();
+        int keyMask = InputEvent.ALT_MASK;
+        if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
+            keyMask = InputEvent.CTRL_MASK | InputEvent.ALT_MASK;
+        }
+        ArrayList<Integer> keys = Util.getKeyCodesFromKeyMask(keyMask);
         for (int i = 0; i < keys.size(); ++i) {
             robot.keyPress(keys.get(i));
         }
 
         robot.keyPress(KeyEvent.VK_L);
 
-        toolkit.realSync();
-        toolkit.getSystemEventQueue().postEvent(new KeyEvent(label, KeyEvent.KEY_RELEASED,
+        robot.waitForIdle();
+        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new KeyEvent(label, KeyEvent.KEY_RELEASED,
                 EventQueue.getMostRecentEventTime(), 0, KeyEvent.VK_L, 'L'));
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         try {
             SwingUtilities.invokeAndWait(new Runnable() {
@@ -98,7 +105,7 @@
             for (int i = 0; i < keys.size(); ++i) {
                 robot.keyRelease(keys.get(i));
             }
-            toolkit.realSync();
+            robot.waitForIdle();
         }
     }
 }
--- a/jdk/test/javax/swing/JList/6462008/bug6462008.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JList/6462008/bug6462008.java	Fri Jan 09 13:28:02 2015 -0500
@@ -32,7 +32,6 @@
 import java.awt.event.*;
 import javax.swing.*;
 import java.util.*;
-import sun.awt.SunToolkit;
 
 public class bug6462008 {
 
@@ -41,11 +40,9 @@
     private static boolean isAquaLAF;
     private static int controlKey;
     private static JList list;
-    private static SunToolkit toolkit;
     private static Robot robot;
 
     public static void main(String[] args) throws Exception {
-        toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         robot = new Robot();
         robot.setAutoDelay(100);
 
@@ -60,15 +57,15 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         setAnchorLead(-1);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         testListSelection();
 
         setAnchorLead(100);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         testListSelection();
     }
@@ -79,10 +76,10 @@
         robot.keyPress(KeyEvent.VK_SPACE);
         robot.keyRelease(KeyEvent.VK_SPACE);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelection();
         resetList();
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // Control + Space
         robot.keyPress(KeyEvent.VK_CONTROL);
@@ -90,10 +87,10 @@
         robot.keyRelease(KeyEvent.VK_SPACE);
         robot.keyRelease(KeyEvent.VK_CONTROL);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelection();
         resetList();
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // Shift + Space
         robot.keyPress(KeyEvent.VK_SHIFT);
@@ -101,10 +98,10 @@
         robot.keyRelease(KeyEvent.VK_SPACE);
         robot.keyRelease(KeyEvent.VK_SHIFT);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelection();
         resetList();
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // Control + Shift + Space
         robot.keyPress(KeyEvent.VK_CONTROL);
@@ -114,10 +111,10 @@
         robot.keyRelease(KeyEvent.VK_SHIFT);
         robot.keyRelease(KeyEvent.VK_CONTROL);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelection();
         resetList();
-        toolkit.realSync();
+        robot.waitForIdle();
 
 
         // Control + A  Multiple Selection
@@ -127,11 +124,11 @@
         robot.keyRelease(KeyEvent.VK_A);
         robot.keyRelease(controlKey);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelectionAL(-1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
         resetList();
         setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // Control + A Single Selection
         robot.keyPress(controlKey);
@@ -139,12 +136,12 @@
         robot.keyRelease(KeyEvent.VK_A);
         robot.keyRelease(controlKey);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelectionAL(0, 0, 0);
         resetList();
         setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
         setSelectionInterval(5, 5);
-        toolkit.realSync();
+        robot.waitForIdle();
 
 
         // Control + A Selection interval (5, 5)
@@ -153,10 +150,10 @@
         robot.keyRelease(KeyEvent.VK_A);
         robot.keyRelease(controlKey);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelection(5);
         resetList();
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // Page Down
         // Not applicable for the Aqua L&F
@@ -164,10 +161,10 @@
             robot.keyPress(KeyEvent.VK_PAGE_DOWN);
             robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
 
-            toolkit.realSync();
+            robot.waitForIdle();
             checkSelection(9, 9, 9);
             resetList();
-            toolkit.realSync();
+            robot.waitForIdle();
         }
 
         // Shift + Page Down
@@ -184,28 +181,28 @@
 
         scrollDownExtendSelection();
 
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelection(0, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
         resetList();
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // Down
         robot.keyPress(KeyEvent.VK_DOWN);
         robot.keyRelease(KeyEvent.VK_DOWN);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelectionAL(0, 0, 0);
         resetList();
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // L
         robot.keyPress(KeyEvent.VK_L);
         robot.keyRelease(KeyEvent.VK_L);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelectionAL(0, 0, 0);
         resetList();
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // Click item 4
         Point p = clickItem4();
@@ -214,10 +211,10 @@
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
 
 
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelectionAL(4, 4, 4);
         resetList();
-        toolkit.realSync();
+        robot.waitForIdle();
 
 
         // Control + Click item 4
@@ -229,10 +226,10 @@
         robot.keyRelease(controlKey);
 
 
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelectionAL(4, 4, 4);
         resetList();
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // Shift + Click item 4
         robot.keyPress(KeyEvent.VK_SHIFT);
@@ -243,10 +240,10 @@
         robot.keyRelease(KeyEvent.VK_SHIFT);
 
 
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelectionAL(0, 4, 0, 1, 2, 3, 4);
         resetList();
-        toolkit.realSync();
+        robot.waitForIdle();
 
 
         // Control + Shift + Click item 4
@@ -259,10 +256,10 @@
         robot.keyRelease(KeyEvent.VK_SHIFT);
         robot.keyRelease(controlKey);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelectionAL(0, 4);
         resetList();
-        toolkit.realSync();
+        robot.waitForIdle();
     }
 
     private static DefaultListModel getModel() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JList/6510999/bug6510999.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 6510999
+   @summary Selection in a JList with both scrollbars visible jumps on arrowkey-down
+   @author Alexander Potochkin
+   @run main bug6510999
+*/
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.KeyEvent;
+
+public class bug6510999 {
+    private static JScrollPane s;
+
+    private static void createGui() {
+        final JFrame frame = new JFrame();
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+        DefaultListModel dlm = new DefaultListModel();
+        for (int i = 0; i < 100; i++)
+          dlm
+            .addElement(i + " listItemlistItemlistItemlistItemItem");
+        JList l = new JList();
+        l.setModel(dlm);
+        s = new JScrollPane(l);
+        l.setSelectedIndex(50);
+        l.ensureIndexIsVisible(50);
+
+        frame.add(s);
+        frame.setSize(200, 200);
+        frame.setLocationRelativeTo(null);
+        frame.setVisible(true);
+    }
+
+    public static void main(String[] args) throws Exception {
+        Robot robot = new Robot();
+        robot.setAutoDelay(10);
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                bug6510999.createGui();
+            }
+        });
+        robot.waitForIdle();
+        Point viewPosition = s.getViewport().getViewPosition();
+        robot.keyPress(KeyEvent.VK_DOWN);
+        robot.keyRelease(KeyEvent.VK_DOWN);
+        robot.waitForIdle();
+        if (!s.getViewport().getViewPosition().equals(viewPosition)) {
+            throw new RuntimeException("JScrollPane was unexpectedly scrolled");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JMenu/4417601/bug4417601.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 4417601
+   @summary JMenus with no items paint a tiny menu.
+   @author Alexander Potochkin
+   @library ../../../../lib/testlibrary
+   @build ExtendedRobot
+   @run main bug4417601
+*/
+
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+
+public class bug4417601 {
+    static JMenu menu;
+    static volatile boolean flag;
+
+    public static void main(String[] args) throws Exception {
+
+        ExtendedRobot robot = new ExtendedRobot();
+        robot.setAutoDelay(10);
+
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                JFrame frame = new JFrame();
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                menu = new JMenu("Menu");
+                JMenuBar bar = new JMenuBar();
+                bar.add(menu);
+                frame.setJMenuBar(bar);
+
+                frame.getLayeredPane().addContainerListener(new ContainerAdapter() {
+                    public void componentAdded(ContainerEvent e) {
+                        flag = true;
+                    }
+                });
+
+                frame.pack();
+                frame.setSize(200, 200);
+                frame.setLocationRelativeTo(null);
+                frame.setVisible(true);
+            }
+        });
+        robot.waitForIdle();
+        Point p = menu.getLocationOnScreen();
+        Dimension size = menu.getSize();
+        p.x += size.width / 2;
+        p.y += size.height / 2;
+        robot.mouseMove(p.x, p.y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.waitForIdle();
+        if (flag) {
+            throw new RuntimeException("Empty popup was shown");
+        }
+    }
+}
--- a/jdk/test/javax/swing/JMenu/4515762/bug4515762.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JMenu/4515762/bug4515762.java	Fri Jan 09 13:28:02 2015 -0500
@@ -24,7 +24,6 @@
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
-import sun.awt.SunToolkit;
 
 /**
  * @test
@@ -107,7 +106,6 @@
     }
 
     public static void main(String[] args) throws Throwable {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(250);
 
@@ -123,17 +121,17 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Util.hitMnemonics(robot, KeyEvent.VK_D);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // Press the S key many times (should not cause an action peformed)
         int TIMES = 5;
         for (int i = 0; i < TIMES; i++) {
             Util.hitKeys(robot, KeyEvent.VK_S);
         }
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // Unique menu items.
         actionExpected = true;
@@ -141,31 +139,31 @@
 
         robot.keyPress(KeyEvent.VK_S);
         robot.keyRelease(KeyEvent.VK_S);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         checkAction();
 
         Util.hitMnemonics(robot, KeyEvent.VK_U);
         robot.keyPress(KeyEvent.VK_M);
         robot.keyRelease(KeyEvent.VK_M);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         checkAction();
 
         Util.hitMnemonics(robot, KeyEvent.VK_U);
         Util.hitKeys(robot, KeyEvent.VK_T);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         checkAction();
         Util.hitMnemonics(robot, KeyEvent.VK_U);
         Util.hitKeys(robot, KeyEvent.VK_W);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         checkAction();
 
         Util.hitMnemonics(robot, KeyEvent.VK_U);
         Util.hitKeys(robot, KeyEvent.VK_U);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         checkAction();
     }
--- a/jdk/test/javax/swing/JMenu/4692443/bug4692443.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JMenu/4692443/bug4692443.java	Fri Jan 09 13:28:02 2015 -0500
@@ -35,7 +35,6 @@
 import javax.swing.event.*;
 import java.awt.event.*;
 import java.awt.*;
-import sun.awt.SunToolkit;
 
 public class bug4692443 {
 
@@ -56,29 +55,23 @@
             }
         });
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-        toolkit.realSync();
+        robo.waitForIdle();
 
-        try {
-                robo = new Robot();
-            } catch (AWTException e) {
-                throw new RuntimeException("Robot could not be created");
-            }
-            int altKey = java.awt.event.KeyEvent.VK_ALT;
-            robo.setAutoDelay(100);
-            Util.hitMnemonics(robo, KeyEvent.VK_F); // Enter File menu
-            robo.keyPress(KeyEvent.VK_S);  // Enter submenu
-            robo.keyRelease(KeyEvent.VK_S);
-            robo.keyPress(KeyEvent.VK_O); // Launch "One" action
-            robo.keyRelease(KeyEvent.VK_O);
-            robo.keyPress(KeyEvent.VK_M); // Launch "One" action
-            robo.keyRelease(KeyEvent.VK_M);
+        int altKey = java.awt.event.KeyEvent.VK_ALT;
+        robo.setAutoDelay(100);
+        Util.hitMnemonics(robo, KeyEvent.VK_F); // Enter File menu
+        robo.keyPress(KeyEvent.VK_S);  // Enter submenu
+        robo.keyRelease(KeyEvent.VK_S);
+        robo.keyPress(KeyEvent.VK_O); // Launch "One" action
+        robo.keyRelease(KeyEvent.VK_O);
+        robo.keyPress(KeyEvent.VK_M); // Launch "One" action
+        robo.keyRelease(KeyEvent.VK_M);
 
-            toolkit.realSync();
+        robo.waitForIdle();
 
-            if (!passed) {
-                throw new RuntimeException("Test failed.");
-            }
+        if (!passed) {
+            throw new RuntimeException("Test failed.");
+        }
 
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JMenu/6359669/bug6359669.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 6359669
+   @summary REGRESSION: Submenu does not work if populated in PopupMenuListener.popupMenuWillBecomeVisible
+   @author Alexander Potochkin
+   @library ../../../../lib/testlibrary
+   @build ExtendedRobot
+   @run main bug6359669
+*/
+
+import javax.swing.*;
+import javax.swing.event.PopupMenuListener;
+import javax.swing.event.PopupMenuEvent;
+import java.awt.*;
+import java.awt.event.InputEvent;
+
+public class bug6359669 {
+    static JMenu menu;
+
+    public static void main(String[] args) throws Exception {
+
+        ExtendedRobot robot = new ExtendedRobot();
+        robot.setAutoDelay(10);
+
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                JFrame f = new JFrame();
+                JMenuBar menuBar = new JMenuBar();
+                menu = new JMenu("Test");
+                menu.getPopupMenu().addPopupMenuListener(new PopupMenuListener() {
+                    public void popupMenuCanceled(PopupMenuEvent e) {
+                    }
+
+                    public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
+                    }
+
+                    public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
+                        menu.add(new JMenuItem("An item"));
+                    }
+                });
+
+                menuBar.add(menu);
+                f.setJMenuBar(menuBar);
+
+                f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                f.setSize(200, 200);
+                f.setVisible(true);
+            }
+        });
+        robot.waitForIdle();
+        Point p = menu.getLocationOnScreen();
+        Dimension size = menu.getSize();
+        p.x += size.width / 2;
+        p.y += size.height / 2;
+        robot.mouseMove(p.x, p.y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.waitForIdle();
+        if (menu.getPopupMenu().getComponentCount() == 0) {
+            throw new RuntimeException("Where is a menuItem ?");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JMenu/6470128/bug6470128.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 6470128
+   @summary Escape Key causes JMenu Selection to Disappear
+   @author Alexander Potochkin
+   @library ../../../../lib/testlibrary
+   @build jdk.testlibrary.OSInfo
+   @run main bug6470128
+*/
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.KeyEvent;
+import jdk.testlibrary.OSInfo;
+
+public class bug6470128 {
+    static JFrame frame;
+    static JMenu subMenu;
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                frame = new JFrame();
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+                JMenuBar bar = new JMenuBar();
+                JMenu menu = new JMenu("Menu");
+                menu.setMnemonic('m');
+                subMenu = new JMenu("SubMenu");
+                JMenuItem item = new JMenuItem("Item");
+
+                frame.setJMenuBar(bar);
+                bar.add(menu);
+                menu.add(subMenu);
+                subMenu.add(item);
+
+                frame.setSize(200, 200);
+                frame.setLocationRelativeTo(null);
+                frame.setVisible(true);
+            }
+        });
+        Robot robot = new Robot();
+        robot.setAutoDelay(10);
+        robot.waitForIdle();
+        if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
+            robot.keyPress(KeyEvent.VK_CONTROL);
+        }
+        robot.keyPress(KeyEvent.VK_ALT);
+        robot.keyPress(KeyEvent.VK_M);
+        robot.keyRelease(KeyEvent.VK_M);
+        robot.keyRelease(KeyEvent.VK_ALT);
+        if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
+            robot.keyRelease(KeyEvent.VK_CONTROL);
+        }
+        robot.keyPress(KeyEvent.VK_ENTER);
+        robot.keyRelease(KeyEvent.VK_ENTER);
+        robot.keyPress(KeyEvent.VK_ESCAPE);
+        robot.keyRelease(KeyEvent.VK_ESCAPE);
+        robot.waitForIdle();
+        if (!subMenu.isSelected()) {
+            throw new RuntimeException("Submenu is unexpectedly unselected");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JMenu/6538132/bug6538132.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 6538132
+   @summary Regression: Pressing Escape key don't close the menu items from jdk7.0 b07 onwards
+   @author Alexander Potochkin
+   @library ../../../../lib/testlibrary
+   @build ExtendedRobot
+   @run main bug6538132
+*/
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+
+public class bug6538132 {
+    private static JMenu menu1;
+    private static JMenu menu2;
+    private static volatile boolean isWinLaf;
+
+    private static void createGui() {
+        try {
+            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
+            isWinLaf = true;
+        } catch (Exception e) {
+            // If we can't set WinLaf it means we are not under Windows
+            // make the test pass
+            isWinLaf = false;
+            return;
+        }
+        JFrame frame = new JFrame();
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+        JMenuBar menuBar = new JMenuBar();
+        menu1 = createMenu();
+        menuBar.add(menu1);
+        menu2 = createMenu();
+        menuBar.add(menu2);
+        frame.setJMenuBar(menuBar);
+
+        frame.setSize(200, 200);
+        frame.setVisible(true);
+    }
+
+    static JMenu createMenu() {
+        JMenu menu = new JMenu("Menu");
+        menu.add(new JMenuItem("MenuItem"));
+        menu.add(new JMenuItem("MenuItem"));
+        menu.add(new JMenuItem("MenuItem"));
+        return menu;
+    }
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                bug6538132.createGui();
+            }
+        });
+        if(isWinLaf) {
+            ExtendedRobot robot = new ExtendedRobot();
+            robot.setAutoDelay(10);
+            robot.waitForIdle();
+            Point p1 = menu1.getLocationOnScreen();
+            final int x1 = p1.x + menu1.getWidth() / 2;
+            final int y1 = p1.y + menu1.getHeight() / 2;
+            robot.glide(0, 0, x1, y1);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            assertPopupOpen();
+            Point p2 = menu2.getLocationOnScreen();
+            final int x2 = p2.x + menu2.getWidth() / 2;
+            final int y2 = p2.y + menu2.getHeight() / 2;
+            robot.glide(x1, y1, x2, y2);
+            assertPopupOpen();
+            robot.keyPress(KeyEvent.VK_ESCAPE);
+            robot.keyRelease(KeyEvent.VK_ESCAPE);
+            assertPopupNotOpen();
+            robot.glide(x2, y2, x1, y1);
+            assertPopupNotOpen();
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            assertPopupOpen();
+        }
+    }
+
+    static void assertPopupOpen() {
+        if (getLastPopup() == null) {
+            throw new RuntimeException("PopupMenu is not open");
+        }
+    }
+
+    static void assertPopupNotOpen() {
+        if (getLastPopup() != null) {
+            throw new RuntimeException("PopupMenu is unexpectedly open");
+        }
+    }
+
+    // copied from BasicPopupMenuUI
+    static JPopupMenu getLastPopup() {
+        MenuSelectionManager msm = MenuSelectionManager.defaultManager();
+        MenuElement[] p = msm.getSelectedPath();
+        JPopupMenu popup = null;
+
+        for (int i = p.length - 1; popup == null && i >= 0; i--) {
+            if (p[i] instanceof JPopupMenu)
+                popup = (JPopupMenu) p[i];
+        }
+        return popup;
+    }
+}
--- a/jdk/test/javax/swing/JMenuBar/4750590/bug4750590.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JMenuBar/4750590/bug4750590.java	Fri Jan 09 13:28:02 2015 -0500
@@ -48,16 +48,15 @@
             }
         });
 
-        sun.awt.SunToolkit toolkit = (sun.awt.SunToolkit) Toolkit.getDefaultToolkit();
-        toolkit.realSync();
-
         Robot robo = new Robot();
         robo.setAutoDelay(500);
+        robo.waitForIdle();
+
         Util.hitMnemonics(robo, KeyEvent.VK_F);
         robo.keyPress(KeyEvent.VK_M);
         robo.keyRelease(KeyEvent.VK_M);
 
-        toolkit.realSync();
+        robo.waitForIdle();
 
         if (passed) {
             System.out.println("Test passed!");
--- a/jdk/test/javax/swing/JMenuItem/4171437/bug4171437.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JMenuItem/4171437/bug4171437.java	Fri Jan 09 13:28:02 2015 -0500
@@ -32,7 +32,6 @@
 import java.util.ArrayList;
 import javax.swing.*;
 import javax.swing.event.*;
-import sun.awt.SunToolkit;
 
 public class bug4171437 {
     static volatile boolean closeActivated = false;
@@ -45,16 +44,14 @@
             }
         });
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-        toolkit.realSync();
-
         Robot robot = new Robot();
         robot.setAutoDelay(50);
+        robot.waitForIdle();
 
         Util.hitMnemonics(robot, KeyEvent.VK_F);
         Util.hitKeys(robot, KeyEvent.VK_C);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         Thread.sleep(1000);
 
         if (!closeActivated || customActivated) {
--- a/jdk/test/javax/swing/JMenuItem/4654927/bug4654927.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JMenuItem/4654927/bug4654927.java	Fri Jan 09 13:28:02 2015 -0500
@@ -36,7 +36,6 @@
 import java.awt.*;
 import java.awt.event.InputEvent;
 import java.util.concurrent.Callable;
-import sun.awt.SunToolkit;
 
 public class bug4654927 {
 
@@ -51,7 +50,6 @@
         }
 
         UIManager.setLookAndFeel(systemLAF);
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(10);
 
@@ -61,20 +59,20 @@
                 createAndShowUI();
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // test mouse press
         Point point = Util.getCenterPoint(menu);
         robot.mouseMove(point.x, point.y);
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         point = Util.getCenterPoint(menuItem);
         robot.mouseMove(point.x, point.y);
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (!isMenuItemShowing()) {
             throw new RuntimeException("Popup is unexpectedly closed");
@@ -107,12 +105,12 @@
         // close menu
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         robot.mousePress(InputEvent.BUTTON1_MASK);
         Util.glide(robot, x0, y0, x1, y1);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (!isMenuItemShowing()) {
             throw new RuntimeException("Popup is unexpectedly closed");
--- a/jdk/test/javax/swing/JMenuItem/6209975/bug6209975.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JMenuItem/6209975/bug6209975.java	Fri Jan 09 13:28:02 2015 -0500
@@ -25,15 +25,12 @@
  * @test
  * @bug 6209975
  * @summary regression: JMenuItem icons overimposed on JMenuItem labels under Metal LAF
- * @library ../../regtesthelpers
- * @build Util
  * @author Alexander Zuev
  * @run main bug6209975
  */
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.InputEvent;
-import sun.awt.SunToolkit;
 
 public class bug6209975 {
 
@@ -45,7 +42,6 @@
 
     public static void main(String[] args) throws Exception {
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(500);
 
@@ -58,19 +54,19 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Point clickPoint = getButtonClickPoint();
         robot.mouseMove(clickPoint.x, clickPoint.y);
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         clickPoint = getMenuClickPoint();
         robot.mouseMove(clickPoint.x, clickPoint.y);
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (RO1.itsValue <= RO2.itsValue) {
             throw new RuntimeException("Offset if the second icon is invalid.");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JMenuItem/6249972/bug6249972.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 6249972
+   @summary Tests that JMenuItem(String,int) handles lower-case mnemonics properly.
+   @library ../../../../lib/testlibrary
+   @build ExtendedRobot
+   @author Mikhail Lapshin
+   @run main bug6249972
+ */
+
+import javax.swing.*;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+
+public class bug6249972 implements ActionListener {
+
+
+    private JFrame frame;
+    private JMenu menu;
+    private volatile boolean testPassed = false;
+
+    public static void main(String[] args) throws Exception {
+        bug6249972 bugTest = new bug6249972();
+        bugTest.test();
+    }
+
+    public bug6249972() throws Exception {
+        SwingUtilities.invokeAndWait(
+                new Runnable() {
+                    public void run() {
+                        frame = new JFrame("bug6249972");
+                        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+                        JMenuBar bar = new JMenuBar();
+                        frame.setJMenuBar(bar);
+
+                        menu = new JMenu("Problem");
+                        bar.add(menu);
+
+                        JMenuItem item = new JMenuItem("JMenuItem(String,'z')", 'z');
+                        item.addActionListener(bug6249972.this);
+                        menu.add(item);
+
+                        frame.setLocationRelativeTo(null);
+                        frame.pack();
+                        frame.setVisible(true);
+                    }
+                }
+        );
+    }
+
+
+    private void test() throws Exception {
+        ExtendedRobot robot = new ExtendedRobot();
+        robot.waitForIdle();
+        java.awt.Point p = menu.getLocationOnScreen();
+        java.awt.Dimension size = menu.getSize();
+        p.x += size.width / 2;
+        p.y += size.height / 2;
+        robot.mouseMove(p.x, p.y);
+        robot.click();
+        robot.delay(100);
+
+        robot.waitForIdle();
+        robot.type(KeyEvent.VK_Z);
+
+        robot.waitForIdle();
+        frame.dispose(); // Try to stop the event dispatch thread
+
+        if (!testPassed) {
+            throw new RuntimeException("JMenuItem(String,int) does not handle " +
+                    "lower-case mnemonics properly.");
+        }
+
+        System.out.println("Test passed");
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        // We are in the actionPerformed() method -
+        // JMenuItem(String,int) handles lower-case mnemonics properly
+        testPassed = true;
+    }
+}
--- a/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -26,10 +26,12 @@
  * @bug 7160951
  * @summary [macosx] ActionListener called twice for JMenuItem using ScreenMenuBar
  * @author vera.akulova@oracle.com
+ * @library ../../../../lib/testlibrary
+ * @build jdk.testlibrary.OSInfo
  * @run main ActionListenerCalledTwiceTest
  */
 
-import sun.awt.*;
+import jdk.testlibrary.OSInfo;
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
@@ -47,7 +49,7 @@
 
     static volatile int listenerCallCounter = 0;
     public static void main(String[] args) throws Exception {
-        if (sun.awt.OSInfo.getOSType() != sun.awt.OSInfo.OSType.MACOSX) {
+        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
             System.out.println("This test is for MacOS only. Automatically passed on other platforms.");
             return;
         }
@@ -59,7 +61,6 @@
             }
         });
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(100);
 
@@ -78,7 +79,7 @@
                 robot.keyRelease(modKeyCode);
             }
 
-            toolkit.realSync();
+            robot.waitForIdle();
 
             if (listenerCallCounter != 1) {
                 throw new Exception("Test failed: ActionListener for " + menuItems[i] +
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JOptionPane/6428694/bug6428694.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 6428694
+@summary Checks that double click closes JOptionPane's input dialog.
+@library ../../../../lib/testlibrary
+@build ExtendedRobot
+@author Mikhail Lapshin
+@run main bug6428694
+*/
+
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+import javax.swing.JOptionPane;
+import java.awt.*;
+import java.awt.event.InputEvent;
+
+public class bug6428694 {
+    private static JFrame frame;
+    private static boolean mainIsWaitingForDialogClosing;
+    private static ExtendedRobot robot;
+    private static volatile boolean testPassed;
+
+    public static void main(String[] args) throws Exception {
+        robot = new ExtendedRobot();
+        try {
+            SwingUtilities.invokeLater(new Runnable() {
+                public void run() {
+                    bug6428694.setupUI();
+                }
+            });
+            robot.waitForIdle();
+            test();
+        } finally {
+            stopEDT();
+        }
+
+        if (testPassed) {
+            System.out.println("Test passed");
+        } else {
+            throw new RuntimeException("JOptionPane doesn't close input dialog " +
+                    "by double click!");
+        }
+    }
+
+    private static void setupUI() {
+        frame = new JFrame("bug6428694 test");
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setVisible(true);
+
+        Object[] selectedItems = new Object[40];
+        for (int i = 0; i < 39; i++) {
+            selectedItems[i] = ("item: " + i);
+        }
+        JOptionPane.showInputDialog(frame,
+                "Double click on selected item then click cancel",
+                "Test Option Dialog", JOptionPane.WARNING_MESSAGE, null,
+                selectedItems, selectedItems[0]);
+
+        // We are here if double click has closed the dialog
+        // or when the EDT is stopping
+        testPassed = mainIsWaitingForDialogClosing;
+    }
+
+    private static void test() {
+
+        mainIsWaitingForDialogClosing = true;
+
+        // Perform double click on an item
+        int frameLeftX = frame.getLocationOnScreen().x;
+        int frameUpperY = frame.getLocationOnScreen().y;
+        robot.mouseMove(frameLeftX + 150, frameUpperY + 120);
+        robot.waitForIdle();
+        robot.delay(100);
+        robot.setAutoDelay(50);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        // Wait for the input dialog closing
+        robot.waitForIdle();
+        robot.delay(2000);
+
+        mainIsWaitingForDialogClosing = false;
+    }
+
+    private static void stopEDT() {
+        if (frame != null) {
+            frame.dispose();
+        }
+    }
+}
--- a/jdk/test/javax/swing/JOptionPane/7138665/bug7138665.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JOptionPane/7138665/bug7138665.java	Fri Jan 09 13:28:02 2015 -0500
@@ -27,8 +27,6 @@
    @author Pavel Porvatov
 */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.KeyEvent;
@@ -55,16 +53,14 @@
             }
         });
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
 
-        toolkit.realSync();
-
-        Robot robot = new Robot();
+        robot.waitForIdle();
 
         robot.setAutoDelay(100);
         robot.keyPress(KeyEvent.VK_ENTER);
         robot.keyRelease(KeyEvent.VK_ENTER);
 
-        toolkit.realSync();
+        robot.waitForIdle();
     }
 }
--- a/jdk/test/javax/swing/JPopupMenu/4458079/bug4458079.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JPopupMenu/4458079/bug4458079.java	Fri Jan 09 13:28:02 2015 -0500
@@ -35,7 +35,6 @@
 import javax.swing.event.*;
 import java.awt.event.KeyEvent;
 import java.util.ArrayList;
-import sun.awt.SunToolkit;
 
 public class bug4458079 extends JFrame implements PopupMenuListener {
     public JMenu menu;
@@ -47,21 +46,20 @@
                 new bug4458079().createAndShowGUI();
             }
         });
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-        toolkit.realSync();
+        Robot robot = new Robot();
+        robot.waitForIdle();
 
-        Robot robot = new Robot();
         robot.setAutoDelay(50);
 
         Util.hitMnemonics(robot, KeyEvent.VK_M);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         Thread.sleep(1000);
 
         Util.hitKeys(robot, KeyEvent.VK_DOWN);
         Util.hitKeys(robot, KeyEvent.VK_ENTER);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         Thread.sleep(1000);
 
         if (!itemASelected) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JPopupMenu/4634626/bug4634626.html	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,8 @@
+<Html>
+<Body>
+<APPLET  code="bug4634626.class" WIDTH = 50 HEIGHT = 50>
+</APPLET>
+
+</Body>
+</Html>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JPopupMenu/4634626/bug4634626.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 4634626
+   @summary Implement context popup menus for components
+   @author Alexander Zuev
+   @library ../../../../lib/testlibrary
+   @build ExtendedRobot
+   @run applet bug4634626.html
+*/
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+
+public class bug4634626 extends JApplet {
+
+    public boolean passed = true;
+    public boolean done = false;
+
+    public JFrame mainFrame = new JFrame("Bug4634626");
+    public JRootPane rootPane = mainFrame.getRootPane();
+    public JPanel contentPane = new JPanel();
+    public JButton nopButton = new JButton("No popup button");
+    public JTextArea someText = new JTextArea("Some text here", 20, 10);
+    public JButton popButton = new JButton("Button with the popup");
+
+    public JPopupMenu btnPopup = new JPopupMenu();
+    public JPopupMenu commonPopup = new JPopupMenu();
+    static public Error toBeThrown = null;
+    static int popTrig = MouseEvent.BUTTON3_MASK;
+    static boolean popt = false;
+
+    public static class MouseWatcher extends MouseAdapter {
+        public void mousePressed(MouseEvent e) {
+            if(e.isPopupTrigger()) popt = true;
+            if(e.getComponent() != null &&
+               e.getComponent() instanceof JComponent &&
+               e.isPopupTrigger() &&
+               ((JComponent)e.getComponent()).getComponentPopupMenu() != null) {
+                toBeThrown =
+                  new Error("The event got thru the component with popup: "
+                  + e);
+            }
+        }
+        public void mouseReleased(MouseEvent e) {
+            if(e.isPopupTrigger()) popt = true;
+            if(e.getComponent() != null &&
+               e.getComponent() instanceof JComponent &&
+               e.isPopupTrigger() &&
+               ((JComponent)e.getComponent()).getComponentPopupMenu() != null) {
+                toBeThrown =
+                  new Error("The event got thru the component with popup: "
+                  + e);
+            }
+            if(toBeThrown != null) {
+                throw(toBeThrown);
+            }
+        }
+    }
+
+    public static MouseWatcher mouser = new MouseWatcher();
+
+    public void init() {
+
+        try {
+            popButton.setComponentPopupMenu(null);
+            popButton.setComponentPopupMenu(null);
+            popButton.setComponentPopupMenu(btnPopup);
+            popButton.setComponentPopupMenu(null);
+        } catch(Exception ex) {
+            System.err.println("Unexpected exception was thrown by " +
+                               "setComponentPopupMenu() method: " + ex);
+        }
+        btnPopup.add("Button 1");
+        btnPopup.add("Button 2");
+        btnPopup.add("Button 3");
+        popButton.setComponentPopupMenu(btnPopup);
+        popButton.addMouseListener(mouser);
+        commonPopup.add("One");
+        commonPopup.add("Two");
+        commonPopup.add("Three");
+
+        contentPane.setLayout(new BorderLayout());
+        contentPane.setComponentPopupMenu(commonPopup);
+        contentPane.addMouseListener(mouser);
+        contentPane.add(nopButton, BorderLayout.NORTH);
+        nopButton.addMouseListener(mouser);
+        contentPane.add(popButton, BorderLayout.SOUTH);
+        someText.addMouseListener(mouser);
+        contentPane.add(someText, BorderLayout.CENTER);
+        mainFrame.setContentPane(contentPane);
+
+        mainFrame.pack();
+        mainFrame.setLocation(50, 50);
+
+        mainFrame.addWindowListener(new TestStateListener());
+        mainFrame.setVisible(true);
+
+        while(!done) Thread.yield();
+
+        if(!passed) {
+            throw new RuntimeException("Test failed");
+        }
+
+    }
+
+    public class TestStateListener extends WindowAdapter {
+        public void windowOpened(WindowEvent ev) {
+            try {
+                ev.getWindow().toFront();
+                ev.getWindow().requestFocus();
+                new Thread(new RobotThread()).start();
+            } catch (Exception ex) {
+                throw new RuntimeException("Thread Exception");
+            }
+        }
+    }
+
+    class RobotThread implements Runnable {
+        public void run() {
+            ExtendedRobot robo;
+            try {
+                robo = new ExtendedRobot();
+            }catch(Exception ex) {
+                ex.printStackTrace();
+                throw new RuntimeException("Cannot create Robot");
+            }
+            robo.setAutoDelay(100);
+            robo.waitForIdle();
+
+            // Determine working popup trigger event
+            clickMouseOn(robo, nopButton, popTrig);
+            robo.waitForIdle();
+            robo.delay(500);
+            if(!popt) popTrig = MouseEvent.BUTTON2_MASK;
+
+            // Inheritance is OFF by default. Popup should not appear.
+            clickMouseOn(robo, someText, popTrig);
+
+            // Set inheritance ON watch for popup.
+            someText.setInheritsPopupMenu(true);
+            clickMouseOn(robo, someText, popTrig);
+            robo.waitForIdle();
+            robo.delay(500);
+            if(!commonPopup.isVisible()) {
+                toBeThrown = new Error("Popup should be visible");
+                passed = false;
+            }
+            // Dispose popup.
+            robo.type(KeyEvent.VK_ESCAPE);
+            robo.waitForIdle();
+            someText.setInheritsPopupMenu(false);
+
+            // Button with popup assigned. Wathch for popup.
+            clickMouseOn(robo, popButton, popTrig);
+            robo.waitForIdle();
+            robo.delay(500);
+            if(!btnPopup.isVisible()) {
+                toBeThrown = new Error("Popup should be visible");
+                passed = false;
+            }
+            // Dispose popup.
+            robo.type(KeyEvent.VK_ESCAPE);
+            // Test finished.
+            done = true;
+        }
+    }
+
+
+
+    public void destroy() {
+        if(!passed) {
+            throw(toBeThrown);
+        }
+    }
+    private void clickMouseOn(ExtendedRobot robot, Component c, int button) {
+        java.awt.Point p = c.getLocationOnScreen();
+        java.awt.Dimension size = c.getSize();
+        p.x += size.width / 2;
+        p.y += size.height / 2;
+        robot.mouseMove(p.x, p.y);
+        robot.delay(100);
+        robot.click(button);
+    }
+}
--- a/jdk/test/javax/swing/JPopupMenu/4966112/bug4966112.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JPopupMenu/4966112/bug4966112.java	Fri Jan 09 13:28:02 2015 -0500
@@ -35,7 +35,6 @@
 import javax.swing.event.PopupMenuEvent;
 import java.awt.*;
 import java.awt.event.*;
-import sun.awt.SunToolkit;
 
 public class bug4966112 {
 
@@ -50,19 +49,18 @@
     private static Robot robot;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         robot = new Robot();
         robot.setAutoDelay(100);
 
         createAndShowButton();
-        toolkit.realSync();
+        robot.waitForIdle();
 
         setClickPoint(testButton);
         clickMouse(InputEvent.BUTTON1_MASK);
         clickMouse(InputEvent.BUTTON2_MASK);
         clickMouse(InputEvent.BUTTON3_MASK);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         closeFrame();
 
         if (popupButton == NO_MOUSE_BUTTON) {
@@ -74,10 +72,10 @@
 
         // Test Split Pane
         createAndShowSplitPane();
-        toolkit.realSync();
+        robot.waitForIdle();
 
         clickMouse(jsp);
-        toolkit.realSync();
+        robot.waitForIdle();
         closeFrame();
 
         if (!shown) {
@@ -86,10 +84,10 @@
 
         // Test Spinner
         createAndShowSpinner();
-        toolkit.realSync();
+        robot.waitForIdle();
 
         clickMouse(spin);
-        toolkit.realSync();
+        robot.waitForIdle();
         closeFrame();
 
         if (!shown) {
@@ -98,16 +96,16 @@
 
         // Test File Chooser
         createAndShowFileChooser();
-        toolkit.realSync();
+        robot.waitForIdle();
 
         clickMouse(filec);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Util.hitKeys(robot, KeyEvent.VK_ESCAPE);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Util.hitKeys(robot, KeyEvent.VK_ESCAPE);
-        toolkit.realSync();
+        robot.waitForIdle();
         closeFrame();
 
         if (!shown) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JPopupMenu/6217905/bug6217905.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 6217905
+@summary JPopupMenu keyboard navigation stops working
+@author Alexander Potochkin
+@library ../../../../lib/testlibrary
+@build ExtendedRobot
+@run main bug6217905
+*/
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+
+public class bug6217905 {
+    private static JPanel popupPanel;
+    private static JMenuItem firstItem;
+    private static JMenuItem lastItem;
+
+    private static void createGui() {
+        final JFrame frame = new JFrame();
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+        JPopupMenu popup = new JPopupMenu("Menu");
+        firstItem = new JMenuItem("MenuItem");
+        popup.add(firstItem);
+        popup.add(new JMenuItem("MenuItem"));
+        lastItem = new JMenuItem("MenuItem");
+        popup.add(lastItem);
+
+        popupPanel = new JPanel();
+        popupPanel.setComponentPopupMenu(popup);
+        frame.add(popupPanel);
+        frame.setSize(100, 100);
+        frame.setVisible(true);
+    }
+
+    public static void main(String[] args) throws Exception {
+        try {
+            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
+        } catch (Exception e) {
+            // This test is for WinLaf only
+            System.out.println("This test is for Windows LaF only.");
+            return;
+        }
+
+        ExtendedRobot robot = new ExtendedRobot();
+        robot.setAutoDelay(10);
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                bug6217905.createGui();
+            }
+        });
+        robot.waitForIdle();
+        Point loc = popupPanel.getLocationOnScreen();
+        int x = loc.x + popupPanel.getWidth()/2;
+        int y = loc.y + popupPanel.getHeight()/2;
+        robot.glide(0, 0, x, y);
+        robot.mousePress(InputEvent.BUTTON3_MASK);
+        robot.mouseRelease(InputEvent.BUTTON3_MASK);
+        robot.waitForIdle();
+        if (getSelectedPathLength() != 1) {
+            throw new RuntimeException("Only popup must be selected");
+        }
+        robot.glide(x, y, 0, 0);
+        robot.type(KeyEvent.VK_DOWN);
+        robot.waitForIdle();
+        if (getSelectedPathLength() != 2 || !firstItem.isArmed()) {
+            throw new RuntimeException("First item must be selected");
+        }
+        robot.type(KeyEvent.VK_ESCAPE);
+        robot.waitForIdle();
+        if (getSelectedPathLength() != 0) {
+            throw new RuntimeException("There must be no selected items");
+        }
+        robot.glide(0, 0, x, y);
+        robot.mousePress(InputEvent.BUTTON3_MASK);
+        robot.mouseRelease(InputEvent.BUTTON3_MASK);
+        robot.waitForIdle();
+        robot.glide(x, y, 0, 0);
+        robot.type(KeyEvent.VK_UP);
+        robot.waitForIdle();
+        if (getSelectedPathLength() != 2 || !lastItem.isArmed()) {
+            throw new RuntimeException("Last item must be selected");
+        }
+    }
+
+    private static int getSelectedPathLength() {
+        return MenuSelectionManager.defaultManager().getSelectedPath().length;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JPopupMenu/6415145/bug6415145.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 6415145
+@summary REGRESSION: Selected item is not being updated while dragging above popup menu
+@library ../../../../lib/testlibrary
+@build ExtendedRobot
+@author Mikhail Lapshin
+@run main bug6415145
+*/
+
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.AWTException;
+import java.awt.Component;
+
+public class bug6415145 {
+    private JFrame frame;
+    private JButton button;
+    private JPopupMenu popupMenu;
+    private JMenuItem item1;
+    private JMenuItem item2;
+    private static ExtendedRobot robot;
+
+    public static void main(String[] args) throws Exception {
+        robot = new ExtendedRobot();
+        final bug6415145 bugTest = new bug6415145();
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    bugTest.init();
+                }
+            });
+
+            robot.waitForIdle();
+            bugTest.test();
+        } finally {
+            bugTest.stopEDT();
+        }
+    }
+
+    private void stopEDT() {
+        if (frame != null) {
+            frame.dispose();
+        }
+    }
+
+    private void init() {
+        popupMenu = new JPopupMenu("test menu");
+        item1 = new JMenuItem("item 1");
+        item2 = new JMenuItem("item 2");
+        popupMenu.add(item1);
+        popupMenu.add(item2);
+
+        button = new JButton("test button");
+        button.addMouseListener(new MouseListener());
+
+        frame = new JFrame("test frame");
+        frame.add(popupMenu);
+        frame.add(button);
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setSize(200, 200);
+        frame.setLocationRelativeTo(null);
+        frame.setVisible(true);
+    }
+
+    private class MouseListener extends MouseAdapter {
+        public void mousePressed(MouseEvent e) {
+            popupMenu.show(button, e.getX(), e.getY());
+        }
+    }
+
+    private void test() throws AWTException {
+        try {
+            moveMouseTo(robot, button);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.waitForIdle();
+
+            moveMouseTo(robot, item1);
+            robot.waitForIdle();
+
+            moveMouseTo(robot, item2);
+            robot.waitForIdle();
+            if ( (item1.isArmed()) || (!item2.isArmed()) ) {
+                throw new RuntimeException("Selected item is not being updated" +
+                        " while dragging above popup menu.");
+            }
+        } finally {
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        }
+    }
+    private void moveMouseTo(ExtendedRobot robot, Component c) {
+        java.awt.Point p = c.getLocationOnScreen();
+        java.awt.Dimension size = c.getSize();
+        p.x += size.width / 2;
+        p.y += size.height / 2;
+        robot.mouseMove(p.x, p.y);
+        robot.delay(100);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JPopupMenu/6515446/bug6515446.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+@test
+@bug 6515446
+@summary JMenuItems in JPopupMenus not receiving ActionEvents - incompat with 1.5
+@author Alexander Potochkin
+@library ../../../../lib/testlibrary
+@build ExtendedRobot
+@run main bug6515446
+*/
+
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+
+public class bug6515446 {
+    private static JPanel panel;
+    private static volatile boolean flag;
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                final JFrame frame = new JFrame();
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+                final JPopupMenu popup = new JPopupMenu("Menu");
+                JMenuItem item = new JMenuItem("MenuItem");
+                item.addActionListener(new ActionListener() {
+                    public void actionPerformed(ActionEvent e) {
+                        flag = true;
+                    }
+                });
+                popup.add(item);
+
+                panel = new JPanel();
+                panel.addMouseListener(new MouseAdapter() {
+                    public void mousePressed(MouseEvent e) {
+                        popup.show(panel, e.getX(), e.getY());
+                    }
+
+                    public void mouseReleased(MouseEvent e) {
+                        popup.setVisible(false);
+                    }
+                });
+                frame.add(panel);
+                frame.setSize(200, 200);
+                frame.setLocationRelativeTo(null);
+                frame.setVisible(true);
+            }
+        });
+
+        ExtendedRobot robot = new ExtendedRobot();
+        robot.setAutoDelay(10);
+        robot.waitForIdle();
+
+        Point l = panel.getLocationOnScreen();
+
+        int x = l.x + panel.getWidth() / 2;
+        int y = l.y + panel.getHeight() / 2;
+        robot.mouseMove(x, y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.glide(x, y, x + 10, y + 10);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.waitForIdle();
+
+        if (!flag) {
+            throw new RuntimeException("ActionEvent wasn't fired");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JPopupMenu/6544309/bug6544309.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 6544309
+   @summary Checks that 'Select Input Method' popup menu allows to select
+            items with keyboard.
+   @author Mikhail Lapshin
+   @library ../../../../lib/testlibrary
+   @build ExtendedRobot
+   @run main bug6544309
+*/
+
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+
+public class bug6544309 {
+    private JDialog dialog;
+    private boolean passed;
+    private static ExtendedRobot robot;
+
+    public static void main(String[] args) throws Exception {
+        robot = new ExtendedRobot();
+        final bug6544309 test = new bug6544309();
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    test.setupUI();
+                }
+            });
+            test.test();
+            System.out.println("Test passed");
+        } finally {
+            if (test.dialog != null) {
+                test.dialog.dispose();
+            }
+        }
+    }
+
+    private void setupUI() {
+        dialog = new JDialog();
+        dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+        dialog.setSize(200, 100);
+        dialog.setLocationRelativeTo(null);
+        dialog.setVisible(true);
+
+        JPopupMenu popup = new JPopupMenu();
+        popup.add(new JMenuItem("one"));
+        JMenuItem two = new JMenuItem("two");
+        two.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                passed = true;
+            }
+        });
+        popup.add(two);
+        popup.add(new JMenuItem("three"));
+        popup.show(dialog, 50, 50);
+    }
+
+    private void test() throws Exception {
+        testImpl();
+        checkResult();
+    }
+
+
+    private void testImpl() throws Exception {
+        robot.waitForIdle();
+        System.out.println("Pressing DOWN ARROW");
+        robot.type(KeyEvent.VK_DOWN);
+        robot.waitForIdle();
+        System.out.println("Pressing DOWN ARROW");
+        robot.type(KeyEvent.VK_DOWN);
+        robot.waitForIdle();
+        System.out.println("Pressing SPACE");
+        robot.type(KeyEvent.VK_SPACE);
+    }
+
+    private void checkResult() {
+        robot.waitForIdle();
+        if (!passed) {
+            throw new RuntimeException("If a JDialog is invoker for JPopupMenu, " +
+                    "the menu cannot be handled by keyboard.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JPopupMenu/6580930/bug6580930.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+@test
+@bug 6580930 7184956
+@summary Swing Popups should overlap taskbar
+@author Alexander Potochkin
+@library ../../../../lib/testlibrary
+@build ExtendedRobot
+@run main bug6580930
+*/
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+
+public class bug6580930 {
+    private static ExtendedRobot robot;
+    private static JFrame frame;
+    private static JPopupMenu popup;
+    private static Toolkit toolkit;
+    private static volatile boolean skipTest = false;
+
+    private static void createGui() {
+        frame = new JFrame();
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setUndecorated(true);
+
+        popup = new JPopupMenu("Menu");
+        for (int i = 0; i < 7; i++) {
+            popup.add(new JMenuItem("MenuItem"));
+        }
+        JPanel panel = new JPanel();
+        panel.setComponentPopupMenu(popup);
+        frame.add(panel);
+
+        frame.setSize(200, 200);
+    }
+
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                JPopupMenu.setDefaultLightWeightPopupEnabled(true);
+                bug6580930.createGui();
+            }
+        });
+
+        toolkit = Toolkit.getDefaultToolkit();
+        robot = new ExtendedRobot();
+        robot.setAutoDelay(10);
+        robot.waitForIdle();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                Insets insets = toolkit.getScreenInsets(frame.getGraphicsConfiguration());
+                if (insets.bottom == 0) {
+                    System.out.println("This test is only for configurations with taskbar on the bottom");
+
+                    skipTest = true;
+                }
+
+                Dimension screenSize = toolkit.getScreenSize();
+                frame.setLocation(screenSize.width/2, screenSize.height - frame.getHeight() - insets.bottom + 10);
+                frame.setVisible(true);
+            }
+        });
+
+        robot.waitForIdle();
+
+        if(skipTest) {
+            return;
+        }
+        Point loc = frame.getLocationOnScreen();
+
+        robot.mouseMove(loc.x, loc.y);
+        showPopup();
+        robot.waitForIdle();
+        if (isHeavyWeightMenuVisible()) {
+            throw new RuntimeException("HeavyWeightPopup is unexpectedly visible");
+        }
+
+        robot.keyPress(KeyEvent.VK_ESCAPE);
+        robot.keyRelease(KeyEvent.VK_ESCAPE);
+
+        int x = loc.x;
+        int y = loc.y + (frame.getHeight() - popup.getPreferredSize().height) + 1;
+        robot.mouseMove(x, y);
+
+        showPopup();
+
+        if (!popup.getLocationOnScreen().equals(new Point(x, y))) {
+            throw new RuntimeException("Popup is unexpectedly shifted");
+        }
+
+        if (!isHeavyWeightMenuVisible()) {
+            throw new RuntimeException("HeavyWeightPopup is unexpectedly hidden");
+        }
+    }
+
+    private static void showPopup() {
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.waitForIdle();
+        if (!popup.isShowing()) {
+            robot.mousePress(InputEvent.BUTTON2_MASK);
+            robot.mouseRelease(InputEvent.BUTTON2_MASK);
+            robot.waitForIdle();
+            if (!popup.isShowing()) {
+                robot.mousePress(InputEvent.BUTTON3_MASK);
+                robot.mouseRelease(InputEvent.BUTTON3_MASK);
+                robot.waitForIdle();
+            }
+        }
+    }
+
+    private static boolean isHeavyWeightMenuVisible() {
+        Window[] windows = Window.getWindows();
+        for (Window window : windows) {
+            if (window.getClass().getSimpleName().equals("HeavyWeightWindow")
+                    && window.isVisible()) {
+                    return true;
+            }
+        }
+        return false;
+    }
+}
--- a/jdk/test/javax/swing/JPopupMenu/6800513/bug6800513.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JPopupMenu/6800513/bug6800513.java	Fri Jan 09 13:28:02 2015 -0500
@@ -32,8 +32,6 @@
  * @run main bug6800513
  */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.InputEvent;
@@ -47,10 +45,10 @@
     private static JPopupMenu popupMenu;
     private static JMenu menu;
     private static JFrame frame;
+    private static Robot robot;
 
     public static void testFrame(final boolean defaultLightWeightPopupEnabled,
             String expectedPopupClass) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
@@ -59,11 +57,11 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         clickOnMenu();
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Field getPopup = JPopupMenu.class.getDeclaredField("popup");
         getPopup.setAccessible(true);
@@ -87,7 +85,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
     }
 
 
@@ -99,7 +97,6 @@
             }
         });
 
-        Robot robot = new Robot();
         robot.setAutoDelay(100);
 
         robot.mouseMove(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
@@ -140,6 +137,7 @@
     }
 
     public static void main(String[] args) throws Exception {
+        robot = new Robot();
         testFrame(false, "javax.swing.PopupFactory$HeavyWeightPopup");
 
         testFrame(true, "javax.swing.PopupFactory$LightWeightPopup");
--- a/jdk/test/javax/swing/JPopupMenu/6827786/bug6827786.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JPopupMenu/6827786/bug6827786.java	Fri Jan 09 13:28:02 2015 -0500
@@ -33,7 +33,6 @@
 import java.awt.*;
 import java.awt.event.KeyEvent;
 import javax.swing.*;
-import sun.awt.SunToolkit;
 
 public class bug6827786 {
 
@@ -41,7 +40,6 @@
     private static Component focusable;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -52,7 +50,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
@@ -61,7 +59,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
         checkfocus();
 
         // select menu
@@ -72,17 +70,17 @@
         }
         // select submenu
         Util.hitKeys(robot, KeyEvent.VK_S);
-        toolkit.realSync();
+        robot.waitForIdle();
         // verify submenu is selected
         verify(1);
 
         Util.hitKeys(robot, KeyEvent.VK_S);
-        toolkit.realSync();
+        robot.waitForIdle();
         // verify last item is selected
         verify(2);
 
         Util.hitKeys(robot, KeyEvent.VK_S);
-        toolkit.realSync();
+        robot.waitForIdle();
         // selection should wrap to first item
         verify(0);
 
--- a/jdk/test/javax/swing/JPopupMenu/6987844/bug6987844.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JPopupMenu/6987844/bug6987844.java	Fri Jan 09 13:28:02 2015 -0500
@@ -29,8 +29,6 @@
  * @run main bug6987844
  */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.InputEvent;
@@ -40,7 +38,6 @@
     static JMenu menu2;
 
     public static void main(String... args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(200);
 
@@ -64,7 +61,7 @@
                 frame.setVisible(true);
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
         Point point1 = menu1.getLocationOnScreen();
         Point point2 = menu2.getLocationOnScreen();
 
@@ -79,7 +76,7 @@
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
 
         robot.mouseMove(point1.x + 1, point1.y + 1);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
--- a/jdk/test/javax/swing/JPopupMenu/7154841/bug7154841.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JPopupMenu/7154841/bug7154841.java	Fri Jan 09 13:28:02 2015 -0500
@@ -26,16 +26,17 @@
   @bug 7154841
   @summary JPopupMenu is overlapped by a Dock on Mac OS X
   @author Petr Pchelko
+  @library ../../../../lib/testlibrary
+  @build ExtendedRobot jdk.testlibrary.OSInfo
+  @run main bug7154841
  */
 
-import sun.awt.OSInfo;
-import sun.awt.SunToolkit;
-
 import java.awt.*;
 import javax.swing.*;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseMotionAdapter;
 import java.util.concurrent.atomic.AtomicReference;
+import jdk.testlibrary.OSInfo;
 
 public class bug7154841 {
 
@@ -71,20 +72,20 @@
         }
 
         try {
-            Robot r = new Robot();
+            ExtendedRobot r = new ExtendedRobot();
             r.setAutoDelay(100);
             r.setAutoWaitForIdle(true);
             r.mouseMove(0, 0);
 
             SwingUtilities.invokeAndWait(bug7154841::initAndShowUI);
 
-            sleep();
+            r.waitForIdle(200);
 
             SwingUtilities.invokeAndWait(() -> {
                 popupMenu.show(frame, frame.getX() + frame.getWidth() / 2, frame.getY() + frame.getHeight() / 2);
             });
 
-            sleep();
+            r.waitForIdle(200);
 
             int y = (int)screenBounds.get().getY() + (int)screenBounds.get().getHeight() - 10;
             int center = (int)(screenBounds.get().getX() + screenBounds.get().getWidth() / 2);
@@ -112,10 +113,4 @@
                 .getBounds();
     }
 
-    private static void sleep() {
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
-        try {
-            Thread.sleep(200);
-        } catch (InterruptedException ignored) { }
-    }
 }
--- a/jdk/test/javax/swing/JRadioButton/8033699/bug8033699.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JRadioButton/8033699/bug8033699.java	Fri Jan 09 13:28:02 2015 -0500
@@ -35,11 +35,9 @@
 import javax.swing.event.*;
 import java.awt.event.*;
 import java.awt.*;
-import sun.awt.SunToolkit;
 
 public class bug8033699 {
     private static Robot robot;
-    private static SunToolkit toolkit;
 
     private static JButton btnStart;
     private static ButtonGroup btnGrp;
@@ -61,7 +59,6 @@
         Thread.sleep(100);
 
         robot.setAutoDelay(100);
-        toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
 
         // tab key test grouped radio button
         runTest1();
@@ -242,7 +239,7 @@
     private static void hitKey(Robot robot, int keycode) {
         robot.keyPress(keycode);
         robot.keyRelease(keycode);
-        toolkit.realSync();
+        robot.waitForIdle();
     }
 
     private static void hitKey(Robot robot, int mode, int keycode) {
@@ -250,6 +247,6 @@
         robot.keyPress(keycode);
         robot.keyRelease(mode);
         robot.keyRelease(keycode);
-        toolkit.realSync();
+        robot.waitForIdle();
     }
 }
--- a/jdk/test/javax/swing/JRadioButton/8041561/bug8041561.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JRadioButton/8041561/bug8041561.java	Fri Jan 09 13:28:02 2015 -0500
@@ -25,7 +25,6 @@
 import java.awt.Color;
 import java.awt.Point;
 import java.awt.Robot;
-import java.awt.Toolkit;
 import javax.swing.JFrame;
 import javax.swing.JPanel;
 import javax.swing.JRadioButton;
@@ -34,7 +33,6 @@
 import javax.swing.UnsupportedLookAndFeelException;
 import javax.swing.plaf.metal.DefaultMetalTheme;
 import javax.swing.plaf.metal.MetalLookAndFeel;
-import sun.awt.SunToolkit;
 
 /**
  * @test
@@ -62,7 +60,7 @@
             }
         });
 
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        new Robot().waitForIdle();
         Thread.sleep(500);
 
         SwingUtilities.invokeAndWait(new Runnable() {
--- a/jdk/test/javax/swing/JRootPane/4670486/bug4670486.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JRootPane/4670486/bug4670486.java	Fri Jan 09 13:28:02 2015 -0500
@@ -24,7 +24,6 @@
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
-import sun.awt.SunToolkit;
 
 /**
  * @test
@@ -101,7 +100,6 @@
     }
 
     public static void main(String[] args) throws Throwable {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(250);
 
@@ -120,7 +118,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // Change the default button to
         // force a call to BasicRootPaneUI.updateDefaultButtonBindings()
@@ -131,14 +129,14 @@
         // effect.
         Util.hitMnemonics(robot, KeyEvent.VK_U);
         Util.hitKeys(robot, KeyEvent.VK_ENTER);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         checkAction();
 
         Util.hitMnemonics(robot, KeyEvent.VK_U);
         Util.hitKeys(robot, KeyEvent.VK_DOWN);
         Util.hitKeys(robot, KeyEvent.VK_ENTER);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         checkAction();
     }
--- a/jdk/test/javax/swing/JScrollBar/4708809/bug4708809.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JScrollBar/4708809/bug4708809.java	Fri Jan 09 13:28:02 2015 -0500
@@ -32,7 +32,6 @@
 import java.awt.*;
 import java.awt.Point;
 import java.awt.event.*;
-import sun.awt.SunToolkit;
 
 public class bug4708809 {
 
@@ -42,7 +41,6 @@
     private static JScrollBar sbar;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(350);
 
@@ -53,7 +51,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
@@ -63,13 +61,13 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Point point = getClickPoint(0.5, 0.5);
         robot.mouseMove(point.x, point.y);
         robot.mousePress(InputEvent.BUTTON1_MASK);
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
@@ -88,12 +86,12 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         point = getClickPoint(0.5, 0.2);
         robot.mouseMove(point.x, point.y);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (!do_test || !passed) {
             throw new Exception("The scrollbar moved with incorrect direction");
@@ -131,4 +129,4 @@
         fr.setSize(200, 200);
         fr.setVisible(true);
     }
-}
\ No newline at end of file
+}
--- a/jdk/test/javax/swing/JScrollBar/6542335/bug6542335.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JScrollBar/6542335/bug6542335.java	Fri Jan 09 13:28:02 2015 -0500
@@ -28,8 +28,6 @@
    @run main bug6542335
 */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.plaf.basic.BasicScrollBarUI;
 import java.awt.*;
@@ -43,8 +41,6 @@
         final Robot robot = new Robot();
         robot.setAutoDelay(10);
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-
         final Rectangle[] thumbBounds = new Rectangle[1];
 
         SwingUtilities.invokeAndWait(new Runnable() {
@@ -72,7 +68,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
@@ -86,7 +82,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
--- a/jdk/test/javax/swing/JScrollBar/7163696/Test7163696.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JScrollBar/7163696/Test7163696.java	Fri Jan 09 13:28:02 2015 -0500
@@ -28,12 +28,9 @@
  * @author Sergey Malenkov
  */
 
-import sun.awt.SunToolkit;
-
 import java.awt.Dimension;
 import java.awt.Point;
 import java.awt.Robot;
-import java.awt.Toolkit;
 import java.awt.event.InputEvent;
 
 import javax.swing.JFrame;
@@ -54,12 +51,11 @@
 
     private void test() throws Exception {
         Robot robot = new Robot();
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
             UIManager.setLookAndFeel(info.getClassName());
 
             SwingUtilities.invokeAndWait(this);
-            toolkit.realSync(); // after creation
+            robot.waitForIdle(); // after creation
             Thread.sleep(1000);
 
             Point point = this.bar.getLocation();
@@ -70,7 +66,7 @@
             robot.mousePress(InputEvent.BUTTON1_MASK);
             robot.mouseRelease(InputEvent.BUTTON1_MASK);
 
-            toolkit.realSync(); // before validation
+            robot.waitForIdle(); // before validation
             Thread.sleep(1000);
             SwingUtilities.invokeAndWait(this);
 
--- a/jdk/test/javax/swing/JScrollBar/bug4202954/bug4202954.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JScrollBar/bug4202954/bug4202954.java	Fri Jan 09 13:28:02 2015 -0500
@@ -22,8 +22,9 @@
  */
 /* @test
    @bug 4202954
+   @library ../../../../lib/testlibrary
    @library ../../regtesthelpers
-   @build Util
+   @build Util jdk.testlibrary.OSInfo
    @author Michael C. Albers
    @run main bug4202954
 */
@@ -31,11 +32,10 @@
 import java.awt.*;
 import java.awt.event.InputEvent;
 import javax.swing.*;
-import sun.awt.*;
+import jdk.testlibrary.OSInfo;
 
 public class bug4202954 {
     static JScrollPane buttonScrollPane;
-    private static final SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
     static Robot robot;
     public static void main(String[] args) throws Exception {
         if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
@@ -138,13 +138,17 @@
             }
         };
         Integer oldHValue = Util.invokeOnEDT(horizontalValue);
+        robot.waitForIdle();
         Integer oldVValue = Util.invokeOnEDT(verticalValue);
+        robot.waitForIdle();
 
         clickMouseOnComponent(scrollButton, buttons);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         int newHValue = Util.invokeOnEDT(horizontalValue);
+        robot.waitForIdle();
         int newVValue = Util.invokeOnEDT(verticalValue);
+        robot.waitForIdle();
 
         return (oldHValue != newHValue || oldVValue != newVValue) == expectScroll;
     }
--- a/jdk/test/javax/swing/JSlider/6348946/bug6348946.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JSlider/6348946/bug6348946.java	Fri Jan 09 13:28:02 2015 -0500
@@ -29,8 +29,6 @@
  * @author Mikhail Lapshin
 */
 
-import sun.awt.SunToolkit;
-
 import java.awt.*;
 import java.awt.event.InputEvent;
 import javax.swing.*;
@@ -42,13 +40,16 @@
     private static JFrame frame;
 
     private static JPanel panel;
+    private static Robot robot;
 
     private static volatile boolean passed = false;
 
     public static void main(String[] args) throws Exception {
+        robot = new Robot();
+        robot.setAutoDelay(10);
+
         String lf = "javax.swing.plaf.metal.MetalLookAndFeel";
         UIManager.setLookAndFeel(lf);
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
 
         try {
             SwingUtilities.invokeAndWait(new Runnable() {
@@ -56,9 +57,9 @@
                     setupUI();
                 }
             });
-            toolkit.realSync();
+            robot.waitForIdle();
             clickOnSlider();
-            toolkit.realSync();
+            robot.waitForIdle();
             checkResult();
         } finally {
             stopEDT();
@@ -79,9 +80,6 @@
     }
 
     private static void clickOnSlider() throws Exception {
-        Robot robot = new Robot();
-        robot.setAutoDelay(10);
-
         Rectangle rect = getPanelRectangle();
 
         double clickX = rect.getX() + rect.getWidth() / 4;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JSlider/6401380/bug6401380.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 6401380
+   @summary JSlider - mouse click ont the left side of the knob is ignored.
+   @library ../../../../lib/testlibrary
+   @build ExtendedRobot
+   @author Alexander Potochkin
+   @run main bug6401380
+*/
+
+import javax.swing.*;
+import javax.swing.plaf.basic.BasicSliderUI;
+import java.awt.*;
+import java.awt.event.InputEvent;
+
+public class bug6401380 extends JFrame {
+    private static JSlider slider;
+
+    public bug6401380() {
+        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+        slider = new JSlider();
+        slider.setMajorTickSpacing(0);
+        slider.setMaximum(50);
+        slider.setMinorTickSpacing(10);
+        slider.setPaintLabels(true);
+        slider.setPaintTicks(true);
+        slider.setSnapToTicks(true);
+
+        // MetalSliderUI overrides scrollDueToClickInTrack() method
+        // so this test doens't work for Metal
+        slider.setUI(new BasicSliderUI(slider));
+
+        add(slider);
+        setSize(200, 200);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        ExtendedRobot robot = new ExtendedRobot();
+        robot.setAutoDelay(10);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                new bug6401380().setVisible(true);
+            }
+        });
+        robot.waitForIdle();
+
+        Point l = slider.getLocationOnScreen();
+        robot.glide(0, 0, l.x + slider.getWidth() / 2, l.y + slider.getHeight() / 2);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        robot.waitForIdle();
+
+        if (slider.getValue() == slider.getMaximum()) {
+            throw new RuntimeException("Slider value unchanged");
+        }
+    }
+}
--- a/jdk/test/javax/swing/JSlider/6848475/bug6848475.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JSlider/6848475/bug6848475.java	Fri Jan 09 13:28:02 2015 -0500
@@ -28,8 +28,6 @@
  * @run main bug6848475
  */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.plaf.SliderUI;
 import javax.swing.plaf.basic.BasicSliderUI;
@@ -47,7 +45,6 @@
     private static int thumbRectX;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
 
         robot = new Robot();
         robot.setAutoDelay(100);
@@ -70,7 +67,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
@@ -80,7 +77,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
@@ -95,7 +92,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
--- a/jdk/test/javax/swing/JSpinner/4973721/bug4973721.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JSpinner/4973721/bug4973721.java	Fri Jan 09 13:28:02 2015 -0500
@@ -30,21 +30,18 @@
 */
 
 import java.awt.Robot;
-import java.awt.Toolkit;
 import javax.swing.event.ChangeListener;
 import javax.swing.event.ChangeEvent;
 import java.awt.event.KeyEvent;
 import java.awt.event.FocusListener;
 import java.awt.event.FocusEvent;
 import javax.swing.*;
-import sun.awt.SunToolkit;
 
 public class bug4973721 implements ChangeListener, FocusListener {
     static volatile boolean bStateChanged = false;
     static volatile boolean bFocusGained = false;
     static JSpinner spinner;
     static final Object listener = new bug4973721();
-    private static final SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
 
     public void focusLost(FocusEvent e) {}
 
@@ -100,7 +97,7 @@
         robot.setAutoDelay(50);
 
         Util.hitKeys(robot, KeyEvent.VK_UP);
-        toolkit.realSync();
+        robot.waitForIdle();
         Thread.sleep(1000);
 
         if (!bStateChanged) {
@@ -110,7 +107,7 @@
         bStateChanged = false;
 
         Util.hitKeys(robot, KeyEvent.VK_DOWN);
-        toolkit.realSync();
+        robot.waitForIdle();
         Thread.sleep(1000);
 
         if (!bStateChanged) {
--- a/jdk/test/javax/swing/JSpinner/5012888/bug5012888.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JSpinner/5012888/bug5012888.java	Fri Jan 09 13:28:02 2015 -0500
@@ -43,10 +43,10 @@
       pane.add(spinner2, BorderLayout.SOUTH);
     }
     public void doTest() throws Exception {
-        ((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        Robot robot = new Robot();
+        robot.waitForIdle();
         Point p = spinner2.getLocationOnScreen();
         Rectangle rect = spinner2.getBounds();
-        Robot robot = new Robot();
         robot.mouseMove(p.x+rect.width-5, p.y+5);
         robot.mousePress(InputEvent.BUTTON1_MASK);
         Thread.sleep(1000);
--- a/jdk/test/javax/swing/JSplitPane/4885629/bug4885629.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JSplitPane/4885629/bug4885629.java	Fri Jan 09 13:28:02 2015 -0500
@@ -28,8 +28,6 @@
  * @author Andrey Pikalev
  */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.border.Border;
 import javax.swing.border.EmptyBorder;
@@ -91,9 +89,8 @@
             }
         });
 
-        ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync();
-
         final Robot robot = new Robot();
+        robot.waitForIdle();
         robot.delay(1000);
 
         SwingUtilities.invokeAndWait(new Runnable() {
--- a/jdk/test/javax/swing/JTabbedPane/4361477/bug4361477.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTabbedPane/4361477/bug4361477.java	Fri Jan 09 13:28:02 2015 -0500
@@ -25,7 +25,6 @@
 import java.awt.event.*;
 import javax.swing.*;
 import javax.swing.event.*;
-import sun.awt.SunToolkit;
 
 /*
  * @test
@@ -42,7 +41,6 @@
 
     public static void main(String args[]) throws Exception {
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -54,7 +52,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
--- a/jdk/test/javax/swing/JTabbedPane/4624207/bug4624207.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTabbedPane/4624207/bug4624207.java	Fri Jan 09 13:28:02 2015 -0500
@@ -26,8 +26,9 @@
  * @bug 4624207
  * @summary JTabbedPane mnemonics don't work from outside the tabbed pane
  * @author Oleg Mokhovikov
+ * @library ../../../../lib/testlibrary
  * @library ../../regtesthelpers
- * @build Util
+ * @build Util jdk.testlibrary.OSInfo
  * @run main bug4624207
  */
 import javax.swing.*;
@@ -38,8 +39,7 @@
 import java.awt.event.FocusListener;
 import java.awt.event.KeyEvent;
 
-import sun.awt.OSInfo;
-import sun.awt.SunToolkit;
+import jdk.testlibrary.OSInfo;
 
 public class bug4624207 implements ChangeListener, FocusListener {
 
@@ -65,7 +65,6 @@
     }
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -76,7 +75,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
@@ -85,7 +84,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (!focusGained) {
             throw new RuntimeException("Couldn't gain focus for text field");
@@ -99,7 +98,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
             Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_B);
@@ -107,7 +106,7 @@
             Util.hitKeys(robot, KeyEvent.VK_ALT, KeyEvent.VK_B);
         }
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (!stateChanged || tab.getSelectedIndex() != 1) {
             throw new RuntimeException("JTabbedPane mnemonics don't work from outside the tabbed pane");
--- a/jdk/test/javax/swing/JTabbedPane/6495408/bug6495408.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTabbedPane/6495408/bug6495408.java	Fri Jan 09 13:28:02 2015 -0500
@@ -23,7 +23,6 @@
 
 import javax.swing.*;
 import java.awt.*;
-import sun.awt.SunToolkit;
 /*
  * @test
  * @bug 6495408
@@ -37,7 +36,6 @@
     static JTabbedPane tabbedPane;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         final Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -56,7 +54,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         final Rectangle d = new Rectangle();
         final Point p = new Point();
--- a/jdk/test/javax/swing/JTabbedPane/7161568/bug7161568.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTabbedPane/7161568/bug7161568.java	Fri Jan 09 13:28:02 2015 -0500
@@ -23,7 +23,6 @@
 import java.awt.*;
 import javax.swing.*;
 import java.awt.event.*;
-import sun.awt.SunToolkit;
 
 /**
  * @test
@@ -40,7 +39,6 @@
     public static void main(String[] args) throws Exception {
         UIManager.put("TabbedPane.selectionFollowsFocus", Boolean.FALSE);
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -52,7 +50,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
@@ -62,12 +60,12 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         for (int i = 0; i < N; i++) {
             robot.keyPress(KeyEvent.VK_LEFT);
             robot.keyRelease(KeyEvent.VK_LEFT);
-            toolkit.realSync();
+            robot.waitForIdle();
         }
     }
 
--- a/jdk/test/javax/swing/JTable/4220171/bug4220171.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTable/4220171/bug4220171.java	Fri Jan 09 13:28:02 2015 -0500
@@ -34,12 +34,10 @@
 import java.awt.Point;
 import java.awt.Rectangle;
 import java.awt.Robot;
-import java.awt.Toolkit;
 import java.awt.event.InputEvent;
 import java.awt.event.KeyEvent;
 import javax.swing.*;
 import javax.swing.border.LineBorder;
-import sun.awt.SunToolkit;
 
 public class bug4220171 {
 
@@ -47,7 +45,6 @@
 
     public static void main(String args[]) throws Exception {
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -58,26 +55,26 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         clickMouse(robot, 0, 0);
         Util.hitKeys(robot, KeyEvent.VK_A, KeyEvent.VK_B, KeyEvent.VK_ENTER);
-        toolkit.realSync();
+        robot.waitForIdle();
         checkCell(0, 0);
 
         clickMouse(robot, 0, 1);
         Util.hitKeys(robot, KeyEvent.VK_D, KeyEvent.VK_E, KeyEvent.VK_ENTER);
-        toolkit.realSync();
+        robot.waitForIdle();
         checkCell(0, 1);
 
         clickMouse(robot, 1, 0);
         Util.hitKeys(robot, KeyEvent.VK_1, KeyEvent.VK_2, KeyEvent.VK_ENTER);
-        toolkit.realSync();
+        robot.waitForIdle();
         checkCell(1, 0);
 
         clickMouse(robot, 1, 1);
         Util.hitKeys(robot, KeyEvent.VK_4, KeyEvent.VK_5, KeyEvent.VK_ENTER);
-        toolkit.realSync();
+        robot.waitForIdle();
         checkCell(1, 1);
     }
 
--- a/jdk/test/javax/swing/JTable/6263446/bug6263446.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTable/6263446/bug6263446.java	Fri Jan 09 13:28:02 2015 -0500
@@ -32,7 +32,6 @@
 import java.awt.event.*;
 import javax.swing.*;
 import javax.swing.table.*;
-import sun.awt.SunToolkit;
 
 public class bug6263446 {
 
@@ -43,7 +42,6 @@
     private static Robot robot;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -55,63 +53,63 @@
         });
 
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Point point = getClickPoint();
         robot.mouseMove(point.x, point.y);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         click(1);
-        toolkit.realSync();
+        robot.waitForIdle();
         assertEditing(false);
 
         click(2);
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelectedText(null);
 
         click(3);
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelectedText(FIRST);
 
 
         click(4);
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelectedText(ALL);
 
         setClickCountToStart(1);
 
         click(1);
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelectedText(null);
 
         click(2);
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelectedText(FIRST);
 
         click(3);
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelectedText(ALL);
 
         setClickCountToStart(3);
 
         click(1);
-        toolkit.realSync();
+        robot.waitForIdle();
         assertEditing(false);
 
         click(2);
-        toolkit.realSync();
+        robot.waitForIdle();
         assertEditing(false);
 
         click(3);
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelectedText(null);
 
         click(4);
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelectedText(FIRST);
 
         click(5);
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelectedText(ALL);
 
 
@@ -123,11 +121,11 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
         assertEditing(true);
 
         click(2);
-        toolkit.realSync();
+        robot.waitForIdle();
         checkSelectedText(FIRST);
 
     }
--- a/jdk/test/javax/swing/JTable/6777378/bug6777378.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTable/6777378/bug6777378.java	Fri Jan 09 13:28:02 2015 -0500
@@ -28,8 +28,6 @@
    @run main bug6777378
 */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.table.AbstractTableModel;
 import javax.swing.table.JTableHeader;
@@ -43,7 +41,6 @@
     private static JTableHeader header;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(20);
         SwingUtilities.invokeAndWait(new Runnable() {
@@ -78,7 +75,7 @@
                 frame.setVisible(true);
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
         Point point = header.getLocationOnScreen();
         robot.mouseMove(point.x + 20, point.y + 50);
         robot.mouseMove(point.x + 30, point.y + 50);
--- a/jdk/test/javax/swing/JTable/7055065/bug7055065.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTable/7055065/bug7055065.java	Fri Jan 09 13:28:02 2015 -0500
@@ -38,7 +38,6 @@
 import java.awt.Point;
 import java.awt.Rectangle;
 import java.awt.Robot;
-import java.awt.Toolkit;
 import java.awt.event.InputEvent;
 import java.awt.event.KeyEvent;
 import javax.swing.JFrame;
@@ -49,7 +48,6 @@
 import javax.swing.table.AbstractTableModel;
 import javax.swing.table.TableModel;
 import javax.swing.table.TableRowSorter;
-import sun.awt.SunToolkit;
 import java.util.concurrent.Callable;
 
 public class bug7055065 {
@@ -57,7 +55,6 @@
     private static JTable table;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
 
         SwingUtilities.invokeAndWait(new Runnable() {
@@ -67,15 +64,15 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
         clickCell(robot, 1, 1);
         Util.hitKeys(robot, KeyEvent.VK_BACK_SPACE, KeyEvent.VK_BACK_SPACE,
                 KeyEvent.VK_BACK_SPACE);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         clickColumnHeader(robot, 1);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         clickColumnHeader(robot, 1);
     }
 
--- a/jdk/test/javax/swing/JTable/7068740/bug7068740.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTable/7068740/bug7068740.java	Fri Jan 09 13:28:02 2015 -0500
@@ -28,8 +28,6 @@
    @run main bug7068740
 */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.plaf.LayerUI;
 import javax.swing.plaf.metal.MetalLookAndFeel;
@@ -43,7 +41,6 @@
 
     private static Robot robot = null;
     private static JTable table = null;
-    private static SunToolkit toolkit = null;
 
     bug7068740() {
         super();
@@ -83,10 +80,6 @@
                 robot.setAutoDelay(50);
             }
 
-            if (toolkit == null) {
-                toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-            }
-
             SwingUtilities.invokeAndWait(new Runnable() {
                 @Override
                 public void run() {
@@ -118,11 +111,11 @@
     }
 
     private static void doTest() throws Exception {
-        toolkit.realSync();
+        robot.waitForIdle();
 
         robot.keyPress(KeyEvent.VK_PAGE_DOWN);
         robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (getSelectedRow() != 19) {
             throw new RuntimeException("Test failed");
@@ -130,7 +123,7 @@
 
         robot.keyPress(KeyEvent.VK_PAGE_UP);
         robot.keyRelease(KeyEvent.VK_PAGE_UP);
-        toolkit.realSync();
+        robot.waitForIdle();
         if (getSelectedRow() != 0) {
             throw new RuntimeException("Test failed");
         }
--- a/jdk/test/javax/swing/JTableHeader/6884066/bug6884066.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTableHeader/6884066/bug6884066.java	Fri Jan 09 13:28:02 2015 -0500
@@ -28,8 +28,6 @@
    @run main bug6884066
 */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.table.JTableHeader;
 import javax.swing.table.TableColumnModel;
@@ -46,7 +44,6 @@
 
         UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(20);
         SwingUtilities.invokeAndWait(new Runnable() {
@@ -62,7 +59,7 @@
                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
         Point point = header.getLocationOnScreen();
         robot.mouseMove(point.x + 3, point.y + 3);
         robot.mousePress(InputEvent.BUTTON1_MASK);
--- a/jdk/test/javax/swing/JTableHeader/6889007/bug6889007.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTableHeader/6889007/bug6889007.java	Fri Jan 09 13:28:02 2015 -0500
@@ -27,8 +27,6 @@
    @author Alexander Potochkin
 */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.plaf.basic.BasicTableHeaderUI;
 import javax.swing.table.JTableHeader;
@@ -37,7 +35,6 @@
 public class bug6889007 {
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(20);
 
@@ -59,7 +56,7 @@
                 frame.setVisible(true);
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
         Point point = frame.getLocationOnScreen();
         int shift = 10;
         int x = point.x;
@@ -67,7 +64,7 @@
         for(int i = -shift; i < frame.getWidth() + 2*shift; i++) {
             robot.mouseMove(x++, y);
         }
-        toolkit.realSync();
+        robot.waitForIdle();
         // 9 is a magic test number
         if (MyTableHeaderUI.getTestValue() != 9) {
             throw new RuntimeException("Unexpected test number "
--- a/jdk/test/javax/swing/JTextArea/4697612/bug4697612.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTextArea/4697612/bug4697612.java	Fri Jan 09 13:28:02 2015 -0500
@@ -35,7 +35,6 @@
 import javax.swing.*;
 
 import javax.swing.text.BadLocationException;
-import sun.awt.SunToolkit;
 
 public class bug4697612 {
 
@@ -49,7 +48,6 @@
     private static JScrollPane scroller;
 
     public static void main(String[] args) throws Throwable {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(100);
 
@@ -61,7 +59,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
@@ -71,7 +69,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // 4697612: pressing PgDn + PgUp should not alter caret position
         Util.hitKeys(robot, KeyEvent.VK_HOME);
@@ -102,11 +100,11 @@
                     }
                 });
 
-                toolkit.realSync();
+                robot.waitForIdle();
 
                 Util.hitKeys(robot, KeyEvent.VK_PAGE_DOWN);
                 Util.hitKeys(robot, KeyEvent.VK_PAGE_UP);
-                toolkit.realSync();
+                robot.waitForIdle();
 
                 int pos = getTextCaretPosition();
                 if (pos0 != pos) {
@@ -126,11 +124,11 @@
             Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_END);
         }
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         pos0 = getScrollerViewPosition();
         Util.hitKeys(robot, KeyEvent.VK_PAGE_DOWN);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         int pos = getScrollerViewPosition();
 
@@ -187,6 +185,7 @@
     private static void createAndShowGUI() {
         frame = new JFrame();
         frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
+        frame.setPreferredSize(new Dimension(FRAME_WIDTH, FRAME_HEIGHT));
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 
         text = new JTextArea();
--- a/jdk/test/javax/swing/JTextField/8036819/bug8036819.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTextField/8036819/bug8036819.java	Fri Jan 09 13:28:02 2015 -0500
@@ -35,7 +35,6 @@
 import javax.swing.event.*;
 import java.awt.event.*;
 import java.awt.*;
-import sun.awt.SunToolkit;
 import javax.accessibility.*;
 
 public class bug8036819 {
@@ -49,15 +48,14 @@
             }
         });
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-        toolkit.realSync();
 
         Robot robo = new Robot();
         robo.setAutoDelay(300);
+        robo.waitForIdle();
 
         // Using mnemonic key to focus on the textfield
         Util.hitMnemonics(robo, KeyEvent.VK_P);
-        toolkit.realSync();
+        robo.waitForIdle();
 
         if (!passed){
             throw new RuntimeException("Test failed.");
--- a/jdk/test/javax/swing/JToolBar/4247996/bug4247996.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JToolBar/4247996/bug4247996.java	Fri Jan 09 13:28:02 2015 -0500
@@ -29,7 +29,6 @@
  */
 import java.awt.*;
 import javax.swing.*;
-import sun.awt.SunToolkit;
 
 public class bug4247996 {
 
@@ -38,7 +37,6 @@
 
     public static void main(String[] args) throws Exception {
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -51,11 +49,11 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Point point = getButtonCenter();
         robot.mouseMove(point.x, point.y);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         checkButtonsSize();
 
--- a/jdk/test/javax/swing/JToolTip/4846413/bug4846413.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JToolTip/4846413/bug4846413.java	Fri Jan 09 13:28:02 2015 -0500
@@ -37,7 +37,6 @@
 import javax.swing.*;
 import java.awt.event.*;
 import javax.swing.plaf.metal.MetalToolTipUI;
-import sun.awt.SunToolkit;
 
 public class bug4846413 {
 
@@ -46,7 +45,6 @@
 
     public static void main(String[] args) throws Exception {
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -59,11 +57,11 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Point movePoint = getButtonPoint();
         robot.mouseMove(movePoint.x, movePoint.y);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         long timeout = System.currentTimeMillis() + 9000;
         while (!isTooltipAdded && (System.currentTimeMillis() < timeout)) {
--- a/jdk/test/javax/swing/JTree/4330357/bug4330357.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTree/4330357/bug4330357.java	Fri Jan 09 13:28:02 2015 -0500
@@ -34,7 +34,6 @@
 import java.awt.event.*;
 import javax.swing.*;
 import javax.swing.tree.*;
-import sun.awt.SunToolkit;
 
 public class bug4330357 {
 
@@ -43,7 +42,6 @@
     private static Robot robot;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -56,12 +54,12 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         clickMouse(getTreeRowClickPoint(1));
         Util.hitKeys(robot, KeyEvent.VK_F2);
         Util.hitKeys(robot, KeyEvent.VK_A, KeyEvent.VK_B, KeyEvent.VK_C);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (!hasComponent(JTextField.class)) {
             throw new RuntimeException("Cell editor is missed for path: color");
@@ -69,11 +67,11 @@
 
 
         clickMouse(getButtonClickPoint());
-        toolkit.realSync();
+        robot.waitForIdle();
 
         clickMouse(getTreeRowClickPoint(2));
         Util.hitKeys(robot, KeyEvent.VK_F2);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (!hasComponent(JComboBox.class)) {
             throw new RuntimeException("Cell editor is missed for path: sports");
--- a/jdk/test/javax/swing/JTree/4908142/bug4908142.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTree/4908142/bug4908142.java	Fri Jan 09 13:28:02 2015 -0500
@@ -36,7 +36,6 @@
 import java.awt.*;
 import java.awt.event.*;
 import java.util.concurrent.Callable;
-import sun.awt.SunToolkit;
 
 public class bug4908142 {
 
@@ -44,7 +43,6 @@
 
     public static void main(String[] args) throws Exception {
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -55,7 +53,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
@@ -65,7 +63,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
 
         robot.keyPress(KeyEvent.VK_A);
@@ -74,7 +72,7 @@
         robot.keyRelease(KeyEvent.VK_A);
         robot.keyPress(KeyEvent.VK_D);
         robot.keyRelease(KeyEvent.VK_D);
-        toolkit.realSync();
+        robot.waitForIdle();
 
 
         String sel = Util.invokeOnEDT(new Callable<String>() {
--- a/jdk/test/javax/swing/JTree/4927934/bug4927934.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTree/4927934/bug4927934.java	Fri Jan 09 13:28:02 2015 -0500
@@ -33,7 +33,6 @@
 import java.awt.*;
 import java.awt.event.*;
 import java.lang.reflect.InvocationTargetException;
-import sun.awt.*;
 
 public class bug4927934 implements TreeSelectionListener, TreeExpansionListener, FocusListener {
 
@@ -73,8 +72,7 @@
             }
         });
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-        toolkit.realSync();
+        robot.waitForIdle();
         Thread.sleep(1000);
 
         SwingUtilities.invokeLater(new Runnable() {
@@ -97,35 +95,35 @@
         // GO TO RIGHT
         selectionChanged = false;
         hitKey(KeyEvent.VK_RIGHT);
-        toolkit.realSync();
+        robot.waitForIdle();
         if (!checkSelectionChanged(tree, 0)) {
             throw new RuntimeException("Root should be selected");
         }
 
         selectionChanged = false;
         hitKey(KeyEvent.VK_RIGHT);
-        toolkit.realSync();
+        robot.waitForIdle();
         if (!checkSelectionChanged(tree, 1)) {
             throw new RuntimeException("Node should be selected");
         }
 
         treeExpanded = false;
         hitKey(KeyEvent.VK_RIGHT);
-        toolkit.realSync();
+        robot.waitForIdle();
         if (!isTreeExpanded()) {
             throw new RuntimeException("Node should be expanded");
         }
 
         selectionChanged = false;
         hitKey(KeyEvent.VK_RIGHT);
-        toolkit.realSync();
+        robot.waitForIdle();
         if (!checkSelectionChanged(tree, 2)) {
             throw new RuntimeException("Leaf1 should be selected");
         }
 
         selectionChanged = false;
         hitKey(KeyEvent.VK_RIGHT);
-        toolkit.realSync();
+        robot.waitForIdle();
         if (!checkSelectionChanged(tree, 2)) {
             throw new RuntimeException("Leaf1 should be selected");
         }
@@ -133,7 +131,7 @@
         // GO TO LEFT
         selectionChanged = false;
         hitKey(KeyEvent.VK_LEFT);
-        toolkit.realSync();
+        robot.waitForIdle();
         if (!checkSelectionChanged(tree, 1)) {
             throw new RuntimeException("Node should be selected");
         }
@@ -146,14 +144,14 @@
 
         selectionChanged = false;
         hitKey(KeyEvent.VK_LEFT);
-        toolkit.realSync();
+        robot.waitForIdle();
         if (!checkSelectionChanged(tree, 0)) {
             throw new RuntimeException("Root should be selected");
         }
 
         treeCollapsed = false;
         hitKey(KeyEvent.VK_LEFT);
-        toolkit.realSync();
+        robot.waitForIdle();
         if (!isTreeCollapsed()) {
             throw new RuntimeException("Root should be collapsed");
         }
--- a/jdk/test/javax/swing/JTree/6263446/bug6263446.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTree/6263446/bug6263446.java	Fri Jan 09 13:28:02 2015 -0500
@@ -33,7 +33,6 @@
 import java.lang.reflect.Field;
 import javax.swing.*;
 import javax.swing.tree.*;
-import sun.awt.SunToolkit;
 
 public class bug6263446 {
 
@@ -42,10 +41,8 @@
     private static final String ALL = FIRST + " " + SECOND;
     private static JTree tree;
     private static Robot robot;
-    private static SunToolkit toolkit;
 
     public static void main(String[] args) throws Exception {
-        toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -56,7 +53,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Point point = getClickPoint();
         robot.mouseMove(point.x, point.y);
@@ -182,7 +179,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
     }
 
@@ -252,7 +249,7 @@
     }
 
     private static void assertEditingNoTreeLock(final boolean editing) throws Exception {
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
--- a/jdk/test/javax/swing/JTree/6505523/bug6505523.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTree/6505523/bug6505523.java	Fri Jan 09 13:28:02 2015 -0500
@@ -31,7 +31,6 @@
 import java.awt.Point;
 import java.awt.Rectangle;
 import java.awt.Robot;
-import java.awt.Toolkit;
 import java.awt.event.InputEvent;
 import javax.swing.JFrame;
 import javax.swing.JScrollPane;
@@ -42,14 +41,12 @@
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeModel;
 import javax.swing.tree.TreeNode;
-import sun.awt.SunToolkit;
 
 public class bug6505523 {
 
     private static JTree tree;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -61,14 +58,14 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Point point = getRowPointToClick(2);
         robot.mouseMove(point.x, point.y);
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
     }
 
@@ -129,4 +126,4 @@
         frame.setLocationRelativeTo(null);
         frame.setVisible(true);
     }
-}
\ No newline at end of file
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTree/6578666/bug6578666.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 6578666
+ * @summary REGRESSION: Exception occurs when updateUI for JTree is triggered by KeyEvent
+ * @run main bug6578666
+ * @author Alexander Potochkin
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+
+public class bug6578666 {
+
+    private static JTree tree;
+
+    private static void createGui() {
+        final JFrame frame = new JFrame();
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+        tree = new JTree();
+        frame.add(tree);
+
+        tree.addKeyListener(new KeyAdapter() {
+            public void keyPressed(KeyEvent e) {
+                tree.updateUI();
+            }
+        });
+
+        frame.setSize(200, 200);
+        frame.setLocationRelativeTo(null);
+        frame.setVisible(true);
+    }
+
+    public static void main(String[] args) throws Exception {
+        Robot robot = new Robot();
+        robot.setAutoDelay(10);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                bug6578666.createGui();
+            }
+        });
+
+        robot.waitForIdle();
+
+        tree.requestFocus();
+        robot.waitForIdle();
+
+        robot.keyPress(KeyEvent.VK_SPACE);
+        robot.keyRelease(KeyEvent.VK_SPACE);
+        robot.waitForIdle();
+        robot.keyPress(KeyEvent.VK_SPACE);
+        robot.keyRelease(KeyEvent.VK_SPACE);
+
+    }
+}
--- a/jdk/test/javax/swing/JTree/8003400/Test8003400.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTree/8003400/Test8003400.java	Fri Jan 09 13:28:02 2015 -0500
@@ -26,17 +26,16 @@
  * @bug 8003400
  * @summary Tests that JTree shows the last row
  * @author Sergey Malenkov
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
  * @run main/othervm Test8003400
  * @run main/othervm Test8003400 reverse
  * @run main/othervm Test8003400 system
  * @run main/othervm Test8003400 system reverse
  */
 
-import sun.awt.SunToolkit;
-
 import java.awt.Rectangle;
 import java.awt.Robot;
-import java.awt.Toolkit;
 import java.awt.event.KeyEvent;
 import java.util.Arrays;
 import java.util.Collections;
@@ -85,10 +84,12 @@
             }
         });
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-        toolkit.realSync(500);
-        new Robot().keyPress(KeyEvent.VK_END);
-        toolkit.realSync(500);
+        ExtendedRobot robot = new ExtendedRobot();
+        robot.waitForIdle(500);
+        robot.keyPress(KeyEvent.VK_END);
+        robot.waitForIdle(500);
+        robot.keyRelease(KeyEvent.VK_END);
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
--- a/jdk/test/javax/swing/JTree/8004298/bug8004298.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/JTree/8004298/bug8004298.java	Fri Jan 09 13:28:02 2015 -0500
@@ -36,7 +36,6 @@
 import javax.swing.*;
 import javax.swing.tree.*;
 import java.util.concurrent.Callable;
-import sun.awt.SunToolkit;
 import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
 import com.sun.java.swing.plaf.windows.WindowsTreeUI;
 
@@ -47,7 +46,6 @@
     public static void main(String[] args) throws Exception {
         Robot robot = new Robot();
         robot.setAutoDelay(50);
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         try {
             UIManager.setLookAndFeel(new WindowsLookAndFeel());
         } catch (javax.swing.UnsupportedLookAndFeelException ulafe) {
@@ -63,7 +61,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Point point = Util.invokeOnEDT(new Callable<Point>() {
 
@@ -81,7 +79,7 @@
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
-        toolkit.realSync();
+        robot.waitForIdle();
 
     }
 
--- a/jdk/test/javax/swing/Popup/TaskbarPositionTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/Popup/TaskbarPositionTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -259,7 +259,6 @@
 
     public static void main(String[] args) throws Throwable {
 
-        sun.awt.SunToolkit toolkit = (sun.awt.SunToolkit) Toolkit.getDefaultToolkit();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
@@ -275,7 +274,7 @@
         // 1 - menu
         Util.hitMnemonics(robot, KeyEvent.VK_1);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         isPopupOnScreen(menu1.getPopupMenu(), screenBounds);
 
         // 2 menu with sub menu
@@ -283,14 +282,14 @@
         robot.keyRelease(KeyEvent.VK_RIGHT);
         Util.hitMnemonics(robot, KeyEvent.VK_S);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         isPopupOnScreen(menu2.getPopupMenu(), screenBounds);
 
         robot.keyPress(KeyEvent.VK_ENTER);
         robot.keyRelease(KeyEvent.VK_ENTER);
 
         // Focus should go to non editable combo box
-        toolkit.realSync();
+        robot.waitForIdle();
         Thread.sleep(500);
 
         robot.keyPress(KeyEvent.VK_DOWN);
@@ -320,7 +319,7 @@
         robot.mousePress(InputEvent.BUTTON3_MASK);
         robot.mouseRelease(InputEvent.BUTTON3_MASK);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 test.setLocation(-30, 100);
@@ -334,7 +333,7 @@
         robot.keyPress(KeyEvent.VK_ESCAPE);
         robot.keyRelease(KeyEvent.VK_ESCAPE);
 
-        toolkit.realSync();
+        robot.waitForIdle();
         Thread.sleep(500);
     }
 }
--- a/jdk/test/javax/swing/PopupFactory/6276087/NonOpaquePopupMenuTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/PopupFactory/6276087/NonOpaquePopupMenuTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -31,7 +31,6 @@
 import java.awt.event.*;
 
 import javax.swing.*;
-import sun.awt.SunToolkit;
 
 public class NonOpaquePopupMenuTest extends JFrame {
 
@@ -53,7 +52,6 @@
     }
 
     public static void main(String[] args) throws Throwable {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(250);
 
@@ -65,14 +63,14 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Point p = getMenuClickPoint();
         robot.mouseMove(p.x, p.y);
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (isParentOpaque()) {
             throw new RuntimeException("Popup menu parent is opaque");
--- a/jdk/test/javax/swing/SwingUtilities/4917669/bug4917669.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/SwingUtilities/4917669/bug4917669.java	Fri Jan 09 13:28:02 2015 -0500
@@ -34,7 +34,6 @@
 import javax.swing.*;
 import java.awt.event.*;
 import java.awt.*;
-import sun.awt.SunToolkit;
 
 public class bug4917669 {
 
@@ -42,7 +41,6 @@
     private static JFrame mainFrame;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(500);
 
@@ -54,7 +52,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
@@ -64,10 +62,10 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_O);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (!passed) {
             throw new RuntimeException("Action did not received by menu item.");
--- a/jdk/test/javax/swing/SwingUtilities/7146377/bug7146377.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/SwingUtilities/7146377/bug7146377.java	Fri Jan 09 13:28:02 2015 -0500
@@ -27,8 +27,6 @@
    @author Pavel Porvatov
 */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.InputEvent;
@@ -82,9 +80,9 @@
             }
         });
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // On Linux platforms realSync doesn't guaranties setSize completion
         Thread.sleep(1000);
@@ -95,7 +93,6 @@
             }
         });
 
-        Robot robot = new Robot();
 
         robot.setAutoDelay(200);
 
@@ -117,7 +114,7 @@
             robot.mouseRelease(button);
         }
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
--- a/jdk/test/javax/swing/ToolTipManager/Test6256140.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/ToolTipManager/Test6256140.java	Fri Jan 09 13:28:02 2015 -0500
@@ -29,8 +29,6 @@
  * @run main Test6256140
  */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.KeyEvent;
@@ -46,14 +44,13 @@
 
         Robot robot = new Robot();
         robot.setAutoDelay(10);
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 createAndShowGUI();
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Point point = ft.getLocationOnScreen();
         robot.mouseMove(point.x, point.y);
@@ -61,7 +58,7 @@
 
         robot.keyPress(KeyEvent.VK_A);
         robot.keyRelease(KeyEvent.VK_A);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (!isTooltipShowning()) {
             throw new RuntimeException("Tooltip is not shown");
@@ -69,7 +66,7 @@
 
         robot.keyPress(KeyEvent.VK_ESCAPE);
         robot.keyRelease(KeyEvent.VK_ESCAPE);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (isTooltipShowning()) {
             throw new RuntimeException("Tooltip must be hidden now");
@@ -81,7 +78,7 @@
 
         robot.keyPress(KeyEvent.VK_ESCAPE);
         robot.keyRelease(KeyEvent.VK_ESCAPE);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (!isTextEqual()) {
             throw new RuntimeException("FormattedTextField must cancel the updated value");
--- a/jdk/test/javax/swing/dnd/7171812/bug7171812.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/dnd/7171812/bug7171812.java	Fri Jan 09 13:28:02 2015 -0500
@@ -28,8 +28,6 @@
    @run main bug7171812
  */
 
-import sun.awt.SunToolkit;
-
 import java.awt.*;
 import java.awt.dnd.*;
 import java.awt.event.InputEvent;
@@ -45,7 +43,6 @@
      * @param args the command line arguments
      */
     public static void main(String[] args) throws Exception{
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
@@ -53,10 +50,10 @@
                 setupGUI();
             }
         });
-        toolkit.realSync();
 
         Robot robot = new Robot();
         robot.setAutoDelay(10);
+        robot.waitForIdle();
         robot.mouseMove(scrollPane.getLocationOnScreen().x + 5, scrollPane.getLocationOnScreen().y + 5);
         robot.mousePress(InputEvent.BUTTON1_MASK);
         for(int offset = 5; offset < scrollPane.getHeight()-20; offset++) {
--- a/jdk/test/javax/swing/plaf/basic/BasicHTML/4251579/bug4251579.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/plaf/basic/BasicHTML/4251579/bug4251579.java	Fri Jan 09 13:28:02 2015 -0500
@@ -32,14 +32,11 @@
 import java.awt.*;
 import javax.swing.*;
 
-import sun.awt.SunToolkit;
-
 public class bug4251579 {
 
     private static JLabel htmlComponent;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         final Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -51,7 +48,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
--- a/jdk/test/javax/swing/plaf/basic/BasicMenuUI/4983388/bug4983388.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/plaf/basic/BasicMenuUI/4983388/bug4983388.java	Fri Jan 09 13:28:02 2015 -0500
@@ -30,7 +30,6 @@
    @run main bug4983388
 */
 
-import sun.awt.*;
 import java.awt.*;
 import javax.swing.*;
 import javax.swing.event.MenuListener;
@@ -64,7 +63,6 @@
 
     public static void main(String[] args) throws Exception {
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         try {
             UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
         } catch (UnsupportedLookAndFeelException | ClassNotFoundException ex) {
@@ -78,9 +76,10 @@
         });
 
         Robot robot = new Robot();
+        robot.waitForIdle();
         Util.hitMnemonics(robot, KeyEvent.VK_F);
-
-        toolkit.realSync();
+        robot.waitForIdle();
+        robot.delay(1000);
 
         if (!bMenuSelected) {
             throw new RuntimeException("shortcuts on menus do not work");
--- a/jdk/test/javax/swing/plaf/basic/BasicTreeUI/8023474/bug8023474.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/plaf/basic/BasicTreeUI/8023474/bug8023474.java	Fri Jan 09 13:28:02 2015 -0500
@@ -29,8 +29,6 @@
  * @run main bug8023474
  */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.event.CellEditorListener;
 import javax.swing.tree.DefaultMutableTreeNode;
@@ -45,7 +43,6 @@
     private static JTree tree;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -55,14 +52,14 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Point point = getRowPointToClick(1);
         robot.mouseMove(point.x, point.y);
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Boolean result = (Boolean)tree.getCellEditor().getCellEditorValue();
         if (!result) {
--- a/jdk/test/javax/swing/plaf/synth/7158712/bug7158712.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/plaf/synth/7158712/bug7158712.java	Fri Jan 09 13:28:02 2015 -0500
@@ -28,8 +28,6 @@
    @author Pavel Porvatov
 */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.plaf.basic.BasicComboPopup;
 import javax.swing.plaf.synth.SynthLookAndFeel;
@@ -82,7 +80,7 @@
             }
         });
 
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         Point comboBoxLocation = Util.invokeOnEDT(new Callable<Point>() {
             @Override
--- a/jdk/test/javax/swing/plaf/synth/SynthButtonUI/6276188/bug6276188.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/plaf/synth/SynthButtonUI/6276188/bug6276188.java	Fri Jan 09 13:28:02 2015 -0500
@@ -35,13 +35,11 @@
 
 import javax.swing.*;
 import javax.swing.plaf.synth.*;
-import sun.awt.SunToolkit;
 
 public class bug6276188 extends JFrame {
 
     private static JButton button;
     private static Point p;
-    private static final SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
 
     public static void main(String[] args) throws Throwable {
         SynthLookAndFeel lookAndFeel = new SynthLookAndFeel();
@@ -67,7 +65,7 @@
 
         robot.mouseMove(p.x , p.y);
         robot.mousePress(InputEvent.BUTTON1_MASK);
-        toolkit.realSync();
+        robot.waitForIdle();
         robot.delay(1000);
 
         Color color = robot.getPixelColor(p.x, p.y);
--- a/jdk/test/javax/swing/plaf/windows/WindowsRootPaneUI/WrongAltProcessing/WrongAltProcessing.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/plaf/windows/WindowsRootPaneUI/WrongAltProcessing/WrongAltProcessing.java	Fri Jan 09 13:28:02 2015 -0500
@@ -28,8 +28,6 @@
    @run main WrongAltProcessing
 */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.*;
@@ -56,7 +54,7 @@
                 createWindows();
             }
         });
-        sync();
+        robot.waitForIdle();
         initRobot();
         runScript();
         SwingUtilities.invokeLater(new Runnable() {
@@ -75,11 +73,6 @@
         }
     }
 
-    public static void sync() {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-        toolkit.realSync();
-    }
-
     public static void initRobot() throws AWTException {
         robot = new Robot();
         robot.setAutoDelay(100);
@@ -101,7 +94,7 @@
         robot.keyPress(KeyEvent.VK_ALT);
         robot.keyRelease(KeyEvent.VK_ALT);
         clickWindowsTitle(firstFrame);
-        sync();
+        robot.waitForIdle();
     }
 
     private static void pressTab() {
--- a/jdk/test/javax/swing/regtesthelpers/Util.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/regtesthelpers/Util.java	Fri Jan 09 13:28:02 2015 -0500
@@ -29,7 +29,7 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.concurrent.Callable;
-import sun.swing.*;
+//import sun.swing.*;
 
 /**
  * <p>This class contains utilities useful for regression testing.
@@ -231,13 +231,6 @@
 
         return result.get(0);
     }
-    /**
-     * Gets key codes from system mnemonic key mask
-     * @return key codes list
-     */
-    public static ArrayList<Integer> getSystemMnemonicKeyCodes() {
-        return Util.getKeyCodesFromKeyMask(SwingUtilities2.getSystemMnemonicKeyMask());
-    }
 
     /**
      * Gets the key codes list from modifiers
@@ -260,4 +253,18 @@
         }
         return result;
     }
+
+    /**
+     * Gets key codes from system mnemonic key mask
+     * @return key codes list
+     */
+    public static ArrayList<Integer> getSystemMnemonicKeyCodes() {
+        String osName = System.getProperty("os.name");
+        ArrayList<Integer> result = new ArrayList<>();
+        if (osName.contains("OS X")) {
+            result.add(KeyEvent.VK_CONTROL);
+        }
+        result.add(KeyEvent.ALT_MASK);
+        return result;
+    }
 }
--- a/jdk/test/javax/swing/text/AbstractDocument/6968363/Test6968363.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/text/AbstractDocument/6968363/Test6968363.java	Fri Jan 09 13:28:02 2015 -0500
@@ -20,8 +20,6 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-import sun.awt.SunToolkit;
-
 import java.awt.Robot;
 import javax.swing.JFrame;
 import javax.swing.JLabel;
@@ -47,17 +45,22 @@
  * @bug 6968363
  * @summary Ensures that a custom document may not extend AbstractDocument
  * @author Sergey Malenkov
+ * @library ../../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @run main Test6968363
  */
 public class Test6968363 implements Runnable, Thread.UncaughtExceptionHandler {
     private JFrame frame;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) getDefaultToolkit();
         Runnable task = new Test6968363();
         invokeAndWait(task);
-        toolkit.realSync(100);
-        new Robot().keyPress(VK_LEFT);
-        toolkit.realSync(100);
+        ExtendedRobot robot = new ExtendedRobot();
+        robot.waitForIdle(100);
+        robot.keyPress(VK_LEFT);
+        robot.waitForIdle(100);
+        robot.keyRelease(VK_LEFT);
+        robot.waitForIdle(100);
         invokeAndWait(task);
     }
 
--- a/jdk/test/javax/swing/text/CSSBorder/6796710/bug6796710.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/text/CSSBorder/6796710/bug6796710.java	Fri Jan 09 13:28:02 2015 -0500
@@ -34,7 +34,6 @@
 import java.awt.*;
 import java.awt.image.BufferedImage;
 import javax.swing.*;
-import sun.awt.SunToolkit;
 
 public class bug6796710 {
     // The page is inlined because we want to be sure that the JEditorPane filled synchronously
@@ -95,7 +94,7 @@
             }
         });
 
-        ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         // This delay should be added for MacOSX, realSync is not enough
         Thread.sleep(1000);
@@ -109,7 +108,7 @@
             }
         });
 
-        ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         // On Linux platforms realSync doesn't guaranties setSize completion
         Thread.sleep(1000);
--- a/jdk/test/javax/swing/text/DefaultEditorKit/4278839/bug4278839.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/text/DefaultEditorKit/4278839/bug4278839.java	Fri Jan 09 13:28:02 2015 -0500
@@ -33,19 +33,16 @@
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
-import sun.awt.SunToolkit;
 
 public class bug4278839 extends JFrame {
 
     private static boolean passed = true;
     private static JTextArea area;
     private static Robot robo;
-    private static SunToolkit toolkit;
 
     public static void main(String[] args) {
         try {
 
-            toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
             robo = new Robot();
             robo.setAutoDelay(100);
 
@@ -56,10 +53,10 @@
                 }
             });
 
-            toolkit.realSync();
+            robo.waitForIdle();
 
             clickMouse();
-            toolkit.realSync();
+            robo.waitForIdle();
 
 
             if ("Aqua".equals(UIManager.getLookAndFeel().getID())) {
@@ -67,7 +64,7 @@
             } else {
                 Util.hitKeys(robo, KeyEvent.VK_CONTROL, KeyEvent.VK_HOME);
             }
-            toolkit.realSync();
+            robo.waitForIdle();
 
             passed &= moveCaret(true) == 1;
             passed &= moveCaret(true) == 5;
@@ -97,7 +94,7 @@
     private static int moveCaret(boolean right) throws Exception {
         Util.hitKeys(robo, getCtrlKey(),
                 right ? KeyEvent.VK_RIGHT : KeyEvent.VK_LEFT);
-        toolkit.realSync();
+        robo.waitForIdle();
 
         final int[] result = new int[1];
 
@@ -127,6 +124,7 @@
 
         robo.mouseMove(rect.x + rect.width / 2, rect.y + rect.width / 2);
         robo.mousePress(InputEvent.BUTTON1_MASK);
+        robo.mouseRelease(InputEvent.BUTTON1_MASK);
     }
 
     /**
--- a/jdk/test/javax/swing/text/JTextComponent/5074573/bug5074573.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/text/JTextComponent/5074573/bug5074573.java	Fri Jan 09 13:28:02 2015 -0500
@@ -35,7 +35,6 @@
 import java.awt.event.*;
 import javax.swing.*;
 import javax.swing.text.*;
-import sun.awt.SunToolkit;
 
 public class bug5074573 {
 
@@ -60,11 +59,11 @@
     }
 
     static boolean test(final Class<? extends JTextComponent> textComponentClass) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoWaitForIdle(true);
         robot.setAutoDelay(50);
 
+
         SwingUtilities.invokeAndWait(new Runnable() {
 
             @Override
@@ -73,7 +72,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // Remove selection from JTextField components for the Aqua Look & Feel
         if (textComponent instanceof JTextField && "Aqua".equals(UIManager.getLookAndFeel().getID())) {
@@ -87,14 +86,14 @@
                 }
             });
 
-            toolkit.realSync();
+            robot.waitForIdle();
         }
 
         robot.keyPress(getCtrlKey());
         robot.keyPress(KeyEvent.VK_BACK_SPACE);
         robot.keyRelease(KeyEvent.VK_BACK_SPACE);
         robot.keyRelease(getCtrlKey());
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
@@ -104,13 +103,13 @@
                 caret.setDot(0);
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
         robot.keyPress(getCtrlKey());
         robot.keyPress(KeyEvent.VK_DELETE);
         robot.keyRelease(KeyEvent.VK_DELETE);
         robot.keyRelease(getCtrlKey());
-        toolkit.realSync();
+        robot.waitForIdle();
 
         return resultString.equals(getText());
     }
--- a/jdk/test/javax/swing/text/StyledEditorKit/4506788/bug4506788.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/text/StyledEditorKit/4506788/bug4506788.java	Fri Jan 09 13:28:02 2015 -0500
@@ -33,13 +33,11 @@
 import javax.swing.*;
 import javax.swing.event.*;
 import javax.swing.text.*;
-import sun.awt.SunToolkit;
 
 public class bug4506788 extends JApplet {
 
     private volatile boolean passed = false;
     private JEditorPane jep;
-    private SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
 
     @Override
     public void init() {
@@ -65,7 +63,7 @@
             throw new RuntimeException("Robot could not be created");
         }
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Point p;
         try {
@@ -78,6 +76,8 @@
         robot.mouseMove(p.x, p.y);
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.keyPress(KeyEvent.VK_HOME);
+        robot.keyRelease(KeyEvent.VK_HOME);
         robot.keyPress(KeyEvent.VK_RIGHT);
         robot.keyRelease(KeyEvent.VK_RIGHT);
         robot.keyPress(KeyEvent.VK_X);
@@ -85,7 +85,7 @@
         robot.keyPress(KeyEvent.VK_RIGHT);
         robot.keyRelease(KeyEvent.VK_RIGHT);
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (!passed) {
             throw new RuntimeException("Test failed.");
--- a/jdk/test/javax/swing/text/View/8014863/bug8014863.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/text/View/8014863/bug8014863.java	Fri Jan 09 13:28:02 2015 -0500
@@ -32,8 +32,6 @@
  * @run main bug8014863
  */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.text.GlyphView;
 import javax.swing.text.View;
@@ -49,7 +47,6 @@
     private static JEditorPane editorPane;
     private static JFrame frame;
     private static Robot robot;
-    private static SunToolkit toolkit;
 
     private static String text1 = "<p>one two qqqq <em>this is a test sentence</em> qqqq <em>pp</em> qqqq <em>pp</em> " +
             "qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq</p>";
@@ -59,14 +56,13 @@
     private static ArrayList<GlyphView> glyphViews;
 
     public static void main(String[] args) throws Exception {
-        toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         robot = new Robot();
         robot.setAutoDelay(50);
         glyphViews = new ArrayList<GlyphView>();
 
         createAndShowGUI(text1);
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
@@ -80,10 +76,10 @@
 
         createAndShowGUI(text2);
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Util.hitKeys(robot, KeyEvent.VK_HOME);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Util.hitKeys(robot, KeyEvent.VK_O);
         Util.hitKeys(robot, KeyEvent.VK_N);
@@ -94,7 +90,7 @@
         Util.hitKeys(robot, KeyEvent.VK_O);
         Util.hitKeys(robot, KeyEvent.VK_SPACE);
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
--- a/jdk/test/javax/swing/text/html/CSS/4530474/bug4530474.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/text/html/CSS/4530474/bug4530474.java	Fri Jan 09 13:28:02 2015 -0500
@@ -34,8 +34,6 @@
 
 import java.io.*;
 
-import sun.awt.SunToolkit;
-
 public class bug4530474 {
 
     private static final Color TEST_COLOR = Color.BLUE;
@@ -43,7 +41,6 @@
 
     public static void main(String args[]) throws Exception {
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         final Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -55,7 +52,8 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
+        robot.delay(500);
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
--- a/jdk/test/javax/swing/text/html/HTMLEditorKit/5043626/bug5043626.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/javax/swing/text/html/HTMLEditorKit/5043626/bug5043626.java	Fri Jan 09 13:28:02 2015 -0500
@@ -37,7 +37,6 @@
 import javax.swing.text.Document;
 import javax.swing.text.BadLocationException;
 import java.awt.event.KeyEvent;
-import sun.awt.SunToolkit;
 
 public class bug5043626 {
 
@@ -45,7 +44,6 @@
     private static Robot robot;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         robot = new Robot();
 
         SwingUtilities.invokeAndWait(new Runnable() {
@@ -54,12 +52,12 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Util.hitKeys(robot, KeyEvent.VK_HOME);
         Util.hitKeys(robot, KeyEvent.VK_1);
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         String test = getText();
 
@@ -70,7 +68,7 @@
         Util.hitKeys(robot, KeyEvent.VK_HOME);
         Util.hitKeys(robot, KeyEvent.VK_2);
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         test = getText();
 
--- a/jdk/test/lib/testlibrary/OutputAnalyzerTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/lib/testlibrary/OutputAnalyzerTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -112,8 +112,10 @@
         }
 
         String stdoutPattern = "[a]";
+        String stdoutByLinePattern = "a*";
         String stderrPattern = "[b]";
         String nonExistingPattern = "[c]";
+        String byLinePattern = "[ab]*";
 
         // Should match
         try {
@@ -148,6 +150,19 @@
             // expected
         }
 
+        if (output.shouldMatchByLine(byLinePattern) != 1) {
+            throw new Exception("shouldMatchByLine() should find one line");
+        }
+        try {
+            output.shouldMatchByLine(nonExistingPattern);
+            throw new Exception("shouldMatchByLine() failed to throw exception");
+        } catch (RuntimeException e) {
+            // expected
+        }
+        if (output.stdoutShouldMatchByLine(stdoutByLinePattern) != 1) {
+            throw new Exception("stdoutShouldMatchByLine() should find one line");
+        }
+
         // Should not match
         try {
             output.shouldNotMatch(nonExistingPattern);
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -25,13 +25,9 @@
 
 import static jdk.testlibrary.Asserts.*;
 
-import java.io.ByteArrayOutputStream;
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -414,8 +410,12 @@
      * @return Contents of the output buffer as list of strings
      */
     public List<String> asLines() {
+        return asLines(getOutput());
+    }
+
+    private List<String> asLines(String buffer) {
         List<String> l = new ArrayList<>();
-        String[] a = getOutput().split(Utils.NEW_LINE);
+        String[] a = buffer.split(Utils.NEW_LINE);
         for (String string : a) {
             l.add(string);
         }
@@ -445,6 +445,13 @@
     }
 
     /**
+     * @see #stdoutShouldMatchByLine(String, String, String)
+     */
+    public int stdoutShouldMatchByLine(String pattern) {
+        return stdoutShouldMatchByLine(null, null, pattern);
+    }
+
+    /**
      * @see #shouldMatchByLine(String, String, String)
      */
     public int shouldMatchByLineFrom(String from, String pattern) {
@@ -474,7 +481,30 @@
      * @return Count of lines which match the {@code pattern}
      */
     public int shouldMatchByLine(String from, String to, String pattern) {
-        List<String> lines = asLines();
+        return shouldMatchByLine(getOutput(), from, to, pattern);
+    }
+
+    /**
+     * Verify that the stdout contents of output buffer matches the
+     * {@code pattern} line by line. The whole stdout could be matched or
+     * just a subset of it.
+     *
+     * @param from
+     *            The line from where stdout will be matched.
+     *            Set {@code from} to null for matching from the first line.
+     * @param to
+     *            The line until where stdout will be matched.
+     *            Set {@code to} to null for matching until the last line.
+     * @param pattern
+     *            Matching pattern
+     * @return Count of lines which match the {@code pattern}
+     */
+    public int stdoutShouldMatchByLine(String from, String to, String pattern) {
+        return shouldMatchByLine(getStdout(), from, to, pattern);
+    }
+
+    private int shouldMatchByLine(String buffer, String from, String to, String pattern) {
+        List<String> lines = asLines(buffer);
 
         int fromIndex = 0;
         if (from != null) {
@@ -500,4 +530,5 @@
 
         return matchedCount;
     }
+
 }
--- a/jdk/test/sun/awt/dnd/8024061/bug8024061.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/sun/awt/dnd/8024061/bug8024061.java	Fri Jan 09 13:28:02 2015 -0500
@@ -25,11 +25,10 @@
  * @bug 8024061
  * @summary Checks that no exception is thrown if dragGestureRecognized
  *          takes a while to complete.
+ * @library ../../../../lib/testlibrary
+ * @build jdk.testlibrary.OSInfo
+ * @run main bug8024061
  */
-import sun.awt.OSInfo;
-import sun.awt.OSInfo.OSType;
-import sun.awt.SunToolkit;
-
 import java.awt.*;
 import java.awt.datatransfer.DataFlavor;
 import java.awt.datatransfer.Transferable;
@@ -55,6 +54,8 @@
 import java.util.concurrent.TimeUnit;
 
 import javax.swing.*;
+import jdk.testlibrary.OSInfo;
+
 
 /**
  * If dragGestureRecognized() takes a while to complete and if user performs a drag quickly,
@@ -106,8 +107,8 @@
     }
 
     public static void main(String[] args) throws AWTException, InvocationTargetException, InterruptedException {
-        OSType type = OSInfo.getOSType();
-        if (type != OSType.LINUX && type != OSType.SOLARIS) {
+        OSInfo.OSType type = OSInfo.getOSType();
+        if (type != OSInfo.OSType.LINUX && type != OSInfo.OSType.SOLARIS) {
             System.out.println("This test is for Linux and Solaris only... " +
                                "skipping!");
             return;
@@ -122,8 +123,7 @@
         });
         final Robot robot = new Robot();
         robot.setAutoDelay(10);
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-        toolkit.realSync();
+        robot.waitForIdle();
 
         JFrame frame = dnd[0].frame;
         Point point = frame.getLocationOnScreen();
@@ -138,7 +138,7 @@
             System.out.println("x = " + here.x);
         }
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
-        toolkit.realSync();
+        robot.waitForIdle();
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
         System.out.println("finished");
@@ -277,9 +277,6 @@
                     try {
                         Transferable t = dtde.getTransferable();
                         Object data = t.getTransferData(DropObjectFlavor);
-                        if (data != null) {
-                            throw new Exception("getTransferData returned non-null");
-                        }
                     } catch (Exception e) {
                         dragEnterException = e;
                         e.printStackTrace();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/java2d/SunGraphics2D/EmptyClipRenderingTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,299 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.AWTException;
+import java.awt.Canvas;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsEnvironment;
+import java.awt.HeadlessException;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.image.BufferedImage;
+import java.awt.image.VolatileImage;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+import javax.imageio.ImageIO;
+import sun.awt.ConstrainableGraphics;
+
+/**
+ * @test
+ * @bug 6335200 6419610
+ * @summary Tests that we don't render anything if specific empty clip is set
+ * @author Dmitri.Trembovetski@Sun.COM: area=Graphics
+ * @run main EmptyClipRenderingTest
+ * @run main/othervm -Dsun.java2d.noddraw=true EmptyClipRenderingTest
+ * @run main/othervm -Dsun.java2d.pmoffscreen=true EmptyClipRenderingTest
+ * @run main/othervm -Dsun.java2d.opengl=true EmptyClipRenderingTest
+ */
+public class EmptyClipRenderingTest {
+    static final int IMG_W = 400;
+    static final int IMG_H = 400;
+
+    // generated rectangles
+    static HashSet<Rectangle> rects;
+
+    volatile boolean isActivated = false;
+    volatile boolean isPainted;
+    private static boolean showErrors = false;
+
+    public EmptyClipRenderingTest() {
+        // initialize clip/render region rectangles
+        initClips();
+
+        HashSet<RuntimeException> errors = new HashSet<RuntimeException>();
+
+        BufferedImage screenResult = testOnscreen();
+        try {
+            testResult(screenResult, "Screen");
+        } catch (RuntimeException e) {
+            errors.add(e);
+        }
+
+        BufferedImage destBI =
+            new BufferedImage(IMG_W, IMG_H, BufferedImage.TYPE_INT_RGB);
+        runTest((Graphics2D)destBI.getGraphics());
+        try {
+            testResult(destBI, "BufferedImage");
+        } catch (RuntimeException e) {
+            errors.add(e);
+        }
+
+        GraphicsConfiguration gc =
+                GraphicsEnvironment.getLocalGraphicsEnvironment().
+                getDefaultScreenDevice().getDefaultConfiguration();
+        VolatileImage destVI = gc.createCompatibleVolatileImage(IMG_W, IMG_H);
+        destVI.validate(gc);
+        runTest((Graphics2D)destVI.getGraphics());
+        try {
+            testResult(destVI.getSnapshot(), "VolatileImage");
+        } catch (RuntimeException e) {
+            errors.add(e);
+        }
+
+        if (errors.isEmpty()) {
+            System.err.println("Test PASSED.");
+        } else {
+            for (RuntimeException re : errors) {
+                re.printStackTrace();
+            }
+            if (showErrors) {
+                System.err.println("Test FAILED: "+ errors.size() +
+                                   " subtest failures.");
+            } else {
+                throw new RuntimeException("Test FAILED: "+ errors.size() +
+                                           " subtest failures.");
+            }
+        }
+    }
+
+    /**
+     * Recursively adds 4 new rectangles: two vertical and two horizontal
+     * based on the passed rectangle area. The area is then shrunk and the
+     * process repeated for smaller area.
+     */
+    private static void add4Rects(HashSet<Rectangle> rects, Rectangle area) {
+        if (area.width < 10 || area.height < 10) {
+            rects.add(area);
+            return;
+        }
+        // two vertical rects
+        rects.add(new Rectangle(area.x, area.y, 5, area.height));
+        rects.add(new Rectangle(area.x + area.width - 5, area.y, 5, area.height));
+        // two horizontal rects
+        int width = area.width - 2*(5 + 1);
+        rects.add(new Rectangle(area.x+6, area.y, width, 5));
+        rects.add(new Rectangle(area.x+6, area.y + area.height - 5, width, 5));
+        // reduce the area and repeat
+        area.grow(-6, -6);
+        add4Rects(rects, area);
+    }
+
+    /**
+     * Generate a bunch of non-intersecting rectangles
+     */
+    private static void initClips() {
+        rects = new HashSet<Rectangle>();
+        add4Rects(rects, new Rectangle(0, 0, IMG_W, IMG_H));
+        System.err.println("Total number of test rects: " + rects.size());
+    }
+
+    /**
+     * Render the pattern to the screen, capture the output with robot and
+     * return it.
+     */
+    private BufferedImage testOnscreen() throws HeadlessException {
+        final Canvas destComponent;
+        final Object lock = new Object();
+        Frame f = new Frame("Test Frame");
+        f.setUndecorated(true);
+        f.add(destComponent = new Canvas() {
+            public void paint(Graphics g) {
+                isPainted = true;
+            }
+            public Dimension getPreferredSize() {
+                return new Dimension(IMG_W, IMG_H);
+            }
+        });
+        f.addWindowListener(new WindowAdapter() {
+            public void windowActivated(WindowEvent e) {
+                if (!isActivated) {
+                    synchronized (lock) {
+                        isActivated = true;
+                        lock.notify();
+                    }
+                }
+            }
+        });
+        f.pack();
+        f.setLocationRelativeTo(null);
+        f.setVisible(true);
+        synchronized(lock) {
+            while (!isActivated) {
+                try {
+                    lock.wait(100);
+                } catch (InterruptedException ex) {
+                    ex.printStackTrace();
+                }
+            }
+        }
+        Robot r;
+        try {
+            r = new Robot();
+        } catch (AWTException ex) {
+            throw new RuntimeException("Can't create Robot");
+        }
+        BufferedImage bi;
+        int attempt = 0;
+        do {
+            if (++attempt > 10) {
+                throw new RuntimeException("Too many attempts: " + attempt);
+            }
+            isPainted = false;
+            runTest((Graphics2D) destComponent.getGraphics());
+            r.waitForIdle();
+            Toolkit.getDefaultToolkit().sync();
+            bi = r.createScreenCapture(
+                    new Rectangle(destComponent.getLocationOnScreen().x,
+                            destComponent.getLocationOnScreen().y,
+                            destComponent.getWidth(),
+                            destComponent.getHeight()));
+        } while (isPainted);
+        f.setVisible(false);
+        f.dispose();
+        return bi;
+    }
+
+    /**
+     * Run the test: cycle through all the rectangles, use one as clip and
+     * another as the area to render to.
+     * Set the clip in the same way Swing does it when repainting:
+     * first constrain the graphics to the damaged area, and repaint everything
+     */
+    void runTest(Graphics2D destGraphics) {
+        destGraphics.setColor(Color.black);
+        destGraphics.fillRect(0, 0, IMG_W, IMG_H);
+
+        destGraphics.setColor(Color.red);
+        for (Rectangle clip : rects) {
+            Graphics2D g2d = (Graphics2D)destGraphics.create();
+            g2d.setColor(Color.red);
+            // mimic what swing does in BufferStrategyPaintManager
+            if (g2d instanceof ConstrainableGraphics) {
+                ((ConstrainableGraphics)g2d).constrain(clip.x, clip.y,
+                                                       clip.width, clip.height);
+            }
+            g2d.setClip(clip);
+
+            for (Rectangle renderRegion : rects) {
+                if (renderRegion != clip) {
+                    // from CellRendererPane's paintComponent
+                    Graphics2D rG = (Graphics2D)
+                        g2d.create(renderRegion.x, renderRegion.y,
+                                   renderRegion.width, renderRegion.height);
+                    rG.fillRect(0,0, renderRegion.width, renderRegion.height);
+                }
+            }
+        }
+    }
+
+    void testResult(final BufferedImage bi, final String desc) {
+        for (int y = 0; y < bi.getHeight(); y++) {
+            for (int x = 0; x < bi.getWidth(); x++) {
+                if (bi.getRGB(x, y) != Color.black.getRGB()) {
+                    if (showErrors) {
+                        Frame f = new Frame("Error: " + desc);
+                        f.add(new Component() {
+                            public void paint(Graphics g) {
+                                g.drawImage(bi, 0, 0, null);
+                            }
+                            public Dimension getPreferredSize() {
+                                return new Dimension(bi.getWidth(),
+                                                     bi.getHeight());
+                            }
+                        });
+                        f.pack();
+                        f.setVisible(true);
+                    }
+                    try {
+                        String fileName =
+                            "EmptyClipRenderingTest_"+desc+"_res.png";
+                        System.out.println("Writing resulting image: "+fileName);
+                        ImageIO.write(bi, "png", new File(fileName));
+                    } catch (IOException ex) {
+                        ex.printStackTrace();
+                    }
+                    throw new RuntimeException("Dest: "+desc+
+                        " was rendered to at x="+
+                        x + " y=" + y +
+                        " pixel="+Integer.toHexString(bi.getRGB(x,y)));
+                }
+            }
+        }
+    }
+
+    public static void main(String argv[]) {
+        for (String arg : argv) {
+            if (arg.equals("-show")) {
+                showErrors = true;
+            } else {
+                usage("Incorrect argument:" + arg);
+            }
+        }
+        new EmptyClipRenderingTest();
+    }
+
+    private static void usage(String string) {
+        System.out.println(string);
+        System.out.println("Usage: EmptyClipRenderingTest [-show]");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/rmi/rmic/iiopCompilation/IIOPCompilation.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8065957
+ * @library ../../../../java/rmi/testlibrary
+ * @build TestLibrary
+ * @summary Compiles a PortableRemoteObject with rmic -iiop and ensures that stub and tie classes are generated.
+ * @run main IIOPCompilation
+ * @author Felix Yang
+ *
+ */
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.rmi.RemoteException;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.rmi.PortableRemoteObject;
+
+public class IIOPCompilation {
+
+    public static void main(String args[]) throws IOException, InterruptedException {
+        IIOPCompilation test = new IIOPCompilation();
+        test.doTest();
+    }
+
+    private void doTest() throws IOException, InterruptedException {
+        String className = DummyImpl.class.getName();
+        int exitCode = runRmic(className);
+        if (exitCode != 0) {
+            throw new RuntimeException("Rmic failed. The exit code is " + exitCode);
+        }
+
+        // Check the stub class generated correctly
+        String stubFile = "_" + Dummy.class.getName() + "_Stub.class";
+        assertFileExists(stubFile);
+
+        // Check the tie class generated correctly
+        String tieFile = "_" + className + "_Tie.class";
+        assertFileExists(tieFile);
+    }
+
+    private void assertFileExists(String fileName) throws FileNotFoundException {
+        if (!new File(fileName).exists()) {
+            throw new FileNotFoundException(fileName + " doesn't exist!");
+        }
+    }
+
+    private int runRmic(String classname) throws IOException, InterruptedException {
+        String rmicProgramStr = TestLibrary.getProperty("java.home", "") + File.separator + "bin" + File.separator + "rmic";
+        String testClasses = TestLibrary.getProperty("test.classes", "");
+        List<String> command = Arrays.asList(rmicProgramStr, "-iiop", "-classpath", testClasses, classname);
+        System.out.println("Running command: " + command);
+
+        Process p = null;
+        try {
+            p = new ProcessBuilder(command).inheritIO().start();
+            p.waitFor();
+            return p.exitValue();
+        } finally {
+            if (p != null && p.isAlive()) {
+                p.destroy();
+            }
+        }
+    }
+}
+
+interface Dummy extends java.rmi.Remote {
+}
+
+class DummyImpl extends PortableRemoteObject implements Dummy {
+    public DummyImpl() throws RemoteException {
+    }
+}
--- a/jdk/test/sun/security/pkcs11/Provider/ConfigShortPath.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/sun/security/pkcs11/Provider/ConfigShortPath.java	Fri Jan 09 13:28:02 2015 -0500
@@ -22,8 +22,8 @@
  */
 /**
  * @test
- * @bug 6581254 6986789 7196009
- * @summary Allow '~', '+' and quoted paths in config file
+ * @bug 6581254 6986789 7196009 8062170
+ * @summary Allow '~', '+', and quoted paths in config file
  * @author Valerie Peng
  */
 
@@ -34,7 +34,7 @@
 public class ConfigShortPath {
 
     private static final String[] configNames = {
-        "csp.cfg", "cspPlus.cfg", "cspQuotedPath.cfg"
+        "csp.cfg", "cspPlus.cfg", "cspSpace.cfg", "cspQuotedPath.cfg"
     };
 
     public static void main(String[] args) throws Exception {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/pkcs11/Provider/cspSpace.cfg	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,5 @@
+showInfo = false
+name = test
+library = C:\pki DLL\x64\acpkcs211.dll
+
+
--- a/jdk/test/sun/security/provider/DSA/TestDSA2.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/sun/security/provider/DSA/TestDSA2.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
     public static void main(String[] args) throws Exception {
         boolean[] expectedToPass = { true, true, true };
         test(1024, expectedToPass);
-        boolean[] expectedToPass2 = { false, true, true };
+        boolean[] expectedToPass2 = { true, true, true };
         test(2048, expectedToPass2);
     }
 
--- a/jdk/test/sun/security/tools/jarsigner/DefaultSigalg.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/sun/security/tools/jarsigner/DefaultSigalg.java	Fri Jan 09 13:28:02 2015 -0500
@@ -74,7 +74,7 @@
         KeyStore ks = KeyStore.getInstance("JKS");
         try (FileInputStream jks = new FileInputStream("jks");
                 JarFile jf = new JarFile("a.jar")) {
-            ks.load(jks, null);
+            ks.load(jks, "changeit".toCharArray());
             for (int i = 0; i<keyalgs.length; i++) {
                 String keyalg = keyalgs[i];
                 // keytool
--- a/jdk/test/sun/security/tools/jarsigner/concise_jarsigner.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/sun/security/tools/jarsigner/concise_jarsigner.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -47,12 +47,13 @@
 # Choose 1024-bit RSA to make sure it runs fine and fast on all platforms. In
 # fact, every keyalg/keysize combination is OK for this test.
 
-KT="$TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -storepass changeit -keypass changeit -keystore js.jks -keyalg rsa -keysize 1024"
+KS=js.ks
+KT="$TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -storepass changeit -keypass changeit -keystore $KS -keyalg rsa -keysize 1024"
 JAR="$TESTJAVA${FS}bin${FS}jar ${TESTTOOLVMOPTS}"
 JARSIGNER="$TESTJAVA${FS}bin${FS}jarsigner ${TESTTOOLVMOPTS}"
 JAVAC="$TESTJAVA${FS}bin${FS}javac ${TESTTOOLVMOPTS} ${TESTJAVACOPTS}"
 
-rm js.jks
+rm $KS
 
 echo class A1 {} > A1.java
 echo class A2 {} > A2.java
@@ -73,9 +74,9 @@
 
 # a.jar includes 8 unsigned, 2 signed by a1 and a2, 2 signed by a3
 $JAR cvf a.jar A1.class A2.class
-$JARSIGNER -keystore js.jks -storepass changeit a.jar a1
+$JARSIGNER -keystore $KS -storepass changeit a.jar a1
 $JAR uvf a.jar A3.class A4.class
-$JARSIGNER -keystore js.jks -storepass changeit a.jar a2
+$JARSIGNER -keystore $KS -storepass changeit a.jar a2
 $JAR uvf a.jar A5.class A6.class
 
 # Verify OK
@@ -87,15 +88,15 @@
 [ $? = 20 ] || exit $LINENO
 
 # 16(hasUnsignedEntry)
-$JARSIGNER -verify a.jar -strict -keystore js.jks
+$JARSIGNER -verify a.jar -strict -keystore $KS -storepass changeit
 [ $? = 16 ] || exit $LINENO
 
 # 16(hasUnsignedEntry)+32(notSignedByAlias)
-$JARSIGNER -verify a.jar a1 -strict -keystore js.jks
+$JARSIGNER -verify a.jar a1 -strict -keystore $KS -storepass changeit
 [ $? = 48 ] || exit $LINENO
 
 # 16(hasUnsignedEntry)
-$JARSIGNER -verify a.jar a1 a2 -strict -keystore js.jks
+$JARSIGNER -verify a.jar a1 a2 -strict -keystore $KS -storepass changeit
 [ $? = 16 ] || exit $LINENO
 
 # 12 entries all together
@@ -153,25 +154,25 @@
         $KT -importcert -alias badchain
 $KT -delete -alias ca
 
-$JARSIGNER -strict -keystore js.jks -storepass changeit a.jar expired
+$JARSIGNER -strict -keystore $KS -storepass changeit a.jar expired
 [ $? = 4 ] || exit $LINENO
 
-$JARSIGNER -strict -keystore js.jks -storepass changeit a.jar notyetvalid
+$JARSIGNER -strict -keystore $KS -storepass changeit a.jar notyetvalid
 [ $? = 4 ] || exit $LINENO
 
-$JARSIGNER -strict -keystore js.jks -storepass changeit a.jar badku
+$JARSIGNER -strict -keystore $KS -storepass changeit a.jar badku
 [ $? = 8 ] || exit $LINENO
 
-$JARSIGNER -strict -keystore js.jks -storepass changeit a.jar badeku
+$JARSIGNER -strict -keystore $KS -storepass changeit a.jar badeku
 [ $? = 8 ] || exit $LINENO
 
-$JARSIGNER -strict -keystore js.jks -storepass changeit a.jar goodku
+$JARSIGNER -strict -keystore $KS -storepass changeit a.jar goodku
 [ $? = 0 ] || exit $LINENO
 
-$JARSIGNER -strict -keystore js.jks -storepass changeit a.jar goodeku
+$JARSIGNER -strict -keystore $KS -storepass changeit a.jar goodeku
 [ $? = 0 ] || exit $LINENO
 
-$JARSIGNER -strict -keystore js.jks -storepass changeit a.jar badchain
+$JARSIGNER -strict -keystore $KS -storepass changeit a.jar badchain
 [ $? = 4 ] || exit $LINENO
 
 $JARSIGNER -verify a.jar
@@ -189,11 +190,11 @@
 $KT -delete -alias ca2
 
 # Now altchain is still self-signed
-$JARSIGNER -strict -keystore js.jks -storepass changeit a.jar altchain
+$JARSIGNER -strict -keystore $KS -storepass changeit a.jar altchain
 [ $? = 0 ] || exit $LINENO
 
 # If -certchain is used, then it's bad
-$JARSIGNER -strict -keystore js.jks -storepass changeit -certchain certchain a.jar altchain
+$JARSIGNER -strict -keystore $KS -storepass changeit -certchain certchain a.jar altchain
 [ $? = 4 ] || exit $LINENO
 
 $JARSIGNER -verify a.jar
--- a/jdk/test/sun/security/tools/jarsigner/emptymanifest.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/sun/security/tools/jarsigner/emptymanifest.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -44,14 +44,14 @@
     ;;
 esac
 
-KS=emptymanifest.jks
+KS=emptymanifest.ks
 JFILE=em.jar
 
 KT="$TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -storepass changeit -keypass changeit -keystore $KS"
 JAR="$TESTJAVA${FS}bin${FS}jar ${TESTTOOLVMOPTS}"
 JAVA="$TESTJAVA${FS}bin${FS}java ${TESTVMOPTS}"
 JAVAC="$TESTJAVA${FS}bin${FS}javac ${TESTTOOLVMOPTS} ${TESTJAVACOPTS}"
-JARSIGNER="$TESTJAVA${FS}bin${FS}jarsigner ${TESTTOOLVMOPTS}"
+JARSIGNER="$TESTJAVA${FS}bin${FS}jarsigner ${TESTTOOLVMOPTS} -keystore $KS -storepass changeit"
 
 rm $KS $JFILE
 echo A > A
@@ -70,7 +70,7 @@
 
 $KT -alias a -dname CN=a -keyalg rsa -genkey -validity 300
 
-$JARSIGNER -keystore $KS -storepass changeit $JFILE a || exit 1
-$JARSIGNER -keystore $KS -verify -debug -strict $JFILE || exit 2
+$JARSIGNER $JFILE a || exit 1
+$JARSIGNER -verify -debug -strict $JFILE || exit 2
 
 exit 0
--- a/jdk/test/sun/security/tools/jarsigner/nameclash.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/sun/security/tools/jarsigner/nameclash.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2014 Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -42,12 +42,12 @@
     ;;
 esac
 
-KS=nc.jks
+KS=nc.ks
 JFILE=nc.jar
 
 KT="$TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -storepass changeit -keypass changeit -keystore $KS"
 JAR="$TESTJAVA${FS}bin${FS}jar ${TESTTOOLVMOPTS}"
-JARSIGNER="$TESTJAVA${FS}bin${FS}jarsigner ${TESTTOOLVMOPTS}"
+JARSIGNER="$TESTJAVA${FS}bin${FS}jarsigner ${TESTTOOLVMOPTS} -keystore $KS -storepass changeit"
 
 rm $KS $JFILE
 
@@ -57,10 +57,10 @@
 echo A > A
 $JAR cvf $JFILE A
 
-$JARSIGNER -keystore $KS -storepass changeit $JFILE a -digestalg SHA1 || exit 1
-$JARSIGNER -keystore $KS -storepass changeit $JFILE b -digestalg SHA-1 || exit 2
+$JARSIGNER $JFILE a -digestalg SHA1 || exit 1
+$JARSIGNER $JFILE b -digestalg SHA-1 || exit 2
 
-$JARSIGNER -keystore $KS -verify -debug -strict $JFILE || exit 3
+$JARSIGNER -verify -debug -strict $JFILE || exit 3
 
 exit 0
 
--- a/jdk/test/sun/security/tools/jarsigner/passtype.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/sun/security/tools/jarsigner/passtype.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
     ;;
 esac
 
-KS=pt.jks
+KS=pt.ks
 JFILE=pt.jar
 
 KT="$TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -keystore $KS -validity 300 -keyalg rsa"
@@ -62,11 +62,15 @@
 echo A > A
 $JAR cvf $JFILE A
 
+# Sign
 $JARSIGNER -keystore $KS -storepass test12 $JFILE a || exit 4
 PASSENV=test12 $JARSIGNER -keystore $KS -storepass:env PASSENV $JFILE b || exit 5
 $JARSIGNER -keystore $KS -storepass:file passfile $JFILE b || exit 6
 
-$JARSIGNER -keystore $KS -verify -debug -strict $JFILE || exit 7
+# Verify
+$JARSIGNER -keystore $KS -storepass test12 -verify -debug -strict $JFILE || exit 7
+PASSENV=test12 $JARSIGNER -keystore $KS -storepass:env PASSENV -verify -debug -strict $JFILE || exit 8
+$JARSIGNER -keystore $KS -storepass:file passfile -verify -debug -strict $JFILE || exit 9
 
 exit 0
 
--- a/jdk/test/sun/security/tools/keytool/KeyToolTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/sun/security/tools/keytool/KeyToolTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -328,15 +328,15 @@
         // name changes: genkeypair, importcert, exportcert
         remove("x.jks");
         remove("x.jks.p1.cert");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -alias p1 -dname CN=olala");
-        testOK("", "-keystore x.jks -storepass changeit -exportcert -alias p1 -file x.jks.p1.cert");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -alias p1 -dname CN=olala");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -exportcert -alias p1 -file x.jks.p1.cert");
         ks = loadStore("x.jks", "changeit", "JKS");
         assertTrue(ks.getKey("p1", "changeit".toCharArray()) != null,
             "key not DSA");
         assertTrue(new File("x.jks.p1.cert").exists(), "p1 export err");
-        testOK("", "-keystore x.jks -storepass changeit -delete -alias p1");
-        testOK("y\n", "-keystore x.jks -storepass changeit -importcert -alias c1 -file x.jks.p1.cert");  // importcert, prompt for Yes/No
-        testOK("", "-keystore x.jks -storepass changeit -importcert -alias c2 -file x.jks.p1.cert -noprompt"); // importcert, -noprompt
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias p1");
+        testOK("y\n", "-keystore x.jks -storetype JKS -storepass changeit -importcert -alias c1 -file x.jks.p1.cert");  // importcert, prompt for Yes/No
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -importcert -alias c2 -file x.jks.p1.cert -noprompt"); // importcert, -noprompt
         ks = loadStore("x.jks", "changeit", "JKS");
         assertTrue(ks.getCertificate("c1") != null, "import c1 err");
 
@@ -346,10 +346,10 @@
         assertTrue(certImpl.getVersion() == 3, "Version is not 3");
 
         // changealias and keyclone
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -alias p1 -dname CN=olala");
-        testOK("changeit\n", "-keystore x.jks -changealias -alias p1 -destalias p11");
-        testOK("changeit\n", "-keystore x.jks -changealias -alias c1 -destalias c11");
-        testOK("changeit\n\n", "-keystore x.jks -keyclone -alias p11 -destalias p111"); // press ENTER when prompt for p111's keypass
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -alias p1 -dname CN=olala");
+        testOK("changeit\n", "-keystore x.jks -storetype JKS -changealias -alias p1 -destalias p11");
+        testOK("changeit\n", "-keystore x.jks -storetype JKS -changealias -alias c1 -destalias c11");
+        testOK("changeit\n\n", "-keystore x.jks -storetype JKS -keyclone -alias p11 -destalias p111"); // press ENTER when prompt for p111's keypass
         ks = loadStore("x.jks", "changeit", "JKS");
         assertTrue(!ks.containsAlias("p1"), "there is no p1");
         assertTrue(!ks.containsAlias("c1"), "there is no c1");
@@ -382,7 +382,7 @@
         assertTrue(!ks.containsAlias("s7"), "s7 not created");
 
         // maybe we needn't test this, one day JKS will support SecretKey
-        //testFail("changeit\nchangeit\n", "-keystore x.jks -genseckey -keyalg AES -alias s3 -keysize 128");
+        //testFail("changeit\nchangeit\n", "-keystore x.jks -storetype JKS -genseckey -keyalg AES -alias s3 -keysize 128");
 
         // importKeyStore
         remove("x.jks");
@@ -479,9 +479,9 @@
 
         // pkcs12
         remove("x.jks");
-        testFail("changeit\nchangeit\n", "-keystore x.jks -genkeypair -alias p1 -dname CN=olala"); // JKS prompt for keypass
+        testFail("changeit\nchangeit\n", "-keystore x.jks -storetype JKS -genkeypair -alias p1 -dname CN=olala"); // JKS prompt for keypass
         remove("x.jks");
-        testOK("changeit\nchangeit\n\n", "-keystore x.jks -genkeypair -alias p1 -dname CN=olala"); // just type ENTER means keypass=storepass
+        testOK("changeit\nchangeit\n\n", "-keystore x.jks -storetype JKS -genkeypair -alias p1 -dname CN=olala"); // just type ENTER means keypass=storepass
         remove("x.p12");
         testOK("", "-keystore x.p12 -storetype PKCS12 -storepass changeit -genkeypair -alias p0 -dname CN=olala"); // PKCS12 only need storepass
         testOK("changeit\n", "-keystore x.p12 -storetype PKCS12 -genkeypair -alias p1 -dname CN=olala");
@@ -616,84 +616,84 @@
     void sqeImportTest() throws Exception {
         KeyStore ks;
         remove("x.jks");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
-        testOK("", "-keystore x.jks -storepass changeit -exportcert -file x.jks.p1.cert");
-        /* deleted */ testOK("", "-keystore x.jks -storepass changeit -delete -alias mykey");
-        testOK("", "-keystore x.jks -storepass changeit -importcert -file x.jks.p1.cert -noprompt");
-        /* deleted */ testOK("", "-keystore x.jks -storepass changeit -delete -alias mykey");
-        testOK("yes\n", "-keystore x.jks -storepass changeit -importcert -file x.jks.p1.cert");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -exportcert -file x.jks.p1.cert");
+        /* deleted */ testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file x.jks.p1.cert -noprompt");
+        /* deleted */ testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey");
+        testOK("yes\n", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file x.jks.p1.cert");
         ks = loadStore("x.jks", "changeit", "JKS");
         assertTrue(ks.containsAlias("mykey"), "imported");
-        /* deleted */ testOK("", "-keystore x.jks -storepass changeit -delete -alias mykey");
-        testOK("\n", "-keystore x.jks -storepass changeit -importcert -file x.jks.p1.cert");
+        /* deleted */ testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey");
+        testOK("\n", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file x.jks.p1.cert");
         ks = loadStore("x.jks", "changeit", "JKS");
         assertTrue(!ks.containsAlias("mykey"), "imported");
-        testOK("no\n", "-keystore x.jks -storepass changeit -importcert -file x.jks.p1.cert");
+        testOK("no\n", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file x.jks.p1.cert");
         ks = loadStore("x.jks", "changeit", "JKS");
         assertTrue(!ks.containsAlias("mykey"), "imported");
-        testFail("no\n", "-keystore x.jks -storepass changeit -importcert -file nonexist");
-        testFail("no\n", "-keystore x.jks -storepass changeit -importcert -file x.jks");
+        testFail("no\n", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file nonexist");
+        testFail("no\n", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file x.jks");
         remove("x.jks");
     }
     // keyclone: exist. nonexist err, cert err, dest exist, misc
     void sqeKeyclonetest() throws Exception {
         remove("x.jks");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -new newpass -keyclone -dest p0"); // new pass
-        testOK("\n", "-keystore x.jks -storepass changeit -keypass changeit -keyclone -dest p1"); // new pass
-        testOK("\n", "-keystore x.jks -storepass changeit -keyclone -dest p2");
-        testFail("\n", "-keystore x.jks -storepass changeit -keyclone -dest p2");
-        testFail("\n", "-keystore x.jks -storepass changeit -keyclone -dest p3 -alias noexist");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -new newpass -keyclone -dest p0"); // new pass
+        testOK("\n", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -keyclone -dest p1"); // new pass
+        testOK("\n", "-keystore x.jks -storetype JKS -storepass changeit -keyclone -dest p2");
+        testFail("\n", "-keystore x.jks -storetype JKS -storepass changeit -keyclone -dest p2");
+        testFail("\n", "-keystore x.jks -storetype JKS -storepass changeit -keyclone -dest p3 -alias noexist");
         // no cert
-        testOK("", "-keystore x.jks -storepass changeit -exportcert -file x.jks.p1.cert");
-        testOK("", "-keystore x.jks -storepass changeit -delete -alias mykey");
-        testOK("", "-keystore x.jks -storepass changeit -importcert -file x.jks.p1.cert -noprompt");
-        testFail("", "-keystore x.jks -storepass changeit -keypass changeit -new newpass -keyclone -dest p0"); // new pass
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -exportcert -file x.jks.p1.cert");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file x.jks.p1.cert -noprompt");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -new newpass -keyclone -dest p0"); // new pass
         remove("x.jks");
     }
     // keypasswd: exist, short, nonexist err, cert err, misc
     void sqeKeypasswdTest() throws Exception {
         remove("x.jks");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -keypasswd -new newpass");
-        /*change back*/ testOK("", "-keystore x.jks -storepass changeit -keypass newpass -keypasswd -new changeit");
-        testOK("newpass\nnewpass\n", "-keystore x.jks -storepass changeit -keypass changeit -keypasswd");
-        /*change back*/ testOK("", "-keystore x.jks -storepass changeit -keypass newpass -keypasswd -new changeit");
-        testOK("new\nnew\nnewpass\nnewpass\n", "-keystore x.jks -storepass changeit -keypass changeit -keypasswd");
-        /*change back*/ testOK("", "-keystore x.jks -storepass changeit -keypass newpass -keypasswd -new changeit");
-        testOK("", "-keystore x.jks -storepass changeit -keypasswd -new newpass");
-        /*change back*/ testOK("", "-keystore x.jks -storepass changeit -keypass newpass -keypasswd -new changeit");
-        testOK("changeit\n", "-keystore x.jks -keypasswd -new newpass");
-        /*change back*/ testOK("", "-keystore x.jks -storepass changeit -keypass newpass -keypasswd -new changeit");
-        testFail("", "-keystore x.jks -storepass badpass -keypass changeit -keypasswd -new newpass");
-        testFail("", "-keystore x.jks -storepass changeit -keypass bad -keypasswd -new newpass");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -keypasswd -new newpass");
+        /*change back*/ testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass newpass -keypasswd -new changeit");
+        testOK("newpass\nnewpass\n", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -keypasswd");
+        /*change back*/ testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass newpass -keypasswd -new changeit");
+        testOK("new\nnew\nnewpass\nnewpass\n", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -keypasswd");
+        /*change back*/ testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass newpass -keypasswd -new changeit");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypasswd -new newpass");
+        /*change back*/ testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass newpass -keypasswd -new changeit");
+        testOK("changeit\n", "-keystore x.jks -storetype JKS -keypasswd -new newpass");
+        /*change back*/ testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass newpass -keypasswd -new changeit");
+        testFail("", "-keystore x.jks -storetype JKS -storepass badpass -keypass changeit -keypasswd -new newpass");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass bad -keypasswd -new newpass");
         // no cert
-        testOK("", "-keystore x.jks -storepass changeit -exportcert -file x.jks.p1.cert");
-        testOK("", "-keystore x.jks -storepass changeit -delete -alias mykey");
-        testOK("", "-keystore x.jks -storepass changeit -importcert -file x.jks.p1.cert -noprompt");
-        testFail("", "-keystore x.jks -storepass changeit -keypass changeit -keypasswd -new newpass");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -exportcert -file x.jks.p1.cert");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file x.jks.p1.cert -noprompt");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -keypasswd -new newpass");
         // diff pass
-        testOK("", "-keystore x.jks -storepass changeit -delete -alias mykey");
-        testOK("", "-keystore x.jks -storepass changeit -keypass keypass -genkeypair -dname CN=olala");
-        testFail("", "-keystore x.jks -storepass changeit -keypasswd -new newpass");
-        testOK("keypass\n", "-keystore x.jks -storepass changeit -keypasswd -new newpass");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass keypass -genkeypair -dname CN=olala");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypasswd -new newpass");
+        testOK("keypass\n", "-keystore x.jks -storetype JKS -storepass changeit -keypasswd -new newpass");
         // i hate those misc test
         remove("x.jks");
     }
     // list: -f -alias, exist, nonexist err; otherwise, check all shows, -rfc shows more, and misc
     void sqeListTest() throws Exception {
         remove("x.jks");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
-        testOK("", "-keystore x.jks -storepass changeit -list");
-        testOK("", "-keystore x.jks -storepass changeit -list -alias mykey");
-        testFail("", "-keystore x.jks -storepass changeit -list -alias notexist");
-        testFail("", "-keystore x.jks -storepass badpass -list -alias mykey");
-        testOK("", "-keystore x.jks -storepass changeit -keypass badpass -list -alias mykey");  // keypass ignore
-        testOK("\n", "-keystore x.jks -list");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -list");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -list -alias mykey");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -list -alias notexist");
+        testFail("", "-keystore x.jks -storetype JKS -storepass badpass -list -alias mykey");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass badpass -list -alias mykey");  // keypass ignore
+        testOK("\n", "-keystore x.jks -storetype JKS -list");
         assertTrue(err.indexOf("WARNING") != -1, "no storepass");
-        testOK("changeit\n", "-keystore x.jks -list");
+        testOK("changeit\n", "-keystore x.jks -storetype JKS -list");
         assertTrue(err.indexOf("WARNING") == -1, "has storepass");
-        testFail("badpass\n", "-keystore x.jks -list");
+        testFail("badpass\n", "-keystore x.jks -storetype JKS -list");
         // misc
         testFail("", "-keystore aa\\bb//cc -storepass changeit -list");
         testFail("", "-keystore nonexisting -storepass changeit -list");
@@ -703,45 +703,45 @@
     // selfcert: exist, non-exist err, cert err, sig..., dname, wrong keypass, misc
     void sqeSelfCertTest() throws Exception {
         remove("x.jks");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
-        testOK("", "-keystore x.jks -storepass changeit -selfcert");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -selfcert");
-        testFail("", "-keystore x.jks -storepass changeit -keypass changeit -selfcert -alias nonexisting"); // not exist
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -selfcert -dname CN=NewName");
-        testFail("", "-keystore x.jks -storepass changeit -keypass changeit -selfcert -sigalg MD5withRSA"); // sig not compatible
-        testFail("", "-keystore x.jks -storepass wrong -keypass changeit -selfcert"); // bad pass
-        testFail("", "-keystore x.jks -storepass changeit -keypass wrong -selfcert"); // bad pass
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -selfcert");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -selfcert");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -selfcert -alias nonexisting"); // not exist
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -selfcert -dname CN=NewName");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -selfcert -sigalg MD5withRSA"); // sig not compatible
+        testFail("", "-keystore x.jks -storetype JKS -storepass wrong -keypass changeit -selfcert"); // bad pass
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass wrong -selfcert"); // bad pass
         //misc
         testFail("", "-keystore nonexist -storepass changeit -keypass changeit -selfcert");
         testFail("", "-keystore aa//dd\\gg -storepass changeit -keypass changeit -selfcert");
         // diff pass
         remove("x.jks");
-        testOK("", "-keystore x.jks -storepass changeit -keypass keypass -genkeypair -dname CN=olala");
-        testFail("", "-keystore x.jks -storepass changeit -selfcert");
-        testOK("keypass\n", "-keystore x.jks -storepass changeit -selfcert");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass keypass -genkeypair -dname CN=olala");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -selfcert");
+        testOK("keypass\n", "-keystore x.jks -storetype JKS -storepass changeit -selfcert");
 
-        testOK("", "-keystore x.jks -storepass changeit -exportcert -file x.jks.p1.cert");
-        testOK("", "-keystore x.jks -storepass changeit -delete -alias mykey");
-        testOK("", "-keystore x.jks -storepass changeit -importcert -file x.jks.p1.cert -noprompt");
-        testFail("", "-keystore x.jks -storepass changeit -selfcert");  // certentry cannot do selfcert
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -exportcert -file x.jks.p1.cert");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file x.jks.p1.cert -noprompt");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -selfcert");  // certentry cannot do selfcert
         remove("x.jks");
     }
     // storepass: bad old, short new, misc
     void sqeStorepassTest() throws Exception {
         remove("x.jks");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
-        testOK("", "-storepasswd -keystore x.jks -storepass changeit -new newstore"); // all in arg
-        /* Change back */ testOK("", "-storepasswd -keystore x.jks -storepass newstore -new changeit");
-        testOK("changeit\nnewstore\nnewstore\n", "-storepasswd -keystore x.jks"); // all not in arg, new twice
-        /* Change back */ testOK("", "-storepasswd -keystore x.jks -storepass newstore -new changeit");
-        testOK("changeit\n", "-storepasswd -keystore x.jks -new newstore"); // new in arg
-        /* Change back */ testOK("", "-storepasswd -keystore x.jks -storepass newstore -new changeit");
-        testOK("newstore\nnewstore\n", "-storepasswd -keystore x.jks -storepass changeit"); // old in arg
-        /* Change back */ testOK("", "-storepasswd -keystore x.jks -storepass newstore -new changeit");
-        testOK("new\nnew\nnewstore\nnewstore\n", "-storepasswd -keystore x.jks -storepass changeit"); // old in arg
-        /* Change back */ testOK("", "-storepasswd -keystore x.jks -storepass newstore -new changeit");
-        testFail("", "-storepasswd -keystore x.jks -storepass badold -new newstore"); // bad old
-        testFail("", "-storepasswd -keystore x.jks -storepass changeit -new new"); // short new
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
+        testOK("", "-storepasswd -keystore x.jks -storetype JKS -storepass changeit -new newstore"); // all in arg
+        /* Change back */ testOK("", "-storepasswd -keystore x.jks -storetype JKS -storepass newstore -new changeit");
+        testOK("changeit\nnewstore\nnewstore\n", "-storepasswd -keystore x.jks -storetype JKS"); // all not in arg, new twice
+        /* Change back */ testOK("", "-storepasswd -keystore x.jks -storetype JKS -storepass newstore -new changeit");
+        testOK("changeit\n", "-storepasswd -keystore x.jks -storetype JKS -new newstore"); // new in arg
+        /* Change back */ testOK("", "-storepasswd -keystore x.jks -storetype JKS -storepass newstore -new changeit");
+        testOK("newstore\nnewstore\n", "-storepasswd -keystore x.jks -storetype JKS -storepass changeit"); // old in arg
+        /* Change back */ testOK("", "-storepasswd -keystore x.jks -storetype JKS -storepass newstore -new changeit");
+        testOK("new\nnew\nnewstore\nnewstore\n", "-storepasswd -keystore x.jks -storetype JKS -storepass changeit"); // old in arg
+        /* Change back */ testOK("", "-storepasswd -keystore x.jks -storetype JKS -storepass newstore -new changeit");
+        testFail("", "-storepasswd -keystore x.jks -storetype JKS -storepass badold -new newstore"); // bad old
+        testFail("", "-storepasswd -keystore x.jks -storetype JKS -storepass changeit -new new"); // short new
         // misc
         testFail("", "-storepasswd -keystore nonexist -storepass changeit -new newstore"); // non exist
         testFail("", "-storepasswd -keystore badkeystore -storepass changeit -new newstore"); // bad file
@@ -752,40 +752,40 @@
     void sqeGenkeyTest() throws Exception {
 
         remove("x.jks");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
-        testFail("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala -alias newentry");
-        testFail("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala -alias newentry");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg DSA -alias n1");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg RSA -alias n2");
-        testFail("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg NoSuchAlg -alias n3");
-        testFail("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keysize 56 -alias n4");
-        testFail("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keysize 999 -alias n5");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keysize 512 -alias n6");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keysize 1024 -alias n7");
-        testFail("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala -sigalg NoSuchAlg -alias n8");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg RSA -sigalg MD2withRSA -alias n9");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg RSA -sigalg MD5withRSA -alias n10");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg RSA -sigalg SHA1withRSA -alias n11");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -alias newentry");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -alias newentry");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg DSA -alias n1");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg RSA -alias n2");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg NoSuchAlg -alias n3");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keysize 56 -alias n4");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keysize 999 -alias n5");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keysize 512 -alias n6");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keysize 1024 -alias n7");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -sigalg NoSuchAlg -alias n8");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg RSA -sigalg MD2withRSA -alias n9");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg RSA -sigalg MD5withRSA -alias n10");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg RSA -sigalg SHA1withRSA -alias n11");
         testFail("", "-keystore aa\\bb//cc\\dd -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg RSA -sigalg NoSuchAlg -alias n12");
         testFail("", "-keystore badkeystore -storepass changeit -keypass changeit -genkeypair -dname CN=olala -alias n14");
-        testFail("", "-keystore x.jks -storepass badpass -keypass changeit -genkeypair -dname CN=olala -alias n16");
-        testFail("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CNN=olala -alias n17");
+        testFail("", "-keystore x.jks -storetype JKS -storepass badpass -keypass changeit -genkeypair -dname CN=olala -alias n16");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CNN=olala -alias n17");
         remove("x.jks");
     }
 
     void sqeExportTest() throws Exception {
         remove("x.jks");
-        testFail("", "-keystore x.jks -storepass changeit -export -file mykey.cert -alias mykey"); // nonexist
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
-        testOK("", "-keystore x.jks -storepass changeit -export -file mykey.cert -alias mykey");
-        testOK("", "-keystore x.jks -storepass changeit -delete -alias mykey");
-        testOK("", "-keystore x.jks -storepass changeit -import -file mykey.cert -noprompt -alias c1");
-        testOK("", "-keystore x.jks -storepass changeit -export -file mykey.cert2 -alias c1");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -export -file mykey.cert -alias mykey"); // nonexist
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -export -file mykey.cert -alias mykey");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -import -file mykey.cert -noprompt -alias c1");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -export -file mykey.cert2 -alias c1");
         testFail("", "-keystore aa\\bb//cc\\dd -storepass changeit -export -file mykey.cert2 -alias c1");
         testFail("", "-keystore nonexistkeystore -storepass changeit -export -file mykey.cert2 -alias c1");
         testFail("", "-keystore badkeystore -storepass changeit -export -file mykey.cert2 -alias c1");
-        testFail("", "-keystore x.jks -storepass badpass -export -file mykey.cert2 -alias c1");
+        testFail("", "-keystore x.jks -storetype JKS -storepass badpass -export -file mykey.cert2 -alias c1");
         remove("mykey.cert");
         remove("mykey.cert2");
         remove("x.jks");
@@ -793,14 +793,14 @@
 
     void sqeDeleteTest() throws Exception {
         remove("x.jks");
-        testFail("", "-keystore x.jks -storepass changeit -delete -alias mykey"); // nonexist
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
-        testOK("", "-keystore x.jks -storepass changeit -delete -alias mykey");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey"); // nonexist
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
         testFail("", "-keystore aa\\bb//cc\\dd -storepass changeit -delete -alias mykey"); // keystore name illegal
         testFail("", "-keystore nonexistkeystore -storepass changeit -delete -alias mykey"); // keystore not exist
         testFail("", "-keystore badkeystore -storepass changeit -delete -alias mykey"); // keystore invalid
-        testFail("", "-keystore x.jks -storepass xxxxxxxx -delete -alias mykey"); // wrong pass
+        testFail("", "-keystore x.jks -storetype JKS -storepass xxxxxxxx -delete -alias mykey"); // wrong pass
         remove("x.jks");
     }
 
@@ -809,31 +809,31 @@
         remove("x.jks.p1.cert");
         remove("csr1");
         // PrivateKeyEntry can do certreq
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keysize 1024");
-        testOK("", "-keystore x.jks -storepass changeit -certreq -file csr1 -alias mykey");
-        testOK("", "-keystore x.jks -storepass changeit -certreq -file csr1");
-        testOK("", "-keystore x.jks -storepass changeit -certreq -file csr1 -sigalg SHA1withDSA");
-        testFail("", "-keystore x.jks -storepass changeit -certreq -file csr1 -sigalg MD5withRSA"); // unmatched sigalg
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keysize 1024");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1 -alias mykey");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1 -sigalg SHA1withDSA");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1 -sigalg MD5withRSA"); // unmatched sigalg
         // misc test
-        testFail("", "-keystore x.jks -storepass badstorepass -certreq -file csr1"); // bad storepass
-        testOK("changeit\n", "-keystore x.jks -certreq -file csr1"); // storepass from terminal
-        testFail("\n", "-keystore x.jks -certreq -file csr1"); // must provide storepass
-        testFail("", "-keystore x.jks -storepass changeit -keypass badkeypass -certreq -file csr1"); // bad keypass
-        testFail("", "-keystore x.jks -storepass changeit -certreq -file aa\\bb//cc\\dd");  // bad filepath
+        testFail("", "-keystore x.jks -storetype JKS -storepass badstorepass -certreq -file csr1"); // bad storepass
+        testOK("changeit\n", "-keystore x.jks -storetype JKS -certreq -file csr1"); // storepass from terminal
+        testFail("\n", "-keystore x.jks -storetype JKS -certreq -file csr1"); // must provide storepass
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass badkeypass -certreq -file csr1"); // bad keypass
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file aa\\bb//cc\\dd");  // bad filepath
         testFail("", "-keystore noexistks -storepass changeit -certreq -file csr1"); // non-existing keystore
         // Try the RSA private key
-        testOK("", "-keystore x.jks -storepass changeit -delete -alias mykey");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg RSA");
-        testOK("", "-keystore x.jks -storepass changeit -certreq -file csr1 -alias mykey");
-        testOK("", "-keystore x.jks -storepass changeit -certreq -file csr1");
-        testFail("", "-keystore x.jks -storepass changeit -certreq -file csr1 -sigalg SHA1withDSA"); // unmatched sigalg
-        testOK("", "-keystore x.jks -storepass changeit -certreq -file csr1 -sigalg MD5withRSA");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg RSA");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1 -alias mykey");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1 -sigalg SHA1withDSA"); // unmatched sigalg
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1 -sigalg MD5withRSA");
         // TrustedCertificateEntry cannot do certreq
-        testOK("", "-keystore x.jks -storepass changeit -exportcert -file x.jks.p1.cert");
-        testOK("", "-keystore x.jks -storepass changeit -delete -alias mykey");
-        testOK("", "-keystore x.jks -storepass changeit -importcert -file x.jks.p1.cert -noprompt");
-        testFail("", "-keystore x.jks -storepass changeit -certreq -file csr1 -alias mykey");
-        testFail("", "-keystore x.jks -storepass changeit -certreq -file csr1");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -exportcert -file x.jks.p1.cert");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file x.jks.p1.cert -noprompt");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1 -alias mykey");
+        testFail("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1");
         remove("x.jks");
         remove("x.jks.p1.cert");
         remove("csr1");
@@ -842,8 +842,8 @@
     void sqePrintcertTest() throws Exception {
         remove("x.jks");
         remove("mykey.cert");
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
-        testOK("", "-keystore x.jks -storepass changeit -export -file mykey.cert -alias mykey");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit -export -file mykey.cert -alias mykey");
         testFail("", "-printcert -file badkeystore");
         testFail("", "-printcert -file a/b/c/d");
         testOK("", "-printcert -file mykey.cert");
@@ -857,7 +857,7 @@
     void v3extTest(String keyAlg) throws Exception {
         KeyStore ks;
         remove("x.jks");
-        String simple = "-keystore x.jks -storepass changeit -keypass changeit -noprompt -keyalg " + keyAlg + " ";
+        String simple = "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -noprompt -keyalg " + keyAlg + " ";
         String pre = simple + "-genkeypair -dname CN=Olala -alias ";
 
         // Version and SKID
@@ -1195,39 +1195,39 @@
         testOK("", "-help");
 
         //   2. keytool -genkey -v -keysize 512 Enter "a" for the keystore password. Check error (password too short). Enter "password" for the keystore password. Hit 'return' for "first and last name", "organizational unit", "City", "State", and "Country Code". Type "yes" when they ask you if everything is correct. Type 'return' for new key password.
-        testOK("a\npassword\npassword\nMe\nHere\nNow\nPlace\nPlace\nUS\nyes\n\n", "-genkey -v -keysize 512 -keystore x.jks");
+        testOK("a\npassword\npassword\nMe\nHere\nNow\nPlace\nPlace\nUS\nyes\n\n", "-genkey -v -keysize 512 -keystore x.jks -storetype JKS");
         //   3. keytool -list -v -storepass password
-        testOK("", "-list -v -storepass password -keystore x.jks");
+        testOK("", "-list -v -storepass password -keystore x.jks -storetype JKS");
         //   4. keytool -list -v Type "a" for the keystore password. Check error (wrong keystore password).
-        testFail("a\n", "-list -v -keystore x.jks");
+        testFail("a\n", "-list -v -keystore x.jks -storetype JKS");
         assertTrue(ex.indexOf("password was incorrect") != -1);
         //   5. keytool -genkey -v -keysize 512 Enter "password" as the password. Check error (alias 'mykey' already exists).
-        testFail("password\n", "-genkey -v -keysize 512 -keystore x.jks");
+        testFail("password\n", "-genkey -v -keysize 512 -keystore x.jks -storetype JKS");
         assertTrue(ex.indexOf("alias <mykey> already exists") != -1);
         //   6. keytool -genkey -v -keysize 512 -alias mykey2 -storepass password Hit 'return' for "first and last name", "organizational unit", "City", "State", and "Country Code". Type "yes" when they ask you if everything is correct. Type 'return' for new key password.
-        testOK("\n\n\n\n\n\nyes\n\n", "-genkey -v -keysize 512 -alias mykey2 -storepass password -keystore x.jks");
+        testOK("\n\n\n\n\n\nyes\n\n", "-genkey -v -keysize 512 -alias mykey2 -storepass password -keystore x.jks -storetype JKS");
         //   7. keytool -list -v Type 'password' for the store password.
-        testOK("password\n", "-list -v -keystore x.jks");
+        testOK("password\n", "-list -v -keystore x.jks -storetype JKS");
         //   8. keytool -keypasswd -v -alias mykey2 -storepass password Type "a" for the new key password. Type "aaaaaa" for the new key password. Type "bbbbbb" when re-entering the new key password. Type "a" for the new key password. Check Error (too many failures).
-        testFail("a\naaaaaa\nbbbbbb\na\n", "-keypasswd -v -alias mykey2 -storepass password -keystore x.jks");
+        testFail("a\naaaaaa\nbbbbbb\na\n", "-keypasswd -v -alias mykey2 -storepass password -keystore x.jks -storetype JKS");
         assertTrue(ex.indexOf("Too many failures - try later") != -1);
         //   9. keytool -keypasswd -v -alias mykey2 -storepass password Type "aaaaaa" for the new key password. Type "aaaaaa" when re-entering the new key password.
-        testOK("aaaaaa\naaaaaa\n", "-keypasswd -v -alias mykey2 -storepass password -keystore x.jks");
+        testOK("aaaaaa\naaaaaa\n", "-keypasswd -v -alias mykey2 -storepass password -keystore x.jks -storetype JKS");
         //  10. keytool -selfcert -v -alias mykey -storepass password
-        testOK("", "-selfcert -v -alias mykey -storepass password -keystore x.jks");
+        testOK("", "-selfcert -v -alias mykey -storepass password -keystore x.jks -storetype JKS");
         //  11. keytool -list -v -storepass password
-        testOK("", "-list -v -storepass password -keystore x.jks");
+        testOK("", "-list -v -storepass password -keystore x.jks -storetype JKS");
         //  12. keytool -export -v -alias mykey -file cert -storepass password
         remove("cert");
-        testOK("", "-export -v -alias mykey -file cert -storepass password -keystore x.jks");
+        testOK("", "-export -v -alias mykey -file cert -storepass password -keystore x.jks -storetype JKS");
         //  13. keytool -import -v -file cert -storepass password Check error (Certificate reply and cert are the same)
-        testFail("", "-import -v -file cert -storepass password -keystore x.jks");
+        testFail("", "-import -v -file cert -storepass password -keystore x.jks -storetype JKS");
         assertTrue(ex.indexOf("Certificate reply and certificate in keystore are identical") != -1);
         //  14. keytool -printcert -file cert
-        testOK("", "-printcert -file cert -keystore x.jks");
+        testOK("", "-printcert -file cert -keystore x.jks -storetype JKS");
         remove("cert");
         //  15. keytool -list -storepass password -provider sun.security.provider.Sun
-        testOK("", "-list -storepass password -provider sun.security.provider.Sun -keystore x.jks");
+        testOK("", "-list -storepass password -provider sun.security.provider.Sun -keystore x.jks -storetype JKS");
 
         //Error tests
 
@@ -1245,13 +1245,13 @@
         testFail("", "-keypasswd -storetype PKCS11 -keystore NONE");
         assertTrue(ex.indexOf("UnsupportedOperationException") != -1);
         //   5. keytool -list -protected -storepass password Check error (password can not be specified with -protected)
-        testFail("", "-list -protected -storepass password -keystore x.jks");
+        testFail("", "-list -protected -storepass password -keystore x.jks -storetype JKS");
         assertTrue(ex.indexOf("if -protected is specified, then") != -1);
         //   6. keytool -keypasswd -protected -keypass password Check error (password can not be specified with -protected)
-        testFail("", "-keypasswd -protected -keypass password -keystore x.jks");
+        testFail("", "-keypasswd -protected -keypass password -keystore x.jks -storetype JKS");
         assertTrue(ex.indexOf("if -protected is specified, then") != -1);
         //   7. keytool -keypasswd -protected -new password Check error (password can not be specified with -protected)
-        testFail("", "-keypasswd -protected -new password -keystore x.jks");
+        testFail("", "-keypasswd -protected -new password -keystore x.jks -storetype JKS");
         assertTrue(ex.indexOf("if -protected is specified, then") != -1);
         remove("x.jks");
     }
--- a/jdk/test/sun/security/tools/keytool/NewSize7.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/sun/security/tools/keytool/NewSize7.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,7 @@
                 " -keypass changeit -keyalg rsa").split(" "));
         KeyStore ks = KeyStore.getInstance("JKS");
         try (FileInputStream fin = new FileInputStream(FILE)) {
-            ks.load(fin, null);
+            ks.load(fin, "changeit".toCharArray());
         }
         Files.delete(Paths.get(FILE));
         RSAPublicKey r = (RSAPublicKey)ks.getCertificate("a").getPublicKey();
--- a/jdk/test/sun/security/tools/keytool/selfissued.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/sun/security/tools/keytool/selfissued.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -44,14 +44,14 @@
     ;;
 esac
 
-KS=selfsigned.jks
+KS=selfsigned.ks
 KT="$TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -storepass changeit -keypass changeit -keystore $KS -keyalg rsa"
 
 rm $KS
 
 $KT -alias ca -dname CN=CA -genkeypair
-$KT -alias ca1 -dname CN=CA -genkeypair
-$KT -alias ca2 -dname CN=CA -genkeypair
+$KT -alias ca1 -dname CN=CA1 -genkeypair
+$KT -alias ca2 -dname CN=CA2 -genkeypair
 $KT -alias e1 -dname CN=E1 -genkeypair
 
 # ca signs ca1, ca1 signs ca2, all self-issued
--- a/jdk/test/sun/tools/jps/JpsHelper.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/sun/tools/jps/JpsHelper.java	Fri Jan 09 13:28:02 2015 -0500
@@ -168,10 +168,8 @@
     }
 
     /**
-     * Verify jps output contains pids and programs' name information.
-     * The function will discard any lines that come before the first line with pid.
-     * This can happen if the JVM outputs a warning message for some reason
-     * before running jps.
+     * Verify jps stdout contains only pids and programs' name information.
+     * jps stderr may contain VM warning messages which will be ignored.
      *
      * The output can look like:
      * 35536 Jps
@@ -180,8 +178,10 @@
      */
     public static void verifyJpsOutput(OutputAnalyzer output, String regex) throws Exception {
         output.shouldHaveExitValue(0);
-        int matchedCount = output.shouldMatchByLineFrom(regex, regex);
+        int matchedCount = output.stdoutShouldMatchByLine(regex);
         assertGreaterThan(matchedCount , 0, "Found no lines matching pattern: " + regex);
+        output.stderrShouldNotMatch("[E|e]xception");
+        output.stderrShouldNotMatch("[E|e]rror");
     }
 
     /**
--- a/jdk/test/sun/tools/jstat/jstatHelp.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/sun/tools/jstat/jstatHelp.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -22,9 +22,9 @@
 #
 
 # @test
-# @bug 4990825
+# @bug 4990825 6364329
 # @run shell jstatHelp.sh
-# @summary Test that output of 'jstat -?' matches the usage.out file
+# @summary Test that output of 'jstat -?', 'jstat -help' and 'jstat' matches the usage.out file
 
 . ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
 
@@ -38,7 +38,7 @@
 diff -w jstat.out ${TESTSRC}/usage.out
 if [ $? != 0 ]
 then
-  echo "Output of jstat -? differ from expected output. Failed."
+  echo "Output of jstat -? differs from expected output. Failed."
   exit 1
 fi
 
@@ -48,7 +48,17 @@
 diff -w jstat.out ${TESTSRC}/usage.out
 if [ $? != 0 ]
 then
-  echo "Output of jstat -help differ from expected output. Failed."
+  echo "Output of jstat -help differs from expected output. Failed."
+  exit 1
+fi
+
+rm -f jstat.out 2>/dev/null
+${JSTAT} -J-XX:+UsePerfData > jstat.out 2>&1
+
+diff -w jstat.out ${TESTSRC}/usage.out
+if [ $? != 0 ]
+then
+  echo "Output of jstat differs from expected output. Failed."
   exit 1
 fi
 
--- a/jdk/test/sun/tools/native2ascii/Native2AsciiTests.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/sun/tools/native2ascii/Native2AsciiTests.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -24,7 +24,7 @@
 #
 
 # @test
-# @bug 4630463 4630971 4636448 4701617 4721296 4710890 6247817 7021987
+# @bug 4630463 4630971 4636448 4701617 4721296 4710890 6247817 7021987 8067964
 # @summary Tests miscellaneous native2ascii bugfixes and regressions
 
 
--- a/jdk/test/sun/util/calendar/zi/Rule.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/sun/util/calendar/zi/Rule.java	Fri Jan 09 13:28:02 2015 -0500
@@ -126,6 +126,14 @@
             });
         rules.clear();
         for (int i = 0; i < n; i++) {
+            if (i != 0 && recs[i -1].getSave() == recs[i].getSave()) {
+                // we have two recs back to back with same saving for the same year.
+                if (recs[i].isLastRule()) {
+                    continue;
+                } else if (recs[i - 1].isLastRule()) {
+                    rules.remove(rules.size() - 1);
+                }
+            }
             rules.add(recs[i]);
         }
         return rules;
--- a/jdk/test/tools/jar/JarEntryTime.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/tools/jar/JarEntryTime.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,9 +51,6 @@
 
     static void extractJar(File jarFile, boolean useExtractionTime) throws Throwable {
         String javahome = System.getProperty("java.home");
-        if (javahome.endsWith("jre")) {
-            javahome = javahome.substring(0, javahome.length() - 4);
-        }
         String jarcmd = javahome + File.separator + "bin" + File.separator + "jar";
         String[] args;
         if (useExtractionTime) {
--- a/jdk/test/tools/launcher/ExecutionEnvironment.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/tools/launcher/ExecutionEnvironment.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,7 +45,7 @@
  *            a. if LD_LIBRARY_PATH64 is set it will override LD_LIBRARY_PATH
  *            b. LD_LIBRARY_PATH32 is ignored if set
  *   5. no extra symlink exists on Solaris ie.
- *      jre/lib/$arch/libjvm.so -> client/libjvm.so
+ *      lib/$arch/libjvm.so -> client/libjvm.so
  * TODO:
  *      a. perhaps we need to add a test to audit all environment variables are
  *         in pristine condition after the launch, there may be a few that the
@@ -267,7 +267,7 @@
         }
 
         File symLink = null;
-        String libPathPrefix = isSDK ? "jre/lib" : "/lib";
+        String libPathPrefix = "/lib";
         symLink = new File(JAVAHOME, libPathPrefix +
                 getJreArch() + "/" + LIBJVM);
         if (symLink.exists()) {
--- a/jdk/test/tools/launcher/MultipleJRE.sh	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/tools/launcher/MultipleJRE.sh	Fri Jan 09 13:28:02 2015 -0500
@@ -1,15 +1,14 @@
 #!/bin/sh
 # @test MultipleJRE.sh
-# @bug 4811102 4953711 4955505 4956301 4991229 4998210 5018605 6387069 6733959
+# @bug 4811102 4953711 4955505 4956301 4991229 4998210 5018605 6387069 6733959 8058407 8067421
 # @build PrintVersion
 # @build UglyPrintVersion
 # @build ZipMeUp
 # @run shell MultipleJRE.sh
 # @summary Verify Multiple JRE version support has been removed
 # @author Joseph E. Kowalski
-
 #
-# Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -91,6 +90,36 @@
 }
 
 #
+# Shell routine to ensure help page does not include mjre options
+#
+TestHelp() {
+    mess="`$JAVA -help 2>&1`"
+    # make sure it worked
+    if [ $? -ne 0 ]; then
+        echo "java -help failed ????"
+        exit 1
+    fi
+
+    echo $mess | grep '\-version:<value>' > /dev/null 2>&1
+    if [ $? -eq 0 ]; then
+       echo "help message contains obsolete option version:<value>"
+       exit 1
+    fi
+
+    echo $mess | grep '\-jre-restrict-search' > /dev/null 2>&1
+    if [ $? -eq 0 ]; then
+       echo "help message contains obsolete option jre-restrict-search"
+       exit 1
+    fi
+
+    echo $mess | grep '\-no-jre-restrict-search' > /dev/null 2>&1
+    if [ $? -eq 0 ]; then
+       echo "help message contains obsolete option no-jre-restrict-search"
+       exit 1
+    fi
+}
+
+#
 # Just as the name says.  We sprinkle these in the appropriate location
 # in the test file system and they just say who they are pretending to be.
 #
@@ -457,7 +486,8 @@
 	LaunchVM "" "${RELEASE}"
         # Going to silently ignore JRE-Version setting in jar file manifest
 	#LaunchVM "" "warning: The jarfile JRE-Version"
-	
+
+	# Verify help does not contain obsolete options
+	TestHelp
 
 exit 0
-
--- a/jdk/test/tools/launcher/PrintVersion.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/tools/launcher/PrintVersion.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,9 @@
  * This stub simply prints out the java version string. It is used
  * by MultipleJRE.sh.
  */
-import sun.misc.Version;
 
 public class PrintVersion {
-
-        public static void main(String argv[]) {
-                Version.print();
-        }
-
+    public static void main(String argv[]) {
+        System.out.println(System.getProperty("java.version"));
+    }
 }
--- a/jdk/test/tools/launcher/TestHelper.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/tools/launcher/TestHelper.java	Fri Jan 09 13:28:02 2015 -0500
@@ -67,10 +67,7 @@
 
     static final String JAVAHOME = System.getProperty("java.home");
     static final String JAVA_BIN;
-    static final String JAVA_JRE_BIN;
     static final String JAVA_LIB;
-    static final String JAVA_JRE_LIB;
-    static final boolean isSDK = JAVAHOME.endsWith("jre");
     static final String javaCmd;
     static final String javawCmd;
     static final String javacCmd;
@@ -135,17 +132,10 @@
         }
         compiler = ToolProvider.getSystemJavaCompiler();
 
-        File binDir = (isSDK)
-                ? new File((new File(JAVAHOME)).getParentFile(), "bin")
-                : new File(JAVAHOME, "bin");
+        File binDir = new File(JAVAHOME, "bin");
         JAVA_BIN = binDir.getAbsolutePath();
-        JAVA_JRE_BIN = new File(JAVAHOME, "bin").getAbsolutePath();
-
-        File libDir = (isSDK)
-                ? new File((new File(JAVAHOME)).getParentFile(), "lib")
-                : new File(JAVAHOME, "lib");
+        File libDir = new File(JAVAHOME, "lib");
         JAVA_LIB = libDir.getAbsolutePath();
-        JAVA_JRE_LIB = new File(JAVAHOME, "lib").getAbsolutePath();
 
         File javaCmdFile = (isWindows)
                 ? new File(binDir, "java.exe")
@@ -191,11 +181,11 @@
     }
     private static boolean haveVmVariant(String type) {
         if (isWindows) {
-            File vmDir = new File(JAVA_JRE_BIN, type);
+            File vmDir = new File(JAVA_BIN, type);
             File jvmFile = new File(vmDir, LIBJVM);
             return jvmFile.exists();
         } else {
-            File vmDir = new File(JAVA_JRE_LIB, type);
+            File vmDir = new File(JAVA_LIB, type);
             File vmArchDir = new File(vmDir, getJreArch());
             File jvmFile = new File(vmArchDir, LIBJVM);
             return jvmFile.exists();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/launcher/TooSmallStackSize.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6762191
+ * @summary Setting stack size to 16K causes segmentation fault
+ * @compile TooSmallStackSize.java
+ * @run main TooSmallStackSize
+ */
+
+/*
+ * The primary purpose of this test is to make sure we can run with a 16k stack
+ * size without crashing. Also this test will determine the minimum allowed
+ * stack size for the platform (as provided by the JVM error message when a very
+ * small stack is used), and then verify that the JVM can be launched with that stack
+ * size without a crash or any error messages.
+ */
+
+public class TooSmallStackSize extends TestHelper {
+    /* for debugging. Normally false. */
+    static final boolean verbose = false;
+
+    static void printTestOutput(TestResult tr) {
+        System.out.println("*** exitValue = " + tr.exitValue);
+        for (String x : tr.testOutput) {
+            System.out.println(x);
+        }
+    }
+
+    /*
+     * Returns the minimum stack size this platform will allowed based on the
+     * contents of the error message the JVM outputs when too small of a
+     * -Xss size was used.
+     *
+     * The TestResult argument must contain the result of having already run
+     * the JVM with too small of a stack size.
+     */
+    static String getMinStackAllowed(TestResult tr) {
+        /*
+         * The JVM output will contain in one of the lines:
+         *   "The stack size specified is too small, Specify at least 100k"
+         * Although the actual size will vary. We need to extract this size
+         * string from the output and return it.
+         */
+        String matchStr = "Specify at least ";
+        for (String x : tr.testOutput) {
+            int match_idx = x.indexOf(matchStr);
+            if (match_idx >= 0) {
+                int size_start_idx = match_idx + matchStr.length();
+                int k_start_idx = x.indexOf("k", size_start_idx);
+                return x.substring(size_start_idx, k_start_idx + 1); // include the "k"
+            }
+        }
+
+        System.out.println("FAILED: Could not get the stack size from the output");
+        throw new RuntimeException("test fails");
+    }
+
+    /*
+     * Run the JVM with the specified stack size.
+     *
+     * Returns the minimum allowed stack size gleaned from the error message,
+     * if there is an error message. Otherwise returns the stack size passed in.
+     */
+    static String checkStack(String stackSize) {
+        String min_stack_allowed;
+        TestResult tr;
+
+        if (verbose)
+            System.out.println("*** Testing " + stackSize);
+        tr = doExec(javaCmd, "-Xss" + stackSize, "-version");
+        if (verbose)
+            printTestOutput(tr);
+
+        if (tr.isOK()) {
+            System.out.println("PASSED: got no error message with stack size of " + stackSize);
+            min_stack_allowed = stackSize;
+        } else {
+            if (tr.contains("The stack size specified is too small")) {
+                System.out.println("PASSED: got expected error message with stack size of " + stackSize);
+                min_stack_allowed = getMinStackAllowed(tr);
+            } else {
+                // Likely a crash
+                System.out.println("FAILED: Did not get expected error message with stack size of " + stackSize);
+                throw new RuntimeException("test fails");
+            }
+        }
+
+        return min_stack_allowed;
+    }
+
+    /*
+     * Run the JVM with the minimum allowed stack size. This should always succeed.
+     */
+    static void checkMinStackAllowed(String stackSize) {
+        TestResult tr = null;
+
+        if (verbose)
+            System.out.println("*** Testing " + stackSize);
+        tr = doExec(javaCmd, "-Xss" + stackSize, "-version");
+        if (verbose)
+            printTestOutput(tr);
+
+        if (tr.isOK()) {
+            System.out.println("PASSED: VM launched with minimum allowed stack size of " + stackSize);
+        } else {
+            // Likely a crash
+            System.out.println("FAILED: VM failed to launch with minimum allowed stack size of " + stackSize);
+            throw new RuntimeException("test fails");
+        }
+    }
+
+    public static void main(String... args) {
+        /*
+         * The result of a 16k stack size should be a quick exit with a complaint
+         * that the stack size is too small. However, for some win32 builds, the
+         * stack is always at least 64k, and this also sometimes is the minimum
+         * allowed size, so we won't see an error in this case.
+         *
+         * This test case will also produce a crash on some platforms if the fix
+         * for 6762191 is not yet in place.
+         */
+        checkStack("16k");
+
+        /*
+         * Try with a 32k stack size, which is the size that the launcher will
+         * set to if you try setting to anything smaller. This should produce the same
+         * result as setting to 16k if the fix for 6762191 is in place.
+         */
+        String min_stack_allowed = checkStack("32k");
+
+        /*
+         * Try again with a the minimum stack size that was given in the error message
+         */
+        checkMinStackAllowed(min_stack_allowed);
+    }
+}
--- a/jdk/test/tools/launcher/UglyPrintVersion.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/tools/launcher/UglyPrintVersion.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,12 +30,8 @@
  */
 package reallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylongpackagename;
 
-import sun.misc.Version;
-
 public class UglyPrintVersion {
-
-        public static void main(String argv[]) {
-                Version.print();
-        }
-
+    public static void main(String argv[]) {
+        System.out.println(System.getProperty("java.version"));
+    }
 }
--- a/jdk/test/tools/pack200/Pack200Test.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/tools/pack200/Pack200Test.java	Fri Jan 09 13:28:02 2015 -0500
@@ -127,7 +127,7 @@
         // select the jars carefully, adding more jars will increase the
         // testing time, especially for jprt.
         jarList.add(Utils.createRtJar());
-        jarList.add(Utils.locateJar("golden.jar"));
+        jarList.add(Utils.getGoldenJar());
         System.out.println(jarList);
         doPackUnpack();
     }
--- a/jdk/test/tools/pack200/PackTestZip64.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/tools/pack200/PackTestZip64.java	Fri Jan 09 13:28:02 2015 -0500
@@ -52,7 +52,7 @@
         // make a copy of the test specimen to local directory
         File testFile = new File("tools_java.jar");
         // Add a large number of small files to the golden jar
-        generateLargeJar(testFile, Utils.locateJar("golden.jar"));
+        generateLargeJar(testFile, Utils.getGoldenJar());
 
         List<String> cmdsList = new ArrayList<>();
 
--- a/jdk/test/tools/pack200/RepackTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/tools/pack200/RepackTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
 
         // make a copy of the test specimen to local directory
         File testFile = new File("src_tools.jar");
-        Utils.copyFile(Utils.locateJar("golden.jar"), testFile);
+        Utils.copyFile(Utils.getGoldenJar(), testFile);
         List<String> cmdsList = new ArrayList<>();
 
         // case 1:
--- a/jdk/test/tools/pack200/TimeStamp.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/tools/pack200/TimeStamp.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,7 +54,7 @@
     public static void main(String... args) throws IOException {
 
         // make a local copy of our test file
-        File srcFile = Utils.locateJar("golden.jar");
+        File srcFile = Utils.getGoldenJar();
         File goldenFile = new File("golden.jar");
         Utils.copyFile(srcFile, goldenFile);
 
--- a/jdk/test/tools/pack200/Utils.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/jdk/test/tools/pack200/Utils.java	Fri Jan 09 13:28:02 2015 -0500
@@ -63,7 +63,7 @@
             System.getProperty("os.name").startsWith("Windows");
     static final boolean Is64Bit =
             System.getProperty("sun.arch.data.model", "32").equals("64");
-    static final File   JavaSDK =  new File(JavaHome).getParentFile();
+    static final File   JavaSDK =  new File(JavaHome);
 
     static final String PACK_FILE_EXT   = ".pack";
     static final String JAVA_FILE_EXT   = ".java";
@@ -82,11 +82,7 @@
         if (VerifierJar.exists()) {
             return;
         }
-        File srcDir = new File(TEST_SRC_DIR, VERIFIER_DIR_NAME);
-        if (!srcDir.exists()) {
-            // if not available try one level above
-            srcDir = new File(TEST_SRC_DIR.getParentFile(), VERIFIER_DIR_NAME);
-        }
+        File srcDir = new File(getVerifierDir(), "src");
         List<File> javaFileList = findFiles(srcDir, createFilter(JAVA_FILE_EXT));
         File tmpFile = File.createTempFile("javac", ".tmp");
         XCLASSES.mkdirs();
@@ -115,6 +111,18 @@
             ".");
     }
 
+    private static File getVerifierDir() {
+        File srcDir = new File(TEST_SRC_DIR, VERIFIER_DIR_NAME);
+        if (!srcDir.exists()) {
+            // if not available try one level above
+            srcDir = new File(TEST_SRC_DIR.getParentFile(), VERIFIER_DIR_NAME);
+        }
+        return srcDir;
+    }
+
+    static File getGoldenJar() {
+        return new File(new File(getVerifierDir(), "data"), "golden.jar");
+    }
     static void dirlist(File dir) {
         File[] files = dir.listFiles();
         System.out.println("--listing " + dir.getAbsolutePath() + "---");
@@ -564,7 +572,8 @@
         File rtJar = new File("rt.jar");
         cmdList.clear();
         cmdList.add(getJarCmd());
-        cmdList.add("cvf");
+        // cmdList.add("cvf"); too noisy
+        cmdList.add("cf");
         cmdList.add(rtJar.getName());
         cmdList.add("-C");
         cmdList.add("out");
@@ -574,24 +583,4 @@
         recursiveDelete(new File("out"));
         return rtJar;
     }
-    private static List<File> locaterCache = null;
-    // search the source dir and jdk dir for requested file and returns
-    // the first location it finds.
-    static File locateJar(String name) {
-        try {
-            if (locaterCache == null) {
-                locaterCache = new ArrayList<File>();
-                locaterCache.addAll(findFiles(TEST_SRC_DIR, createFilter(JAR_FILE_EXT)));
-                locaterCache.addAll(findFiles(JavaSDK, createFilter(JAR_FILE_EXT)));
-            }
-            for (File f : locaterCache) {
-                if (f.getName().equals(name)) {
-                    return f;
-                }
-            }
-            throw new IOException("file not found: " + name);
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-    }
 }
--- a/langtools/.hgtags	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/.hgtags	Fri Jan 09 13:28:02 2015 -0500
@@ -285,3 +285,5 @@
 c286272a81dd8f6005e22fed0238c4a3f75188c7 jdk9-b40
 f7ce2cfa4cdbec0ae0f46080484eace66be7987a jdk9-b41
 23a3a063a906a91ba696d792f0eeabf157cd2f86 jdk9-b42
+6a06008aec10d32898ca665685f531c681b28f5f jdk9-b43
+de2ce70d907c9f227b802cea29285bece5194cd5 jdk9-b44
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,509 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javac.comp;
+
+import com.sun.source.tree.LambdaExpressionTree;
+import com.sun.tools.javac.code.Source;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.Types;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCBlock;
+import com.sun.tools.javac.tree.JCTree.JCClassDecl;
+import com.sun.tools.javac.tree.JCTree.JCDoWhileLoop;
+import com.sun.tools.javac.tree.JCTree.JCEnhancedForLoop;
+import com.sun.tools.javac.tree.JCTree.JCForLoop;
+import com.sun.tools.javac.tree.JCTree.JCIf;
+import com.sun.tools.javac.tree.JCTree.JCLambda;
+import com.sun.tools.javac.tree.JCTree.JCLambda.ParameterKind;
+import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
+import com.sun.tools.javac.tree.JCTree.JCMethodInvocation;
+import com.sun.tools.javac.tree.JCTree.JCNewClass;
+import com.sun.tools.javac.tree.JCTree.JCStatement;
+import com.sun.tools.javac.tree.JCTree.JCSwitch;
+import com.sun.tools.javac.tree.JCTree.JCTypeApply;
+import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
+import com.sun.tools.javac.tree.JCTree.JCWhileLoop;
+import com.sun.tools.javac.tree.JCTree.Tag;
+import com.sun.tools.javac.tree.TreeCopier;
+import com.sun.tools.javac.tree.TreeInfo;
+import com.sun.tools.javac.tree.TreeMaker;
+import com.sun.tools.javac.tree.TreeScanner;
+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.Filter;
+import com.sun.tools.javac.util.JCDiagnostic;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
+import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.ListBuffer;
+import com.sun.tools.javac.util.Log;
+import com.sun.tools.javac.util.Names;
+import com.sun.tools.javac.util.Options;
+
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.Predicate;
+
+import static com.sun.tools.javac.code.Flags.GENERATEDCONSTR;
+import static com.sun.tools.javac.code.Flags.SYNTHETIC;
+import static com.sun.tools.javac.code.TypeTag.CLASS;
+import static com.sun.tools.javac.tree.JCTree.Tag.APPLY;
+import static com.sun.tools.javac.tree.JCTree.Tag.CLASSDEF;
+import static com.sun.tools.javac.tree.JCTree.Tag.METHODDEF;
+import static com.sun.tools.javac.tree.JCTree.Tag.NEWCLASS;
+import static com.sun.tools.javac.tree.JCTree.Tag.TYPEAPPLY;
+
+/**
+ * Helper class for defining custom code analysis, such as finding instance creation expression
+ * that can benefit from diamond syntax.
+ */
+public class Analyzer {
+    protected static final Context.Key<Analyzer> analyzerKey = new Context.Key<>();
+
+    final Types types;
+    final Log log;
+    final Attr attr;
+    final DeferredAttr deferredAttr;
+    final TreeMaker make;
+    final Names names;
+
+    final EnumSet<AnalyzerMode> analyzerModes;
+
+    public static Analyzer instance(Context context) {
+        Analyzer instance = context.get(analyzerKey);
+        if (instance == null)
+            instance = new Analyzer(context);
+        return instance;
+    }
+
+    protected Analyzer(Context context) {
+        context.put(analyzerKey, this);
+        types = Types.instance(context);
+        log = Log.instance(context);
+        attr = Attr.instance(context);
+        deferredAttr = DeferredAttr.instance(context);
+        make = TreeMaker.instance(context);
+        names = Names.instance(context);
+        Options options = Options.instance(context);
+        String findOpt = options.get("find");
+        //parse modes
+        Source source = Source.instance(context);
+        analyzerModes = AnalyzerMode.getAnalyzerModes(findOpt, source);
+    }
+
+    /**
+     * This enum defines supported analyzer modes, as well as defining the logic for decoding
+     * the {@code -XDfind} option.
+     */
+    enum AnalyzerMode {
+        DIAMOND("diamond", Source::allowDiamond),
+        LAMBDA("lambda", Source::allowLambda),
+        METHOD("method", Source::allowGraphInference);
+
+        final String opt;
+        final Predicate<Source> sourceFilter;
+
+        AnalyzerMode(String opt, Predicate<Source> sourceFilter) {
+            this.opt = opt;
+            this.sourceFilter = sourceFilter;
+        }
+
+        /**
+         * This method is used to parse the {@code find} option.
+         * Possible modes are separated by colon; a mode can be excluded by
+         * prepending '-' to its name. Finally, the special mode 'all' can be used to
+         * add all modes to the resulting enum.
+         */
+        static EnumSet<AnalyzerMode> getAnalyzerModes(String opt, Source source) {
+            if (opt == null) {
+                return EnumSet.noneOf(AnalyzerMode.class);
+            }
+            List<String> modes = List.from(opt.split(","));
+            EnumSet<AnalyzerMode> res = EnumSet.noneOf(AnalyzerMode.class);
+            if (modes.contains("all")) {
+                res = EnumSet.allOf(AnalyzerMode.class);
+            }
+            for (AnalyzerMode mode : values()) {
+                if (modes.contains(mode.opt)) {
+                    res.add(mode);
+                } else if (modes.contains("-" + mode.opt) || !mode.sourceFilter.test(source)) {
+                    res.remove(mode);
+                }
+            }
+            return res;
+        }
+    }
+
+    /**
+     * A statement analyzer is a work-unit that matches certain AST nodes (of given type {@code S}),
+     * rewrites them to different AST nodes (of type {@code T}) and then generates some meaningful
+     * messages in case the analysis has been successful.
+     */
+    abstract class StatementAnalyzer<S extends JCTree, T extends JCTree> {
+
+        AnalyzerMode mode;
+        JCTree.Tag tag;
+
+        StatementAnalyzer(AnalyzerMode mode, Tag tag) {
+            this.mode = mode;
+            this.tag = tag;
+        }
+
+        /**
+         * Is this analyzer allowed to run?
+         */
+        boolean isEnabled() {
+            return analyzerModes.contains(mode);
+        }
+
+        /**
+         * Should this analyzer be rewriting the given tree?
+         */
+        abstract boolean match(S tree);
+
+        /**
+         * Rewrite a given AST node into a new one
+         */
+        abstract T map(S oldTree, S newTree);
+
+        /**
+         * Entry-point for comparing results and generating diagnostics.
+         */
+        abstract void process(S oldTree, T newTree, boolean hasErrors);
+
+    }
+
+    /**
+     * This analyzer checks if generic instance creation expression can use diamond syntax.
+     */
+    class DiamondInitializer extends StatementAnalyzer<JCNewClass, JCNewClass> {
+
+        DiamondInitializer() {
+            super(AnalyzerMode.DIAMOND, NEWCLASS);
+        }
+
+        @Override
+        boolean match(JCNewClass tree) {
+            return tree.clazz.hasTag(TYPEAPPLY) &&
+                    !TreeInfo.isDiamond(tree) &&
+                    tree.def == null;
+        }
+
+        @Override
+        JCNewClass map(JCNewClass oldTree, JCNewClass newTree) {
+            if (newTree.clazz.hasTag(TYPEAPPLY)) {
+                ((JCTypeApply)newTree.clazz).arguments = List.nil();
+            }
+            return newTree;
+        }
+
+        @Override
+        void process(JCNewClass oldTree, JCNewClass newTree, boolean hasErrors) {
+            if (!hasErrors) {
+                List<Type> inferredArgs = newTree.type.getTypeArguments();
+                List<Type> explicitArgs = oldTree.type.getTypeArguments();
+                for (Type t : inferredArgs) {
+                    if (!types.isSameType(t, explicitArgs.head)) {
+                        log.warning(oldTree.clazz, "diamond.redundant.args.1",
+                                oldTree.clazz.type, newTree.clazz.type);
+                        return;
+                    }
+                    explicitArgs = explicitArgs.tail;
+                }
+                //exact match
+                log.warning(oldTree.clazz, "diamond.redundant.args");
+            }
+        }
+    }
+
+    /**
+     * This analyzer checks if anonymous instance creation expression can replaced by lambda.
+     */
+    class LambdaAnalyzer extends StatementAnalyzer<JCNewClass, JCLambda> {
+
+        LambdaAnalyzer() {
+            super(AnalyzerMode.LAMBDA, NEWCLASS);
+        }
+
+        @Override
+        boolean match (JCNewClass tree){
+            Type clazztype = tree.clazz.type;
+            return tree.def != null &&
+                    clazztype.hasTag(CLASS) &&
+                    types.isFunctionalInterface(clazztype.tsym) &&
+                    decls(tree.def).length() == 1;
+        }
+        //where
+            private List<JCTree> decls(JCClassDecl decl) {
+                ListBuffer<JCTree> decls = new ListBuffer<>();
+                for (JCTree t : decl.defs) {
+                    if (t.hasTag(METHODDEF)) {
+                        JCMethodDecl md = (JCMethodDecl)t;
+                        if ((md.getModifiers().flags & GENERATEDCONSTR) == 0) {
+                            decls.add(md);
+                        }
+                    } else {
+                        decls.add(t);
+                    }
+                }
+                return decls.toList();
+            }
+
+        @Override
+        JCLambda map (JCNewClass oldTree, JCNewClass newTree){
+            JCMethodDecl md = (JCMethodDecl)decls(newTree.def).head;
+            List<JCVariableDecl> params = md.params;
+            JCBlock body = md.body;
+            return make.Lambda(params, body);
+        }
+        @Override
+        void process (JCNewClass oldTree, JCLambda newTree, boolean hasErrors){
+            if (!hasErrors) {
+                log.warning(oldTree.def, "potential.lambda.found");
+            }
+        }
+    }
+
+    /**
+     * This analyzer checks if generic method call has redundant type arguments.
+     */
+    class RedundantTypeArgAnalyzer extends StatementAnalyzer<JCMethodInvocation, JCMethodInvocation> {
+
+        RedundantTypeArgAnalyzer() {
+            super(AnalyzerMode.METHOD, APPLY);
+        }
+
+        @Override
+        boolean match (JCMethodInvocation tree){
+            return tree.typeargs != null &&
+                    tree.typeargs.nonEmpty();
+        }
+        @Override
+        JCMethodInvocation map (JCMethodInvocation oldTree, JCMethodInvocation newTree){
+            newTree.typeargs = List.nil();
+            return newTree;
+        }
+        @Override
+        void process (JCMethodInvocation oldTree, JCMethodInvocation newTree, boolean hasErrors){
+            if (!hasErrors) {
+                //exact match
+                log.warning(oldTree, "method.redundant.typeargs");
+            }
+        }
+    }
+
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    StatementAnalyzer<JCTree, JCTree>[] analyzers = new StatementAnalyzer[] {
+            new DiamondInitializer(),
+            new LambdaAnalyzer(),
+            new RedundantTypeArgAnalyzer()
+    };
+
+    /**
+     * Analyze an AST node if needed.
+     */
+    void analyzeIfNeeded(JCTree tree, Env<AttrContext> env) {
+        if (!analyzerModes.isEmpty() &&
+                !env.info.isSpeculative &&
+                TreeInfo.isStatement(tree)) {
+            JCStatement stmt = (JCStatement)tree;
+            analyze(stmt, env);
+        }
+    }
+
+    /**
+     * Analyze an AST node; this involves collecting a list of all the nodes that needs rewriting,
+     * and speculatively type-check the rewritten code to compare results against previously attributed code.
+     */
+    void analyze(JCStatement statement, Env<AttrContext> env) {
+        AnalysisContext context = new AnalysisContext();
+        StatementScanner statementScanner = new StatementScanner(context);
+        statementScanner.scan(statement);
+
+        if (!context.treesToAnalyzer.isEmpty()) {
+
+            //add a block to hoist potential dangling variable declarations
+            JCBlock fakeBlock = make.Block(SYNTHETIC, List.of(statement));
+
+            TreeMapper treeMapper = new TreeMapper(context);
+            //TODO: to further refine the analysis, try all rewriting combinations
+            deferredAttr.attribSpeculative(fakeBlock, env, attr.statInfo, treeMapper,
+                    t -> new AnalyzeDeferredDiagHandler(context));
+
+            context.treeMap.entrySet().forEach(e -> {
+                context.treesToAnalyzer.get(e.getKey())
+                        .process(e.getKey(), e.getValue(), context.errors.nonEmpty());
+            });
+        }
+    }
+
+    /**
+     * Simple deferred diagnostic handler which filters out all messages and keep track of errors.
+     */
+    class AnalyzeDeferredDiagHandler extends Log.DeferredDiagnosticHandler {
+        AnalysisContext context;
+
+        public AnalyzeDeferredDiagHandler(AnalysisContext context) {
+            super(log, d -> {
+                if (d.getType() == DiagnosticType.ERROR) {
+                    context.errors.add(d);
+                }
+                return true;
+            });
+            this.context = context;
+        }
+    }
+
+    /**
+     * This class is used to pass around contextual information bewteen analyzer classes, such as
+     * trees to be rewritten, errors occurred during the speculative attribution step, etc.
+     */
+    class AnalysisContext {
+        /** Map from trees to analyzers. */
+        Map<JCTree, StatementAnalyzer<JCTree, JCTree>> treesToAnalyzer = new HashMap<>();
+
+        /** Map from original AST nodes to rewritten AST nodes */
+        Map<JCTree, JCTree> treeMap = new HashMap<>();
+
+        /** Errors in rewritten tree */
+        ListBuffer<JCDiagnostic> errors = new ListBuffer<>();
+    }
+
+    /**
+     * Subclass of {@link com.sun.tools.javac.tree.TreeScanner} which visit AST-nodes w/o crossing
+     * statement boundaries.
+     */
+    class StatementScanner extends TreeScanner {
+
+        /** context */
+        AnalysisContext context;
+
+        StatementScanner(AnalysisContext context) {
+            this.context = context;
+        }
+
+        @Override
+        @SuppressWarnings("unchecked")
+        public void scan(JCTree tree) {
+            if (tree != null) {
+                for (StatementAnalyzer<JCTree, JCTree> analyzer : analyzers) {
+                    if (analyzer.isEnabled() &&
+                            tree.hasTag(analyzer.tag) &&
+                            analyzer.match(tree)) {
+                        context.treesToAnalyzer.put(tree, analyzer);
+                        break; //TODO: cover cases where multiple matching analyzers are found
+                    }
+                }
+            }
+            super.scan(tree);
+        }
+
+        @Override
+        public void visitClassDef(JCClassDecl tree) {
+            //do nothing (prevents seeing same stuff twice
+        }
+
+        @Override
+        public void visitMethodDef(JCMethodDecl tree) {
+            //do nothing (prevents seeing same stuff twice
+        }
+
+        @Override
+        public void visitBlock(JCBlock tree) {
+            //do nothing (prevents seeing same stuff twice
+        }
+
+        @Override
+        public void visitSwitch(JCSwitch tree) {
+            scan(tree.getExpression());
+        }
+
+        @Override
+        public void visitForLoop(JCForLoop tree) {
+            scan(tree.getInitializer());
+            scan(tree.getCondition());
+            scan(tree.getUpdate());
+        }
+
+        @Override
+        public void visitForeachLoop(JCEnhancedForLoop tree) {
+            scan(tree.getExpression());
+        }
+
+        @Override
+        public void visitWhileLoop(JCWhileLoop tree) {
+            scan(tree.getCondition());
+        }
+
+        @Override
+        public void visitDoLoop(JCDoWhileLoop tree) {
+            scan(tree.getCondition());
+        }
+
+        @Override
+        public void visitIf(JCIf tree) {
+            scan(tree.getCondition());
+        }
+    }
+
+    /**
+     * Subclass of TreeCopier that maps nodes matched by analyzers onto new AST nodes.
+     */
+    class TreeMapper extends TreeCopier<Void> {
+
+        AnalysisContext context;
+
+        TreeMapper(AnalysisContext context) {
+            super(make);
+            this.context = context;
+        }
+
+        @Override
+        @SuppressWarnings("unchecked")
+        public <Z extends JCTree> Z copy(Z tree, Void _unused) {
+            Z newTree = super.copy(tree, _unused);
+            StatementAnalyzer<JCTree, JCTree> analyzer = context.treesToAnalyzer.get(tree);
+            if (analyzer != null) {
+                newTree = (Z)analyzer.map(tree, newTree);
+                context.treeMap.put(tree, newTree);
+            }
+            return newTree;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public JCTree visitLambdaExpression(LambdaExpressionTree node, Void _unused) {
+            JCLambda oldLambda = (JCLambda)node;
+            JCLambda newLambda = (JCLambda)super.visitLambdaExpression(node, _unused);
+            if (oldLambda.paramKind == ParameterKind.IMPLICIT) {
+                //reset implicit lambda parameters (whose type might have been set during attr)
+                newLambda.paramKind = ParameterKind.IMPLICIT;
+                newLambda.params.forEach(p -> p.vartype = null);
+            }
+            return newLambda;
+        }
+    }
+}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Jan 09 13:28:02 2015 -0500
@@ -83,6 +83,7 @@
     final Symtab syms;
     final Resolve rs;
     final Infer infer;
+    final Analyzer analyzer;
     final DeferredAttr deferredAttr;
     final Check chk;
     final Flow flow;
@@ -121,6 +122,7 @@
         make = TreeMaker.instance(context);
         enter = Enter.instance(context);
         infer = Infer.instance(context);
+        analyzer = Analyzer.instance(context);
         deferredAttr = DeferredAttr.instance(context);
         cfolder = ConstFold.instance(context);
         target = Target.instance(context);
@@ -143,11 +145,8 @@
         allowStaticInterfaceMethods = source.allowStaticInterfaceMethods();
         sourceName = source.name;
         relax = (options.isSet("-retrofit") ||
-                 options.isSet("-relax"));
-        findDiamonds = options.get("findDiamond") != null &&
-                 source.allowDiamond();
+                options.isSet("-relax"));
         useBeforeDeclarationWarning = options.isSet("useBeforeDeclarationWarning");
-        identifyLambdaCandidate = options.getBoolean("identifyLambdaCandidate", false);
 
         statInfo = new ResultInfo(KindSelector.NIL, Type.noType);
         varAssignmentInfo = new ResultInfo(KindSelector.ASG, Type.noType);
@@ -156,6 +155,8 @@
         unknownTypeInfo = new ResultInfo(KindSelector.TYP, Type.noType);
         unknownTypeExprInfo = new ResultInfo(KindSelector.VAL_TYP, Type.noType);
         recoveryInfo = new RecoveryInfo(deferredAttr.emptyDeferredAttrContext);
+
+        noCheckTree = make.at(-1).Skip();
     }
 
     /** Switch: relax some constraints for retrofit mode.
@@ -182,16 +183,6 @@
      */
     boolean allowStaticInterfaceMethods;
 
-    /** Switch: generates a warning if diamond can be safely applied
-     *  to a given new expression
-     */
-    boolean findDiamonds;
-
-    /**
-     * Internally enables/disables diamond finder feature
-     */
-    static final boolean allowDiamondFinder = true;
-
     /**
      * Switch: warn about use of variable before declaration?
      * RFE: 6425594
@@ -199,12 +190,6 @@
     boolean useBeforeDeclarationWarning;
 
     /**
-     * Switch: generate warnings whenever an anonymous inner class that is convertible
-     * to a lambda expression is found
-     */
-    boolean identifyLambdaCandidate;
-
-    /**
      * Switch: allow strings in switch?
      */
     boolean allowStringsInSwitch;
@@ -231,31 +216,32 @@
                final ResultInfo resultInfo) {
         InferenceContext inferenceContext = resultInfo.checkContext.inferenceContext();
         Type owntype;
-        if (!found.hasTag(ERROR) && !resultInfo.pt.hasTag(METHOD) && !resultInfo.pt.hasTag(FORALL)) {
-            if (!ownkind.subset(resultInfo.pkind)) {
-                log.error(tree.pos(), "unexpected.type",
-                        resultInfo.pkind.kindNames(),
-                        ownkind.kindNames());
-                owntype = types.createErrorType(found);
-            } else if (allowPoly && inferenceContext.free(found)) {
-                //delay the check if there are inference variables in the found type
-                //this means we are dealing with a partially inferred poly expression
-                owntype = resultInfo.pt;
-                inferenceContext.addFreeTypeListener(List.of(found, resultInfo.pt), new FreeTypeListener() {
-                    @Override
-                    public void typesInferred(InferenceContext inferenceContext) {
+        boolean shouldCheck = !found.hasTag(ERROR) &&
+                !resultInfo.pt.hasTag(METHOD) &&
+                !resultInfo.pt.hasTag(FORALL);
+        if (shouldCheck && !ownkind.subset(resultInfo.pkind)) {
+            log.error(tree.pos(), "unexpected.type",
+            resultInfo.pkind.kindNames(),
+            ownkind.kindNames());
+            owntype = types.createErrorType(found);
+        } else if (allowPoly && inferenceContext.free(found)) {
+            //delay the check if there are inference variables in the found type
+            //this means we are dealing with a partially inferred poly expression
+            owntype = shouldCheck ? resultInfo.pt : found;
+            inferenceContext.addFreeTypeListener(List.of(found, resultInfo.pt),
+                    instantiatedContext -> {
                         ResultInfo pendingResult =
                                 resultInfo.dup(inferenceContext.asInstType(resultInfo.pt));
                         check(tree, inferenceContext.asInstType(found), ownkind, pendingResult);
-                    }
-                });
-            } else {
-                owntype = resultInfo.check(tree, found);
-            }
+                    });
         } else {
-            owntype = found;
+            owntype = shouldCheck ?
+            resultInfo.check(tree, found) :
+            found;
         }
-        tree.type = owntype;
+        if (tree != noCheckTree) {
+            tree.type = owntype;
+        }
         return owntype;
     }
 
@@ -531,6 +517,10 @@
      */
     Type result;
 
+    /** Synthetic tree to be used during 'fake' checks.
+     */
+    JCTree noCheckTree;
+
     /** Visitor method: attribute a tree, catching any completion failure
      *  exceptions. Return the tree's type.
      *
@@ -610,7 +600,13 @@
     /** Derived visitor method: attribute a statement or definition tree.
      */
     public Type attribStat(JCTree tree, Env<AttrContext> env) {
-        return attribTree(tree, env, statInfo);
+        Env<AttrContext> analyzeEnv =
+                env.dup(tree, env.info.dup(env.info.scope.dupUnshared(env.info.scope.owner)));
+        try {
+            return attribTree(tree, env, statInfo);
+        } finally {
+            analyzer.analyzeIfNeeded(tree, analyzeEnv);
+        }
     }
 
     /** Attribute a list of expressions, returning a list of types.
@@ -792,8 +788,8 @@
 
     Type attribIdentAsEnumType(Env<AttrContext> env, JCIdent id) {
         Assert.check((env.enclClass.sym.flags() & ENUM) != 0);
-        id.type = env.info.scope.owner.type;
-        id.sym = env.info.scope.owner;
+        id.type = env.info.scope.owner.enclClass().type;
+        id.sym = env.info.scope.owner.enclClass();
         return id.type;
     }
 
@@ -2018,7 +2014,7 @@
                     }
                 });
                 Type constructorType = tree.constructorType = types.createErrorType(clazztype);
-                constructorType = checkId(tree, site,
+                constructorType = checkId(noCheckTree, site,
                         constructor,
                         diamondEnv,
                         diamondResult);
@@ -2044,7 +2040,7 @@
                 tree.constructor = rs.resolveConstructor(
                     tree.pos(), rsEnv, clazztype, argtypes, typeargtypes);
                 if (cdef == null) { //do not check twice!
-                    tree.constructorType = checkId(tree,
+                    tree.constructorType = checkId(noCheckTree,
                             clazztype,
                             tree.constructor,
                             rsEnv,
@@ -2052,12 +2048,6 @@
                     if (rsEnv.info.lastResolveVarargs())
                         Assert.check(tree.constructorType.isErroneous() || tree.varargsElement != null);
                 }
-                if (cdef == null &&
-                        !clazztype.isErroneous() &&
-                        clazztype.getTypeArguments().nonEmpty() &&
-                        findDiamonds) {
-                    findDiamond(localEnv, tree, clazztype);
-                }
             }
 
             if (cdef != null) {
@@ -2105,8 +2095,6 @@
 
                 attribStat(cdef, localEnv);
 
-                checkLambdaCandidate(tree, cdef.sym, clazztype);
-
                 // If an outer instance is given,
                 // prefix it to the constructor arguments
                 // and delete it from the new expression
@@ -2122,7 +2110,7 @@
                     tree.pos(), localEnv, clazztype, argtypes, typeargtypes);
                 Assert.check(!sym.kind.isOverloadError());
                 tree.constructor = sym;
-                tree.constructorType = checkId(tree,
+                tree.constructorType = checkId(noCheckTree,
                     clazztype,
                     tree.constructor,
                     localEnv,
@@ -2133,60 +2121,16 @@
                 owntype = clazztype;
         }
         result = check(tree, owntype, KindSelector.VAL, resultInfo);
+        InferenceContext inferenceContext = resultInfo.checkContext.inferenceContext();
+        if (tree.constructorType != null && inferenceContext.free(tree.constructorType)) {
+            //we need to wait for inference to finish and then replace inference vars in the constructor type
+            inferenceContext.addFreeTypeListener(List.of(tree.constructorType),
+                    instantiatedContext -> {
+                        tree.constructorType = instantiatedContext.asInstType(tree.constructorType);
+                    });
+        }
         chk.validate(tree.typeargs, localEnv);
     }
-    //where
-        void findDiamond(Env<AttrContext> env, JCNewClass tree, Type clazztype) {
-            JCTypeApply ta = (JCTypeApply)tree.clazz;
-            List<JCExpression> prevTypeargs = ta.arguments;
-            try {
-                //create a 'fake' diamond AST node by removing type-argument trees
-                ta.arguments = List.nil();
-                ResultInfo findDiamondResult = new ResultInfo(KindSelector.VAL,
-                        resultInfo.checkContext.inferenceContext().free(resultInfo.pt) ? Type.noType : pt());
-                Type inferred = deferredAttr.attribSpeculative(tree, env, findDiamondResult).type;
-                Type polyPt = allowPoly ?
-                        syms.objectType :
-                        clazztype;
-                if (!inferred.isErroneous() &&
-                    (allowPoly && pt() == Infer.anyPoly ?
-                        types.isSameType(inferred, clazztype) :
-                        types.isAssignable(inferred, pt().hasTag(NONE) ? polyPt : pt(), types.noWarnings))) {
-                    String key = types.isSameType(clazztype, inferred) ?
-                        "diamond.redundant.args" :
-                        "diamond.redundant.args.1";
-                    log.warning(tree.clazz.pos(), key, clazztype, inferred);
-                }
-            } finally {
-                ta.arguments = prevTypeargs;
-            }
-        }
-
-            private void checkLambdaCandidate(JCNewClass tree, ClassSymbol csym, Type clazztype) {
-                if (allowLambda &&
-                        identifyLambdaCandidate &&
-                        clazztype.hasTag(CLASS) &&
-                        !pt().hasTag(NONE) &&
-                        types.isFunctionalInterface(clazztype.tsym)) {
-                    Symbol descriptor = types.findDescriptorSymbol(clazztype.tsym);
-                    int count = 0;
-                    boolean found = false;
-                    for (Symbol sym : csym.members().getSymbols()) {
-                        if ((sym.flags() & SYNTHETIC) != 0 ||
-                                sym.isConstructor()) continue;
-                        count++;
-                        if (sym.kind != MTH ||
-                                !sym.name.equals(descriptor.name)) continue;
-                        Type mtype = types.memberType(clazztype, sym);
-                        if (types.overrideEquivalent(mtype, types.memberType(clazztype, descriptor))) {
-                            found = true;
-                        }
-                    }
-                    if (found && count == 1) {
-                        log.note(tree.def, "potential.lambda.found");
-                    }
-                }
-            }
 
     /** Make an attributed null check tree.
      */
@@ -2361,6 +2305,7 @@
             preFlow(that);
             flow.analyzeLambda(env, that, make, isSpeculativeRound);
 
+            that.type = currentTarget; //avoids recovery at this stage
             checkLambdaCompatible(that, lambdaType, resultInfo.checkContext);
 
             if (!isSpeculativeRound) {
@@ -2801,7 +2746,7 @@
                         that.kind.isUnbound() ? argtypes.tail : argtypes, typeargtypes),
                         new FunctionalReturnContext(resultInfo.checkContext));
 
-            Type refType = checkId(that, lookupHelper.site, refSym, localEnv, checkInfo);
+            Type refType = checkId(noCheckTree, lookupHelper.site, refSym, localEnv, checkInfo);
 
             if (that.kind.isUnbound() &&
                     resultInfo.checkContext.inferenceContext().free(argtypes.head)) {
@@ -2823,6 +2768,8 @@
             //is a no-op (as this has been taken care during method applicability)
             boolean isSpeculativeRound =
                     resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.SPECULATIVE;
+
+            that.type = currentTarget; //avoids recovery at this stage
             checkReferenceCompatible(that, desc, refType, resultInfo.checkContext, isSpeculativeRound);
             if (!isSpeculativeRound) {
                 checkAccessibleTypes(that, localEnv, resultInfo.checkContext.inferenceContext(), desc, currentTarget);
@@ -3953,7 +3900,7 @@
                 all_multicatchTypes.append(ctype);
             }
         }
-        Type t = check(tree, types.lub(multicatchTypes.toList()),
+        Type t = check(noCheckTree, types.lub(multicatchTypes.toList()),
                 KindSelector.TYP, resultInfo);
         if (t.hasTag(CLASS)) {
             List<Type> alternatives =
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java	Fri Jan 09 13:28:02 2015 -0500
@@ -59,6 +59,10 @@
      */
     boolean isSerializable = false;
 
+    /** Is this a speculative attribution environment?
+     */
+    boolean isSpeculative = false;
+
     /** Are arguments to current function applications boxed into an array for varargs?
      */
     Resolve.MethodResolutionPhase pendingResolutionPhase = null;
@@ -95,6 +99,7 @@
         info.returnResult = returnResult;
         info.defaultSuperCallSite = defaultSuperCallSite;
         info.isSerializable = isSerializable;
+        info.isSpeculative = isSpeculative;
         return info;
     }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Fri Jan 09 13:28:02 2015 -0500
@@ -37,15 +37,18 @@
 import com.sun.tools.javac.comp.Infer.InferenceContext;
 import com.sun.tools.javac.comp.Resolve.MethodResolutionPhase;
 import com.sun.tools.javac.tree.JCTree.*;
+import com.sun.tools.javac.util.Log.DeferredDiagnosticHandler;
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.EnumMap;
 import java.util.EnumSet;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
 import java.util.WeakHashMap;
+import java.util.function.Function;
 
 import static com.sun.tools.javac.code.TypeTag.*;
 import static com.sun.tools.javac.tree.JCTree.Tag.*;
@@ -364,28 +367,16 @@
      * disabled during speculative type-checking.
      */
     JCTree attribSpeculative(JCTree tree, Env<AttrContext> env, ResultInfo resultInfo) {
-        final JCTree newTree = new TreeCopier<>(make).copy(tree);
-        Env<AttrContext> speculativeEnv = env.dup(newTree, env.info.dup(env.info.scope.dupUnshared(env.info.scope.owner)));
-        Log.DeferredDiagnosticHandler deferredDiagnosticHandler =
-                new Log.DeferredDiagnosticHandler(log, new Filter<JCDiagnostic>() {
-            public boolean accepts(final JCDiagnostic d) {
-                class PosScanner extends TreeScanner {
-                    boolean found = false;
+        return attribSpeculative(tree, env, resultInfo, new TreeCopier<>(make),
+                (newTree)->new DeferredAttrDiagHandler(log, newTree));
+    }
 
-                    @Override
-                    public void scan(JCTree tree) {
-                        if (tree != null &&
-                                tree.pos() == d.getDiagnosticPosition()) {
-                            found = true;
-                        }
-                        super.scan(tree);
-                    }
-                }
-                PosScanner posScanner = new PosScanner();
-                posScanner.scan(newTree);
-                return posScanner.found;
-            }
-        });
+    <Z> JCTree attribSpeculative(JCTree tree, Env<AttrContext> env, ResultInfo resultInfo, TreeCopier<Z> deferredCopier,
+                                 Function<JCTree, DeferredDiagnosticHandler> diagHandlerCreator) {
+        final JCTree newTree = deferredCopier.copy(tree);
+        Env<AttrContext> speculativeEnv = env.dup(newTree, env.info.dup(env.info.scope.dupUnshared(env.info.scope.owner)));
+        speculativeEnv.info.isSpeculative = true;
+        Log.DeferredDiagnosticHandler deferredDiagnosticHandler = diagHandlerCreator.apply(newTree);
         try {
             attr.attribTree(newTree, speculativeEnv, resultInfo);
             unenterScanner.scan(newTree);
@@ -413,6 +404,37 @@
             }
         }
 
+        static class DeferredAttrDiagHandler extends Log.DeferredDiagnosticHandler {
+
+            static class PosScanner extends TreeScanner {
+                DiagnosticPosition pos;
+                boolean found = false;
+
+                PosScanner(DiagnosticPosition pos) {
+                    this.pos = pos;
+                }
+
+                @Override
+                public void scan(JCTree tree) {
+                    if (tree != null &&
+                            tree.pos() == pos) {
+                        found = true;
+                    }
+                    super.scan(tree);
+                }
+            }
+
+            DeferredAttrDiagHandler(Log log, JCTree newTree) {
+                super(log, new Filter<JCDiagnostic>() {
+                    public boolean accepts(JCDiagnostic d) {
+                        PosScanner posScanner = new PosScanner(d.getDiagnosticPosition());
+                        posScanner.scan(newTree);
+                        return posScanner.found;
+                    }
+                });
+            }
+        }
+
     /**
      * A deferred context is created on each method check. A deferred context is
      * used to keep track of information associated with the method check, such as
@@ -817,6 +839,14 @@
     /** an empty deferred attribution context - all methods throw exceptions */
     final DeferredAttrContext emptyDeferredAttrContext;
 
+    /** The AttrMode to descriptive name mapping */
+    private static final EnumMap<AttrMode, String> deferredTypeMapDescriptions;
+    static {
+        deferredTypeMapDescriptions = new EnumMap<>(AttrMode.class);
+        deferredTypeMapDescriptions.put(AttrMode.CHECK, "deferredTypeMap[CHECK]");
+        deferredTypeMapDescriptions.put(AttrMode.SPECULATIVE, "deferredTypeMap[SPECULATIVE]");
+    }
+
     /**
      * Map a list of types possibly containing one or more deferred types
      * into a list of ordinary types. Each deferred type D is mapped into a type T,
@@ -824,11 +854,10 @@
      * computed for D during a previous deferred attribution round of the given kind.
      */
     class DeferredTypeMap extends Type.Mapping {
-
         DeferredAttrContext deferredAttrContext;
 
         protected DeferredTypeMap(AttrMode mode, Symbol msym, MethodResolutionPhase phase) {
-            super(String.format("deferredTypeMap[%s]", mode));
+            super(deferredTypeMapDescriptions.get(mode));
             this.deferredAttrContext = new DeferredAttrContext(mode, msym, phase,
                     infer.emptyContext, emptyDeferredAttrContext, types.noWarnings);
         }
@@ -1221,7 +1250,7 @@
 
         @Override
         public void visitNewClass(JCNewClass tree) {
-            result = (TreeInfo.isDiamond(tree) || attr.findDiamonds) ?
+            result = TreeInfo.isDiamond(tree) ?
                     ArgumentExpressionKind.POLY : ArgumentExpressionKind.NO_POLY;
         }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1176,12 +1176,14 @@
         @Override
         public void visitClassDef(JCClassDecl tree) {
             List<Frame> prevStack = frameStack;
+            int prevLambdaCount = lambdaCount;
             SyntheticMethodNameCounter prevSyntheticMethodNameCounts =
                     syntheticMethodNameCounts;
             Map<ClassSymbol, Symbol> prevClinits = clinits;
             DiagnosticSource prevSource = log.currentSource();
             try {
                 log.useSource(tree.sym.sourcefile);
+                lambdaCount = 0;
                 syntheticMethodNameCounts = new SyntheticMethodNameCounter();
                 prevClinits = new HashMap<>();
                 if (tree.sym.owner.kind == MTH) {
@@ -1208,6 +1210,7 @@
             finally {
                 log.useSource(prevSource.getFile());
                 frameStack = prevStack;
+                lambdaCount = prevLambdaCount;
                 syntheticMethodNameCounts = prevSyntheticMethodNameCounts;
                 clinits = prevClinits;
             }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Jan 09 13:28:02 2015 -0500
@@ -251,19 +251,19 @@
      *     mode = NOPARAMS    : no parameters allowed for type
      *     mode = TYPEARG     : type argument
      */
-    static final int EXPR = 0x1;
-    static final int TYPE = 0x2;
-    static final int NOPARAMS = 0x4;
-    static final int TYPEARG = 0x8;
-    static final int DIAMOND = 0x10;
+    protected static final int EXPR = 0x1;
+    protected static final int TYPE = 0x2;
+    protected static final int NOPARAMS = 0x4;
+    protected static final int TYPEARG = 0x8;
+    protected static final int DIAMOND = 0x10;
 
     /** The current mode.
      */
-    private int mode = 0;
+    protected int mode = 0;
 
     /** The mode of the term that was parsed last.
      */
-    private int lastmode = 0;
+    protected int lastmode = 0;
 
     /* ---------- token management -------------- */
 
@@ -326,7 +326,7 @@
 
     /** Skip forward until a suitable stop token is found.
      */
-    private void skip(boolean stopAtImport, boolean stopAtMemberDecl, boolean stopAtIdentifier, boolean stopAtStatement) {
+    protected void skip(boolean stopAtImport, boolean stopAtMemberDecl, boolean stopAtIdentifier, boolean stopAtStatement) {
          while (true) {
              switch (token.kind) {
                 case SEMI:
@@ -403,11 +403,11 @@
         }
     }
 
-    private JCErroneous syntaxError(int pos, String key, TokenKind... args) {
+    protected JCErroneous syntaxError(int pos, String key, TokenKind... args) {
         return syntaxError(pos, List.<JCTree>nil(), key, args);
     }
 
-    private JCErroneous syntaxError(int pos, List<JCTree> errs, String key, TokenKind... args) {
+    protected JCErroneous syntaxError(int pos, List<JCTree> errs, String key, TokenKind... args) {
         setErrorEndPos(pos);
         JCErroneous err = F.at(pos).Erroneous(errs);
         reportSyntaxError(err, key, (Object[])args);
@@ -427,7 +427,7 @@
      * Report a syntax using the given the position parameter and arguments,
      * unless one was already reported at the same position.
      */
-    private void reportSyntaxError(int pos, String key, Object... args) {
+    protected void reportSyntaxError(int pos, String key, Object... args) {
         JCDiagnostic.DiagnosticPosition diag = new JCDiagnostic.SimpleDiagnosticPosition(pos);
         reportSyntaxError(diag, key, args);
     }
@@ -436,7 +436,7 @@
      * Report a syntax error using the given DiagnosticPosition object and
      * arguments, unless one was already reported at the same position.
      */
-    private void reportSyntaxError(JCDiagnostic.DiagnosticPosition diagPos, String key, Object... args) {
+    protected void reportSyntaxError(JCDiagnostic.DiagnosticPosition diagPos, String key, Object... args) {
         int pos = diagPos.getPreferredPosition();
         if (pos > S.errPos() || pos == Position.NOPOS) {
             if (token.kind == EOF) {
@@ -459,14 +459,14 @@
     /** Generate a syntax error at current position unless one was already
      *  reported at the same position.
      */
-    private JCErroneous syntaxError(String key) {
+    protected JCErroneous syntaxError(String key) {
         return syntaxError(token.pos, key);
     }
 
     /** Generate a syntax error at current position unless one was
      *  already reported at the same position.
      */
-    private JCErroneous syntaxError(String key, TokenKind arg) {
+    protected JCErroneous syntaxError(String key, TokenKind arg) {
         return syntaxError(token.pos, key, arg);
     }
 
@@ -500,7 +500,7 @@
     }
 
     /** Diagnose a modifier flag from the set, if any. */
-    void checkNoMods(long mods) {
+    protected void checkNoMods(long mods) {
         if (mods != 0) {
             long lowestMod = mods & -mods;
             error(token.pos, "mod.not.allowed.here",
@@ -521,7 +521,7 @@
      *  @param tree   The tree to be used as index in the hashtable
      *  @param dc     The doc comment to associate with the tree, or null.
      */
-    void attach(JCTree tree, Comment dc) {
+    protected void attach(JCTree tree, Comment dc) {
         if (keepDocComments && dc != null) {
 //          System.out.println("doc comment = ");System.out.println(dc);//DEBUG
             docComments.putComment(tree, dc);
@@ -530,19 +530,19 @@
 
 /* -------- source positions ------- */
 
-    private void setErrorEndPos(int errPos) {
+    protected void setErrorEndPos(int errPos) {
         endPosTable.setErrorEndPos(errPos);
     }
 
-    private void storeEnd(JCTree tree, int endpos) {
+    protected void storeEnd(JCTree tree, int endpos) {
         endPosTable.storeEnd(tree, endpos);
     }
 
-    private <T extends JCTree> T to(T t) {
+    protected <T extends JCTree> T to(T t) {
         return endPosTable.to(t);
     }
 
-    private <T extends JCTree> T toP(T t) {
+    protected <T extends JCTree> T toP(T t) {
         return endPosTable.toP(t);
     }
 
@@ -574,7 +574,7 @@
     /**
      * Ident = IDENTIFIER
      */
-    Name ident() {
+    protected Name ident() {
         if (token.kind == IDENTIFIER) {
             Name name = token.name();
             nextToken();
@@ -789,7 +789,7 @@
         return term(TYPE);
     }
 
-    JCExpression term(int newmode) {
+    protected JCExpression term(int newmode) {
         int prevmode = mode;
         mode = newmode;
         JCExpression t = term();
@@ -1669,7 +1669,7 @@
     }
 
     /** Accepts all identifier-like tokens */
-    Filter<TokenKind> LAX_IDENTIFIER = new Filter<TokenKind>() {
+    protected Filter<TokenKind> LAX_IDENTIFIER = new Filter<TokenKind>() {
         public boolean accepts(TokenKind t) {
             return t == IDENTIFIER || t == UNDERSCORE || t == ASSERT || t == ENUM;
         }
@@ -2408,7 +2408,7 @@
      *     | ASSERT Expression [ ":" Expression ] ";"
      *     | ";"
      */
-    JCStatement parseSimpleStatement() {
+    public JCStatement parseSimpleStatement() {
         int pos = token.pos;
         switch (token.kind) {
         case LBRACE:
@@ -2706,7 +2706,7 @@
      *
      * @param kind Whether to parse an ANNOTATION or TYPE_ANNOTATION
      */
-    List<JCAnnotation> annotationsOpt(Tag kind) {
+    protected List<JCAnnotation> annotationsOpt(Tag kind) {
         if (token.kind != MONKEYS_AT) return List.nil(); // optimization
         ListBuffer<JCAnnotation> buf = new ListBuffer<>();
         int prevmode = mode;
@@ -2732,7 +2732,7 @@
      *           | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE | "@"
      *           | "@" Annotation
      */
-    JCModifiers modifiersOpt() {
+    protected JCModifiers modifiersOpt() {
         return modifiersOpt(null);
     }
     protected JCModifiers modifiersOpt(JCModifiers partial) {
@@ -2914,7 +2914,7 @@
      *  @param reqInit  Is an initializer always required?
      *  @param dc       The documentation comment for the variable declarations, or null.
      */
-    <T extends ListBuffer<? super JCVariableDecl>> T variableDeclaratorsRest(int pos,
+    protected <T extends ListBuffer<? super JCVariableDecl>> T variableDeclaratorsRest(int pos,
                                                                      JCModifiers mods,
                                                                      JCExpression type,
                                                                      Name name,
@@ -3117,7 +3117,7 @@
 
     /** ImportDeclaration = IMPORT [ STATIC ] Ident { "." Ident } [ "." "*" ] ";"
      */
-    JCTree importDeclaration() {
+    protected JCTree importDeclaration() {
         int pos = token.pos;
         nextToken();
         boolean importStatic = false;
@@ -3159,7 +3159,7 @@
      *  @param mods     Any modifiers starting the class or interface declaration
      *  @param dc       The documentation comment for the class, or null.
      */
-    JCStatement classOrInterfaceOrEnumDeclaration(JCModifiers mods, Comment dc) {
+    protected JCStatement classOrInterfaceOrEnumDeclaration(JCModifiers mods, Comment dc) {
         if (token.kind == CLASS) {
             return classDeclaration(mods, dc);
         } else if (token.kind == INTERFACE) {
@@ -3569,7 +3569,7 @@
      *  TypeParametersOpt = ["<" TypeParameter {"," TypeParameter} ">"]
      *  }
      */
-    List<JCTypeParameter> typeParametersOpt() {
+    protected List<JCTypeParameter> typeParametersOpt() {
         if (token.kind == LT) {
             ListBuffer<JCTypeParameter> typarams = new ListBuffer<>();
             nextToken();
@@ -4004,7 +4004,7 @@
             allowTypeAnnotations = true;
         }
     }
-    void checkAnnotationsAfterTypeParams(int pos) {
+    protected void checkAnnotationsAfterTypeParams(int pos) {
         if (!allowAnnotationsAfterTypeParams) {
             log.error(pos, "annotations.after.type.params.not.supported.in.source", source.name);
             allowAnnotationsAfterTypeParams = true;
@@ -4092,7 +4092,7 @@
         /**
          * Store the last error position.
          */
-        protected int errorEndPos = Position.NOPOS;
+        public int errorEndPos = Position.NOPOS;
 
         public AbstractEndPosTable(JavacParser parser) {
             this.parser = parser;
@@ -4119,13 +4119,13 @@
          * will be set only if it is greater than the last stored error position.
          * @param errPos The error position
          */
-        protected void setErrorEndPos(int errPos) {
+        public void setErrorEndPos(int errPos) {
             if (errPos > errorEndPos) {
                 errorEndPos = errPos;
             }
         }
 
-        protected void setParser(JavacParser parser) {
+        public void setParser(JavacParser parser) {
             this.parser = parser;
         }
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Jan 09 13:28:02 2015 -0500
@@ -1196,9 +1196,6 @@
 compiler.note.compressed.diags=\
     Some messages have been simplified; recompile with -Xdiags:verbose to get full output
 
-compiler.note.potential.lambda.found=\
-    This anonymous inner class creation can be turned into a lambda expression.
-
 # 0: boolean, 1: symbol
 compiler.note.lambda.stat=\
     Translating lambda expression\n\
@@ -1640,14 +1637,20 @@
 
 # 0: unused, 1: unused
 compiler.warn.diamond.redundant.args=\
-    redundant type arguments in new expression (use diamond operator instead).
-
-# 0: type, 1: type
+    Redundant type arguments in new expression (use diamond operator instead).
+
+# 0: type, 1: list of type
 compiler.warn.diamond.redundant.args.1=\
-    redundant type arguments in new expression (use diamond operator instead).\n\
+    Redundant type arguments in new expression (use diamond operator instead).\n\
     explicit: {0}\n\
     inferred: {1}
 
+compiler.warn.potential.lambda.found=\
+    This anonymous inner class creation can be turned into a lambda expression.
+
+compiler.warn.method.redundant.typeargs=\
+    Redundant type arguments in method call.
+
 # 0: symbol, 1: message segment
 compiler.warn.varargs.redundant.trustme.anno=\
     Redundant {0} annotation. {1}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Fri Jan 09 13:28:02 2015 -0500
@@ -313,6 +313,14 @@
         }
     }
 
+    /** Return true if the tree corresponds to a statement */
+    public static boolean isStatement(JCTree tree) {
+        return (tree instanceof JCStatement) &&
+                !tree.hasTag(CLASSDEF) &&
+                !tree.hasTag(Tag.BLOCK) &&
+                !tree.hasTag(METHODDEF);
+    }
+
     /**
      * Return true if the AST corresponds to a static select of the kind A.B
      */
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/JdepsTask.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/JdepsTask.java	Fri Jan 09 13:28:02 2015 -0500
@@ -554,8 +554,9 @@
         classpaths.addAll(PlatformClassPath.getModules(options.mpath));
         if (options.mpath != null) {
             initialArchives.addAll(PlatformClassPath.getModules(options.mpath));
+        } else {
+            classpaths.addAll(PlatformClassPath.getJarFiles());
         }
-        classpaths.addAll(PlatformClassPath.getJarFiles());
         // add all classpath archives to the source locations for reporting
         sourceLocations.addAll(classpaths);
     }
--- a/langtools/test/Makefile	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/test/Makefile	Fri Jan 09 13:28:02 2015 -0500
@@ -21,7 +21,6 @@
 ifeq ($(OSNAME), SunOS)
   SLASH_JAVA = /java
   PLATFORM = solaris
-  JT_PLATFORM = solaris
   ARCH = $(shell uname -p)
   ifeq ($(ARCH), i386)
     ARCH=i586
@@ -30,7 +29,6 @@
 ifeq ($(OSNAME), Linux)
   SLASH_JAVA = /java
   PLATFORM = linux
-  JT_PLATFORM = linux
   ARCH = $(shell uname -m)
   ifeq ($(ARCH), i386)
     ARCH=i586
@@ -38,7 +36,6 @@
 endif
 ifeq ($(OSNAME), Darwin)
   PLATFORM = bsd
-  JT_PLATFORM = linux
   ARCH = $(shell uname -m)
   ifeq ($(ARCH), i386)
     ARCH=i586
@@ -55,7 +52,6 @@
 
 ifeq ($(PLATFORM), windows)
   SLASH_JAVA = J:
-  JT_PLATFORM = win32
   ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64)
     ARCH=ia64
   else
@@ -93,8 +89,8 @@
 else
   JTREG_HOME = $(SLASH_JAVA)/re/jtreg/4.1/promoted/latest/binaries/jtreg
 endif
-JTREG = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtreg
-JTDIFF = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtdiff
+JTREG = $(JTREG_HOME)/bin/jtreg
+JTDIFF = $(JTREG_HOME)/bin/jtdiff
 
 # Default JCK to run
 ifdef JPRT_JCK_HOME
@@ -105,21 +101,19 @@
 
 # Default JDK for JTREG and JCK
 #
-# JT_JAVA is the version of java used to run jtreg/JCK. Since it is now
-# standard to execute tests in sameVM mode, it should normally be set the
-# same as TESTJAVA (although not necessarily so.)
+# JT_JAVA is the version of java used to run jtreg/JCK. 
 #
 ifdef JPRT_JAVA_HOME
   JT_JAVA = $(JPRT_JAVA_HOME)
 else
-  JT_JAVA = $(SLASH_JAVA)/re/jdk/1.7.0/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
+  JT_JAVA = $(SLASH_JAVA)/re/jdk/1.9.0/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
 endif
 
 # Default JDK to test
 ifdef JPRT_IMPORT_PRODUCT_HOME
   TESTJAVA = $(JPRT_IMPORT_PRODUCT_HOME)
 else
-  TESTJAVA = $(SLASH_JAVA)/re/jdk/1.7.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH)
+  TESTJAVA = $(SLASH_JAVA)/re/jdk/1.9.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH)
 endif
 
 # PRODUCT_HOME is a JPRT variable pointing to a directory containing the output from
@@ -152,7 +146,7 @@
 ifdef CONCURRENCY
   JTREG_OPTIONS += -agentvm -concurrency:$(CONCURRENCY)
 else
-  JTREG_OPTIONS += -samevm
+  JTREG_OPTIONS += -agentvm
 endif
 
 ifdef JCK_CONCURRENCY
--- a/langtools/test/tools/javac/diags/examples/DiamondRedundantArgs.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/test/tools/javac/diags/examples/DiamondRedundantArgs.java	Fri Jan 09 13:28:02 2015 -0500
@@ -22,8 +22,8 @@
  */
 
 // key: compiler.warn.diamond.redundant.args
-// options: -XDfindDiamond
+// options: -XDfind=diamond
 
-class Foo<X> {
-   Foo<String> fs = new Foo<String>();
+class DiamondRedundantArgs<X> {
+   DiamondRedundantArgs<String> fs = new DiamondRedundantArgs<String>();
 }
--- a/langtools/test/tools/javac/diags/examples/DiamondRedundantArgs1.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/test/tools/javac/diags/examples/DiamondRedundantArgs1.java	Fri Jan 09 13:28:02 2015 -0500
@@ -22,8 +22,8 @@
  */
 
 // key: compiler.warn.diamond.redundant.args.1
-// options: -XDfindDiamond
+// options: -XDfind=diamond
 
-class Foo<X> {
-   Foo<?> fs = new Foo<String>();
+class DiamondRedundantArgs1<X> {
+   DiamondRedundantArgs1<?> fs = new DiamondRedundantArgs1<String>();
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/MethodRedundantTypeargs.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+// key: compiler.warn.method.redundant.typeargs
+// options: -XDfind=method
+
+class MethodRedundantTypeargs {
+    <Z> Z id(Z z) { return z; }
+
+    void test() {
+        String s = this.<String>id("");
+    }
+}
--- a/langtools/test/tools/javac/diags/examples/PotentialLambdaFound.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/test/tools/javac/diags/examples/PotentialLambdaFound.java	Fri Jan 09 13:28:02 2015 -0500
@@ -21,8 +21,8 @@
  * questions.
  */
 
-// key: compiler.note.potential.lambda.found
-// options: -XDidentifyLambdaCandidate=true
+// key: compiler.warn.potential.lambda.found
+// options: -XDfind=lambda
 
 class PotentialLambdaFound {
 
--- a/langtools/test/tools/javac/generics/diamond/6939780/T6939780.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/test/tools/javac/generics/diamond/6939780/T6939780.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,11 +1,11 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 6939780 7020044 8009459 8021338
+ * @bug 6939780 7020044 8009459 8021338 8064365
  *
  * @summary  add a warning to detect diamond sites
  * @author mcimadamore
- * @compile/ref=T6939780_7.out -Xlint:-options -source 7 T6939780.java -XDrawDiagnostics -XDfindDiamond
- * @compile/ref=T6939780_8.out T6939780.java -XDrawDiagnostics -XDfindDiamond
+ * @compile/ref=T6939780_7.out -Xlint:-options -source 7 T6939780.java -XDrawDiagnostics -XDfind=diamond
+ * @compile/ref=T6939780_8.out T6939780.java -XDrawDiagnostics -XDfind=diamond
  *
  */
 
--- a/langtools/test/tools/javac/generics/diamond/6939780/T6939780_7.out	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/test/tools/javac/generics/diamond/6939780/T6939780_7.out	Fri Jan 09 13:28:02 2015 -0500
@@ -1,4 +1,5 @@
-T6939780.java:21:28: compiler.warn.diamond.redundant.args: T6939780.Foo<java.lang.Number>, T6939780.Foo<java.lang.Number>
+T6939780.java:21:28: compiler.warn.diamond.redundant.args
 T6939780.java:22:28: compiler.warn.diamond.redundant.args.1: T6939780.Foo<java.lang.Integer>, T6939780.Foo<java.lang.Number>
-T6939780.java:30:19: compiler.warn.diamond.redundant.args: T6939780.Foo<java.lang.Number>, T6939780.Foo<java.lang.Number>
-3 warnings
+T6939780.java:30:19: compiler.warn.diamond.redundant.args
+T6939780.java:31:19: compiler.warn.diamond.redundant.args.1: T6939780.Foo<java.lang.Integer>, T6939780.Foo<java.lang.Number>
+4 warnings
--- a/langtools/test/tools/javac/generics/diamond/6939780/T6939780_8.out	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/test/tools/javac/generics/diamond/6939780/T6939780_8.out	Fri Jan 09 13:28:02 2015 -0500
@@ -1,7 +1,7 @@
-T6939780.java:20:33: compiler.warn.diamond.redundant.args: T6939780.Foo<java.lang.Number>, T6939780.Foo<java.lang.Number>
-T6939780.java:21:28: compiler.warn.diamond.redundant.args: T6939780.Foo<java.lang.Number>, T6939780.Foo<java.lang.Number>
+T6939780.java:20:33: compiler.warn.diamond.redundant.args
+T6939780.java:21:28: compiler.warn.diamond.redundant.args
 T6939780.java:22:28: compiler.warn.diamond.redundant.args.1: T6939780.Foo<java.lang.Integer>, T6939780.Foo<java.lang.Number>
-T6939780.java:29:19: compiler.warn.diamond.redundant.args: T6939780.Foo<java.lang.Number>, T6939780.Foo<java.lang.Number>
-T6939780.java:30:19: compiler.warn.diamond.redundant.args: T6939780.Foo<java.lang.Number>, T6939780.Foo<java.lang.Number>
+T6939780.java:29:19: compiler.warn.diamond.redundant.args
+T6939780.java:30:19: compiler.warn.diamond.redundant.args
 T6939780.java:31:19: compiler.warn.diamond.redundant.args.1: T6939780.Foo<java.lang.Integer>, T6939780.Foo<java.lang.Number>
 6 warnings
--- a/langtools/test/tools/javac/generics/diamond/7002837/T7002837.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/test/tools/javac/generics/diamond/7002837/T7002837.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,10 +1,10 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 7002837
+ * @bug 7002837 8064365
  *
  * @summary  Diamond: javac generates diamond inference errors when in 'finder' mode
  * @author mcimadamore
- * @compile/fail/ref=T7002837.out -Werror -XDrawDiagnostics -XDfindDiamond T7002837.java
+ * @compile/fail/ref=T7002837.out -Werror -XDrawDiagnostics -XDfind=diamond T7002837.java
  *
  */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8066974/T8066974.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,44 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8066974
+ * @summary Compiler doesn't infer method's generic type information in lambda body
+ * @compile/fail/ref=T8066974.out -XDrawDiagnostics T8066974.java
+ */
+class T8066974 {
+    static class Throwing<E extends Throwable> { }
+    static class RuntimeThrowing extends Throwing<RuntimeException> { }
+    static class CheckedThrowing extends Throwing<Exception> { }
+
+    interface Parameter {
+        <E extends Throwable> Object m(Throwing<E> tw) throws E;
+    }
+
+    interface Mapper<R> {
+        R m(Parameter p);
+    }
+
+    <Z> Z map(Mapper<Z> mz) { return null; }
+
+    <Z extends Throwable> Mapper<Throwing<Z>> mapper(Throwing<Z> tz) throws Z { return null; }
+
+    static class ThrowingMapper<X extends Throwable> implements Mapper<Throwing<X>> {
+        ThrowingMapper(Throwing<X> arg) throws X { }
+
+        @Override
+        public Throwing<X> m(Parameter p) {
+        return null;
+        }
+    }
+
+    void testRuntime(RuntimeThrowing rt) {
+        map(p->p.m(rt));
+        map(mapper(rt));
+        map(new ThrowingMapper<>(rt));
+    }
+
+    void testChecked(CheckedThrowing ct) {
+        map(p->p.m(ct));
+        map(mapper(ct));
+        map(new ThrowingMapper<>(ct));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8066974/T8066974.out	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,4 @@
+T8066974.java:40:19: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
+T8066974.java:41:19: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
+T8066974.java:42:13: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
+3 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8067792/T8067792.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,19 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8067792
+ * @summary Javac crashes in finder mode with nested implicit lambdas
+ * @compile/fail/ref=T8067792.out -XDrawDiagnostics -Werror -XDfind=lambda T8067792.java
+ */
+
+import java.util.stream.*;
+import java.util.*;
+
+class T8067792 {
+    void test(Stream<List<?>> sl) {
+        Runnable r = new Runnable() {
+            public void run() {
+                Stream<List<?>> constructor = sl.filter(c -> true);
+            }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8067792/T8067792.out	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,4 @@
+T8067792.java:13:37: compiler.warn.potential.lambda.found
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- a/langtools/test/tools/javac/lambda/LambdaConv18.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/test/tools/javac/lambda/LambdaConv18.java	Fri Jan 09 13:28:02 2015 -0500
@@ -1,9 +1,9 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8003280
+ * @bug 8003280 8064365
  * @summary Add lambda tests
  *  simple test for lambda candidate check
- * @compile/fail/ref=LambdaConv18.out -XDrawDiagnostics -XDidentifyLambdaCandidate=true LambdaConv18.java
+ * @compile/fail/ref=LambdaConv18.out -XDrawDiagnostics -XDfind=lambda LambdaConv18.java
  */
 
 class LambdaConv18 {
--- a/langtools/test/tools/javac/lambda/LambdaConv18.out	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/test/tools/javac/lambda/LambdaConv18.out	Fri Jan 09 13:28:02 2015 -0500
@@ -1,4 +1,5 @@
 LambdaConv18.java:23:5: compiler.err.cant.resolve.location: kindname.class, NonExistent, , , (compiler.misc.location: kindname.class, LambdaConv18, null)
-LambdaConv18.java:20:24: compiler.note.potential.lambda.found
+LambdaConv18.java:20:24: compiler.warn.potential.lambda.found
 LambdaConv18.java:23:26: compiler.err.cant.resolve.location: kindname.class, NonExistent, , , (compiler.misc.location: kindname.class, LambdaConv18, null)
 2 errors
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/lambdaNaming/TestNonSerializableLambdaNameStability.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8067422
+ * @summary Check that the lambda names are not unnecessarily unstable
+ * @library /tools/lib
+ * @build ToolBox
+ * @run main TestNonSerializableLambdaNameStability
+ */
+
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.Method;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import javax.tools.StandardLocation;
+
+public class TestNonSerializableLambdaNameStability {
+
+    public static void main(String... args) throws Exception {
+        new TestNonSerializableLambdaNameStability().run();
+    }
+
+    String lambdaSource = "public class L%d {\n" +
+                          "    public static class A {\n" +
+                          "        private Runnable r = () -> { };\n" +
+                          "    }\n" +
+                          "    public static class B {\n" +
+                          "        private Runnable r = () -> { };\n" +
+                          "    }\n" +
+                          "    private Runnable r = () -> { };\n" +
+                          "}\n";
+
+    String expectedLambdaMethodName = "lambda$new$0";
+
+    void run() throws Exception {
+        List<String> sources = new ArrayList<>();
+
+        for (int i = 0; i < 3; i++) {
+            sources.add(String.format(lambdaSource, i));
+        }
+
+        ToolBox tb = new ToolBox();
+
+        try (ToolBox.MemoryFileManager fm = new ToolBox.MemoryFileManager()) {
+            tb.new JavacTask()
+              .sources(sources.toArray(new String[sources.size()]))
+              .fileManager(fm)
+              .run();
+
+            for (String file : fm.files.get(StandardLocation.CLASS_OUTPUT).keySet()) {
+                byte[] fileBytes = fm.getFileBytes(StandardLocation.CLASS_OUTPUT, file);
+                try (InputStream in = new ByteArrayInputStream(fileBytes)) {
+                    boolean foundLambdaMethod = false;
+                    ClassFile cf = ClassFile.read(in);
+                    StringBuilder seenMethods = new StringBuilder();
+                    String sep = "";
+                    for (Method m : cf.methods) {
+                        String methodName = m.getName(cf.constant_pool);
+                        if (expectedLambdaMethodName.equals(methodName)) {
+                            foundLambdaMethod = true;
+                            break;
+                        }
+                        seenMethods.append(sep);
+                        seenMethods.append(methodName);
+                        sep = ", ";
+                    }
+
+                    if (!foundLambdaMethod) {
+                        throw new AbstractMethodError("Did not find the lambda method, " +
+                                                      "found methods: " + seenMethods.toString());
+                    }
+                }
+            }
+        }
+    }
+}
--- a/langtools/test/tools/javac/lambda/speculative/DiamondFinder.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/langtools/test/tools/javac/lambda/speculative/DiamondFinder.java	Fri Jan 09 13:28:02 2015 -0500
@@ -23,10 +23,10 @@
 
 /*
  * @test
- * @bug 8003280
+ * @bug 8003280 8064365
  * @summary Add lambda tests
  *  spurious crashes when running in 'diamond finder' mode
- * @compile -XDfindDiamond DiamondFinder.java
+ * @compile -XDfind=diamond DiamondFinder.java
  */
 import java.util.*;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/CompileCircularSources.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verify that circular sources split on multiple cores can be compiled
+ * @bug 8054689
+ * @author Fredrik O
+ * @author sogoel (rewrite)
+ * @library /tools/lib
+ * @build Wrapper ToolBox
+ * @run main Wrapper CompileCircularSources
+ */
+
+import java.util.*;
+import java.nio.file.*;
+
+public class CompileCircularSources extends SJavacTester {
+    public static void main(String... args) throws Exception {
+        CompileCircularSources ccs = new CompileCircularSources();
+        ccs.test();
+    }
+
+    void test() throws Exception {
+        Files.createDirectory(BIN);
+        clean(GENSRC, BIN);
+
+        Map<String,Long> previous_bin_state = collectState(BIN);
+
+        ToolBox tb = new ToolBox();
+        tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),
+                 "package alfa.omega; public class A { beta.B b; }");
+        tb.writeFile(GENSRC.resolve("beta/B.java"),
+                 "package beta; public class B { gamma.C c; }");
+        tb.writeFile(GENSRC.resolve("gamma/C.java"),
+                 "package gamma; public class C { alfa.omega.A a; }");
+
+        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "3",
+                SERVER_ARG,"--log=debug");
+        Map<String,Long> new_bin_state = collectState(BIN);
+        verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
+                                     "bin/alfa/omega/A.class",
+                                     "bin/beta/B.class",
+                                     "bin/gamma/C.class",
+                                     "bin/javac_state");
+        clean(GENSRC, BIN);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/CompileExcludingDependency.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Tests compiling class A that depends on class B without compiling class B
+ * @bug 8054689
+ * @author Fredrik O
+ * @author sogoel (rewrite)
+ * @library /tools/lib
+ * @build Wrapper ToolBox
+ * @run main Wrapper CompileExcludingDependency
+ */
+
+import java.util.*;
+import java.nio.file.*;
+
+public class CompileExcludingDependency extends SJavacTester {
+    public static void main(String... args) throws Exception {
+        CompileExcludingDependency ced = new CompileExcludingDependency();
+        ced.test();
+    }
+
+    // Verify that excluding classes from compilation but not from linking works
+    void test() throws Exception {
+        Files.createDirectory(BIN);
+        clean(GENSRC,BIN);
+        Map<String,Long> previous_bin_state = collectState(BIN);
+        ToolBox tb = new ToolBox();
+        tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),
+                 "package alfa.omega; public class A { beta.B b; }");
+        tb.writeFile(GENSRC.resolve("beta/B.java"),
+                 "package beta; public class B { }");
+
+        compile("-x", "beta", "-src", "gensrc", "-x", "alfa/omega", "-sourcepath", "gensrc",
+                "-d", "bin", SERVER_ARG);
+
+        Map<String,Long> new_bin_state = collectState(BIN);
+        verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
+                                     "bin/alfa/omega/A.class",
+                                     "bin/javac_state");
+        clean(GENSRC, BIN);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/CompileWithAtFile.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Test \@atfile with command line content
+ * @bug 8054689
+ * @author Fredrik O
+ * @author sogoel (rewrite)
+ * @library /tools/lib
+ * @build Wrapper ToolBox
+ * @run main Wrapper CompileWithAtFile
+ */
+
+import java.util.*;
+import java.nio.file.*;
+
+public class CompileWithAtFile extends SJavacTester {
+    public static void main(String... args) throws Exception {
+        CompileWithAtFile cwf = new CompileWithAtFile();
+        cwf.test();
+    }
+
+    void test() throws Exception {
+        ToolBox tb = new ToolBox();
+        tb.writeFile(GENSRC.resolve("list.txt"),
+                 "-if */alfa/omega/A.java\n-if */beta/B.java\ngensrc\n-d bin\n");
+        tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),
+                 "package alfa.omega; import beta.B; public class A { B b; }");
+        tb.writeFile(GENSRC.resolve("beta/B.java"),
+                 "package beta; public class B { }");
+        tb.writeFile(GENSRC.resolve("beta/C.java"),
+                 "broken");
+
+        Files.createDirectory(BIN);
+        Map<String,Long> previous_bin_state = collectState(BIN);
+        compile("@gensrc/list.txt", "--server:portfile=testserver,background=false");
+
+        Map<String,Long> new_bin_state = collectState(BIN);
+        verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
+                         "bin/javac_state",
+                         "bin/alfa/omega/A.class",
+                         "bin/beta/B.class");
+        clean(GENSRC, BIN);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/CompileWithInvisibleSources.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verify that we can make sources invisible to linking (sourcepath)
+ * @bug 8054689
+ * @author Fredrik O
+ * @author sogoel (rewrite)
+ * @library /tools/lib
+ * @build Wrapper ToolBox
+ * @run main Wrapper CompileWithInvisibleSources
+ */
+
+import java.util.*;
+import java.nio.file.*;
+
+public class CompileWithInvisibleSources extends SJavacTester {
+    public static void main(String... args) throws Exception {
+        CompileWithInvisibleSources cis = new CompileWithInvisibleSources();
+        cis.test();
+    }
+
+    // Compile gensrc and link against gensrc2 and gensrc3
+    // gensrc2 contains broken code in beta.B, thus exclude that package
+    // gensrc3 contains a proper beta.B
+    void test() throws Exception {
+        Files.createDirectory(BIN);
+        clean(GENSRC, GENSRC2, GENSRC3, BIN);
+
+        Map<String,Long> previous_bin_state = collectState(BIN);
+
+        ToolBox tb = new ToolBox();
+        tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),
+                 "package alfa.omega; import beta.B; import gamma.C; public class A { B b; C c; }");
+        tb.writeFile(GENSRC2.resolve("beta/B.java"),
+                 "package beta; public class B { broken");
+        tb.writeFile(GENSRC2.resolve("gamma/C.java"),
+                 "package gamma; public class C { }");
+        tb.writeFile(GENSRC3.resolve("beta/B.java"),
+                 "package beta; public class B { }");
+
+        compile("gensrc", "-x", "beta", "-sourcepath", "gensrc2",
+                "-sourcepath", "gensrc3", "-d", "bin", "-h", "headers", "-j", "1",
+                SERVER_ARG);
+
+        System.out.println("The first compile went well!");
+        Map<String,Long> new_bin_state = collectState(BIN);
+        verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
+                                     "bin/alfa/omega/A.class",
+                                     "bin/javac_state");
+
+        System.out.println("----- Compile with exluded beta went well!");
+        clean(BIN);
+        compileExpectFailure("gensrc", "-sourcepath", "gensrc2", "-sourcepath", "gensrc3",
+                             "-d", "bin", "-h", "headers", "-j", "1",
+                             SERVER_ARG);
+
+        System.out.println("----- Compile without exluded beta failed, as expected! Good!");
+        clean(GENSRC, BIN);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/CompileWithOverrideSources.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary verify that we can override sources to be compiled
+ * @bug 8054689
+ * @author Fredrik O
+ * @author sogoel (rewrite)
+ * @library /tools/lib
+ * @build Wrapper ToolBox
+ * @run main Wrapper CompileWithOverrideSources
+ */
+
+import java.util.*;
+import java.nio.file.*;
+
+public class CompileWithOverrideSources extends SJavacTester {
+    public static void main(String... args) throws Exception {
+        CompileWithOverrideSources cos = new CompileWithOverrideSources();
+        cos.test();
+    }
+
+    // Compile gensrc and gensrc2. However do not compile broken beta.B in gensrc,
+    // only compile ok beta.B in gensrc2
+    void test() throws Exception {
+        Files.createDirectory(BIN);
+        clean(GENSRC, GENSRC2, GENSRC3, BIN);
+
+        Map<String,Long> previous_bin_state = collectState(BIN);
+        ToolBox tb = new ToolBox();
+        tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),
+                 "package alfa.omega; import beta.B; import gamma.C; public class A { B b; C c; }");
+        tb.writeFile(GENSRC.resolve("beta/B.java"),
+                 "package beta; public class B { broken");
+        tb.writeFile(GENSRC.resolve("gamma/C.java"),
+                 "package gamma; public class C { }");
+
+        tb.writeFile(GENSRC2.resolve("beta/B.java"),
+                 "package beta; public class B { }");
+
+        compile("-x", "beta", "gensrc", "gensrc2", "-d", "bin", "-h", "headers", "-j", "1",
+                SERVER_ARG);
+        Map<String,Long> new_bin_state = collectState(BIN);
+        verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
+                                     "bin/alfa/omega/A.class",
+                                     "bin/beta/B.class",
+                                     "bin/gamma/C.class",
+                                     "bin/javac_state");
+
+        System.out.println("----- Compile with exluded beta went well!");
+        clean(BIN);
+        compileExpectFailure("gensrc", "gensrc2", "-d", "bin", "-h", "headers", "-j", "1",
+                             SERVER_ARG);
+
+        System.out.println("----- Compile without exluded beta failed, as expected! Good!");
+        clean(GENSRC, GENSRC2, BIN);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/IncCompileChangeNative.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verify native files are removed when native method is removed
+ * @bug 8054689
+ * @author Fredrik O
+ * @author sogoel (rewrite)
+ * @library /tools/lib
+ * @build Wrapper ToolBox
+ * @run main Wrapper IncCompileChangeNative
+ */
+
+import java.util.*;
+import java.nio.file.*;
+
+public class IncCompileChangeNative extends SJavacTester {
+    public static void main(String... args) throws Exception {
+        IncCompileChangeNative cn = new IncCompileChangeNative();
+        cn.test();
+    }
+
+    // Remember the previous bin and headers state here.
+    Map<String,Long> previous_bin_state;
+    Map<String,Long> previous_headers_state;
+    ToolBox tb = new ToolBox();
+
+    void test() throws Exception {
+        Files.createDirectory(GENSRC);
+        Files.createDirectory(BIN);
+        Files.createDirectory(HEADERS);
+
+        initialCompile();
+        incrementalCompileDropAllNatives();
+        incrementalCompileAddNative();
+
+        clean(GENSRC, BIN, HEADERS);
+    }
+
+    // Update B.java with one less native method i.e. it has no longer any methods
+    // Verify that beta_B.h is removed
+    void incrementalCompileDropAllNatives() throws Exception {
+        previous_bin_state = collectState(BIN);
+        previous_headers_state = collectState(HEADERS);
+        System.out.println("\nIn incrementalCompileDropAllNatives() ");
+        System.out.println("Verify that beta_B.h is removed");
+        tb.writeFile(GENSRC.resolve("beta/B.java"),
+                       "package beta; import alfa.omega.A; public class B {"+
+                       "private int b() { return A.DEFINITION; } }");
+
+        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
+                SERVER_ARG, "--log=debug");
+        Map<String,Long> new_bin_state = collectState(BIN);
+        verifyNewerFiles(previous_bin_state, new_bin_state,
+                         "bin/beta/B.class",
+                         "bin/beta/BINT.class",
+                         "bin/javac_state");
+        previous_bin_state = new_bin_state;
+
+        Map<String,Long> new_headers_state = collectState(HEADERS);
+        verifyThatFilesHaveBeenRemoved(previous_headers_state, new_headers_state,
+                                       "headers/beta_B.h");
+        previous_headers_state = new_headers_state;
+    }
+
+    // Update the B.java with a final static annotated with @Native
+    // Verify that beta_B.h is added again
+    void incrementalCompileAddNative() throws Exception {
+        System.out.println("\nIn incrementalCompileAddNative() ");
+        System.out.println("Verify that beta_B.h is added again");
+        tb.writeFile(GENSRC.resolve("beta/B.java"),
+                       "package beta; import alfa.omega.A; public class B {"+
+                       "private int b() { return A.DEFINITION; } "+
+                 "@java.lang.annotation.Native final static int alfa = 42; }");
+
+        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
+                SERVER_ARG, "--log=debug");
+        Map<String,Long> new_bin_state = collectState(BIN);
+        verifyNewerFiles(previous_bin_state, new_bin_state,
+                         "bin/beta/B.class",
+                         "bin/beta/BINT.class",
+                         "bin/javac_state");
+        previous_bin_state = new_bin_state;
+
+        Map<String,Long> new_headers_state = collectState(HEADERS);
+        verifyThatFilesHaveBeenAdded(previous_headers_state, new_headers_state,
+                                     "headers/beta_B.h");
+        previous_headers_state = new_headers_state;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/IncCompileDropClasses.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verify deletion of a source file results in dropping of all .class files including inner classes
+ * @bug 8054689
+ * @author Fredrik O
+ * @author sogoel (rewrite)
+ * @library /tools/lib
+ * @build Wrapper ToolBox
+ * @run main Wrapper IncCompileDropClasses
+ */
+
+import java.util.*;
+import java.nio.file.*;
+
+public class IncCompileDropClasses extends SJavacTester {
+    public static void main(String... args) throws Exception {
+        IncCompileDropClasses dc = new IncCompileDropClasses();
+        dc.test();
+    }
+
+    // Remember the previous bin and headers state here.
+    Map<String,Long> previous_bin_state;
+    Map<String,Long> previous_headers_state;
+    ToolBox tb = new ToolBox();
+
+    void test() throws Exception {
+        Files.createDirectory(GENSRC);
+        Files.createDirectory(BIN);
+        Files.createDirectory(HEADERS);
+
+        initialCompile();
+        incrementalCompileDroppingClasses();
+
+        clean(GENSRC, BIN, HEADERS);
+    }
+
+    // Testing that deleting AA.java deletes all generated inner class including AA.class
+    void incrementalCompileDroppingClasses() throws Exception {
+        previous_bin_state = collectState(BIN);
+        previous_headers_state = collectState(HEADERS);
+        System.out.println("\nIn incrementalCompileDroppingClasses() ");
+        System.out.println("Testing that deleting AA.java deletes all generated inner class including AA.class");
+        removeFrom(GENSRC, "alfa/omega/AA.java");
+        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
+                SERVER_ARG, "--log=debug");
+        Map<String,Long> new_bin_state = collectState(BIN);
+        verifyThatFilesHaveBeenRemoved(previous_bin_state, new_bin_state,
+                                       "bin/alfa/omega/AA$1.class",
+                                       "bin/alfa/omega/AA$AAAA.class",
+                                       "bin/alfa/omega/AA$AAA.class",
+                                       "bin/alfa/omega/AAAAA.class",
+                                       "bin/alfa/omega/AA.class");
+
+        previous_bin_state = new_bin_state;
+        Map<String,Long> new_headers_state = collectState(HEADERS);
+        verifyEqual(previous_headers_state, new_headers_state);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/IncCompileFullyQualifiedRef.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verify that "alfa.omega.A a" does create a proper dependency
+ * @bug 8054689
+ * @author Fredrik O
+ * @author sogoel (rewrite)
+ * @library /tools/lib
+ * @build Wrapper ToolBox
+ * @run main Wrapper IncCompileFullyQualifiedRef
+ */
+
+import java.util.*;
+import java.nio.file.*;
+
+public class IncCompileFullyQualifiedRef extends SJavacTester {
+    public static void main(String... args) throws Exception {
+        IncCompileFullyQualifiedRef fr = new IncCompileFullyQualifiedRef();
+        fr.test();
+    }
+
+    void test() throws Exception {
+        ToolBox tb = new ToolBox();
+        tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),
+                 "package alfa.omega; public class A { "+
+                 "  public final static int DEFINITION = 18; "+
+                 "  public void hello() { }"+
+                 "}");
+        tb.writeFile(GENSRC.resolve("beta/B.java"),
+                 "package beta; public class B { "+
+                 "  public void world() { alfa.omega.A a; }"+
+                 "}");
+
+        compile("gensrc", "-d", "bin", "-j", "1",
+                SERVER_ARG, "--log=debug");
+        Map<String,Long> previous_bin_state = collectState(BIN);
+
+        // Change pubapi of A, this should trigger a recompile of B.
+        tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),
+                 "package alfa.omega; public class A { "+
+                 "  public final static int DEFINITION = 19; "+
+                 "  public void hello() { }"+
+                 "}");
+
+        compile("gensrc", "-d", "bin", "-j", "1",
+                SERVER_ARG, "--log=debug");
+        Map<String,Long> new_bin_state = collectState(BIN);
+
+        verifyNewerFiles(previous_bin_state, new_bin_state,
+                         "bin/alfa/omega/A.class",
+                         "bin/beta/B.class",
+                         "bin/javac_state");
+        clean(GENSRC,BIN);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/IncCompileNoChanges.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verify no change in sources implies no change in binaries
+ * @bug 8054689
+ * @author Fredrik O
+ * @author sogoel (rewrite)
+ * @library /tools/lib
+ * @build Wrapper ToolBox
+ * @run main Wrapper IncCompileNoChanges
+ */
+
+import java.util.*;
+import java.nio.file.*;
+
+public class IncCompileNoChanges  extends SJavacTester {
+    public static void main(String... args) throws Exception {
+        IncCompileNoChanges nc = new IncCompileNoChanges();
+        nc.test();
+    }
+
+    // Remember the previous bin and headers state here.
+    Map<String,Long> previous_bin_state;
+    Map<String,Long> previous_headers_state;
+
+    void test() throws Exception {
+        Files.createDirectory(GENSRC);
+        Files.createDirectory(BIN);
+        Files.createDirectory(HEADERS);
+
+        initialCompile();
+        incrementalCompileNoChanges();
+
+        clean(GENSRC, BIN, HEADERS);
+    }
+
+    // Testing that no change in sources implies no change in binaries
+    void incrementalCompileNoChanges() throws Exception {
+        previous_bin_state = collectState(BIN);
+        previous_headers_state = collectState(HEADERS);
+        System.out.println("\nIn incrementalCompileNoChanges() ");
+        System.out.println("Testing that no change in sources implies no change in binaries");
+        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
+                SERVER_ARG, "--log=debug");
+        Map<String,Long> new_bin_state = collectState(BIN);
+        verifyEqual(new_bin_state, previous_bin_state);
+        Map<String,Long> new_headers_state = collectState(HEADERS);
+        verifyEqual(previous_headers_state, new_headers_state);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/IncCompileUpdateNative.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verify native files are rewritten
+ * @bug 8054689
+ * @author Fredrik O
+ * @author sogoel (rewrite)
+ * @library /tools/lib
+ * @build Wrapper ToolBox
+ * @run main Wrapper IncCompileUpdateNative
+ */
+
+import java.util.*;
+import java.nio.file.*;
+
+public class IncCompileUpdateNative extends SJavacTester {
+    public static void main(String... args) throws Exception {
+        IncCompileUpdateNative un = new IncCompileUpdateNative();
+        un.test();
+    }
+
+    // Remember the previous bin and headers state here.
+    Map<String,Long> previous_bin_state;
+    Map<String,Long> previous_headers_state;
+    ToolBox tb = new ToolBox();
+
+    void test() throws Exception {
+        Files.createDirectory(GENSRC);
+        Files.createDirectory(BIN);
+        Files.createDirectory(HEADERS);
+
+        initialCompile();
+        incrementalCompileChangeNative();
+
+        clean(GENSRC, BIN, HEADERS);
+    }
+
+    // Update B.java with a new value for the final static annotated with @Native
+    // Verify that beta_B.h is rewritten again
+    void incrementalCompileChangeNative() throws Exception {
+        previous_bin_state = collectState(BIN);
+        previous_headers_state = collectState(HEADERS);
+        System.out.println("\nIn incrementalCompileChangeNative() ");
+        System.out.println("Verify that beta_B.h is rewritten again");
+        tb.writeFile(GENSRC.resolve("beta/B.java"),
+                       "package beta; import alfa.omega.A; public class B {"+
+                       "private int b() { return A.DEFINITION; } "+
+                 "@java.lang.annotation.Native final static int alfa = 43; }");
+
+        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
+                SERVER_ARG, "--log=debug");
+        Map<String,Long> new_bin_state = collectState(BIN);
+        verifyNewerFiles(previous_bin_state, new_bin_state,
+                         "bin/beta/B.class",
+                         "bin/beta/BINT.class",
+                         "bin/javac_state");
+        previous_bin_state = new_bin_state;
+
+        Map<String,Long> new_headers_state = collectState(HEADERS);
+        verifyNewerFiles(previous_headers_state, new_headers_state,
+                         "headers/beta_B.h");
+        previous_headers_state = new_headers_state;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/IncCompileWithChanges.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verify incremental changes in gensrc are handled as expected
+ * @bug 8054689
+ * @author Fredrik O
+ * @author sogoel (rewrite)
+ * @library /tools/lib
+ * @build Wrapper ToolBox
+ * @run main Wrapper IncCompileWithChanges
+ */
+
+import java.util.*;
+import java.nio.file.*;
+
+public class IncCompileWithChanges extends SJavacTester {
+    public static void main(String... args) throws Exception {
+        IncCompileWithChanges wc = new IncCompileWithChanges();
+        wc.test();
+    }
+
+    // Remember the previous bin and headers state here.
+    Map<String,Long> previous_bin_state;
+    Map<String,Long> previous_headers_state;
+    ToolBox tb = new ToolBox();
+
+    void test() throws Exception {
+        Files.createDirectory(GENSRC);
+        Files.createDirectory(BIN);
+        Files.createDirectory(HEADERS);
+
+        initialCompile();
+        incrementalCompileWithChange();
+
+        clean(GENSRC, BIN, HEADERS);
+    }
+
+    /* Update A.java with a new timestamp and new final static definition.
+     * This should trigger a recompile, not only of alfa, but also beta.
+     * Generated native header should not be updated since native api of B was not modified.
+     */
+    void incrementalCompileWithChange() throws Exception {
+        previous_bin_state = collectState(BIN);
+        previous_headers_state = collectState(HEADERS);
+        System.out.println("\nIn incrementalCompileWithChange() ");
+        System.out.println("A.java updated to trigger a recompile");
+        System.out.println("Generated native header should not be updated since native api of B was not modified");
+        tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),
+                       "package alfa.omega; public class A implements AINT { "+
+                 "public final static int DEFINITION = 18; public void aint() { } private void foo() { } }");
+
+        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
+                SERVER_ARG, "--log=debug");
+        Map<String,Long> new_bin_state = collectState(BIN);
+
+        verifyNewerFiles(previous_bin_state, new_bin_state,
+                         "bin/alfa/omega/A.class",
+                         "bin/alfa/omega/AINT.class",
+                         "bin/alfa/omega/AA$AAAA.class",
+                         "bin/alfa/omega/AAAAA.class",
+                         "bin/alfa/omega/AA$AAA.class",
+                         "bin/alfa/omega/AA.class",
+                         "bin/alfa/omega/AA$1.class",
+                         "bin/beta/B.class",
+                         "bin/beta/BINT.class",
+                         "bin/javac_state");
+        previous_bin_state = new_bin_state;
+
+        Map<String,Long> new_headers_state = collectState(HEADERS);
+        verifyEqual(new_headers_state, previous_headers_state);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/PermittedArtifact.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Test white listing of external artifacts inside the destination dir
+ * @bug 8054689
+ * @author Fredrik O
+ * @author sogoel (rewrite)
+ * @library /tools/lib
+ * @build Wrapper ToolBox
+ * @run main Wrapper PermittedArtifact
+ */
+
+import java.lang.reflect.Method;
+import java.util.*;
+import java.io.*;
+import java.nio.file.*;
+import java.nio.file.attribute.*;
+import java.nio.charset.*;
+
+public class PermittedArtifact extends SJavacTester {
+    public static void main(String... args) throws Exception {
+        PermittedArtifact pa = new PermittedArtifact();
+        pa.test();
+    }
+
+    //Verify that --permit-artifact=bin works
+    void test() throws Exception {
+        Files.createDirectory(BIN);
+        clean(GENSRC, BIN);
+
+        Map<String,Long> previous_bin_state = collectState(BIN);
+
+        new ToolBox().writeFile(GENSRC+"/alfa/omega/A.java",
+                "package alfa.omega; public class A { }");
+
+        new ToolBox().writeFile(BIN+"/alfa/omega/AA.class",
+                 "Ugh, a messy build system (tobefixed) wrote this class file, "
+                         + "sjavac must not delete it.");
+
+        compile("--log=debug", "--permit-artifact=bin/alfa/omega/AA.class",
+                "-src", "gensrc", "-d", "bin", SERVER_ARG);
+
+        Map<String,Long> new_bin_state = collectState(BIN);
+        verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
+                                     "bin/alfa/omega/A.class",
+                                     "bin/alfa/omega/AA.class",
+                                     "bin/javac_state");
+        clean(GENSRC, BIN);
+    }
+}
--- a/langtools/test/tools/sjavac/SJavac.java	Fri Jan 09 05:45:13 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,746 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @summary Test all aspects of sjavac.
- * @bug 8004658 8042441 8042699 8054461 8054474 8054465
- *
- * @build Wrapper
- * @run main Wrapper SJavac
- */
-
-import java.util.*;
-import java.io.*;
-import java.nio.file.*;
-import java.nio.file.attribute.*;
-import java.nio.charset.*;
-
-import com.sun.tools.sjavac.Main;
-
-public class SJavac {
-
-    public static void main(String... args) throws Exception {
-        try {
-            SJavac s = new SJavac();
-            s.test();
-        } finally {
-            System.out.println("\ntest complete\n");
-        }
-    }
-
-    FileSystem defaultfs = FileSystems.getDefault();
-    String serverArg = "--server:"
-            + "portfile=testportfile,"
-            + "background=false";
-
-    // Where to put generated sources that will
-    // test aspects of sjavac, ie JTWork/scratch/gensrc
-    Path gensrc;
-    // More gensrc dirs are used to test merging of serveral source roots.
-    Path gensrc2;
-    Path gensrc3;
-
-    // Where to put compiled classes.
-    Path bin;
-    // Where to put c-header files.
-    Path headers;
-
-    // Remember the previous bin and headers state here.
-    Map<String,Long> previous_bin_state;
-    Map<String,Long> previous_headers_state;
-
-    public void test() throws Exception {
-        gensrc = defaultfs.getPath("gensrc");
-        gensrc2 = defaultfs.getPath("gensrc2");
-        gensrc3 = defaultfs.getPath("gensrc3");
-        bin = defaultfs.getPath("bin");
-        headers = defaultfs.getPath("headers");
-
-        Files.createDirectory(gensrc);
-        Files.createDirectory(gensrc2);
-        Files.createDirectory(gensrc3);
-        Files.createDirectory(bin);
-        Files.createDirectory(headers);
-
-        initialCompile();
-        incrementalCompileNoChanges();
-        incrementalCompileDroppingClasses();
-        incrementalCompileWithChange();
-        incrementalCompileDropAllNatives();
-        incrementalCompileAddNative();
-        incrementalCompileChangeNative();
-        compileWithOverrideSource();
-        compileWithInvisibleSources();
-        compileCircularSources();
-        compileExcludingDependency();
-        incrementalCompileTestFullyQualifiedRef();
-        compileWithAtFile();
-        testStateDir();
-        testPermittedArtifact();
-
-        delete(gensrc);
-        delete(gensrc2);
-        delete(gensrc3);
-        delete(bin);
-        delete(headers);
-    }
-
-    void initialCompile() throws Exception {
-        System.out.println("\nInitial compile of gensrc.");
-        System.out.println("----------------------------");
-        populate(gensrc,
-            "alfa/omega/AINT.java",
-            "package alfa.omega; public interface AINT { void aint(); }",
-
-            "alfa/omega/A.java",
-            "package alfa.omega; public class A implements AINT { "+
-                 "public final static int DEFINITION = 17; public void aint() { } }",
-
-            "alfa/omega/AA.java",
-            "package alfa.omega;"+
-            "// A package private class, not contributing to the public api.\n"+
-            "class AA {"+
-            "   // A properly nested static inner class.\n"+
-            "    static class AAA { }\n"+
-            "    // A properly nested inner class.\n"+
-            "    class AAAA { }\n"+
-            "    Runnable foo() {\n"+
-            "        // A proper anonymous class.\n"+
-            "        return new Runnable() { public void run() { } };\n"+
-            "    }\n"+
-            "    AAA aaa;\n"+
-            "    AAAA aaaa;\n"+
-            "    AAAAA aaaaa;\n"+
-            "}\n"+
-            "class AAAAA {\n"+
-            "    // A bad auxiliary class, but no one is referencing it\n"+
-            "    // from outside of this source file, therefore it is ok.\n"+
-            "}\n",
-
-            "beta/BINT.java",
-            "package beta;public interface BINT { void foo(); }",
-
-            "beta/B.java",
-            "package beta; import alfa.omega.A; public class B {"+
-            "private int b() { return A.DEFINITION; } native void foo(); }");
-
-        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
-                serverArg, "--log=debug");
-        previous_bin_state = collectState(bin);
-        previous_headers_state = collectState(headers);
-    }
-
-    void incrementalCompileNoChanges() throws Exception {
-        System.out.println("\nTesting that no change in sources implies no change in binaries.");
-        System.out.println("------------------------------------------------------------------");
-        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
-                serverArg, "--log=debug");
-        Map<String,Long> new_bin_state = collectState(bin);
-        verifyEqual(new_bin_state, previous_bin_state);
-        Map<String,Long> new_headers_state = collectState(headers);
-        verifyEqual(previous_headers_state, new_headers_state);
-    }
-
-    void incrementalCompileDroppingClasses() throws Exception {
-        System.out.println("\nTesting that deleting AA.java deletes all");
-        System.out.println("generated inner class as well as AA.class");
-        System.out.println("-----------------------------------------");
-        removeFrom(gensrc, "alfa/omega/AA.java");
-        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
-                serverArg, "--log=debug");
-        Map<String,Long> new_bin_state = collectState(bin);
-        verifyThatFilesHaveBeenRemoved(previous_bin_state, new_bin_state,
-                                       "bin/alfa/omega/AA$1.class",
-                                       "bin/alfa/omega/AA$AAAA.class",
-                                       "bin/alfa/omega/AA$AAA.class",
-                                       "bin/alfa/omega/AAAAA.class",
-                                       "bin/alfa/omega/AA.class");
-
-        previous_bin_state = new_bin_state;
-        Map<String,Long> new_headers_state = collectState(headers);
-        verifyEqual(previous_headers_state, new_headers_state);
-    }
-
-    void incrementalCompileWithChange() throws Exception {
-        System.out.println("\nNow update the A.java file with a new timestamps and");
-        System.out.println("new final static definition. This should trigger a recompile,");
-        System.out.println("not only of alfa, but also beta.");
-        System.out.println("But check that the generated native header was not updated!");
-        System.out.println("Since we did not modify the native api of B.");
-        System.out.println("-------------------------------------------------------------");
-
-        populate(gensrc,"alfa/omega/A.java",
-                       "package alfa.omega; public class A implements AINT { "+
-                 "public final static int DEFINITION = 18; public void aint() { } private void foo() { } }");
-
-        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
-                serverArg, "--log=debug");
-        Map<String,Long> new_bin_state = collectState(bin);
-
-        verifyNewerFiles(previous_bin_state, new_bin_state,
-                         "bin/alfa/omega/A.class",
-                         "bin/alfa/omega/AINT.class",
-                         "bin/beta/B.class",
-                         "bin/beta/BINT.class",
-                         "bin/javac_state");
-        previous_bin_state = new_bin_state;
-
-        Map<String,Long> new_headers_state = collectState(headers);
-        verifyEqual(new_headers_state, previous_headers_state);
-    }
-
-    void incrementalCompileDropAllNatives() throws Exception {
-        System.out.println("\nNow update the B.java file with one less native method,");
-        System.out.println("ie it has no longer any methods!");
-        System.out.println("Verify that beta_B.h is removed!");
-        System.out.println("---------------------------------------------------------");
-
-        populate(gensrc,"beta/B.java",
-                       "package beta; import alfa.omega.A; public class B {"+
-                       "private int b() { return A.DEFINITION; } }");
-
-        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
-                serverArg, "--log=debug");
-        Map<String,Long> new_bin_state = collectState(bin);
-        verifyNewerFiles(previous_bin_state, new_bin_state,
-                         "bin/beta/B.class",
-                         "bin/beta/BINT.class",
-                         "bin/javac_state");
-        previous_bin_state = new_bin_state;
-
-        Map<String,Long> new_headers_state = collectState(headers);
-        verifyThatFilesHaveBeenRemoved(previous_headers_state, new_headers_state,
-                                       "headers/beta_B.h");
-        previous_headers_state = new_headers_state;
-    }
-
-    void incrementalCompileAddNative() throws Exception {
-        System.out.println("\nNow update the B.java file with a final static annotated with @Native.");
-        System.out.println("Verify that beta_B.h is added again!");
-        System.out.println("------------------------------------------------------------------------");
-
-        populate(gensrc,"beta/B.java",
-                       "package beta; import alfa.omega.A; public class B {"+
-                       "private int b() { return A.DEFINITION; } "+
-                 "@java.lang.annotation.Native final static int alfa = 42; }");
-
-        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
-                serverArg, "--log=debug");
-        Map<String,Long> new_bin_state = collectState(bin);
-        verifyNewerFiles(previous_bin_state, new_bin_state,
-                         "bin/beta/B.class",
-                         "bin/beta/BINT.class",
-                         "bin/javac_state");
-        previous_bin_state = new_bin_state;
-
-        Map<String,Long> new_headers_state = collectState(headers);
-        verifyThatFilesHaveBeenAdded(previous_headers_state, new_headers_state,
-                                     "headers/beta_B.h");
-        previous_headers_state = new_headers_state;
-    }
-
-    void incrementalCompileChangeNative() throws Exception {
-        System.out.println("\nNow update the B.java file with a new value for the final static"+
-                           " annotated with @Native.");
-        System.out.println("Verify that beta_B.h is rewritten again!");
-        System.out.println("-------------------------------------------------------------------");
-
-        populate(gensrc,"beta/B.java",
-                       "package beta; import alfa.omega.A; public class B {"+
-                       "private int b() { return A.DEFINITION; } "+
-                 "@java.lang.annotation.Native final static int alfa = 43; }");
-
-        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
-                serverArg, "--log=debug");
-        Map<String,Long> new_bin_state = collectState(bin);
-        verifyNewerFiles(previous_bin_state, new_bin_state,
-                         "bin/beta/B.class",
-                         "bin/beta/BINT.class",
-                         "bin/javac_state");
-        previous_bin_state = new_bin_state;
-
-        Map<String,Long> new_headers_state = collectState(headers);
-        verifyNewerFiles(previous_headers_state, new_headers_state,
-                         "headers/beta_B.h");
-        previous_headers_state = new_headers_state;
-    }
-
-    void compileWithOverrideSource() throws Exception {
-        System.out.println("\nNow verify that we can override sources to be compiled.");
-        System.out.println("Compile gensrc and gensrc2. However do not compile broken beta.B in gensrc,");
-        System.out.println("only compile ok beta.B in gensrc2.");
-        System.out.println("---------------------------------------------------------------------------");
-
-        delete(gensrc);
-        delete(gensrc2);
-        delete(bin);
-        previous_bin_state = collectState(bin);
-
-        populate(gensrc,"alfa/omega/A.java",
-                 "package alfa.omega; import beta.B; import gamma.C; public class A { B b; C c; }",
-                 "beta/B.java",
-                 "package beta; public class B { broken",
-                 "gamma/C.java",
-                 "package gamma; public class C { }");
-
-        populate(gensrc2,
-                 "beta/B.java",
-                 "package beta; public class B { }");
-
-        compile("-x", "beta", "gensrc", "gensrc2", "-d", "bin", "-h", "headers", "-j", "1",
-                serverArg);
-        Map<String,Long> new_bin_state = collectState(bin);
-        verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
-                                     "bin/alfa/omega/A.class",
-                                     "bin/beta/B.class",
-                                     "bin/gamma/C.class",
-                                     "bin/javac_state");
-
-        System.out.println("----- Compile with exluded beta went well!");
-        delete(bin);
-        compileExpectFailure("gensrc", "gensrc2", "-d", "bin", "-h", "headers", "-j", "1",
-                             serverArg);
-
-        System.out.println("----- Compile without exluded beta failed, as expected! Good!");
-        delete(bin);
-    }
-
-    void compileWithInvisibleSources() throws Exception {
-        System.out.println("\nNow verify that we can make sources invisible to linking (sourcepath).");
-        System.out.println("Compile gensrc and link against gensrc2 and gensrc3, however");
-        System.out.println("gensrc2 contains broken code in beta.B, thus we must exclude that package");
-        System.out.println("fortunately gensrc3 contains a proper beta.B.");
-        System.out.println("------------------------------------------------------------------------");
-
-        // Start with a fresh gensrcs and bin.
-        delete(gensrc);
-        delete(gensrc2);
-        delete(gensrc3);
-        delete(bin);
-        previous_bin_state = collectState(bin);
-
-        populate(gensrc,"alfa/omega/A.java",
-                 "package alfa.omega; import beta.B; import gamma.C; public class A { B b; C c; }");
-        populate(gensrc2,"beta/B.java",
-                 "package beta; public class B { broken",
-                 "gamma/C.java",
-                 "package gamma; public class C { }");
-        populate(gensrc3, "beta/B.java",
-                 "package beta; public class B { }");
-
-        compile("gensrc", "-x", "beta", "-sourcepath", "gensrc2",
-                "-sourcepath", "gensrc3", "-d", "bin", "-h", "headers", "-j", "1",
-                serverArg);
-
-        System.out.println("The first compile went well!");
-        Map<String,Long> new_bin_state = collectState(bin);
-        verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
-                                     "bin/alfa/omega/A.class",
-                                     "bin/javac_state");
-
-        System.out.println("----- Compile with exluded beta went well!");
-        delete(bin);
-        compileExpectFailure("gensrc", "-sourcepath", "gensrc2", "-sourcepath", "gensrc3",
-                             "-d", "bin", "-h", "headers", "-j", "1",
-                             serverArg);
-
-        System.out.println("----- Compile without exluded beta failed, as expected! Good!");
-        delete(bin);
-    }
-
-    void compileCircularSources() throws Exception {
-        System.out.println("\nNow verify that circular sources split on multiple cores can be compiled.");
-        System.out.println("---------------------------------------------------------------------------");
-
-        // Start with a fresh gensrcs and bin.
-        delete(gensrc);
-        delete(gensrc2);
-        delete(gensrc3);
-        delete(bin);
-        previous_bin_state = collectState(bin);
-
-        populate(gensrc,"alfa/omega/A.java",
-                 "package alfa.omega; public class A { beta.B b; }",
-                 "beta/B.java",
-                 "package beta; public class B { gamma.C c; }",
-                 "gamma/C.java",
-                 "package gamma; public class C { alfa.omega.A a; }");
-
-        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "3",
-                serverArg,"--log=debug");
-        Map<String,Long> new_bin_state = collectState(bin);
-        verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
-                                     "bin/alfa/omega/A.class",
-                                     "bin/beta/B.class",
-                                     "bin/gamma/C.class",
-                                     "bin/javac_state");
-        delete(bin);
-    }
-
-    /**
-     * Tests compiling class A that depends on class B without compiling class B
-     * @throws Exception If test fails
-     */
-    void compileExcludingDependency() throws Exception {
-        System.out.println("\nVerify that excluding classes from compilation but not from linking works.");
-        System.out.println("---------------------------------------------------------------------------");
-
-        delete(gensrc);
-        delete(bin);
-        previous_bin_state = collectState(bin);
-
-        populate(gensrc,
-                 "alfa/omega/A.java",
-                 "package alfa.omega; public class A { beta.B b; }",
-                 "beta/B.java",
-                 "package beta; public class B { }");
-
-        compile("-x", "beta", "-src", "gensrc", "-x", "alfa/omega", "-sourcepath", "gensrc",
-                "-d", "bin", serverArg);
-
-        Map<String,Long> new_bin_state = collectState(bin);
-        verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
-                                     "bin/alfa/omega/A.class",
-                                     "bin/javac_state");
-    }
-
-    void incrementalCompileTestFullyQualifiedRef() throws Exception {
-        System.out.println("\nVerify that \"alfa.omega.A a;\" does create a proper dependency.");
-        System.out.println("----------------------------------------------------------------");
-
-        populate(gensrc,
-                 "alfa/omega/A.java",
-                 "package alfa.omega; public class A { "+
-                 "  public final static int DEFINITION = 18; "+
-                 "  public void hello() { }"+
-                 "}",
-                 "beta/B.java",
-                 "package beta; public class B { "+
-                 "  public void world() { alfa.omega.A a; }"+
-                 "}");
-
-        compile("gensrc", "-d", "bin", "-j", "1",
-                serverArg, "--log=debug");
-        Map<String,Long> previous_bin_state = collectState(bin);
-
-        // Change pubapi of A, this should trigger a recompile of B.
-        populate(gensrc,
-                 "alfa/omega/A.java",
-                 "package alfa.omega; public class A { "+
-                 "  public final static int DEFINITION = 19; "+
-                 "  public void hello() { }"+
-                 "}");
-
-        compile("gensrc", "-d", "bin", "-j", "1",
-                serverArg, "--log=debug");
-        Map<String,Long> new_bin_state = collectState(bin);
-
-        verifyNewerFiles(previous_bin_state, new_bin_state,
-                         "bin/alfa/omega/A.class",
-                         "bin/beta/B.class",
-                         "bin/javac_state");
-    }
-
-   /**
-     * Tests @atfile
-     * @throws Exception If test fails
-     */
-    void compileWithAtFile() throws Exception {
-        System.out.println("\nTest @atfile with command line content.");
-        System.out.println("---------------------------------------");
-
-        delete(gensrc);
-        delete(gensrc2);
-        delete(bin);
-
-        populate(gensrc,
-                 "list.txt",
-                 "-if */alfa/omega/A.java\n-if */beta/B.java\ngensrc\n-d bin\n",
-                 "alfa/omega/A.java",
-                 "package alfa.omega; import beta.B; public class A { B b; }",
-                 "beta/B.java",
-                 "package beta; public class B { }",
-                 "beta/C.java",
-                 "broken");
-        previous_bin_state = collectState(bin);
-        compile("@gensrc/list.txt", "--server:portfile=testserver,background=false");
-
-        Map<String,Long> new_bin_state = collectState(bin);
-        verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
-                         "bin/javac_state",
-                         "bin/alfa/omega/A.class",
-                         "bin/beta/B.class");
-    }
-
-    /**
-     * Tests storing javac_state into another directory.
-     * @throws Exception If test fails
-     */
-    void testStateDir() throws Exception {
-        System.out.println("\nVerify that --state-dir=bar works.");
-        System.out.println("----------------------------------");
-
-        Path bar = defaultfs.getPath("bar");
-        Files.createDirectory(bar);
-
-        delete(gensrc);
-        delete(bin);
-        delete(bar);
-        previous_bin_state = collectState(bin);
-        Map<String,Long> previous_bar_state = collectState(bar);
-
-        populate(gensrc,
-                 "alfa/omega/A.java",
-                 "package alfa.omega; public class A { }");
-
-        compile("--state-dir=bar", "-src", "gensrc", "-d", "bin", serverArg);
-
-        Map<String,Long> new_bin_state = collectState(bin);
-        verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
-                                     "bin/alfa/omega/A.class");
-        Map<String,Long> new_bar_state = collectState(bar);
-        verifyThatFilesHaveBeenAdded(previous_bar_state, new_bar_state,
-                                     "bar/javac_state");
-    }
-
-    /**
-     * Test white listing of external artifacts inside the destination dir.
-     * @throws Exception If test fails
-     */
-    void testPermittedArtifact() throws Exception {
-        System.out.println("\nVerify that --permit-artifact=bar works.");
-        System.out.println("-------------------------------------------");
-
-        delete(gensrc);
-        delete(bin);
-
-        previous_bin_state = collectState(bin);
-
-        populate(gensrc,
-                 "alfa/omega/A.java",
-                 "package alfa.omega; public class A { }");
-
-        populate(bin,
-                 "alfa/omega/AA.class",
-                 "Ugh, a messy build system (tobefixed) wrote this class file, sjavac must not delete it.");
-
-        compile("--log=debug", "--permit-artifact=bin/alfa/omega/AA.class", "-src", "gensrc", "-d", "bin", serverArg);
-
-        Map<String,Long> new_bin_state = collectState(bin);
-        verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
-                                     "bin/alfa/omega/A.class",
-                                     "bin/alfa/omega/AA.class",
-                                     "bin/javac_state");
-    }
-
-    void removeFrom(Path dir, String... args) throws IOException {
-        for (String filename : args) {
-            Path p = dir.resolve(filename);
-            Files.delete(p);
-        }
-    }
-
-    void populate(Path src, String... args) throws IOException {
-        if (!Files.exists(src)) {
-            Files.createDirectory(src);
-        }
-        String[] a = args;
-        for (int i = 0; i<a.length; i+=2) {
-            String filename = a[i];
-            String content = a[i+1];
-            Path p = src.resolve(filename);
-            Files.createDirectories(p.getParent());
-            PrintWriter out = new PrintWriter(Files.newBufferedWriter(p,
-                                                                      Charset.defaultCharset()));
-            out.println(content);
-            out.close();
-        }
-    }
-
-    void delete(final Path root) throws IOException {
-        if (!Files.exists(root)) return;
-        Files.walkFileTree(root, new SimpleFileVisitor<Path>() {
-                 @Override
-                 public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException
-                 {
-                     Files.delete(file);
-                     return FileVisitResult.CONTINUE;
-                 }
-
-                 @Override
-                 public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException
-                 {
-                     if (e == null) {
-                         if (!dir.equals(root)) Files.delete(dir);
-                         return FileVisitResult.CONTINUE;
-                     } else {
-                         // directory iteration failed
-                         throw e;
-                     }
-                 }
-            });
-    }
-
-    void compile(String... args) throws Exception {
-        int rc = Main.go(args);
-        if (rc != 0) throw new Exception("Error during compile!");
-
-        // Wait a second, to get around the (temporary) problem with
-        // second resolution in the Java file api. But do not do this
-        // on windows where the timestamps work.
-        long in_a_sec = System.currentTimeMillis()+1000;
-        while (in_a_sec > System.currentTimeMillis()) {
-            try {
-                Thread.sleep(1000);
-            } catch (InterruptedException e) {
-            }
-        }
-    }
-
-    void compileExpectFailure(String... args) throws Exception {
-        int rc = Main.go(args);
-        if (rc == 0) throw new Exception("Expected error during compile! Did not fail!");
-    }
-
-    Map<String,Long> collectState(Path dir) throws IOException {
-        final Map<String,Long> files = new HashMap<>();
-        Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
-                 @Override
-                 public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
-                   throws IOException
-                 {
-                     files.put(file.toString(),new Long(Files.getLastModifiedTime(file).toMillis()));
-                     return FileVisitResult.CONTINUE;
-                 }
-            });
-        return files;
-    }
-
-    void verifyThatFilesHaveBeenRemoved(Map<String,Long> from,
-                                        Map<String,Long> to,
-                                        String... args) throws Exception {
-
-        Set<String> froms = from.keySet();
-        Set<String> tos = to.keySet();
-
-        if (froms.equals(tos)) {
-            throw new Exception("Expected new state to have fewer files than previous state!");
-        }
-
-        for (String t : tos) {
-            if (!froms.contains(t)) {
-                throw new Exception("Expected "+t+" to exist in previous state!");
-            }
-        }
-
-        for (String f : args) {
-            f = f.replace("/", File.separator);
-            if (!froms.contains(f)) {
-                throw new Exception("Expected "+f+" to exist in previous state!");
-            }
-            if (tos.contains(f)) {
-                throw new Exception("Expected "+f+" to have been removed from the new state!");
-            }
-        }
-
-        if (froms.size() - args.length != tos.size()) {
-            throw new Exception("There are more removed files than the expected list!");
-        }
-    }
-
-    void verifyThatFilesHaveBeenAdded(Map<String,Long> from,
-                                      Map<String,Long> to,
-                                      String... args) throws Exception {
-
-        Set<String> froms = from.keySet();
-        Set<String> tos = to.keySet();
-
-        if (froms.equals(tos)) {
-            throw new Exception("Expected new state to have more files than previous state!");
-        }
-
-        for (String t : froms) {
-            if (!tos.contains(t)) {
-                throw new Exception("Expected "+t+" to exist in new state!");
-            }
-        }
-
-        for (String f : args) {
-            f = f.replace("/", File.separator);
-            if (!tos.contains(f)) {
-                throw new Exception("Expected "+f+" to have been added to new state!");
-            }
-            if (froms.contains(f)) {
-                throw new Exception("Expected "+f+" to not exist in previous state!");
-            }
-        }
-
-        if (froms.size() + args.length != tos.size()) {
-            throw new Exception("There are more added files than the expected list!");
-        }
-    }
-
-    void verifyNewerFiles(Map<String,Long> from,
-                          Map<String,Long> to,
-                          String... args) throws Exception {
-        if (!from.keySet().equals(to.keySet())) {
-            throw new Exception("Expected the set of files to be identical!");
-        }
-        Set<String> files = new HashSet<String>();
-        for (String s : args) {
-            files.add(s.replace("/", File.separator));
-        }
-        for (String fn : from.keySet()) {
-            long f = from.get(fn);
-            long t = to.get(fn);
-            if (files.contains(fn)) {
-                if (t <= f) {
-                    throw new Exception("Expected "+fn+" to have a more recent timestamp!");
-                }
-            } else {
-                if (t != f) {
-                    throw new Exception("Expected "+fn+" to have the same timestamp!");
-                }
-            }
-        }
-    }
-
-    String print(Map<String,Long> m) {
-        StringBuilder b = new StringBuilder();
-        Set<String> keys = m.keySet();
-        for (String k : keys) {
-            b.append(k+" "+m.get(k)+"\n");
-        }
-        return b.toString();
-    }
-
-    void verifyEqual(Map<String,Long> from, Map<String,Long> to) throws Exception {
-        if (!from.equals(to)) {
-            System.out.println("FROM---"+print(from));
-            System.out.println("TO-----"+print(to));
-            throw new Exception("The dir should not differ! But it does!");
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/SJavacTester.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.*;
+import java.io.*;
+import java.nio.file.*;
+import java.nio.file.attribute.*;
+import java.nio.charset.*;
+
+import com.sun.tools.sjavac.Main;
+
+public class SJavacTester {
+
+    static final String SERVER_ARG = "--server:"
+            + "portfile=testportfile,"
+            + "background=false";
+
+    // Generated sources that will test aspects of sjavac
+    static final Path GENSRC = Paths.get("gensrc");
+    // Gensrc dirs used to test merging of serveral source roots.
+    static final Path GENSRC2 = Paths.get("gensrc2");
+    static final Path GENSRC3= Paths.get("gensrc3");
+
+    // Dir for compiled classes.
+    static final Path BIN = Paths.get("bin");
+    // Dir for c-header files.
+    Path HEADERS = Paths.get("headers");
+
+    // Remember the previous bin and headers state here.
+    Map<String,Long> previous_bin_state;
+    Map<String,Long> previous_headers_state;
+
+    void initialCompile() throws Exception {
+        System.out.println("\nInitial compile of gensrc.");
+        ToolBox tb = new ToolBox();
+        tb.writeFile(GENSRC.resolve("alfa/omega/AINT.java"),
+            "package alfa.omega; public interface AINT { void aint(); }");
+        tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),
+            "package alfa.omega; public class A implements AINT { "+
+                 "public final static int DEFINITION = 17; public void aint() { } }");
+        tb.writeFile(GENSRC.resolve("alfa/omega/AA.java"),
+            "package alfa.omega;"+
+            "// A package private class, not contributing to the public api.\n"+
+            "class AA {"+
+            "   // A properly nested static inner class.\n"+
+            "    static class AAA { }\n"+
+            "    // A properly nested inner class.\n"+
+            "    class AAAA { }\n"+
+            "    Runnable foo() {\n"+
+            "        // A proper anonymous class.\n"+
+            "        return new Runnable() { public void run() { } };\n"+
+            "    }\n"+
+            "    AAA aaa;\n"+
+            "    AAAA aaaa;\n"+
+            "    AAAAA aaaaa;\n"+
+            "}\n"+
+            "class AAAAA {\n"+
+            "    // A bad auxiliary class, but no one is referencing it\n"+
+            "    // from outside of this source file, therefore it is ok.\n"+
+            "}\n");
+        tb.writeFile(GENSRC.resolve("beta/BINT.java"),
+            "package beta;public interface BINT { void foo(); }");
+        tb.writeFile(GENSRC.resolve("beta/B.java"),
+            "package beta; import alfa.omega.A; public class B {"+
+            "private int b() { return A.DEFINITION; } native void foo(); }");
+
+        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
+                SERVER_ARG, "--log=debug");
+    }
+
+    void removeFrom(Path dir, String... args) throws IOException {
+        for (String filename : args) {
+            Path p = dir.resolve(filename);
+            Files.delete(p);
+        }
+    }
+
+    void delete(final Path root) throws IOException {
+        if (!Files.exists(root)) return;
+        Files.walkFileTree(root, new SimpleFileVisitor<Path>() {
+                 @Override
+                 public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException
+                 {
+                     Files.delete(file);
+                     return FileVisitResult.CONTINUE;
+                 }
+
+                 @Override
+                 public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException
+                 {
+                     if (e == null) {
+                         if (!dir.equals(root)) Files.delete(dir);
+                         return FileVisitResult.CONTINUE;
+                     } else {
+                         // directory iteration failed
+                         throw e;
+                     }
+                 }
+            });
+    }
+
+    void compile(String... args) throws Exception {
+        int rc = Main.go(args);
+        if (rc != 0) throw new Exception("Error during compile!");
+
+        // Wait a second, to get around the (temporary) problem with
+        // second resolution in the Java file api. But do not do this
+        // on windows where the timestamps work.
+        long in_a_sec = System.currentTimeMillis()+1000;
+        while (in_a_sec > System.currentTimeMillis()) {
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+            }
+        }
+    }
+
+    void compileExpectFailure(String... args) throws Exception {
+        int rc = Main.go(args);
+        if (rc == 0) throw new Exception("Expected error during compile! Did not fail!");
+    }
+
+    Map<String,Long> collectState(Path dir) throws IOException {
+        final Map<String,Long> files = new HashMap<>();
+        Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
+                 @Override
+                 public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
+                   throws IOException
+                 {
+                     files.put(file.toString(),new Long(Files.getLastModifiedTime(file).toMillis()));
+                     return FileVisitResult.CONTINUE;
+                 }
+            });
+        return files;
+    }
+
+    void verifyThatFilesHaveBeenRemoved(Map<String,Long> from,
+                                        Map<String,Long> to,
+                                        String... args) throws Exception {
+
+        Set<String> froms = from.keySet();
+        Set<String> tos = to.keySet();
+
+        if (froms.equals(tos)) {
+            throw new Exception("Expected new state to have fewer files than previous state!");
+        }
+
+        for (String t : tos) {
+            if (!froms.contains(t)) {
+                throw new Exception("Expected "+t+" to exist in previous state!");
+            }
+        }
+
+        for (String f : args) {
+            f = f.replace("/", File.separator);
+            if (!froms.contains(f)) {
+                throw new Exception("Expected "+f+" to exist in previous state!");
+            }
+            if (tos.contains(f)) {
+                throw new Exception("Expected "+f+" to have been removed from the new state!");
+            }
+        }
+
+        if (froms.size() - args.length != tos.size()) {
+            throw new Exception("There are more removed files than the expected list!");
+        }
+    }
+
+    void verifyThatFilesHaveBeenAdded(Map<String,Long> from,
+                                      Map<String,Long> to,
+                                      String... args) throws Exception {
+
+        Set<String> froms = from.keySet();
+        Set<String> tos = to.keySet();
+
+        if (froms.equals(tos)) {
+            throw new Exception("Expected new state to have more files than previous state!");
+        }
+
+        for (String t : froms) {
+            if (!tos.contains(t)) {
+                throw new Exception("Expected "+t+" to exist in new state!");
+            }
+        }
+
+        for (String f : args) {
+            f = f.replace("/", File.separator);
+            if (!tos.contains(f)) {
+                throw new Exception("Expected "+f+" to have been added to new state!");
+            }
+            if (froms.contains(f)) {
+                throw new Exception("Expected "+f+" to not exist in previous state!");
+            }
+        }
+
+        if (froms.size() + args.length != tos.size()) {
+            throw new Exception("There are more added files than the expected list!");
+        }
+    }
+
+    void verifyNewerFiles(Map<String,Long> from,
+                          Map<String,Long> to,
+                          String... args) throws Exception {
+        if (!from.keySet().equals(to.keySet())) {
+            throw new Exception("Expected the set of files to be identical!");
+        }
+        Set<String> files = new HashSet<String>();
+        for (String s : args) {
+            files.add(s.replace("/", File.separator));
+        }
+        for (String fn : from.keySet()) {
+            long f = from.get(fn);
+            long t = to.get(fn);
+            if (files.contains(fn)) {
+                if (t <= f) {
+                    throw new Exception("Expected "+fn+" to have a more recent timestamp!");
+                }
+            } else {
+                if (t != f) {
+                    throw new Exception("Expected "+fn+" to have the same timestamp!");
+                }
+            }
+        }
+    }
+
+    String print(Map<String,Long> m) {
+        StringBuilder b = new StringBuilder();
+        Set<String> keys = m.keySet();
+        for (String k : keys) {
+            b.append(k+" "+m.get(k)+"\n");
+        }
+        return b.toString();
+    }
+
+    void verifyEqual(Map<String,Long> from, Map<String,Long> to) throws Exception {
+        if (!from.equals(to)) {
+            System.out.println("FROM---"+print(from));
+            System.out.println("TO-----"+print(to));
+            throw new Exception("The dir should not differ! But it does!");
+        }
+    }
+
+    void clean(Path... listOfDirs) throws Exception {
+        for (Path dir : listOfDirs) {
+            delete(dir);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/StateDir.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verify that --state-dir=bar works
+ * @bug 8054689
+ * @author Fredrik O
+ * @author sogoel (rewrite)
+ * @library /tools/lib
+ * @build Wrapper ToolBox
+ * @run main Wrapper StateDir
+ */
+
+import java.util.*;
+import java.nio.file.*;
+
+public class StateDir extends SJavacTester {
+    public static void main(String... args) throws Exception {
+        StateDir sd = new StateDir();
+        sd.test();
+    }
+
+    void test() throws Exception {
+        Path bar = Paths.get("bar");
+        Files.createDirectory(bar);
+        Files.createDirectory(BIN);
+
+        clean(GENSRC, BIN, bar);
+
+        Map<String,Long> previous_bin_state = collectState(BIN);
+        Map<String,Long> previous_bar_state = collectState(bar);
+
+        ToolBox tb = new ToolBox();
+        tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),
+                "package alfa.omega; public class A { }");
+
+        compile("--state-dir=bar", "-src", "gensrc", "-d", "bin",
+                SJavacTester.SERVER_ARG);
+
+        Map<String,Long> new_bin_state = collectState(BIN);
+        verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
+                                     "bin/alfa/omega/A.class");
+        Map<String,Long> new_bar_state = collectState(bar);
+        verifyThatFilesHaveBeenAdded(previous_bar_state, new_bar_state,
+                                     "bar/javac_state");
+        clean(GENSRC, BIN, bar);
+    }
+}
--- a/make/Javadoc.gmk	Fri Jan 09 05:45:13 2015 -0800
+++ b/make/Javadoc.gmk	Fri Jan 09 13:28:02 2015 -0500
@@ -53,8 +53,7 @@
 
 JAVADOC_CMD = $(JAVA) \
     -Djava.awt.headless=true \
-    $(NEW_JAVADOC) \
-    -bootclasspath $(JDK_OUTPUTDIR)/classes
+    $(NEW_JAVADOC)
 
 # Copyright year for beginning of Java and some of the apis
 # (Needed when creating the javadocs)
@@ -231,17 +230,17 @@
 
 # Common echo of option
 define OptionOnly # opt
-	if [ "$1" != "" ] ; then \
-		$(PRINTF) "%s\n" "$1"; \
+	if [ "$(strip $1)" != "" ] ; then \
+		$(PRINTF) "%s\n" "$(strip $1)"; \
 	fi
 endef
 
 define OptionPair # opt arg
-	$(PRINTF) "%s '%s'\n" "$1" '$2'
+	$(PRINTF) "%s '%s'\n" "$(strip $1)" '$(strip $2)'
 endef
 
 define OptionTrip # opt arg arg
-	$(PRINTF) "%s '%s' '%s'\n" "$1" '$2' '$3'
+	$(PRINTF) "%s '%s' '%s'\n" "$(strip $1)" '$(strip $2)' '$(strip $3)'
 endef
 
 # Core api bottom argument (with special sauce)
--- a/make/Main.gmk	Fri Jan 09 05:45:13 2015 -0800
+++ b/make/Main.gmk	Fri Jan 09 13:28:02 2015 -0500
@@ -257,7 +257,7 @@
 
 test:
 	($(CD) $(SRC_ROOT)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \
-	    JT_HOME=$(JT_HOME) PRODUCT_HOME=$(JDK_OUTPUTDIR) \
+	    JT_HOME=$(JT_HOME) PRODUCT_HOME=$(JDK_IMAGE_DIR) \
 	    ALT_OUTPUTDIR=$(OUTPUT_ROOT) CONCURRENCY=$(JOBS) $(TEST)) || true
 
 test-make:
@@ -394,7 +394,7 @@
 
   docs-jvmtidoc: hotspot
 
-  test: exploded-image
+  test: jimages
 
   verify-modules: exploded-image
 
--- a/make/StripBinaries.gmk	Fri Jan 09 05:45:13 2015 -0800
+++ b/make/StripBinaries.gmk	Fri Jan 09 13:28:02 2015 -0500
@@ -66,11 +66,6 @@
     $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs \
         -name '*$(SHARED_LIBRARY_SUFFIX)' -type f)
 
-# On Windows, don't include debug info for libs either.
-ifeq ($(OPENJDK_TARGET_OS), windows)
-  COPY_LIBS_SRC := $(filter-out %.diz %.map %.pdb, $(COPY_LIBS_SRC))
-endif
-
 $(eval $(call SetupCopyFiles,STRIP_MODULES_CMDS, \
     SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
     DEST := $(MODULES_CMDS_STRIPPED), \
--- a/make/jprt.properties	Fri Jan 09 05:45:13 2015 -0800
+++ b/make/jprt.properties	Fri Jan 09 13:28:02 2015 -0500
@@ -188,6 +188,13 @@
     ${my.test.target.set:TESTNAME=svc_tools},                           \
     ${my.make.rule.test.targets.svc.extra}
 
+# JAXP vm test targets (testset=jaxp)
+my.test.targets.jaxp=
+
+# JAXP test targets (testset=jaxp)
+my.make.rule.test.targets.jaxp=						\
+    ${my.test.target.set:TESTNAME=jaxp_all}
+
 # All vm test targets (testset=all)
 my.test.targets.all=							\
     ${my.test.targets.default},						\
@@ -211,7 +218,8 @@
 my.make.rule.test.targets.pit=						\
     ${my.test.target.set:TESTNAME=langtools_jtreg},			\
     ${my.make.rule.test.targets.core},					\
-    ${my.make.rule.test.targets.svc}
+    ${my.make.rule.test.targets.svc}                                    \
+    ${my.make.rule.test.targets.jaxp}
 
 # JCK test targets in test/Makefile (no windows)
 my.test.target.set.jck=							\
--- a/nashorn/.hgtags	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/.hgtags	Fri Jan 09 13:28:02 2015 -0500
@@ -276,3 +276,5 @@
 74dcd8dbef252938d6deb032aefb46b8f452dd9e jdk9-b40
 52340a35aec9955d4aeaaf01d6337284f179b31c jdk9-b41
 498d1d6c4219086143b764b3bf61afe65dcece47 jdk9-b42
+8ae8dff2a28f3b8831cce97ae0c7a957c5dc650a jdk9-b43
+50ee576062726e536d1bb9a5eadd8fd4470128fc jdk9-b44
--- a/nashorn/make/build.xml	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/make/build.xml	Fri Jan 09 13:28:02 2015 -0500
@@ -209,7 +209,7 @@
   </target>
 
   <target name="javadoc" depends="jar">
-    <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="src/overview.html" 
+    <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="${src.dir}/overview.html" 
         extdirs="${nashorn.ext.path}" windowtitle="${nashorn.product.name} ${nashorn.version}"
         additionalparam="-quiet" failonerror="true">
       <classpath>
--- a/nashorn/make/nbproject/ide-targets.xml	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/make/nbproject/ide-targets.xml	Fri Jan 09 13:28:02 2015 -0500
@@ -32,9 +32,8 @@
         </nbjpdastart>
         <java classname="jdk.nashorn.tools.Shell" classpath="${run.test.classpath}" dir="samples" fork="true">
 	    <jvmarg line="-Dnashorn.optimistic"/>
-            <jvmarg line="${ext.class.path}"/> 
+            <jvmarg line="${boot.class.path}"/> 
             <jvmarg line="${run.test.jvmargs}"/>
-            <arg value="../samples/test.js"/>
             <jvmarg value="-Xdebug"/>
             <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
         </java>
--- a/nashorn/make/nbproject/project.xml	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/make/nbproject/project.xml	Fri Jan 09 13:28:02 2015 -0500
@@ -38,10 +38,6 @@
                     <encoding>UTF-8</encoding>
                 </source-folder>
                 <source-folder>
-                    <label>../src</label>
-                    <location>../src</location>
-                </source-folder>
-                <source-folder>
                     <label>../test/src</label>
                     <location>../test/src</location>
                 </source-folder>
@@ -50,21 +46,25 @@
                     <location>../buildtools/nasgen/src</location>
                 </source-folder>
                 <source-folder>
+                    <label>../src/jdk.scripting.nashorn/share/classes</label>
+                    <location>../src/jdk.scripting.nashorn/share/classes</location>
+                </source-folder>
+                <source-folder>
                     <label>../test/src</label>
                     <type>java</type>
                     <location>../test/src</location>
                     <encoding>UTF-8</encoding>
                 </source-folder>
                 <source-folder>
-                    <label>../src</label>
+                    <label>../buildtools/nasgen/src</label>
                     <type>java</type>
-                    <location>../src</location>
+                    <location>../buildtools/nasgen/src</location>
                     <encoding>UTF-8</encoding>
                 </source-folder>
                 <source-folder>
-                    <label>../buildtools/nasgen/src</label>
+                    <label>../src/jdk.scripting.nashorn/share/classes</label>
                     <type>java</type>
-                    <location>../buildtools/nasgen/src</location>
+                    <location>../src/jdk.scripting.nashorn/share/classes</location>
                     <encoding>UTF-8</encoding>
                 </source-folder>
             </folders>
@@ -132,12 +132,12 @@
                         <location>../test/src</location>
                     </source-folder>
                     <source-folder style="packages">
-                        <label>../src</label>
-                        <location>../src</location>
+                        <label>../buildtools/nasgen/src</label>
+                        <location>../buildtools/nasgen/src</location>
                     </source-folder>
                     <source-folder style="packages">
-                        <label>../buildtools/nasgen/src</label>
-                        <location>../buildtools/nasgen/src</location>
+                        <label>../src/jdk.scripting.nashorn/share/classes</label>
+                        <location>../src/jdk.scripting.nashorn/share/classes</location>
                     </source-folder>
                     <source-file>
                         <location>build.xml</location>
@@ -159,11 +159,7 @@
             <compilation-unit>
                 <package-root>../test/src</package-root>
                 <unit-tests/>
-                <classpath mode="compile">../test/lib/testng.jar:../build/classes:../src</classpath>
-                <source-level>1.7</source-level>
-            </compilation-unit>
-            <compilation-unit>
-                <package-root>../src</package-root>
+                <classpath mode="compile">../test/lib/testng.jar:../build/classes:../src/jdk.scripting.nashorn/share/classes</classpath>
                 <source-level>1.7</source-level>
             </compilation-unit>
             <compilation-unit>
@@ -171,6 +167,10 @@
                 <classpath mode="compile">../build/classes:../src</classpath>
                 <source-level>1.7</source-level>
             </compilation-unit>
+            <compilation-unit>
+                <package-root>../src/jdk.scripting.nashorn/share/classes</package-root>
+                <source-level>1.7</source-level>
+            </compilation-unit>
         </java-data>
     </configuration>
 </project>
--- a/nashorn/make/project.properties	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/make/project.properties	Fri Jan 09 13:28:02 2015 -0500
@@ -24,7 +24,7 @@
 application.title=nashorn
 
 # location of JDK embedded ASM sources
-jdk.asm.src.dir=../jdk/src/share/classes/jdk/internal/org/objectweb/asm
+jdk.asm.src.dir=../jdk/src/java.base/share/classes/jdk/internal/org/objectweb/asm
 
 # source and target levels
 build.compiler=modern
--- a/nashorn/samples/browser_dom.js	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/samples/browser_dom.js	Fri Jan 09 13:28:02 2015 -0500
@@ -1,4 +1,4 @@
-#// Usage: jjs -fx browser.js
+#// Usage: jjs -fx browser_dom.js
 
 /*
  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 if (!$OPTIONS._fx) {
-    print("Usage: jjs -fx browser.js");
+    print("Usage: jjs -fx browser_dom.js");
     exit(1);
 }
 
@@ -40,7 +40,6 @@
 var ChangeListener = Java.type("javafx.beans.value.ChangeListener");
 var Scene     = Java.type("javafx.scene.Scene");
 var WebView   = Java.type("javafx.scene.web.WebView");
-var EventListener = Java.type("org.w3c.dom.events.EventListener");
 
 // JavaFX start method
 function start(stage) {
@@ -74,10 +73,10 @@
                var btn = document.createElement("button");
                var n = 0;
                // attach a button handler - nashorn function!
-               btn.onclick = new EventListener(function() {
+               btn.onclick = function() {
                    n++; print("You clicked " + n + " time(s)");
                    print("you clicked OK " + wv.engine.executeScript("okCount"));
-               });
+               };
                // attach text to button
                var t = document.createTextNode("Click Me!"); 
                btn.appendChild(t);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/time_color.fx	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,89 @@
+#// Usage: jjs -fx time_color.js [-- true/false]
+
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// A simple javafx program that changes background color
+// of scene based on current time value (once per sec).
+// inspired by http://whatcolourisit.scn9a.org/
+
+if (!$OPTIONS._fx) {
+    print("Usage: jjs -fx time_color.js");
+    print("       jjs -fx time_color.js -- true");
+    exit(1);
+}
+
+// JavaFX classes used
+var Color = Java.type("javafx.scene.paint.Color");
+var Group = Java.type("javafx.scene.Group");
+var Label = Java.type("javafx.scene.control.Label");
+var Platform = Java.type("javafx.application.Platform");
+var Scene = Java.type("javafx.scene.Scene");
+var Timer = Java.type("java.util.Timer");
+
+// execute function periodically once per given time in millisec
+function setInterval(func, ms) {
+    // New timer, run as daemon so the application can quit
+    var timer = new Timer("setInterval", true);
+    timer.schedule(function() Platform.runLater(func), ms, ms);	
+    return timer;
+}
+
+// do you want to flip hour/min/sec for RGB?
+var flip = arguments.length > 0? "true".equals(arguments[0]) : false;
+
+// JavaFX start method
+function start(stage) {
+    start.title = "Time Color";
+    var root = new Group();
+    var label = new Label("time");
+    label.textFill = Color.WHITE;
+    root.children.add(label); 
+    stage.scene = new Scene(root, 700, 500);
+
+    setInterval(function() {
+        var d = new Date();
+        var hours = d.getHours();
+	var mins = d.getMinutes();
+	var secs = d.getSeconds();
+
+        if (hours < 10) hours = "0" + hours;
+        if (mins < 10) mins = "0" + mins;
+        if (secs < 10) secs = "0" + secs;
+
+	var hex = flip?
+            "#" + secs + mins + hours : "#" + hours + mins + secs;
+        label.text = "Color: " + hex;
+        stage.scene.fill = Color.web(hex);
+    }, 1000);
+
+    stage.show();
+}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java	Fri Jan 09 13:28:02 2015 -0500
@@ -40,21 +40,22 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.function.Function;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.AccessNode;
-import jdk.nashorn.internal.ir.BaseNode;
 import jdk.nashorn.internal.ir.BinaryNode;
 import jdk.nashorn.internal.ir.Block;
 import jdk.nashorn.internal.ir.BreakNode;
 import jdk.nashorn.internal.ir.BreakableNode;
+import jdk.nashorn.internal.ir.CallNode;
 import jdk.nashorn.internal.ir.CaseNode;
 import jdk.nashorn.internal.ir.CatchNode;
 import jdk.nashorn.internal.ir.ContinueNode;
 import jdk.nashorn.internal.ir.Expression;
+import jdk.nashorn.internal.ir.ExpressionStatement;
 import jdk.nashorn.internal.ir.ForNode;
 import jdk.nashorn.internal.ir.FunctionNode;
 import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
+import jdk.nashorn.internal.ir.GetSplitState;
 import jdk.nashorn.internal.ir.IdentNode;
 import jdk.nashorn.internal.ir.IfNode;
 import jdk.nashorn.internal.ir.IndexNode;
@@ -65,9 +66,11 @@
 import jdk.nashorn.internal.ir.LexicalContext;
 import jdk.nashorn.internal.ir.LexicalContextNode;
 import jdk.nashorn.internal.ir.LiteralNode;
+import jdk.nashorn.internal.ir.LiteralNode.ArrayLiteralNode;
 import jdk.nashorn.internal.ir.LocalVariableConversion;
 import jdk.nashorn.internal.ir.LoopNode;
 import jdk.nashorn.internal.ir.Node;
+import jdk.nashorn.internal.ir.ObjectNode;
 import jdk.nashorn.internal.ir.PropertyNode;
 import jdk.nashorn.internal.ir.ReturnNode;
 import jdk.nashorn.internal.ir.RuntimeNode;
@@ -82,6 +85,7 @@
 import jdk.nashorn.internal.ir.UnaryNode;
 import jdk.nashorn.internal.ir.VarNode;
 import jdk.nashorn.internal.ir.WhileNode;
+import jdk.nashorn.internal.ir.WithNode;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.parser.TokenType;
 
@@ -131,8 +135,44 @@
         OBJECT(Type.OBJECT);
 
         private final Type type;
+        private final TypeHolderExpression typeExpression;
+
         private LvarType(final Type type) {
             this.type = type;
+            this.typeExpression = new TypeHolderExpression(type);
+        }
+    }
+
+    /**
+     * A bogus Expression subclass that only reports its type. Used to interrogate BinaryNode and UnaryNode about their
+     * types by creating temporary copies of them and replacing their operands with instances of these. An alternative
+     * solution would be to add BinaryNode.getType(Type lhsType, Type rhsType) and UnaryNode.getType(Type exprType)
+     * methods. For the time being though, this is easier to implement and is in fact fairly clean. It does result in
+     * generation of higher number of temporary short lived nodes, though.
+     */
+    private static class TypeHolderExpression extends Expression {
+        private static final long serialVersionUID = 1L;
+
+        private final Type type;
+
+        TypeHolderExpression(final Type type) {
+            super(0L, 0, 0);
+            this.type = type;
+        }
+
+        @Override
+        public Node accept(final NodeVisitor<? extends LexicalContext> visitor) {
+            throw new AssertionError();
+        }
+
+        @Override
+        public Type getType() {
+            return type;
+        }
+
+        @Override
+        public void toString(final StringBuilder sb, final boolean printType) {
+            throw new AssertionError();
         }
     }
 
@@ -359,6 +399,8 @@
     // allocates a new map. Immutability of maps allows for cheap snapshots by just keeping the reference to the current
     // value.
     private Map<Symbol, LvarType> localVariableTypes = new IdentityHashMap<>();
+    // Stack for evaluated expression types.
+    private final Deque<LvarType> typeStack = new ArrayDeque<>();
 
     // Whether the current point in the AST is reachable code
     private boolean reachable = true;
@@ -375,8 +417,6 @@
     private final Map<IdentNode, LvarType> identifierLvarTypes = new IdentityHashMap<>();
     private final Map<Symbol, SymbolConversions> symbolConversions = new IdentityHashMap<>();
 
-    private SymbolToType symbolToType = new SymbolToType();
-
     // Stack of open labels for starts of catch blocks, one for every currently traversed try block; for inserting
     // control flow edges to them. Note that we currently don't insert actual control flow edges, but instead edges that
     // help us with type calculations. This means that some operations that can result in an exception being thrown
@@ -400,62 +440,56 @@
     private void doesNotContinueSequentially() {
         reachable = false;
         localVariableTypes = Collections.emptyMap();
+        assertTypeStackIsEmpty();
     }
 
+    private boolean pushExpressionType(final Expression expr) {
+        typeStack.push(toLvarType(expr.getType()));
+        return false;
+    }
+
+    @Override
+    public boolean enterAccessNode(final AccessNode accessNode) {
+        visitExpression(accessNode.getBase());
+        return pushExpressionType(accessNode);
+    }
 
     @Override
     public boolean enterBinaryNode(final BinaryNode binaryNode) {
         // NOTE: regardless of operator's lexical associativity, lhs is always evaluated first.
         final Expression lhs = binaryNode.lhs();
-        final boolean isAssignment = binaryNode.isAssignment();
-        LvarType lhsTypeOnLoad = null;
-        if(isAssignment) {
-            if(lhs instanceof BaseNode) {
-                ((BaseNode)lhs).getBase().accept(this);
-                if(lhs instanceof IndexNode) {
-                    ((IndexNode)lhs).getIndex().accept(this);
-                } else {
-                    assert lhs instanceof AccessNode;
-                }
-            } else {
-                assert lhs instanceof IdentNode;
-                if(binaryNode.isSelfModifying()) {
-                    final IdentNode ident = ((IdentNode)lhs);
-                    ident.accept(this);
-                    // Self-assignment can cause a change in the type of the variable. For purposes of evaluating
-                    // the type of the operation, we must use its type as it was when it was loaded. If we didn't
-                    // do this, some awkward expressions would end up being calculated incorrectly, e.g.
-                    // "var x; x += x = 0;". In this case we have undefined+int so the result type is double (NaN).
-                    // However, if we used the type of "x" on LHS after we evaluated RHS, we'd see int+int, so the
-                    // result type would be either optimistic int or pessimistic long, which would be wrong.
-                    lhsTypeOnLoad = getLocalVariableTypeIfBytecode(ident.getSymbol());
-                }
-            }
+        final LvarType lhsType;
+        if (!(lhs instanceof IdentNode && binaryNode.tokenType() == TokenType.ASSIGN)) {
+            lhsType = visitExpression(lhs);
         } else {
-            lhs.accept(this);
+            // Can't visit IdentNode on LHS of a simple assignment, as visits imply use, and this is def.
+            // The type is irrelevant, as only RHS is used to determine the type anyway.
+            lhsType = LvarType.UNDEFINED;
         }
 
         final boolean isLogical = binaryNode.isLogical();
-        assert !(isAssignment && isLogical); // there are no logical assignment operators in JS
         final Label joinLabel = isLogical ? new Label("") : null;
         if(isLogical) {
             jumpToLabel((JoinPredecessor)lhs, joinLabel);
         }
 
         final Expression rhs = binaryNode.rhs();
-        rhs.accept(this);
+        final LvarType rhsType = visitExpression(rhs);
         if(isLogical) {
             jumpToLabel((JoinPredecessor)rhs, joinLabel);
         }
         joinOnLabel(joinLabel);
 
-        if(isAssignment && lhs instanceof IdentNode) {
+        final LvarType type = toLvarType(binaryNode.setOperands(lhsType.typeExpression, rhsType.typeExpression).getType());
+
+        if(binaryNode.isAssignment() && lhs instanceof IdentNode) {
             if(binaryNode.isSelfModifying()) {
-                onSelfAssignment((IdentNode)lhs, binaryNode, lhsTypeOnLoad);
+                onSelfAssignment((IdentNode)lhs, type);
             } else {
-                onAssignment((IdentNode)lhs, rhs);
+                onAssignment((IdentNode)lhs, type);
             }
         }
+        typeStack.push(type);
         return false;
     }
 
@@ -475,6 +509,17 @@
     }
 
     @Override
+    public boolean enterCallNode(final CallNode callNode) {
+        visitExpression(callNode.getFunction());
+        visitExpressions(callNode.getArgs());
+        final CallNode.EvalArgs evalArgs = callNode.getEvalArgs();
+        if (evalArgs != null) {
+            visitExpressions(evalArgs.getArgs());
+        }
+        return pushExpressionType(callNode);
+    }
+
+    @Override
     public boolean enterContinueNode(final ContinueNode continueNode) {
         return enterJumpStatement(continueNode);
     }
@@ -483,6 +528,7 @@
         if(!reachable) {
             return false;
         }
+        assertTypeStackIsEmpty();
         final BreakableNode target = jump.getTarget(lc);
         jumpToLabel(jump, jump.getTargetLabel(target), getBreakTargetTypes(target));
         doesNotContinueSequentially();
@@ -495,6 +541,7 @@
     }
 
     private void enterDoWhileLoop(final WhileNode loopNode) {
+        assertTypeStackIsEmpty();
         final JoinPredecessorExpression test = loopNode.getTest();
         final Block body = loopNode.getBody();
         final Label continueLabel = loopNode.getContinueLabel();
@@ -512,7 +559,7 @@
             if(!reachable) {
                 break;
             }
-            test.accept(this);
+            visitExpressionOnEmptyStack(test);
             jumpToLabel(test, breakLabel);
             if(isAlwaysFalse(test)) {
                 break;
@@ -535,6 +582,45 @@
     }
 
     @Override
+    public boolean enterExpressionStatement(final ExpressionStatement expressionStatement) {
+        if (reachable) {
+            visitExpressionOnEmptyStack(expressionStatement.getExpression());
+        }
+        return false;
+    }
+
+    private void assertTypeStackIsEmpty() {
+        assert typeStack.isEmpty();
+    }
+
+    @Override
+    protected Node leaveDefault(final Node node) {
+        assert !(node instanceof Expression); // All expressions were handled
+        assert !(node instanceof Statement) || typeStack.isEmpty(); // No statements leave with a non-empty stack
+        return node;
+    }
+
+    private LvarType visitExpressionOnEmptyStack(final Expression expr) {
+        assertTypeStackIsEmpty();
+        return visitExpression(expr);
+    }
+
+    private LvarType visitExpression(final Expression expr) {
+        final int stackSize = typeStack.size();
+        expr.accept(this);
+        assert typeStack.size() == stackSize + 1;
+        return typeStack.pop();
+    }
+
+    private void visitExpressions(final List<Expression> exprs) {
+        for(final Expression expr: exprs) {
+            if (expr != null) {
+                visitExpression(expr);
+            }
+        }
+    }
+
+    @Override
     public boolean enterForNode(final ForNode forNode) {
         if(!reachable) {
             return false;
@@ -543,7 +629,7 @@
         final Expression init = forNode.getInit();
         if(forNode.isForIn()) {
             final JoinPredecessorExpression iterable = forNode.getModify();
-            iterable.accept(this);
+            visitExpression(iterable);
             enterTestFirstLoop(forNode, null, init,
                     // If we're iterating over property names, and we can discern from the runtime environment
                     // of the compilation that the object being iterated over must use strings for property
@@ -552,16 +638,18 @@
                     !compiler.useOptimisticTypes() || (!forNode.isForEach() && compiler.hasStringPropertyIterator(iterable.getExpression())));
         } else {
             if(init != null) {
-                init.accept(this);
+                visitExpressionOnEmptyStack(init);
             }
             enterTestFirstLoop(forNode, forNode.getModify(), null, false);
         }
+        assertTypeStackIsEmpty();
         return false;
     }
 
     @Override
     public boolean enterFunctionNode(final FunctionNode functionNode) {
         if(alreadyEnteredTopLevelFunction) {
+            typeStack.push(LvarType.OBJECT);
             return false;
         }
         int pos = 0;
@@ -603,11 +691,20 @@
     }
 
     @Override
+    public boolean enterGetSplitState(final GetSplitState getSplitState) {
+        return pushExpressionType(getSplitState);
+    }
+
+    @Override
     public boolean enterIdentNode(final IdentNode identNode) {
         final Symbol symbol = identNode.getSymbol();
         if(symbol.isBytecodeLocal()) {
             symbolIsUsed(symbol);
-            setIdentifierLvarType(identNode, getLocalVariableType(symbol));
+            final LvarType type = getLocalVariableType(symbol);
+            setIdentifierLvarType(identNode, type);
+            typeStack.push(type);
+        } else {
+            pushExpressionType(identNode);
         }
         return false;
     }
@@ -622,11 +719,12 @@
         final Block pass = ifNode.getPass();
         final Block fail = ifNode.getFail();
 
-        test.accept(this);
+        visitExpressionOnEmptyStack(test);
 
         final Map<Symbol, LvarType> afterTestLvarTypes = localVariableTypes;
         if(!isAlwaysFalse(test)) {
             pass.accept(this);
+            assertTypeStackIsEmpty();
         }
         final Map<Symbol, LvarType> passLvarTypes = localVariableTypes;
         final boolean reachableFromPass = reachable;
@@ -635,6 +733,7 @@
         localVariableTypes = afterTestLvarTypes;
         if(!isAlwaysTrue(test) && fail != null) {
             fail.accept(this);
+            assertTypeStackIsEmpty();
             final boolean reachableFromFail = reachable;
             reachable |= reachableFromPass;
             if(!reachable) {
@@ -667,15 +766,54 @@
     }
 
     @Override
-    public boolean enterPropertyNode(final PropertyNode propertyNode) {
-        // Avoid falsely adding property keys to the control flow graph
-        if(propertyNode.getValue() != null) {
-            propertyNode.getValue().accept(this);
+    public boolean enterIndexNode(final IndexNode indexNode) {
+        visitExpression(indexNode.getBase());
+        visitExpression(indexNode.getIndex());
+        return pushExpressionType(indexNode);
+    }
+
+    @Override
+    public boolean enterJoinPredecessorExpression(final JoinPredecessorExpression joinExpr) {
+        final Expression expr = joinExpr.getExpression();
+        if (expr != null) {
+            expr.accept(this);
+        } else {
+            typeStack.push(LvarType.UNDEFINED);
         }
         return false;
     }
 
     @Override
+    public boolean enterLiteralNode(final LiteralNode<?> literalNode) {
+        if (literalNode instanceof ArrayLiteralNode) {
+            final List<Expression> expressions = ((ArrayLiteralNode)literalNode).getElementExpressions();
+            if (expressions != null) {
+                visitExpressions(expressions);
+            }
+        }
+        pushExpressionType(literalNode);
+        return false;
+    }
+
+    @Override
+    public boolean enterObjectNode(final ObjectNode objectNode) {
+        for(final PropertyNode propertyNode: objectNode.getElements()) {
+            // Avoid falsely adding property keys to the control flow graph
+            final Expression value = propertyNode.getValue();
+            if (value != null) {
+                visitExpression(value);
+            }
+        }
+        return pushExpressionType(objectNode);
+    }
+
+    @Override
+    public boolean enterPropertyNode(final PropertyNode propertyNode) {
+        // Property nodes are only accessible through object literals, and we handled that case above
+        throw new AssertionError();
+    }
+
+    @Override
     public boolean enterReturnNode(final ReturnNode returnNode) {
         if(!reachable) {
             return false;
@@ -684,9 +822,9 @@
         final Expression returnExpr = returnNode.getExpression();
         final Type returnExprType;
         if(returnExpr != null) {
-            returnExpr.accept(this);
-            returnExprType = getType(returnExpr);
+            returnExprType = visitExpressionOnEmptyStack(returnExpr).type;
         } else {
+            assertTypeStackIsEmpty();
             returnExprType = Type.UNDEFINED;
         }
         returnType = Type.widestReturnType(returnType, returnExprType);
@@ -695,6 +833,12 @@
     }
 
     @Override
+    public boolean enterRuntimeNode(final RuntimeNode runtimeNode) {
+        visitExpressions(runtimeNode.getArgs());
+        return pushExpressionType(runtimeNode);
+    }
+
+    @Override
     public boolean enterSplitReturn(final SplitReturn splitReturn) {
         doesNotContinueSequentially();
         return false;
@@ -706,8 +850,7 @@
             return false;
         }
 
-        final Expression expr = switchNode.getExpression();
-        expr.accept(this);
+        visitExpressionOnEmptyStack(switchNode.getExpression());
 
         final List<CaseNode> cases = switchNode.getCases();
         if(cases.isEmpty()) {
@@ -724,7 +867,7 @@
         for(final CaseNode caseNode: cases) {
             final Expression test = caseNode.getTest();
             if(!isInteger && test != null) {
-                test.accept(this);
+                visitExpressionOnEmptyStack(test);
                 if(!tagUsed) {
                     symbolIsUsed(switchNode.getTag(), LvarType.OBJECT);
                     tagUsed = true;
@@ -769,29 +912,42 @@
         final Expression trueExpr = ternaryNode.getTrueExpression();
         final Expression falseExpr = ternaryNode.getFalseExpression();
 
-        test.accept(this);
+        visitExpression(test);
 
         final Map<Symbol, LvarType> testExitLvarTypes = localVariableTypes;
+        final LvarType trueType;
         if(!isAlwaysFalse(test)) {
-            trueExpr.accept(this);
+            trueType = visitExpression(trueExpr);
+        } else {
+            trueType = null;
         }
         final Map<Symbol, LvarType> trueExitLvarTypes = localVariableTypes;
         localVariableTypes = testExitLvarTypes;
+        final LvarType falseType;
         if(!isAlwaysTrue(test)) {
-            falseExpr.accept(this);
+            falseType = visitExpression(falseExpr);
+        } else {
+            falseType = null;
         }
         final Map<Symbol, LvarType> falseExitLvarTypes = localVariableTypes;
         localVariableTypes = getUnionTypes(trueExitLvarTypes, falseExitLvarTypes);
         setConversion((JoinPredecessor)trueExpr, trueExitLvarTypes, localVariableTypes);
         setConversion((JoinPredecessor)falseExpr, falseExitLvarTypes, localVariableTypes);
+
+        typeStack.push(trueType != null ? falseType != null ? widestLvarType(trueType, falseType) : trueType : assertNotNull(falseType));
         return false;
     }
 
+    private static <T> T assertNotNull(final T t) {
+        assert t != null;
+        return t;
+    }
+
     private void enterTestFirstLoop(final LoopNode loopNode, final JoinPredecessorExpression modify,
             final Expression iteratorValues, final boolean iteratorValuesAreObject) {
         final JoinPredecessorExpression test = loopNode.getTest();
         if(isAlwaysFalse(test)) {
-            test.accept(this);
+            visitExpressionOnEmptyStack(test);
             return;
         }
 
@@ -804,7 +960,7 @@
             jumpToLabel(loopNode, repeatLabel, beforeLoopTypes);
             final Map<Symbol, LvarType> beforeRepeatTypes = localVariableTypes;
             if(test != null) {
-                test.accept(this);
+                visitExpressionOnEmptyStack(test);
             }
             if(!isAlwaysTrue(test)) {
                 jumpToLabel(test, breakLabel);
@@ -827,7 +983,7 @@
                 break;
             }
             if(modify != null) {
-                modify.accept(this);
+                visitExpressionOnEmptyStack(modify);
                 jumpToLabel(modify, repeatLabel);
                 joinOnLabel(repeatLabel);
             }
@@ -853,7 +1009,7 @@
             return false;
         }
 
-        throwNode.getExpression().accept(this);
+        visitExpressionOnEmptyStack(throwNode.getExpression());
         jumpToCatchBlock(throwNode);
         doesNotContinueSequentially();
         return false;
@@ -892,7 +1048,7 @@
             onAssignment(exception, LvarType.OBJECT);
             final Expression condition = catchNode.getExceptionCondition();
             if(condition != null) {
-                condition.accept(this);
+                visitExpression(condition);
             }
             final Map<Symbol, LvarType> afterConditionTypes = localVariableTypes;
             final Block catchBody = catchNode.getBody();
@@ -927,14 +1083,11 @@
     @Override
     public boolean enterUnaryNode(final UnaryNode unaryNode) {
         final Expression expr = unaryNode.getExpression();
-        expr.accept(this);
-
-        if(unaryNode.isSelfModifying()) {
-            if(expr instanceof IdentNode) {
-                final IdentNode ident = (IdentNode)expr;
-                onSelfAssignment(ident, unaryNode, getLocalVariableTypeIfBytecode(ident.getSymbol()));
-            }
+        final LvarType unaryType = toLvarType(unaryNode.setExpression(visitExpression(expr).typeExpression).getType());
+        if(unaryNode.isSelfModifying() && expr instanceof IdentNode) {
+            onSelfAssignment((IdentNode)expr, unaryType);
         }
+        typeStack.push(unaryType);
         return false;
     }
 
@@ -945,8 +1098,7 @@
         }
         final Expression init = varNode.getInit();
         if(init != null) {
-            init.accept(this);
-            onAssignment(varNode.getName(), init);
+            onAssignment(varNode.getName(), visitExpression(init));
         }
         return false;
     }
@@ -964,6 +1116,15 @@
         return false;
     }
 
+    @Override
+    public boolean enterWithNode(final WithNode withNode) {
+        if (reachable) {
+            visitExpression(withNode.getExpression());
+            withNode.getBody().accept(this);
+        }
+        return false;
+    };
+
     private Map<Symbol, LvarType> getBreakTargetTypes(final BreakableNode target) {
         // Remove symbols defined in the the blocks that are being broken out of.
         Map<Symbol, LvarType> types = localVariableTypes;
@@ -1002,18 +1163,6 @@
     }
 
     /**
-     * Gets the type for a local variable if it is a bytecode local, otherwise null. Can be used in circumstances where
-     * the type is irrelevant if the symbol is not a bytecode local. Note that for bytecode locals, it delegates to
-     * {@link #getLocalVariableType(Symbol)}, so it will still assert that the type for such variable is already
-     * defined (that is, not null).
-     * @param symbol the symbol representing the variable.
-     * @return the current variable type, if it is a bytecode local, otherwise null.
-     */
-    private LvarType getLocalVariableTypeIfBytecode(final Symbol symbol) {
-        return symbol.isBytecodeLocal() ? getLocalVariableType(symbol) : null;
-    }
-
-    /**
      * Gets the type for a variable represented by a symbol, or null if the type is not know. This is the least strict
      * of all local variable type getters, and as such its use is discouraged except in initialization scenarios (where
      * a just-defined symbol might still be null).
@@ -1154,6 +1303,7 @@
      */
     private void leaveBreakable(final BreakableNode breakable) {
         joinOnLabel(breakable.getBreakLabel());
+        assertTypeStackIsEmpty();
     }
 
     @Override
@@ -1329,10 +1479,6 @@
         return conv == null || !conv.isLive();
     }
 
-    private void onAssignment(final IdentNode identNode, final Expression rhs) {
-        onAssignment(identNode, toLvarType(getType(rhs)));
-    }
-
     private void onAssignment(final IdentNode identNode, final LvarType type) {
         final Symbol symbol = identNode.getSymbol();
         assert symbol != null : identNode.getName();
@@ -1400,13 +1546,12 @@
         jumpToCatchBlock(identNode);
     }
 
-    private void onSelfAssignment(final IdentNode identNode, final Expression assignment, final LvarType typeOnLoad) {
+    private void onSelfAssignment(final IdentNode identNode, final LvarType type) {
         final Symbol symbol = identNode.getSymbol();
         assert symbol != null : identNode.getName();
         if(!symbol.isBytecodeLocal()) {
             return;
         }
-        final LvarType type = toLvarType(getType(assignment, symbol, typeOnLoad.type));
         // Self-assignment never produce either a boolean or undefined
         assert type != null && type != LvarType.UNDEFINED && type != LvarType.BOOLEAN;
         setType(symbol, type);
@@ -1466,7 +1611,6 @@
      * @param symbol the symbol representing the variable
      * @param type the type
      */
-    @SuppressWarnings("unused")
     private void setType(final Symbol symbol, final LvarType type) {
         if(getLocalVariableTypeOrNull(symbol) == type) {
             return;
@@ -1486,77 +1630,4 @@
     private void symbolIsUsed(final Symbol symbol) {
         symbolIsUsed(symbol, getLocalVariableType(symbol));
     }
-
-    /**
-     * Gets the type of the expression, dependent on the current types of the local variables.
-     *
-     * @param expr the expression
-     * @return the current type of the expression dependent on the current types of the local variables.
-     */
-    private Type getType(final Expression expr) {
-        return expr.getType(getSymbolToType());
-    }
-
-    /**
-     * Returns a function object from symbols to their types, used by the expressions to evaluate their type.
-     * {@link BinaryNode} specifically uses identity of the function to cache type calculations. This method makes
-     * sure to return the same function object while the local variable types don't change, and create a new function
-     * object if the local variable types have been changed.
-     * @return a function object representing a mapping from symbols to their types.
-     */
-    private Function<Symbol, Type> getSymbolToType() {
-        if(symbolToType.isStale()) {
-            symbolToType = new SymbolToType();
-        }
-        return symbolToType;
-    }
-
-    private class SymbolToType implements Function<Symbol, Type> {
-        private final Object boundTypes = localVariableTypes;
-        @Override
-        public Type apply(final Symbol t) {
-            return getLocalVariableType(t).type;
-        }
-
-        boolean isStale() {
-            return boundTypes != localVariableTypes;
-        }
-    }
-
-    /**
-     * Gets the type of the expression, dependent on the current types of the local variables and a single overridden
-     * symbol type. Used by type calculation on compound operators to ensure the type of the LHS at the time it was
-     * loaded (which can potentially be different after RHS evaluation, e.g. "var x; x += x = 0;") is preserved for
-     * the calculation.
-     *
-     * @param expr the expression
-     * @param overriddenSymbol the overridden symbol
-     * @param overriddenType the overridden type
-     * @return the current type of the expression dependent on the current types of the local variables and the single
-     * potentially overridden type.
-     */
-    private Type getType(final Expression expr, final Symbol overriddenSymbol, final Type overriddenType) {
-        return expr.getType(getSymbolToType(overriddenSymbol, overriddenType));
-    }
-
-    private Function<Symbol, Type> getSymbolToType(final Symbol overriddenSymbol, final Type overriddenType) {
-        return getLocalVariableType(overriddenSymbol).type == overriddenType ? getSymbolToType() :
-            new SymbolToTypeOverride(overriddenSymbol, overriddenType);
-    }
-
-    private class SymbolToTypeOverride implements Function<Symbol, Type> {
-        private final Function<Symbol, Type> originalSymbolToType = getSymbolToType();
-        private final Symbol overriddenSymbol;
-        private final Type overriddenType;
-
-        SymbolToTypeOverride(final Symbol overriddenSymbol, final Type overriddenType) {
-            this.overriddenSymbol = overriddenSymbol;
-            this.overriddenType = overriddenType;
-        }
-
-        @Override
-        public Type apply(final Symbol symbol) {
-            return symbol == overriddenSymbol ? overriddenType : originalSymbolToType.apply(symbol);
-        }
-    }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java	Fri Jan 09 13:28:02 2015 -0500
@@ -67,7 +67,7 @@
 import jdk.nashorn.internal.runtime.options.Options;
 
 /**
- * Static utility that encapsulates persistence of type information for functions compiled with optimistic
+ * <p>Static utility that encapsulates persistence of type information for functions compiled with optimistic
  * typing. With this feature enabled, when a JavaScript function is recompiled because it gets deoptimized,
  * the type information for deoptimization is stored in a cache file. If the same function is compiled in a
  * subsequent JVM invocation, the type information is used for initial compilation, thus allowing the system
@@ -83,6 +83,7 @@
  * {@code nashorn.typeInfo.cleanupDelaySeconds} system property. You can also specify the word
  * {@code unlimited} as the value for {@code nashorn.typeInfo.maxFiles} in which case the type info cache is
  * allowed to grow without limits.
+ * </p>
  */
 public final class OptimisticTypesPersistence {
     // Default is 0, for disabling the feature when not specified. A reasonable default when enabled is
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BaseNode.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BaseNode.java	Fri Jan 09 13:28:02 2015 -0500
@@ -27,7 +27,6 @@
 
 import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT;
 
-import java.util.function.Function;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.annotations.Immutable;
 
@@ -98,7 +97,7 @@
     }
 
     @Override
-    public Type getType(final Function<Symbol, Type> localVariableTypes) {
+    public Type getType() {
         return type == null ? getMostPessimisticType() : type;
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BinaryNode.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BinaryNode.java	Fri Jan 09 13:28:02 2015 -0500
@@ -31,7 +31,6 @@
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
-import java.util.function.Function;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.annotations.Ignore;
 import jdk.nashorn.internal.ir.annotations.Immutable;
@@ -57,9 +56,7 @@
     private final int programPoint;
 
     private final Type type;
-
     private transient Type cachedType;
-    private transient Object cachedTypeFunction;
 
     @Ignore
     private static final Set<TokenType> CAN_OVERFLOW =
@@ -143,24 +140,6 @@
         }
     }
 
-    private static final Function<Symbol, Type> UNKNOWN_LOCALS = new Function<Symbol, Type>() {
-        @Override
-        public Type apply(final Symbol t) {
-            return null;
-        }
-    };
-
-    /**
-     * Return the widest possible type for this operation. This is used for compile time
-     * static type inference
-     *
-     * @return Type
-     */
-    @Override
-    public Type getWidestOperationType() {
-        return getWidestOperationType(UNKNOWN_LOCALS);
-    }
-
     /**
      * Return the widest possible operand type for this operation.
      *
@@ -181,14 +160,15 @@
         }
     }
 
-    private Type getWidestOperationType(final Function<Symbol, Type> localVariableTypes) {
+    @Override
+    public Type getWidestOperationType() {
         switch (tokenType()) {
         case ADD:
         case ASSIGN_ADD: {
             // Compare this logic to decideType(Type, Type); it's similar, but it handles the optimistic type
             // calculation case while this handles the conservative case.
-            final Type lhsType = lhs.getType(localVariableTypes);
-            final Type rhsType = rhs.getType(localVariableTypes);
+            final Type lhsType = lhs.getType();
+            final Type rhsType = rhs.getType();
             if(lhsType == Type.BOOLEAN && rhsType == Type.BOOLEAN) {
                 // Will always fit in an int, as the value range is [0, 1, 2]. If we didn't treat them specially here,
                 // they'd end up being treated as generic INT operands and their sum would be conservatively considered
@@ -238,8 +218,8 @@
         case SUB:
         case ASSIGN_MUL:
         case ASSIGN_SUB: {
-            final Type lhsType = lhs.getType(localVariableTypes);
-            final Type rhsType = rhs.getType(localVariableTypes);
+            final Type lhsType = lhs.getType();
+            final Type rhsType = rhs.getType();
             if(lhsType == Type.BOOLEAN && rhsType == Type.BOOLEAN) {
                 return Type.INT;
             }
@@ -253,20 +233,20 @@
             return Type.UNDEFINED;
         }
         case ASSIGN: {
-            return rhs.getType(localVariableTypes);
+            return rhs.getType();
         }
         case INSTANCEOF: {
             return Type.BOOLEAN;
         }
         case COMMALEFT: {
-            return lhs.getType(localVariableTypes);
+            return lhs.getType();
         }
         case COMMARIGHT: {
-            return rhs.getType(localVariableTypes);
+            return rhs.getType();
         }
         case AND:
         case OR:{
-            return Type.widestReturnType(lhs.getType(localVariableTypes), rhs.getType(localVariableTypes));
+            return Type.widestReturnType(lhs.getType(), rhs.getType());
         }
         default:
             if (isComparison()) {
@@ -487,7 +467,7 @@
 
     /**
      * Set the right hand side expression for this node
-     * @param rhs new left hand side expression
+     * @param rhs new right hand side expression
      * @return a node equivalent to this one except for the requested change.
      */
     public BinaryNode setRHS(final Expression rhs) {
@@ -497,6 +477,19 @@
         return new BinaryNode(this, lhs, rhs, type, programPoint);
     }
 
+    /**
+     * Set both the left and the right hand side expression for this node
+     * @param lhs new left hand side expression
+     * @param rhs new left hand side expression
+     * @return a node equivalent to this one except for the requested change.
+     */
+    public BinaryNode setOperands(final Expression lhs, final Expression rhs) {
+        if (this.lhs == lhs && this.rhs == rhs) {
+            return this;
+        }
+        return new BinaryNode(this, lhs, rhs, type, programPoint);
+    }
+
     @Override
     public int getProgramPoint() {
         return programPoint;
@@ -541,24 +534,22 @@
     }
 
     @Override
-    public Type getType(final Function<Symbol, Type> localVariableTypes) {
-        if(localVariableTypes == cachedTypeFunction) {
-            return cachedType;
+    public Type getType() {
+        if (cachedType == null) {
+            cachedType = getTypeUncached();
         }
-        cachedType = getTypeUncached(localVariableTypes);
-        cachedTypeFunction = localVariableTypes;
         return cachedType;
     }
 
-    private Type getTypeUncached(final Function<Symbol, Type> localVariableTypes) {
+    private Type getTypeUncached() {
         if(type == OPTIMISTIC_UNDECIDED_TYPE) {
-            return decideType(lhs.getType(localVariableTypes), rhs.getType(localVariableTypes));
+            return decideType(lhs.getType(), rhs.getType());
         }
-        final Type widest = getWidestOperationType(localVariableTypes);
+        final Type widest = getWidestOperationType();
         if(type == null) {
             return widest;
         }
-        return Type.narrowest(widest, Type.widest(type, Type.widest(lhs.getType(localVariableTypes), rhs.getType(localVariableTypes))));
+        return Type.narrowest(widest, Type.widest(type, Type.widest(lhs.getType(), rhs.getType())));
     }
 
     private static Type decideType(final Type lhsType, final Type rhsType) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/CallNode.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/CallNode.java	Fri Jan 09 13:28:02 2015 -0500
@@ -30,7 +30,6 @@
 import java.io.Serializable;
 import java.util.Collections;
 import java.util.List;
-import java.util.function.Function;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.annotations.Ignore;
 import jdk.nashorn.internal.ir.annotations.Immutable;
@@ -154,7 +153,7 @@
     }
 
     @Override
-    public Type getType(final Function<Symbol, Type> localVariableTypes) {
+    public Type getType() {
         return optimisticType == null ? Type.OBJECT : optimisticType;
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Expression.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Expression.java	Fri Jan 09 13:28:02 2015 -0500
@@ -25,7 +25,6 @@
 
 package jdk.nashorn.internal.ir;
 
-import java.util.function.Function;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.runtime.UnwarrantedOptimismException;
 
@@ -39,14 +38,7 @@
 
     static final String OPT_IDENTIFIER = "%";
 
-    private static final Function<Symbol, Type> UNKNOWN_LOCALS = new Function<Symbol, Type>() {
-        @Override
-        public Type apply(final Symbol t) {
-            return null;
-        }
-    };
-
-    Expression(final long token, final int start, final int finish) {
+    protected Expression(final long token, final int start, final int finish) {
         super(token, start, finish);
     }
 
@@ -63,18 +55,7 @@
      *
      * @return the type of the expression.
      */
-    public final Type getType() {
-        return getType(UNKNOWN_LOCALS);
-    }
-
-    /**
-     * Returns the type of the expression under the specified symbol-to-type mapping. By default delegates to
-     * {@link #getType()} but expressions whose type depends on their subexpressions' types and expressions whose type
-     * depends on symbol type ({@link IdentNode}) will have a special implementation.
-     * @param localVariableTypes a mapping from symbols to their types, used for type calculation.
-     * @return the type of the expression under the specified symbol-to-type mapping.
-     */
-    public abstract Type getType(final Function<Symbol, Type> localVariableTypes);
+    public abstract Type getType();
 
     /**
      * Returns {@code true} if this expression depends exclusively on state that is constant
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/FunctionNode.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/FunctionNode.java	Fri Jan 09 13:28:02 2015 -0500
@@ -36,7 +36,6 @@
 import java.util.EnumSet;
 import java.util.Iterator;
 import java.util.List;
-import java.util.function.Function;
 import jdk.nashorn.internal.AssertsEnabled;
 import jdk.nashorn.internal.codegen.CompileUnit;
 import jdk.nashorn.internal.codegen.Compiler;
@@ -1101,7 +1100,7 @@
     }
 
     @Override
-    public Type getType(final Function<Symbol, Type> localVariableTypes) {
+    public Type getType() {
         return FUNCTION_TYPE;
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/GetSplitState.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/GetSplitState.java	Fri Jan 09 13:28:02 2015 -0500
@@ -25,7 +25,6 @@
 
 package jdk.nashorn.internal.ir;
 
-import java.util.function.Function;
 import jdk.nashorn.internal.codegen.CompilerConstants;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
@@ -47,7 +46,7 @@
     }
 
     @Override
-    public Type getType(final Function<Symbol, Type> localVariableTypes) {
+    public Type getType() {
         return Type.INT;
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/IdentNode.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/IdentNode.java	Fri Jan 09 13:28:02 2015 -0500
@@ -30,7 +30,6 @@
 import static jdk.nashorn.internal.codegen.CompilerConstants.__LINE__;
 import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT;
 
-import java.util.function.Function;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
@@ -118,14 +117,13 @@
     }
 
     @Override
-    public Type getType(final Function<Symbol, Type> localVariableTypes) {
+    public Type getType() {
         if(type != null) {
             return type;
         } else if(symbol != null && symbol.isScope()) {
             return Type.OBJECT;
         }
-        final Type symbolType = localVariableTypes.apply(symbol);
-        return symbolType == null ? Type.UNDEFINED : symbolType;
+        return Type.UNDEFINED;
     }
 
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/JoinPredecessorExpression.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/JoinPredecessorExpression.java	Fri Jan 09 13:28:02 2015 -0500
@@ -25,7 +25,6 @@
 
 package jdk.nashorn.internal.ir;
 
-import java.util.function.Function;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 
@@ -71,8 +70,8 @@
     }
 
     @Override
-    public Type getType(final Function<Symbol, Type> localVariableTypes) {
-        return expression.getType(localVariableTypes);
+    public Type getType() {
+        return expression.getType();
     }
 
     @Override
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LiteralNode.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LiteralNode.java	Fri Jan 09 13:28:02 2015 -0500
@@ -29,7 +29,6 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
-import java.util.function.Function;
 import jdk.nashorn.internal.codegen.CompileUnit;
 import jdk.nashorn.internal.codegen.types.ArrayType;
 import jdk.nashorn.internal.codegen.types.Type;
@@ -109,7 +108,7 @@
     }
 
     @Override
-    public Type getType(final Function<Symbol, Type> localVariableTypes) {
+    public Type getType() {
         return Type.typeFor(value.getClass());
     }
 
@@ -164,16 +163,6 @@
     }
 
     /**
-     * Get the array value of the node
-     *
-     * @return the array value
-     */
-    public Node[] getArray() {
-        assert false : "not an array node";
-        return null;
-    }
-
-    /**
      * Fetch String value of node.
      *
      * @return String value of node.
@@ -325,7 +314,7 @@
         }
 
         @Override
-        public Type getType(final Function<Symbol, Type> localVariableTypes) {
+        public Type getType() {
             return Type.BOOLEAN;
         }
 
@@ -389,7 +378,7 @@
         }
 
         @Override
-        public Type getType(final Function<Symbol, Type> localVariableTypes) {
+        public Type getType() {
             return type;
         }
 
@@ -519,7 +508,7 @@
         }
 
         @Override
-        public Type getType(final Function<Symbol, Type> localVariableTypes) {
+        public Type getType() {
             return Type.OBJECT;
         }
 
@@ -589,7 +578,7 @@
         }
 
         @Override
-        public Type getType(final Function<Symbol, Type> localVariableTypes) {
+        public Type getType() {
             return Type.OBJECT;
         }
 
@@ -840,9 +829,13 @@
             this.units       = units;
         }
 
-        @Override
-        public Node[] getArray() {
-            return value;
+        /**
+         * Returns a list of array element expressions. Note that empty array elements manifest themselves as
+         * null.
+         * @return a list of array element expressions.
+         */
+        public List<Expression> getElementExpressions() {
+            return Collections.unmodifiableList(Arrays.asList(value));
         }
 
         /**
@@ -879,7 +872,7 @@
         }
 
         @Override
-        public Type getType(final Function<Symbol, Type> localVariableTypes) {
+        public Type getType() {
             return Type.typeFor(NativeArray.class);
         }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ObjectNode.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ObjectNode.java	Fri Jan 09 13:28:02 2015 -0500
@@ -27,7 +27,6 @@
 
 import java.util.Collections;
 import java.util.List;
-import java.util.function.Function;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
@@ -69,7 +68,7 @@
     }
 
     @Override
-    public Type getType(final Function<Symbol, Type> localVariableTypes) {
+    public Type getType() {
         return Type.OBJECT;
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/RuntimeNode.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/RuntimeNode.java	Fri Jan 09 13:28:02 2015 -0500
@@ -30,7 +30,6 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
-import java.util.function.Function;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
@@ -460,7 +459,7 @@
      * Return type for the ReferenceNode
      */
     @Override
-    public Type getType(final Function<Symbol, Type> localVariableTypes) {
+    public Type getType() {
         return request.getReturnType();
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/TernaryNode.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/TernaryNode.java	Fri Jan 09 13:28:02 2015 -0500
@@ -25,7 +25,6 @@
 
 package jdk.nashorn.internal.ir;
 
-import java.util.function.Function;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
@@ -122,8 +121,8 @@
     }
 
     @Override
-    public Type getType(final Function<Symbol, Type> localVariableTypes) {
-        return Type.widestReturnType(getTrueExpression().getType(localVariableTypes), getFalseExpression().getType(localVariableTypes));
+    public Type getType() {
+        return Type.widestReturnType(getTrueExpression().getType(), getFalseExpression().getType());
     }
 
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/UnaryNode.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/UnaryNode.java	Fri Jan 09 13:28:02 2015 -0500
@@ -33,7 +33,6 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
-import java.util.function.Function;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.annotations.Ignore;
 import jdk.nashorn.internal.ir.annotations.Immutable;
@@ -123,23 +122,11 @@
         return isAssignment();
     }
 
-    private static final Function<Symbol, Type> UNKNOWN_LOCALS = new Function<Symbol, Type>() {
-        @Override
-        public Type apply(final Symbol t) {
-            return null;
-        }
-    };
-
-
     @Override
     public Type getWidestOperationType() {
-        return getWidestOperationType(UNKNOWN_LOCALS);
-    }
-
-    private Type getWidestOperationType(final Function<Symbol, Type> localVariableTypes) {
         switch (tokenType()) {
         case ADD:
-            final Type operandType = getExpression().getType(localVariableTypes);
+            final Type operandType = getExpression().getType();
             if(operandType == Type.BOOLEAN) {
                 return Type.INT;
             } else if(operandType.isObject()) {
@@ -326,12 +313,12 @@
     }
 
     @Override
-    public Type getType(final Function<Symbol, Type> localVariableTypes) {
-        final Type widest = getWidestOperationType(localVariableTypes);
+    public Type getType() {
+        final Type widest = getWidestOperationType();
         if(type == null) {
             return widest;
         }
-        return Type.narrowest(widest, Type.widest(type, expression.getType(localVariableTypes)));
+        return Type.narrowest(widest, Type.widest(type, expression.getType()));
     }
 
     @Override
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/JSONWriter.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/JSONWriter.java	Fri Jan 09 13:28:02 2015 -0500
@@ -28,7 +28,6 @@
 import static jdk.nashorn.internal.runtime.Source.sourceFor;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 import jdk.nashorn.internal.ir.AccessNode;
 import jdk.nashorn.internal.ir.BinaryNode;
@@ -553,8 +552,7 @@
             type("ArrayExpression");
             comma();
 
-            final Node[] value = literalNode.getArray();
-            array("elements", Arrays.asList(value));
+            array("elements", ((LiteralNode.ArrayLiteralNode)literalNode).getElementExpressions());
         } else {
             type("Literal");
             comma();
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java	Fri Jan 09 13:28:02 2015 -0500
@@ -275,7 +275,7 @@
         final PropertyDescriptor newLenDesc = desc;
 
         // Step 3c and 3d - get new length and convert to long
-        final long newLen = NativeArray.validLength(newLenDesc.getValue(), true);
+        final long newLen = NativeArray.validLength(newLenDesc.getValue());
 
         // Step 3e
         newLenDesc.setValue(newLen);
@@ -348,8 +348,8 @@
         final PropertyDescriptor oldLenDesc = (PropertyDescriptor) super.getOwnPropertyDescriptor("length");
 
         // Step 2
-        // get old length and convert to long
-        final long oldLen = NativeArray.validLength(oldLenDesc.getValue(), true);
+        // get old length and convert to long. Always a Long/Uint32 but we take the safe road.
+        final long oldLen = JSType.toUint32(oldLenDesc.getValue());
 
         // Step 3
         if ("length".equals(key)) {
@@ -471,7 +471,7 @@
     @Setter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE)
     public static void length(final Object self, final Object length) {
         if (isArray(self)) {
-            ((ScriptObject)self).setLength(validLength(length, true));
+            ((ScriptObject)self).setLength(validLength(length));
         }
     }
 
@@ -495,18 +495,13 @@
         length(self, length);  // Same as instance setter but we can't make nasgen use the same method for prototype
     }
 
-    static long validLength(final Object length, final boolean reject) {
+    static long validLength(final Object length) {
+        // ES5 15.4.5.1, steps 3.c and 3.d require two ToNumber conversions here
         final double doubleLength = JSType.toNumber(length);
-        if (!Double.isNaN(doubleLength) && JSType.isRepresentableAsLong(doubleLength)) {
-            final long len = (long) doubleLength;
-            if (len >= 0 && len <= JSType.MAX_UINT) {
-                return len;
-            }
-        }
-        if (reject) {
+        if (doubleLength != JSType.toUint32(length)) {
             throw rangeError("inappropriate.array.length", ScriptRuntime.safeToString(length));
         }
-        return -1;
+        return (long) doubleLength;
     }
 
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeRegExpExecResult.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeRegExpExecResult.java	Fri Jan 09 13:28:02 2015 -0500
@@ -88,7 +88,7 @@
     @Setter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE)
     public static void length(final Object self, final Object length) {
         if (self instanceof ScriptObject) {
-            ((ScriptObject)self).setLength(NativeArray.validLength(length, true));
+            ((ScriptObject)self).setLength(NativeArray.validLength(length));
         }
     }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeInstaller.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeInstaller.java	Fri Jan 09 13:28:02 2015 -0500
@@ -86,7 +86,7 @@
      * @param source the script source
      * @param mainClassName the main class name
      * @param classBytes map of class names to class bytes
-     * @param initializers compilation id -> FunctionInitializer map
+     * @param initializers compilation id -&gt; FunctionInitializer map
      * @param constants constants array
      * @param compilationId compilation id
      */
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java	Fri Jan 09 13:28:02 2015 -0500
@@ -180,10 +180,10 @@
     /** Div exact wrapper for potentially integer division that turns into float point */
     public static final Call DIV_EXACT_LONG       = staticCall(JSTYPE_LOOKUP, JSType.class, "divExact", long.class, long.class, long.class, int.class);
 
-    /** Div zero wrapper for long division that handles (0/0) >>> 0 == 0 */
+    /** Div zero wrapper for long division that handles (0/0) &gt;&gt;&gt; 0 == 0 */
     public static final Call DIV_ZERO_LONG        = staticCall(JSTYPE_LOOKUP, JSType.class, "divZero", long.class, long.class, long.class);
 
-    /** Mod zero wrapper for long division that handles (0%0) >>> 0 == 0 */
+    /** Mod zero wrapper for long division that handles (0%0) &gt;&gt;&gt; 0 == 0 */
     public static final Call REM_ZERO_LONG       = staticCall(JSTYPE_LOOKUP, JSType.class, "remZero", long.class, long.class, long.class);
 
     /** Mod exact wrapper for potentially integer remainders that turns into float point */
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StoredScript.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StoredScript.java	Fri Jan 09 13:28:02 2015 -0500
@@ -58,7 +58,7 @@
      * @param compilationId compilation id
      * @param mainClassName main class name
      * @param classBytes map of class names to class bytes
-     * @param initializers initializer map, id -> FunctionInitializer
+     * @param initializers initializer map, id -&gt; FunctionInitializer
      * @param constants constants array
      */
     public StoredScript(final int compilationId, final String mainClassName, final Map<String, byte[]> classBytes, final Map<Integer, FunctionInitializer> initializers, final Object[] constants) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Fri Jan 09 13:28:02 2015 -0500
@@ -275,7 +275,7 @@
     /**
      * Align an array size up to the nearest array chunk size
      * @param size size required
-     * @return size given, always >= size
+     * @return size given, always &gt;= size
      */
     protected final static int alignUp(final int size) {
         return size + CHUNK_SIZE - 1 & ~(CHUNK_SIZE - 1);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundCallableLinker.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundCallableLinker.java	Fri Jan 09 13:28:02 2015 -0500
@@ -99,7 +99,7 @@
         MethodType newMethodType = descriptor.getMethodType().changeParameterType(0, callable.getClass());
         if (isCall) {
             // R(callable.class, T1, ...) => R(callable.class, boundThis.class, ...)
-            newMethodType = newMethodType.changeParameterType(1, boundThis.getClass());
+            newMethodType = newMethodType.changeParameterType(1, boundThis == null? Object.class : boundThis.getClass());
         }
         // R(callable.class[, boundThis.class], T2, ...) => R(callable.class[, boundThis.class], boundArg0.class, ..., boundArgn.class, T2, ...)
         for(int i = boundArgs.length; i-- > 0;) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java	Fri Jan 09 13:28:02 2015 -0500
@@ -40,6 +40,7 @@
 import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
 import jdk.nashorn.internal.lookup.MethodHandleFactory;
 import jdk.nashorn.internal.lookup.MethodHandleFunctionality;
+import jdk.nashorn.internal.runtime.ConsString;
 import jdk.nashorn.internal.runtime.JSType;
 
 /**
@@ -118,20 +119,21 @@
     private GuardedInvocation lookup(final CallSiteDescriptor desc, final LinkRequest request, final LinkerServices linkerServices) throws Exception {
         final String operator = CallSiteDescriptorFactory.tokenizeOperators(desc).get(0);
         final int c = desc.getNameTokenCount();
+        GuardedInvocation inv;
+        try {
+            inv = nashornBeansLinker.getGuardedInvocation(request, linkerServices);
+        } catch (Throwable th) {
+            inv = null;
+        }
 
         switch (operator) {
             case "getProp":
             case "getElem":
             case "getMethod":
-                if (c > 2) {
-                    return findGetMethod(desc);
-                }
-            // For indexed get, we want GuardedInvocation from beans linker and pass it.
-            // BrowserJSObjectLinker.get uses this fallback getter for explicit signature method access.
-            return findGetIndexMethod(nashornBeansLinker.getGuardedInvocation(request, linkerServices));
+                return c > 2? findGetMethod(desc, inv) : findGetIndexMethod(inv);
             case "setProp":
             case "setElem":
-                return c > 2 ? findSetMethod(desc) : findSetIndexMethod();
+                return c > 2? findSetMethod(desc, inv) : findSetIndexMethod();
             case "call":
                 return findCallMethod(desc);
             default:
@@ -139,7 +141,10 @@
         }
     }
 
-    private static GuardedInvocation findGetMethod(final CallSiteDescriptor desc) {
+    private static GuardedInvocation findGetMethod(final CallSiteDescriptor desc, final GuardedInvocation inv) {
+        if (inv != null) {
+            return inv;
+        }
         final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND);
         final MethodHandle getter = MH.insertArguments(JSOBJECT_GETMEMBER, 1, name);
         return new GuardedInvocation(getter, IS_JSOBJECT_GUARD);
@@ -150,7 +155,10 @@
         return inv.replaceMethods(getter, inv.getGuard());
     }
 
-    private static GuardedInvocation findSetMethod(final CallSiteDescriptor desc) {
+    private static GuardedInvocation findSetMethod(final CallSiteDescriptor desc, final GuardedInvocation inv) {
+        if (inv != null) {
+            return inv;
+        }
         final MethodHandle getter = MH.insertArguments(JSOBJECT_SETMEMBER, 1, desc.getNameToken(2));
         return new GuardedInvocation(getter, IS_JSOBJECT_GUARD);
     }
@@ -178,12 +186,12 @@
             if (index > -1) {
                 return JSOBJECT_GETSLOT.invokeExact(jsobj, index);
             }
-        } else if (key instanceof String) {
-            final String name = (String)key;
+        } else if (key instanceof String || key instanceof ConsString) {
+            final String name = key.toString();
             if (name.indexOf('(') != -1) {
-                return fallback.invokeExact(jsobj, key);
+                return fallback.invokeExact(jsobj, (Object) name);
             }
-            return JSOBJECT_GETMEMBER.invokeExact(jsobj, (String)key);
+            return JSOBJECT_GETMEMBER.invokeExact(jsobj, name);
         }
         return null;
     }
@@ -194,8 +202,8 @@
             JSOBJECT_SETSLOT.invokeExact(jsobj, (int)key, value);
         } else if (key instanceof Number) {
             JSOBJECT_SETSLOT.invokeExact(jsobj, getIndex((Number)key), value);
-        } else if (key instanceof String) {
-            JSOBJECT_SETMEMBER.invokeExact(jsobj, (String)key, value);
+        } else if (key instanceof String || key instanceof ConsString) {
+            JSOBJECT_SETMEMBER.invokeExact(jsobj, key.toString(), value);
         }
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Fri Jan 09 13:28:02 2015 -0500
@@ -42,6 +42,7 @@
 import jdk.nashorn.api.scripting.JSObject;
 import jdk.nashorn.internal.lookup.MethodHandleFactory;
 import jdk.nashorn.internal.lookup.MethodHandleFunctionality;
+import jdk.nashorn.internal.runtime.ConsString;
 import jdk.nashorn.internal.runtime.JSType;
 
 /**
@@ -185,11 +186,11 @@
             if (index > -1) {
                 return ((JSObject)jsobj).getSlot(index);
             }
-        } else if (key instanceof String) {
-            final String name = (String)key;
+        } else if (key instanceof String || key instanceof ConsString) {
+            final String name = key.toString();
             // get with method name and signature. delegate it to beans linker!
             if (name.indexOf('(') != -1) {
-                return fallback.invokeExact(jsobj, key);
+                return fallback.invokeExact(jsobj, (Object) name);
             }
             return ((JSObject)jsobj).getMember(name);
         }
@@ -202,8 +203,8 @@
             ((JSObject)jsobj).setSlot((Integer)key, value);
         } else if (key instanceof Number) {
             ((JSObject)jsobj).setSlot(getIndex((Number)key), value);
-        } else if (key instanceof String) {
-            ((JSObject)jsobj).setMember((String)key, value);
+        } else if (key instanceof String || key instanceof ConsString) {
+            ((JSObject)jsobj).setMember(key.toString(), value);
         }
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java	Fri Jan 09 13:28:02 2015 -0500
@@ -26,17 +26,23 @@
 package jdk.nashorn.internal.runtime.linker;
 
 import static jdk.nashorn.internal.lookup.Lookup.MH;
+import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
+
 import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
 import java.lang.invoke.SwitchPoint;
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.LinkRequest;
+import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
 import jdk.internal.dynalink.support.Guards;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.FindProperty;
 import jdk.nashorn.internal.runtime.GlobalConstants;
+import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ScriptObject;
+import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.UserAccessorProperty;
 
 /**
@@ -46,6 +52,11 @@
  */
 public final class PrimitiveLookup {
 
+    /** Method handle to link setters on primitive base. See ES5 8.7.2. */
+    private static final MethodHandle PRIMITIVE_SETTER = findOwnMH("primitiveSetter",
+            MH.type(void.class, ScriptObject.class, Object.class, Object.class, boolean.class, Object.class));
+
+
     private PrimitiveLookup() {
     }
 
@@ -87,40 +98,58 @@
                                                     final ScriptObject wrappedReceiver, final MethodHandle wrapFilter,
                                                     final MethodHandle protoFilter) {
         final CallSiteDescriptor desc = request.getCallSiteDescriptor();
+        final String name;
+        final FindProperty find;
 
-        //checks whether the property name is hard-coded in the call-site (i.e. a getProp vs a getElem, or setProp vs setElem)
-        //if it is we can make assumptions on the property: that if it is not defined on primitive wrapper itself it never will be.
-        //so in that case we can skip creation of primitive wrapper and start our search with the prototype.
         if (desc.getNameTokenCount() > 2) {
-            final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND);
-            final FindProperty find = wrappedReceiver.findProperty(name, true);
+            name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND);
+            find = wrappedReceiver.findProperty(name, true);
+        } else {
+            name = null;
+            find = null;
+        }
 
-            if (find == null) {
-                // Give up early, give chance to BeanLinker and NashornBottomLinker to deal with it.
-                return null;
-            }
+        final String firstOp = CallSiteDescriptorFactory.tokenizeOperators(desc).get(0);
 
-            final SwitchPoint sp = find.getProperty().getBuiltinSwitchPoint(); //can use this instead of proto filter
-            if (sp instanceof Context.BuiltinSwitchPoint && !sp.hasBeenInvalidated()) {
-                return new GuardedInvocation(GlobalConstants.staticConstantGetter(find.getObjectValue()), guard, sp, null);
-            }
+        switch (firstOp) {
+        case "getProp":
+        case "getElem":
+        case "getMethod":
+            //checks whether the property name is hard-coded in the call-site (i.e. a getProp vs a getElem, or setProp vs setElem)
+            //if it is we can make assumptions on the property: that if it is not defined on primitive wrapper itself it never will be.
+            //so in that case we can skip creation of primitive wrapper and start our search with the prototype.
+            if (name != null) {
+                if (find == null) {
+                    // Give up early, give chance to BeanLinker and NashornBottomLinker to deal with it.
+                    return null;
+                }
 
-            if (find.isInherited() && !(find.getProperty() instanceof UserAccessorProperty)) {
-                // If property is found in the prototype object bind the method handle directly to
-                // the proto filter instead of going through wrapper instantiation below.
-                final ScriptObject proto = wrappedReceiver.getProto();
-                final GuardedInvocation link = proto.lookup(desc, request);
+                final SwitchPoint sp = find.getProperty().getBuiltinSwitchPoint(); //can use this instead of proto filter
+                if (sp instanceof Context.BuiltinSwitchPoint && !sp.hasBeenInvalidated()) {
+                    return new GuardedInvocation(GlobalConstants.staticConstantGetter(find.getObjectValue()), guard, sp, null);
+                }
 
-                if (link != null) {
-                    final MethodHandle invocation = link.getInvocation(); //this contains the builtin switchpoint
+                if (find.isInherited() && !(find.getProperty() instanceof UserAccessorProperty)) {
+                    // If property is found in the prototype object bind the method handle directly to
+                    // the proto filter instead of going through wrapper instantiation below.
+                    final ScriptObject proto = wrappedReceiver.getProto();
+                    final GuardedInvocation link = proto.lookup(desc, request);
 
-                    final MethodHandle adaptedInvocation = MH.asType(invocation, invocation.type().changeParameterType(0, Object.class));
-                    final MethodHandle method = MH.filterArguments(adaptedInvocation, 0, protoFilter);
-                    final MethodHandle protoGuard = MH.filterArguments(link.getGuard(), 0, protoFilter);
-
-                    return new GuardedInvocation(method, NashornGuards.combineGuards(guard, protoGuard));
+                    if (link != null) {
+                        final MethodHandle invocation = link.getInvocation(); //this contains the builtin switchpoint
+                        final MethodHandle adaptedInvocation = MH.asType(invocation, invocation.type().changeParameterType(0, Object.class));
+                        final MethodHandle method = MH.filterArguments(adaptedInvocation, 0, protoFilter);
+                        final MethodHandle protoGuard = MH.filterArguments(link.getGuard(), 0, protoFilter);
+                        return new GuardedInvocation(method, NashornGuards.combineGuards(guard, protoGuard));
+                    }
                 }
             }
+            break;
+        case "setProp":
+        case "setElem":
+            return getPrimitiveSetter(name, guard, wrapFilter, NashornCallSiteDescriptor.isStrict(desc));
+        default:
+            break;
         }
 
         final GuardedInvocation link = wrappedReceiver.lookup(desc, request);
@@ -138,4 +167,41 @@
 
         return null;
     }
+
+    private static GuardedInvocation getPrimitiveSetter(final String name, final MethodHandle guard,
+                                                        final MethodHandle wrapFilter, final boolean isStrict) {
+        MethodHandle filter = MH.asType(wrapFilter, wrapFilter.type().changeReturnType(ScriptObject.class));
+        final MethodHandle target;
+
+        if (name == null) {
+            filter = MH.dropArguments(filter, 1, Object.class, Object.class);
+            target = MH.insertArguments(PRIMITIVE_SETTER, 3, isStrict);
+        } else {
+            filter = MH.dropArguments(filter, 1, Object.class);
+            target = MH.insertArguments(PRIMITIVE_SETTER, 2, name, isStrict);
+        }
+
+        return new GuardedInvocation(MH.foldArguments(target, filter), guard);
+    }
+
+
+    @SuppressWarnings("unused")
+    private static void primitiveSetter(final ScriptObject wrappedSelf, final Object self, final Object key,
+                                        final boolean strict, final Object value) {
+        // See ES5.1 8.7.2 PutValue (V, W)
+        final String name = JSType.toString(key);
+        final FindProperty find = wrappedSelf.findProperty(name, true);
+        if (find == null || !(find.getProperty() instanceof UserAccessorProperty) || !find.getProperty().isWritable()) {
+            if (strict) {
+                throw typeError("property.not.writable", name, ScriptRuntime.safeToString(self));
+            }
+            return;
+        }
+        // property found and is a UserAccessorProperty
+        find.setValue(value, strict);
+    }
+
+    private static MethodHandle findOwnMH(final String name, final MethodType type) {
+        return MH.findStatic(MethodHandles.lookup(), PrimitiveLookup.class, name, type);
+    }
 }
--- a/nashorn/test/script/basic/JDK-8055762.js	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/test/script/basic/JDK-8055762.js	Fri Jan 09 13:28:02 2015 -0500
@@ -74,9 +74,12 @@
         }
     };
 
+    var a = "a";
     print(obj["foo"]);
+    print(obj[a + "bc"]);
     print(obj[2]);
     obj.bar = 23;
+    obj[a + "bc"] = 23;
     obj[3] = 23;
     obj.func("hello");
 }
--- a/nashorn/test/script/basic/JDK-8055762.js.EXPECTED	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/test/script/basic/JDK-8055762.js.EXPECTED	Fri Jan 09 13:28:02 2015 -0500
@@ -1,5 +1,7 @@
 FOO
+ABC
 0
 bar set to 23
+abc set to 23
 [3] set to 23
 func called with hello
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8066215.js	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8066215: Fuzzing bug: length valueOf bug
+ *
+ * @test
+ * @run
+ */
+
+function defineLength(arr, length) {
+    Object.defineProperty(arr, "length", {
+        value: {
+            valueOf: function() {
+                print("value retrieved: " + length);
+                return length;
+            }
+        }
+    });
+    print("done: " + arr.length + ", " + typeof arr.length);
+}
+
+var a = [];
+defineLength(a, 3);
+defineLength(a, 6);
+defineLength(a, 3);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8066215.js.EXPECTED	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,9 @@
+value retrieved: 3
+value retrieved: 3
+done: 3, number
+value retrieved: 6
+value retrieved: 6
+done: 6, number
+value retrieved: 3
+value retrieved: 3
+done: 3, number
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8066226.js	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ *
+ JDK-8066226: Fuzzing bug: parameter counts differ in TypeConverterFactory
+ *
+ * @test
+ * @run
+ */
+
+Object.defineProperty(Object.prototype, "accessor", {
+    set: function(value) {
+        print("Setting accessor on " + this + " to " + value);
+    }
+});
+
+Object.defineProperty(Object.prototype, "getterOnly", {
+    get: function() {
+        return 1;
+    }
+});
+
+function set(o) {
+    print("set(" + o + ")");
+    o.foo = 1;
+    o.constructor = 1;
+    o.accessor = 1;
+    o.getterOnly = 1;
+    print();
+}
+
+function setStrict(o) {
+    "use strict";
+    print("setStrict(" + o + ")")
+    try {
+        o.foo = 1;
+    } catch (e) {
+        print(e);
+    }
+    try {
+        o.constructor = 1;
+    } catch (e) {
+        print(e);
+    }
+    try {
+        o.accessor = 1;
+    } catch (e) {
+        print(e);
+    }
+    try {
+        o.getterOnly = 1;
+    } catch (e) {
+        print(e);
+    }
+    print();
+}
+
+function setAttr(o, id) {
+    print("setAttr(" + o + ", " + id + ")")
+    o[id] = 1;
+    print();
+}
+
+function setAttrStrict(o, id) {
+    "use strict";
+    print("setAttrStrict(" + o + ", " + id + ")")
+    try {
+        o[id] = 1;
+    } catch (e) {
+        print(e);
+    }
+    print();
+}
+
+set(1);
+set("str");
+set(true);
+set({});
+set([]);
+
+setStrict(1);
+setStrict("str");
+setStrict(true);
+setStrict({});
+setStrict([]);
+
+setAttr(1, "foo");
+setAttr(1, "constructor");
+setAttr(1, "accessor");
+setAttr(1, "getterOnly");
+setAttr("str", "foo");
+setAttr("str", "constructor");
+setAttr("str", "accessor");
+setAttr("str", "getterOnly");
+setAttr(true, "foo");
+setAttr(true, "constructor");
+setAttr(true, "accessor");
+setAttr(true, "getterOnly");
+
+setAttrStrict(1, "foo");
+setAttrStrict(1, "constructor");
+setAttrStrict(1, "accessor");
+setAttrStrict(1, "getterOnly");
+setAttrStrict("str", "foo");
+setAttrStrict("str", "constructor");
+setAttrStrict("str", "accessor");
+setAttrStrict("str", "getterOnly");
+setAttrStrict(true, "foo");
+setAttrStrict(true, "constructor");
+setAttrStrict(true, "accessor");
+setAttrStrict(true, "getterOnly");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8066226.js.EXPECTED	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,104 @@
+set(1)
+Setting accessor on 1 to 1
+
+set(str)
+Setting accessor on str to 1
+
+set(true)
+Setting accessor on true to 1
+
+set([object Object])
+Setting accessor on [object Object] to 1
+
+set()
+Setting accessor on  to 1
+
+setStrict(1)
+TypeError: "foo" is not a writable property of 1
+TypeError: "constructor" is not a writable property of 1
+Setting accessor on 1 to 1
+TypeError: Cannot set property "getterOnly" of [object Object] that has only a getter
+
+setStrict(str)
+TypeError: "foo" is not a writable property of str
+TypeError: "constructor" is not a writable property of str
+Setting accessor on str to 1
+TypeError: Cannot set property "getterOnly" of [object Object] that has only a getter
+
+setStrict(true)
+TypeError: "foo" is not a writable property of true
+TypeError: "constructor" is not a writable property of true
+Setting accessor on true to 1
+TypeError: Cannot set property "getterOnly" of [object Object] that has only a getter
+
+setStrict([object Object])
+Setting accessor on [object Object] to 1
+TypeError: Cannot set property "getterOnly" of [object Object] that has only a getter
+
+setStrict()
+Setting accessor on  to 1
+TypeError: Cannot set property "getterOnly" of [object Array] that has only a getter
+
+setAttr(1, foo)
+
+setAttr(1, constructor)
+
+setAttr(1, accessor)
+Setting accessor on 1 to 1
+
+setAttr(1, getterOnly)
+
+setAttr(str, foo)
+
+setAttr(str, constructor)
+
+setAttr(str, accessor)
+Setting accessor on str to 1
+
+setAttr(str, getterOnly)
+
+setAttr(true, foo)
+
+setAttr(true, constructor)
+
+setAttr(true, accessor)
+Setting accessor on true to 1
+
+setAttr(true, getterOnly)
+
+setAttrStrict(1, foo)
+TypeError: "foo" is not a writable property of 1
+
+setAttrStrict(1, constructor)
+TypeError: "constructor" is not a writable property of 1
+
+setAttrStrict(1, accessor)
+Setting accessor on 1 to 1
+
+setAttrStrict(1, getterOnly)
+TypeError: Cannot set property "getterOnly" of [object Object] that has only a getter
+
+setAttrStrict(str, foo)
+TypeError: "foo" is not a writable property of str
+
+setAttrStrict(str, constructor)
+TypeError: "constructor" is not a writable property of str
+
+setAttrStrict(str, accessor)
+Setting accessor on str to 1
+
+setAttrStrict(str, getterOnly)
+TypeError: Cannot set property "getterOnly" of [object Object] that has only a getter
+
+setAttrStrict(true, foo)
+TypeError: "foo" is not a writable property of true
+
+setAttrStrict(true, constructor)
+TypeError: "constructor" is not a writable property of true
+
+setAttrStrict(true, accessor)
+Setting accessor on true to 1
+
+setAttrStrict(true, getterOnly)
+TypeError: Cannot set property "getterOnly" of [object Object] that has only a getter
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8067774.js	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8067774: Use a stack of types when calculating local variable types
+ *
+ * @test
+ * @run
+ */
+
+print((function (p) {
+    var a, b;
+    
+    a = p ? ((b = 1), b) : 0;
+
+    return a;
+})(true));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8067774.js.EXPECTED	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,1 @@
+1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/trusted/JDK-8067854.js	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8067854: bound java static method throws NPE when 'null' is used for this argument
+ *
+ * @test
+ * @run
+ */
+
+getProp = java.lang.System.getProperty;
+
+// bind this and an argument. "null" for this as getProperty is a
+// static method of java.lang.System
+getHome = Function.prototype.bind.call(getProp, null, "java.home");
+
+if (getHome() != getProp("java.home")) {
+    fail("getHome() failed to get java.home");
+}
--- a/nashorn/test/src/jdk/nashorn/api/scripting/PluggableJSObjectTest.java	Fri Jan 09 05:45:13 2015 -0800
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/PluggableJSObjectTest.java	Fri Jan 09 13:28:02 2015 -0500
@@ -109,6 +109,35 @@
         }
     }
 
+    // @bug 8062030: Nashorn bug retrieving array property after key string concatenation
+    @Test
+    // ConsString attribute access on a JSObject
+    public void consStringTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            final MapWrapperObject obj = new MapWrapperObject();
+            e.put("obj", obj);
+            e.put("f", "f");
+            e.eval("obj[f + 'oo'] = 'bar';");
+
+            assertEquals(obj.getMap().get("foo"), "bar");
+            assertEquals(e.eval("obj[f + 'oo']"), "bar");
+            assertEquals(e.eval("obj['foo']"), "bar");
+            assertEquals(e.eval("f + 'oo' in obj"), Boolean.TRUE);
+            assertEquals(e.eval("'foo' in obj"), Boolean.TRUE);
+            e.eval("delete obj[f + 'oo']");
+            assertFalse(obj.getMap().containsKey("foo"));
+            assertEquals(e.eval("obj[f + 'oo']"), null);
+            assertEquals(e.eval("obj['foo']"), null);
+            assertEquals(e.eval("f + 'oo' in obj"), Boolean.FALSE);
+            assertEquals(e.eval("'foo' in obj"), Boolean.FALSE);
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
     public static class BufferObject extends AbstractJSObject {
         private final IntBuffer buf;
 
--- a/test/Makefile	Fri Jan 09 05:45:13 2015 -0800
+++ b/test/Makefile	Fri Jan 09 13:28:02 2015 -0500
@@ -33,6 +33,7 @@
 # This makefile depends on the availability of sibling directories.
 LANGTOOLS_DIR=$(TOPDIR)/langtools
 JDK_DIR=$(TOPDIR)/jdk
+JAXP_DIR=$(TOPDIR)/jaxp
 HOTSPOT_DIR=$(TOPDIR)/hotspot
 
 # Macro to run a test target in a subdir
@@ -51,10 +52,10 @@
 endef
 
 # Default test target (core)
-default: jdk_core langtools_jtreg
+default: jdk_core langtools_jtreg jaxp_all
 
 # All testing
-all: jdk_all langtools_all
+all: jdk_all langtools_all jaxp_all
 
 # Test targets
 langtools_% :
@@ -63,6 +64,9 @@
 jdk_% core_%s svc_%:
 	@$(NO_STOPPING)$(call SUBDIR_TEST, $(JDK_DIR), TEST="$@" $@)
 
+jaxp_%:
+	@$(NO_STOPPING)$(call SUBDIR_TEST, $(JAXP_DIR), TEST="$@" $@)
+
 hotspot_%:
 	@$(NO_STOPPING)$(call SUBDIR_TEST, $(HOTSPOT_DIR), TEST="$@" $@)
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/Makefile	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,65 @@
+#
+# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.	See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# Utility Makefile that creates wb.jar, which is used to simplify using 
+# the Whitebox API outside the jtreg-testbase.
+
+ifneq "x$(ALT_BOOTDIR)" "x"
+	BOOTDIR := $(ALT_BOOTDIR)
+endif
+
+ifeq "x$(BOOTDIR)" "x"
+	JDK_HOME := $(shell dirname $(shell which java))/..
+else
+	JDK_HOME := $(BOOTDIR)
+endif
+
+SRC_DIR = ./
+BUILD_DIR = build
+OUTPUT_DIR = $(BUILD_DIR)/classes
+
+JAVAC = $(JDK_HOME)/bin/javac
+JAR = $(JDK_HOME)/bin/jar
+
+SRC_FILES = $(shell find $(SRC_DIR) -name '*.java')
+
+.PHONY: filelist clean cleantmp
+
+all: wb.jar cleantmp
+
+wb.jar: filelist
+	@mkdir -p $(OUTPUT_DIR)
+	$(JAVAC) -sourcepath $(SRC_DIR) -d $(OUTPUT_DIR) -cp $(OUTPUT_DIR) @filelist
+	$(JAR) cf wb.jar -C $(OUTPUT_DIR) .
+	@rm -rf $(OUTPUT_DIR)
+
+filelist: $(SRC_FILES)
+	@rm -f $@
+	@echo $(SRC_FILES) > $@
+
+clean: cleantmp
+	@rm -rf wb.jar
+
+cleantmp:
+	@rm -rf filelist
+	@rm -rf $(BUILD_DIR)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/sun/hotspot/WhiteBox.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,254 @@
+/*
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.hotspot;
+
+import java.lang.reflect.Executable;
+import java.util.Arrays;
+import java.util.List;
+import java.util.function.Function;
+import java.util.stream.Stream;
+import java.security.BasicPermission;
+
+import sun.hotspot.parser.DiagnosticCommand;
+
+public class WhiteBox {
+
+  @SuppressWarnings("serial")
+  public static class WhiteBoxPermission extends BasicPermission {
+    public WhiteBoxPermission(String s) {
+      super(s);
+    }
+  }
+
+  private WhiteBox() {}
+  private static final WhiteBox instance = new WhiteBox();
+  private static native void registerNatives();
+
+  /**
+   * Returns the singleton WhiteBox instance.
+   *
+   * The returned WhiteBox object should be carefully guarded
+   * by the caller, since it can be used to read and write data
+   * at arbitrary memory addresses. It must never be passed to
+   * untrusted code.
+   */
+  public synchronized static WhiteBox getWhiteBox() {
+    SecurityManager sm = System.getSecurityManager();
+    if (sm != null) {
+      sm.checkPermission(new WhiteBoxPermission("getInstance"));
+    }
+    return instance;
+  }
+
+  static {
+    registerNatives();
+  }
+
+  // Get the maximum heap size supporting COOPs
+  public native long getCompressedOopsMaxHeapSize();
+  // Arguments
+  public native void printHeapSizes();
+
+  // Memory
+  public native long getObjectAddress(Object o);
+  public native int  getHeapOopSize();
+  public native int  getVMPageSize();
+  public native boolean isObjectInOldGen(Object o);
+  public native long getObjectSize(Object o);
+
+  // Runtime
+  // Make sure class name is in the correct format
+  public boolean isClassAlive(String name) {
+    return isClassAlive0(name.replace('.', '/'));
+  }
+  private native boolean isClassAlive0(String name);
+
+  // JVMTI
+  public native void addToBootstrapClassLoaderSearch(String segment);
+  public native void addToSystemClassLoaderSearch(String segment);
+
+  // G1
+  public native boolean g1InConcurrentMark();
+  public native boolean g1IsHumongous(Object o);
+  public native long    g1NumFreeRegions();
+  public native int     g1RegionSize();
+  public native Object[]    parseCommandLine(String commandline, char delim, DiagnosticCommand[] args);
+
+  // NMT
+  public native long NMTMalloc(long size);
+  public native void NMTFree(long mem);
+  public native long NMTReserveMemory(long size);
+  public native void NMTCommitMemory(long addr, long size);
+  public native void NMTUncommitMemory(long addr, long size);
+  public native void NMTReleaseMemory(long addr, long size);
+  public native long NMTMallocWithPseudoStack(long size, int index);
+  public native boolean NMTIsDetailSupported();
+  public native boolean NMTChangeTrackingLevel();
+  public native int NMTGetHashSize();
+
+  // Compiler
+  public native int     deoptimizeFrames(boolean makeNotEntrant);
+  public native void    deoptimizeAll();
+  public        boolean isMethodCompiled(Executable method) {
+    return isMethodCompiled(method, false /*not osr*/);
+  }
+  public native boolean isMethodCompiled(Executable method, boolean isOsr);
+  public        boolean isMethodCompilable(Executable method) {
+    return isMethodCompilable(method, -1 /*any*/);
+  }
+  public        boolean isMethodCompilable(Executable method, int compLevel) {
+    return isMethodCompilable(method, compLevel, false /*not osr*/);
+  }
+  public native boolean isMethodCompilable(Executable method, int compLevel, boolean isOsr);
+  public native boolean isMethodQueuedForCompilation(Executable method);
+  public        int     deoptimizeMethod(Executable method) {
+    return deoptimizeMethod(method, false /*not osr*/);
+  }
+  public native int     deoptimizeMethod(Executable method, boolean isOsr);
+  public        void    makeMethodNotCompilable(Executable method) {
+    makeMethodNotCompilable(method, -1 /*any*/);
+  }
+  public        void    makeMethodNotCompilable(Executable method, int compLevel) {
+    makeMethodNotCompilable(method, compLevel, false /*not osr*/);
+  }
+  public native void    makeMethodNotCompilable(Executable method, int compLevel, boolean isOsr);
+  public        int     getMethodCompilationLevel(Executable method) {
+    return getMethodCompilationLevel(method, false /*not ost*/);
+  }
+  public native int     getMethodCompilationLevel(Executable method, boolean isOsr);
+  public native boolean testSetDontInlineMethod(Executable method, boolean value);
+  public        int     getCompileQueuesSize() {
+    return getCompileQueueSize(-1 /*any*/);
+  }
+  public native int     getCompileQueueSize(int compLevel);
+  public native boolean testSetForceInlineMethod(Executable method, boolean value);
+  public        boolean enqueueMethodForCompilation(Executable method, int compLevel) {
+    return enqueueMethodForCompilation(method, compLevel, -1 /*InvocationEntryBci*/);
+  }
+  public native boolean enqueueMethodForCompilation(Executable method, int compLevel, int entry_bci);
+  public native void    clearMethodState(Executable method);
+  public native void    lockCompilation();
+  public native void    unlockCompilation();
+  public native int     getMethodEntryBci(Executable method);
+  public native Object[] getNMethod(Executable method, boolean isOsr);
+  public native long    allocateCodeBlob(int size, int type);
+  public        long    allocateCodeBlob(long size, int type) {
+      int intSize = (int) size;
+      if ((long) intSize != size || size < 0) {
+          throw new IllegalArgumentException(
+                "size argument has illegal value " + size);
+      }
+      return allocateCodeBlob( intSize, type);
+  }
+  public native void    freeCodeBlob(long addr);
+  public        void    forceNMethodSweep() {
+    try {
+        forceNMethodSweep0().join();
+    } catch (InterruptedException e) {
+        Thread.currentThread().interrupt();
+    }
+  }
+  public native Thread  forceNMethodSweep0();
+  public native Object[] getCodeHeapEntries(int type);
+  public native int     getCompilationActivityMode();
+  public native Object[] getCodeBlob(long addr);
+
+  // Intered strings
+  public native boolean isInStringTable(String str);
+
+  // Memory
+  public native void readReservedMemory();
+  public native long allocateMetaspace(ClassLoader classLoader, long size);
+  public native void freeMetaspace(ClassLoader classLoader, long addr, long size);
+  public native long incMetaspaceCapacityUntilGC(long increment);
+  public native long metaspaceCapacityUntilGC();
+
+  // Force Young GC
+  public native void youngGC();
+
+  // Force Full GC
+  public native void fullGC();
+
+  // Method tries to start concurrent mark cycle.
+  // It returns false if CM Thread is always in concurrent cycle.
+  public native boolean g1StartConcMarkCycle();
+
+  // Tests on ReservedSpace/VirtualSpace classes
+  public native int stressVirtualSpaceResize(long reservedSpaceSize, long magnitude, long iterations);
+  public native void runMemoryUnitTests();
+  public native void readFromNoaccessArea();
+  public native long getThreadStackSize();
+  public native long getThreadRemainingStackSize();
+
+  // CPU features
+  public native String getCPUFeatures();
+
+  // Native extensions
+  public native long getHeapUsageForContext(int context);
+  public native long getHeapRegionCountForContext(int context);
+  public native int getContextForObject(Object obj);
+  public native void printRegionInfo(int context);
+
+  // VM flags
+  public native boolean isConstantVMFlag(String name);
+  public native boolean isLockedVMFlag(String name);
+  public native void    setBooleanVMFlag(String name, boolean value);
+  public native void    setIntxVMFlag(String name, long value);
+  public native void    setUintxVMFlag(String name, long value);
+  public native void    setUint64VMFlag(String name, long value);
+  public native void    setSizeTVMFlag(String name, long value);
+  public native void    setStringVMFlag(String name, String value);
+  public native void    setDoubleVMFlag(String name, double value);
+  public native Boolean getBooleanVMFlag(String name);
+  public native Long    getIntxVMFlag(String name);
+  public native Long    getUintxVMFlag(String name);
+  public native Long    getUint64VMFlag(String name);
+  public native Long    getSizeTVMFlag(String name);
+  public native String  getStringVMFlag(String name);
+  public native Double  getDoubleVMFlag(String name);
+  private final List<Function<String,Object>> flagsGetters = Arrays.asList(
+    this::getBooleanVMFlag, this::getIntxVMFlag, this::getUintxVMFlag,
+    this::getUint64VMFlag, this::getSizeTVMFlag, this::getStringVMFlag,
+    this::getDoubleVMFlag);
+
+  public Object getVMFlag(String name) {
+    return flagsGetters.stream()
+                       .map(f -> f.apply(name))
+                       .filter(x -> x != null)
+                       .findAny()
+                       .orElse(null);
+  }
+  public native int getOffsetForName0(String name);
+  public int getOffsetForName(String name) throws Exception {
+    int offset = getOffsetForName0(name);
+    if (offset == -1) {
+      throw new RuntimeException(name + " not found");
+    }
+    return offset;
+  }
+
+  // Safepoint Checking
+  public native void assertMatchingSafepointCalls(boolean mutexSafepointValue, boolean attemptedNoSafepointValue);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/sun/hotspot/code/BlobType.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.hotspot.code;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryPoolMXBean;
+import java.util.EnumSet;
+
+import sun.hotspot.WhiteBox;
+
+public enum BlobType {
+    // Execution level 1 and 4 (non-profiled) nmethods (including native nmethods)
+    MethodNonProfiled(0, "CodeHeap 'non-profiled nmethods'"),
+    // Execution level 2 and 3 (profiled) nmethods
+    MethodProfiled(1, "CodeHeap 'profiled nmethods'"),
+    // Non-nmethods like Buffers, Adapters and Runtime Stubs
+    NonNMethod(2, "CodeHeap 'non-nmethods'") {
+        @Override
+        public boolean allowTypeWhenOverflow(BlobType type) {
+            return super.allowTypeWhenOverflow(type)
+                    || type == BlobType.MethodNonProfiled;
+        }
+    },
+    // All types (No code cache segmentation)
+    All(3, "CodeCache");
+
+    public final int id;
+    private final String beanName;
+
+    private BlobType(int id, String beanName) {
+        this.id = id;
+        this.beanName = beanName;
+    }
+
+    public MemoryPoolMXBean getMemoryPool() {
+        for (MemoryPoolMXBean bean : ManagementFactory.getMemoryPoolMXBeans()) {
+            String name = bean.getName();
+            if (beanName.equals(name)) {
+                return bean;
+            }
+        }
+        return null;
+    }
+
+    public boolean allowTypeWhenOverflow(BlobType type) {
+        return type == this;
+    }
+
+    public static EnumSet<BlobType> getAvailable() {
+        WhiteBox whiteBox = WhiteBox.getWhiteBox();
+        if (!whiteBox.getBooleanVMFlag("SegmentedCodeCache")) {
+            // only All for non segmented world
+            return EnumSet.of(All);
+        }
+        if (System.getProperty("java.vm.info").startsWith("interpreted ")) {
+            // only NonNMethod for -Xint
+            return EnumSet.of(NonNMethod);
+        }
+
+        EnumSet<BlobType> result = EnumSet.complementOf(EnumSet.of(All));
+        if (!whiteBox.getBooleanVMFlag("TieredCompilation")
+                || whiteBox.getIntxVMFlag("TieredStopAtLevel") <= 1) {
+            // there is no MethodProfiled in non tiered world or pure C1
+            result.remove(MethodProfiled);
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/sun/hotspot/code/CodeBlob.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.hotspot.code;
+
+import sun.hotspot.WhiteBox;
+
+public class CodeBlob {
+  private static final WhiteBox WB = WhiteBox.getWhiteBox();
+  public static CodeBlob[] getCodeBlobs(BlobType type) {
+    Object[] obj = WB.getCodeHeapEntries(type.id);
+    if (obj == null) {
+      return null;
+    }
+    CodeBlob[] result = new CodeBlob[obj.length];
+    for (int i = 0, n = result.length; i < n; ++i) {
+      result[i] = new CodeBlob((Object[]) obj[i]);
+    }
+    return result;
+  }
+  public static CodeBlob getCodeBlob(long addr) {
+    Object[] obj = WB.getCodeBlob(addr);
+    if (obj == null) {
+      return null;
+    }
+    return new CodeBlob(obj);
+  }
+  protected CodeBlob(Object[] obj) {
+    assert obj.length == 3;
+    name = (String) obj[0];
+    size = (Integer) obj[1];
+    code_blob_type = BlobType.values()[(Integer) obj[2]];
+    assert code_blob_type.id == (Integer) obj[2];
+  }
+  public final String name;
+  public final int size;
+  public final BlobType code_blob_type;
+
+  @Override
+  public String toString() {
+    return "CodeBlob{"
+        + "name=" + name
+        + ", size=" + size
+        + ", code_blob_type=" + code_blob_type
+        + '}';
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/sun/hotspot/code/NMethod.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.hotspot.code;
+
+import java.lang.reflect.Executable;
+import sun.hotspot.WhiteBox;
+
+public class NMethod extends CodeBlob {
+  private static final WhiteBox wb = WhiteBox.getWhiteBox();
+  public static NMethod get(Executable method, boolean isOsr) {
+    Object[] obj = wb.getNMethod(method, isOsr);
+    return obj == null ? null : new NMethod(obj);
+  }
+  private NMethod(Object[] obj) {
+    super((Object[])obj[0]);
+    assert obj.length == 4;
+    comp_level = (Integer) obj[1];
+    insts = (byte[]) obj[2];
+    compile_id = (Integer) obj[3];
+  }
+  public final byte[] insts;
+  public final int comp_level;
+  public final int compile_id;
+
+  @Override
+  public String toString() {
+    return "NMethod{"
+        + super.toString()
+        + ", insts=" + insts
+        + ", comp_level=" + comp_level
+        + ", compile_id=" + compile_id
+        + '}';
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/sun/hotspot/cpuinfo/CPUInfo.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.hotspot.cpuinfo;
+
+import java.util.List;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+
+import sun.hotspot.WhiteBox;
+
+/**
+ * Information about CPU on test box.
+ *
+ * CPUInfo uses WhiteBox to gather information,
+ * so WhiteBox class should be added to bootclasspath
+ * and option -XX:+WhiteBoxAPI should expclicetly
+ * specified on command line.
+ */
+public class CPUInfo {
+
+    private static final List<String> features;
+    private static final String additionalCPUInfo;
+
+    static {
+        WhiteBox wb = WhiteBox.getWhiteBox();
+
+        Pattern additionalCPUInfoRE =
+            Pattern.compile("([^(]*\\([^)]*\\)[^,]*),\\s*");
+
+        String cpuFeaturesString = wb.getCPUFeatures();
+        Matcher matcher = additionalCPUInfoRE.matcher(cpuFeaturesString);
+        if (matcher.find()) {
+            additionalCPUInfo = matcher.group(1);
+        } else {
+            additionalCPUInfo = "";
+        }
+        String splittedFeatures[] = matcher.replaceAll("").split("(, )| ");
+
+        features = Collections.unmodifiableList(Arrays.
+                                                asList(splittedFeatures));
+    }
+
+    /**
+     * Get additional information about CPU.
+     * For example, on X86 in will be family/model/stepping
+     * and number of cores.
+     *
+     * @return additional CPU info
+     */
+    public static String getAdditionalCPUInfo() {
+        return additionalCPUInfo;
+    }
+
+    /**
+     * Get all known features supported by CPU.
+     *
+     * @return unmodifiable list with names of all known features
+     *         supported by CPU.
+     */
+    public static List<String> getFeatures() {
+        return features;
+    }
+
+    /**
+     * Check if some feature is supported by CPU.
+     *
+     * @param feature Name of feature to be tested.
+     * @return <b>true</b> if tested feature is supported by CPU.
+     */
+    public static boolean hasFeature(String feature) {
+        return features.contains(feature.toLowerCase());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/sun/hotspot/parser/DiagnosticCommand.java	Fri Jan 09 13:28:02 2015 -0500
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.hotspot.parser;
+
+public class DiagnosticCommand {
+
+    public enum DiagnosticArgumentType {
+        JLONG, BOOLEAN, STRING, NANOTIME, STRINGARRAY, MEMORYSIZE
+    }
+
+    private String name;
+    private String desc;
+    private DiagnosticArgumentType type;
+    private boolean mandatory;
+    private String defaultValue;
+    private boolean argument;
+
+    public DiagnosticCommand(String name, String desc, DiagnosticArgumentType type,
+            boolean mandatory, String defaultValue) {
+        this(name, desc, type, false, mandatory, defaultValue);
+    }
+
+    public DiagnosticCommand(String name, String desc, DiagnosticArgumentType type,
+            boolean argument, boolean mandatory, String defaultValue) {
+        this.name = name;
+        this.desc = desc;
+        this.type = type;
+        this.mandatory = mandatory;
+        this.defaultValue = defaultValue;
+        this.argument = argument;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public DiagnosticArgumentType getType() {
+        return type;
+    }
+
+    public boolean isMandatory() {
+        return mandatory;
+    }
+
+    public boolean isArgument() {
+        return argument;
+    }
+
+    public String getDefaultValue() {
+        return defaultValue;
+    }
+}