Merge
authorehelin
Tue, 01 Apr 2014 15:37:15 +0200
changeset 23542 e860dc279345
parent 23541 3cc6bbf28016 (current diff)
parent 23511 a6e433ebd892 (diff)
child 23543 0625da57ab78
Merge
corba/make/src/classes/build/tools/stripproperties/StripPropertiesCorba.java
hotspot/src/share/vm/runtime/thread.cpp
jdk/make/src/classes/build/tools/stripproperties/StripProperties.java
jdk/src/macosx/classes/sun/lwawt/macosx/event/NSEvent.java
jdk/src/macosx/native/sun/awt/CWrapper.h
jdk/src/share/classes/sun/swing/AbstractFilterComboBoxModel.java
jdk/src/share/classes/sun/tools/serialver/serialver.properties
jdk/src/share/classes/sun/tools/serialver/serialver_ja.properties
jdk/src/share/classes/sun/tools/serialver/serialver_zh_CN.properties
jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.h
jdk/test/java/lang/ClassLoader/Assert.sh
jdk/test/javax/swing/text/AbstractDocument/7146146/bug7146146.java
langtools/test/tools/javac/6464451/BigFinally.java
langtools/test/tools/javac/6464451/DeepNestedFinally.java
langtools/test/tools/javac/6464451/ManyExitsInTry.java
langtools/test/tools/javac/ArrayCloneCodeGen.java
langtools/test/tools/javac/ConditionalClass.java
langtools/test/tools/javac/NoNoClassDefFoundErrorError.java
langtools/test/tools/javac/T6557865.java
langtools/test/tools/javac/annotations/neg/MixedSource.java
langtools/test/tools/javac/boxing/NoBoxingBool.java
langtools/test/tools/javac/boxing/NoBoxingByte.java
langtools/test/tools/javac/boxing/NoBoxingChar.java
langtools/test/tools/javac/boxing/NoBoxingDouble.java
langtools/test/tools/javac/boxing/NoBoxingFloat.java
langtools/test/tools/javac/boxing/NoBoxingInt.java
langtools/test/tools/javac/boxing/NoBoxingLong.java
langtools/test/tools/javac/boxing/NoBoxingShort.java
langtools/test/tools/javac/enum/6384542/T6384542.java
langtools/test/tools/javac/enum/6384542/T6384542.out
langtools/test/tools/javac/enum/6384542/T6384542a.java
langtools/test/tools/javac/enum/6384542/T6384542a_1_4.out
langtools/test/tools/javac/enum/6384542/T6384542a_5.out
langtools/test/tools/javac/enum/EnumAsIdentifier4.out
langtools/test/tools/javac/enum/EnumAsIdentifier5.out
langtools/test/tools/javac/enum/FauxEnum2.java
langtools/test/tools/javac/foreach/T6682380.java
langtools/test/tools/javac/generics/BridgeRestype.java
langtools/test/tools/javac/generics/compat/CovariantCompat1.java
langtools/test/tools/javac/generics/compat/CovariantCompat2.java
langtools/test/tools/javac/generics/compat/OverrideBridge1.java
langtools/test/tools/javac/generics/compat/OverrideBridge2.java
langtools/test/tools/javac/generics/compat/OverrideBridge3.java
langtools/test/tools/javac/generics/compat/VisibleBridge.java
langtools/test/tools/javac/limits/FinallyNesting.java
nashorn/src/jdk/nashorn/internal/runtime/GlobalObject.java
--- a/.hgtags	Tue Apr 01 07:46:51 2014 +0200
+++ b/.hgtags	Tue Apr 01 15:37:15 2014 +0200
@@ -246,3 +246,5 @@
 f130ca87de6637acae7d99fcd7a8573eea1cbaed jdk9-b01
 b32e2219736e42baaf45daf0ad67ed34f6033799 jdk9-b02
 7f655f31f9bcee618cf832f08176ad8c1ed3fdd3 jdk9-b03
+099891b1d86f3719e116ac717ffdafc90d037fb7 jdk9-b04
+dd311791ad6895a3989020dd6c6c46db87972ab8 jdk9-b05
--- a/.hgtags-top-repo	Tue Apr 01 07:46:51 2014 +0200
+++ b/.hgtags-top-repo	Tue Apr 01 15:37:15 2014 +0200
@@ -246,3 +246,5 @@
 50669e45cec4491de0d921d3118a3fe2e767020a jdk9-b01
 135f0c7af57ebace31383d8877f47e32172759ff jdk9-b02
 fd8d51bdf9aadf7ae83e65e8655c53581017c363 jdk9-b03
+cb4c3440bc2748101923e2488506e61009ab1bf5 jdk9-b04
+8c63f0b6ada282f27e3a80125e53c3be603f9af7 jdk9-b05
--- a/common/autoconf/boot-jdk.m4	Tue Apr 01 07:46:51 2014 +0200
+++ b/common/autoconf/boot-jdk.m4	Tue Apr 01 15:37:15 2014 +0200
@@ -350,8 +350,23 @@
 
   AC_MSG_CHECKING([flags for boot jdk java command] )
 
+  # Disable special log output when a debug build is used as Boot JDK...
+  ADD_JVM_ARG_IF_OK([-XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput],boot_jdk_jvmargs,[$JAVA])
+
+  # Apply user provided options.
+  ADD_JVM_ARG_IF_OK([$with_boot_jdk_jvmargs],boot_jdk_jvmargs,[$JAVA])
+
+  AC_MSG_RESULT([$boot_jdk_jvmargs])
+
+  # For now, general JAVA_FLAGS are the same as the boot jdk jvmargs
+  JAVA_FLAGS=$boot_jdk_jvmargs
+  AC_SUBST(JAVA_FLAGS)
+
+
+  AC_MSG_CHECKING([flags for boot jdk java command for big workloads])
+
   # Starting amount of heap memory.
-  ADD_JVM_ARG_IF_OK([-Xms64M],boot_jdk_jvmargs,[$JAVA])
+  ADD_JVM_ARG_IF_OK([-Xms64M],boot_jdk_jvmargs_big,[$JAVA])
 
   # Maximum amount of heap memory.
   # Maximum stack size.
@@ -366,20 +381,24 @@
     JVM_MAX_HEAP=1600M
     STACK_SIZE=1536
   fi
-  ADD_JVM_ARG_IF_OK([-Xmx$JVM_MAX_HEAP],boot_jdk_jvmargs,[$JAVA])
-  ADD_JVM_ARG_IF_OK([-XX:ThreadStackSize=$STACK_SIZE],boot_jdk_jvmargs,[$JAVA])
+  ADD_JVM_ARG_IF_OK([-Xmx$JVM_MAX_HEAP],boot_jdk_jvmargs_big,[$JAVA])
+  ADD_JVM_ARG_IF_OK([-XX:ThreadStackSize=$STACK_SIZE],boot_jdk_jvmargs_big,[$JAVA])
+
+  AC_MSG_RESULT([$boot_jdk_jvmargs_big])
 
-  # Disable special log output when a debug build is used as Boot JDK...
-  ADD_JVM_ARG_IF_OK([-XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput],boot_jdk_jvmargs,[$JAVA])
+  JAVA_FLAGS_BIG=$boot_jdk_jvmargs_big
+  AC_SUBST(JAVA_FLAGS_BIG)
 
-  # Apply user provided options.
-  ADD_JVM_ARG_IF_OK([$with_boot_jdk_jvmargs],boot_jdk_jvmargs,[$JAVA])
+
+  AC_MSG_CHECKING([flags for boot jdk java command for small workloads])
 
-  AC_MSG_RESULT([$boot_jdk_jvmargs])
+  # Use serial gc for small short lived tools if possible
+  ADD_JVM_ARG_IF_OK([-XX:+UseSerialGC],boot_jdk_jvmargs_small,[$JAVA])
+  ADD_JVM_ARG_IF_OK([-Xms32M],boot_jdk_jvmargs_small,[$JAVA])
+  ADD_JVM_ARG_IF_OK([-Xmx512M],boot_jdk_jvmargs_small,[$JAVA])
 
-  # For now, general JAVA_FLAGS are the same as the boot jdk jvmargs
-  JAVA_FLAGS=$boot_jdk_jvmargs
+  AC_MSG_RESULT([$boot_jdk_jvmargs_small])
 
-  AC_SUBST(BOOT_JDK_JVMARGS, $boot_jdk_jvmargs)
-  AC_SUBST(JAVA_FLAGS, $JAVA_FLAGS)
+  JAVA_FLAGS_SMALL=$boot_jdk_jvmargs_small
+  AC_SUBST(JAVA_FLAGS_SMALL)
 ])
--- a/common/autoconf/flags.m4	Tue Apr 01 07:46:51 2014 +0200
+++ b/common/autoconf/flags.m4	Tue Apr 01 15:37:15 2014 +0200
@@ -148,6 +148,26 @@
       SET_SHARED_LIBRARY_NAME='-Xlinker -soname=[$]1'
       SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=[$]1'
     fi
+  elif test "x$TOOLCHAIN_TYPE" = xclang; then
+    PICFLAG=''
+    C_FLAG_REORDER=''
+    CXX_FLAG_REORDER=''
+
+    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+      # Linking is different on MacOSX
+      SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
+      SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.'
+      SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
+      SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/[$]1'
+      SET_SHARED_LIBRARY_MAPFILE=''
+    else
+      # Default works for linux, might work on other platforms as well.
+      SHARED_LIBRARY_FLAGS='-shared'
+      SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker \$$$$ORIGIN[$]1'
+      SET_SHARED_LIBRARY_ORIGIN="-Xlinker -z -Xlinker origin $SET_EXECUTABLE_ORIGIN"
+      SET_SHARED_LIBRARY_NAME='-Xlinker -soname=[$]1'
+      SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=[$]1'
+    fi
   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
     PICFLAG="-KPIC"
     C_FLAG_REORDER='-xF'
@@ -242,6 +262,8 @@
   # Generate make dependency files
   if test "x$TOOLCHAIN_TYPE" = xgcc; then
     C_FLAG_DEPS="-MMD -MF"
+  elif test "x$TOOLCHAIN_TYPE" = xclang; then
+    C_FLAG_DEPS="-MMD -MF"
   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
     C_FLAG_DEPS="-xMMD -xMF"
   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
@@ -260,6 +282,9 @@
       CFLAGS_DEBUG_SYMBOLS="-g"
       CXXFLAGS_DEBUG_SYMBOLS="-g"
     fi
+  elif test "x$TOOLCHAIN_TYPE" = xclang; then
+    CFLAGS_DEBUG_SYMBOLS="-g"
+    CXXFLAGS_DEBUG_SYMBOLS="-g"
   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
     CFLAGS_DEBUG_SYMBOLS="-g -xs"
     CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs"
@@ -315,6 +340,20 @@
         C_O_FLAG_NORM="-O2"
         C_O_FLAG_NONE="-O0"
       fi
+    elif test "x$TOOLCHAIN_TYPE" = xclang; then
+      if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+        # On MacOSX we optimize for size, something
+        # we should do for all platforms?
+        C_O_FLAG_HIGHEST="-Os"
+        C_O_FLAG_HI="-Os"
+        C_O_FLAG_NORM="-Os"
+        C_O_FLAG_NONE=""
+      else
+        C_O_FLAG_HIGHEST="-O3"
+        C_O_FLAG_HI="-O3"
+        C_O_FLAG_NORM="-O2"
+        C_O_FLAG_NONE="-O0"
+      fi
     elif test "x$TOOLCHAIN_TYPE" = xxlc; then
       C_O_FLAG_HIGHEST="-O3"
       C_O_FLAG_HI="-O3 -qstrict"
--- a/common/autoconf/generated-configure.sh	Tue Apr 01 07:46:51 2014 +0200
+++ b/common/autoconf/generated-configure.sh	Tue Apr 01 15:37:15 2014 +0200
@@ -653,6 +653,9 @@
 LIBM
 LIBZIP_CAN_USE_MMAP
 USE_EXTERNAL_LIBZ
+USE_EXTERNAL_LIBPNG
+PNG_LIBS
+PNG_CFLAGS
 USE_EXTERNAL_LIBGIF
 USE_EXTERNAL_LIBJPEG
 ALSA_LIBS
@@ -793,8 +796,9 @@
 JAXP_TOPDIR
 CORBA_TOPDIR
 LANGTOOLS_TOPDIR
+JAVA_FLAGS_SMALL
+JAVA_FLAGS_BIG
 JAVA_FLAGS
-BOOT_JDK_JVMARGS
 JAVAC_FLAGS
 BOOT_JDK_SOURCETARGET
 JARSIGNER
@@ -1071,6 +1075,7 @@
 with_alsa_include
 with_alsa_lib
 with_giflib
+with_libpng
 with_zlib
 with_stdc__lib
 with_msvcr_dll
@@ -1183,6 +1188,8 @@
 FREETYPE_LIBS
 ALSA_CFLAGS
 ALSA_LIBS
+PNG_CFLAGS
+PNG_LIBS
 LIBFFI_CFLAGS
 LIBFFI_LIBS
 CCACHE'
@@ -1921,6 +1928,8 @@
   --with-alsa-lib         specify directory for the alsa library
   --with-giflib           use giflib from build system or OpenJDK source
                           (system, bundled) [bundled]
+  --with-libpng           use libpng from build system or OpenJDK source
+                          (system, bundled) [bundled]
   --with-zlib             use zlib from build system or OpenJDK source
                           (system, bundled) [bundled]
   --with-stdc++lib=<static>,<dynamic>,<default>
@@ -2045,6 +2054,8 @@
               linker flags for FREETYPE, overriding pkg-config
   ALSA_CFLAGS C compiler flags for ALSA, overriding pkg-config
   ALSA_LIBS   linker flags for ALSA, overriding pkg-config
+  PNG_CFLAGS  C compiler flags for PNG, overriding pkg-config
+  PNG_LIBS    linker flags for PNG, overriding pkg-config
   LIBFFI_CFLAGS
               C compiler flags for LIBFFI, overriding pkg-config
   LIBFFI_LIBS linker flags for LIBFFI, overriding pkg-config
@@ -4221,7 +4232,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1394011255
+DATE_WHEN_GENERATED=1394794899
 
 ###############################################################################
 #
@@ -25856,67 +25867,6 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking flags for boot jdk java command " >&5
 $as_echo_n "checking flags for boot jdk java command ... " >&6; }
 
-  # Starting amount of heap memory.
-
-  $ECHO "Check if jvm arg is ok: -Xms64M" >&5
-  $ECHO "Command: $JAVA -Xms64M -version" >&5
-  OUTPUT=`$JAVA -Xms64M -version 2>&1`
-  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
-  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
-  if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-    boot_jdk_jvmargs="$boot_jdk_jvmargs -Xms64M"
-    JVM_ARG_OK=true
-  else
-    $ECHO "Arg failed:" >&5
-    $ECHO "$OUTPUT" >&5
-    JVM_ARG_OK=false
-  fi
-
-
-  # Maximum amount of heap memory.
-  # Maximum stack size.
-  if test "x$BUILD_NUM_BITS" = x32; then
-    JVM_MAX_HEAP=1100M
-    STACK_SIZE=768
-  else
-    # Running Javac on a JVM on a 64-bit machine, takes more space since 64-bit
-    # pointers are used. Apparently, we need to increase the heap and stack
-    # space for the jvm. More specifically, when running javac to build huge
-    # jdk batch
-    JVM_MAX_HEAP=1600M
-    STACK_SIZE=1536
-  fi
-
-  $ECHO "Check if jvm arg is ok: -Xmx$JVM_MAX_HEAP" >&5
-  $ECHO "Command: $JAVA -Xmx$JVM_MAX_HEAP -version" >&5
-  OUTPUT=`$JAVA -Xmx$JVM_MAX_HEAP -version 2>&1`
-  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
-  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
-  if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-    boot_jdk_jvmargs="$boot_jdk_jvmargs -Xmx$JVM_MAX_HEAP"
-    JVM_ARG_OK=true
-  else
-    $ECHO "Arg failed:" >&5
-    $ECHO "$OUTPUT" >&5
-    JVM_ARG_OK=false
-  fi
-
-
-  $ECHO "Check if jvm arg is ok: -XX:ThreadStackSize=$STACK_SIZE" >&5
-  $ECHO "Command: $JAVA -XX:ThreadStackSize=$STACK_SIZE -version" >&5
-  OUTPUT=`$JAVA -XX:ThreadStackSize=$STACK_SIZE -version 2>&1`
-  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
-  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
-  if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
-    boot_jdk_jvmargs="$boot_jdk_jvmargs -XX:ThreadStackSize=$STACK_SIZE"
-    JVM_ARG_OK=true
-  else
-    $ECHO "Arg failed:" >&5
-    $ECHO "$OUTPUT" >&5
-    JVM_ARG_OK=false
-  fi
-
-
   # Disable special log output when a debug build is used as Boot JDK...
 
   $ECHO "Check if jvm arg is ok: -XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput" >&5
@@ -25957,9 +25907,133 @@
   # For now, general JAVA_FLAGS are the same as the boot jdk jvmargs
   JAVA_FLAGS=$boot_jdk_jvmargs
 
-  BOOT_JDK_JVMARGS=$boot_jdk_jvmargs
-
-  JAVA_FLAGS=$JAVA_FLAGS
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking flags for boot jdk java command for big workloads" >&5
+$as_echo_n "checking flags for boot jdk java command for big workloads... " >&6; }
+
+  # Starting amount of heap memory.
+
+  $ECHO "Check if jvm arg is ok: -Xms64M" >&5
+  $ECHO "Command: $JAVA -Xms64M -version" >&5
+  OUTPUT=`$JAVA -Xms64M -version 2>&1`
+  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
+    boot_jdk_jvmargs_big="$boot_jdk_jvmargs_big -Xms64M"
+    JVM_ARG_OK=true
+  else
+    $ECHO "Arg failed:" >&5
+    $ECHO "$OUTPUT" >&5
+    JVM_ARG_OK=false
+  fi
+
+
+  # Maximum amount of heap memory.
+  # Maximum stack size.
+  if test "x$BUILD_NUM_BITS" = x32; then
+    JVM_MAX_HEAP=1100M
+    STACK_SIZE=768
+  else
+    # Running Javac on a JVM on a 64-bit machine, takes more space since 64-bit
+    # pointers are used. Apparently, we need to increase the heap and stack
+    # space for the jvm. More specifically, when running javac to build huge
+    # jdk batch
+    JVM_MAX_HEAP=1600M
+    STACK_SIZE=1536
+  fi
+
+  $ECHO "Check if jvm arg is ok: -Xmx$JVM_MAX_HEAP" >&5
+  $ECHO "Command: $JAVA -Xmx$JVM_MAX_HEAP -version" >&5
+  OUTPUT=`$JAVA -Xmx$JVM_MAX_HEAP -version 2>&1`
+  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
+    boot_jdk_jvmargs_big="$boot_jdk_jvmargs_big -Xmx$JVM_MAX_HEAP"
+    JVM_ARG_OK=true
+  else
+    $ECHO "Arg failed:" >&5
+    $ECHO "$OUTPUT" >&5
+    JVM_ARG_OK=false
+  fi
+
+
+  $ECHO "Check if jvm arg is ok: -XX:ThreadStackSize=$STACK_SIZE" >&5
+  $ECHO "Command: $JAVA -XX:ThreadStackSize=$STACK_SIZE -version" >&5
+  OUTPUT=`$JAVA -XX:ThreadStackSize=$STACK_SIZE -version 2>&1`
+  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
+    boot_jdk_jvmargs_big="$boot_jdk_jvmargs_big -XX:ThreadStackSize=$STACK_SIZE"
+    JVM_ARG_OK=true
+  else
+    $ECHO "Arg failed:" >&5
+    $ECHO "$OUTPUT" >&5
+    JVM_ARG_OK=false
+  fi
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $boot_jdk_jvmargs_big" >&5
+$as_echo "$boot_jdk_jvmargs_big" >&6; }
+
+  JAVA_FLAGS_BIG=$boot_jdk_jvmargs_big
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking flags for boot jdk java command for small workloads" >&5
+$as_echo_n "checking flags for boot jdk java command for small workloads... " >&6; }
+
+  # Use serial gc for small short lived tools if possible
+
+  $ECHO "Check if jvm arg is ok: -XX:+UseSerialGC" >&5
+  $ECHO "Command: $JAVA -XX:+UseSerialGC -version" >&5
+  OUTPUT=`$JAVA -XX:+UseSerialGC -version 2>&1`
+  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
+    boot_jdk_jvmargs_small="$boot_jdk_jvmargs_small -XX:+UseSerialGC"
+    JVM_ARG_OK=true
+  else
+    $ECHO "Arg failed:" >&5
+    $ECHO "$OUTPUT" >&5
+    JVM_ARG_OK=false
+  fi
+
+
+  $ECHO "Check if jvm arg is ok: -Xms32M" >&5
+  $ECHO "Command: $JAVA -Xms32M -version" >&5
+  OUTPUT=`$JAVA -Xms32M -version 2>&1`
+  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
+    boot_jdk_jvmargs_small="$boot_jdk_jvmargs_small -Xms32M"
+    JVM_ARG_OK=true
+  else
+    $ECHO "Arg failed:" >&5
+    $ECHO "$OUTPUT" >&5
+    JVM_ARG_OK=false
+  fi
+
+
+  $ECHO "Check if jvm arg is ok: -Xmx512M" >&5
+  $ECHO "Command: $JAVA -Xmx512M -version" >&5
+  OUTPUT=`$JAVA -Xmx512M -version 2>&1`
+  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
+    boot_jdk_jvmargs_small="$boot_jdk_jvmargs_small -Xmx512M"
+    JVM_ARG_OK=true
+  else
+    $ECHO "Arg failed:" >&5
+    $ECHO "$OUTPUT" >&5
+    JVM_ARG_OK=false
+  fi
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $boot_jdk_jvmargs_small" >&5
+$as_echo "$boot_jdk_jvmargs_small" >&6; }
+
+  JAVA_FLAGS_SMALL=$boot_jdk_jvmargs_small
 
 
 
@@ -26297,8 +26371,28 @@
   # Use indirect variable referencing
   toolchain_var_name=VALID_TOOLCHAINS_$OPENJDK_BUILD_OS
   VALID_TOOLCHAINS=${!toolchain_var_name}
-  # First toolchain type in the list is the default
-  DEFAULT_TOOLCHAIN=${VALID_TOOLCHAINS%% *}
+
+  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+    # On Mac OS X, default toolchain to clang after Xcode 5
+    XCODE_VERSION_OUTPUT=`xcodebuild -version 2>&1 | $HEAD -n 1`
+    $ECHO "$XCODE_VERSION_OUTPUT" | $GREP "Xcode " > /dev/null
+    if test $? -ne 0; then
+      as_fn_error $? "Failed to determine Xcode version." "$LINENO" 5
+    fi
+    XCODE_MAJOR_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | \
+        $SED -e 's/^Xcode \([1-9][0-9.]*\)/\1/' | \
+        $CUT -f 1 -d .`
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Xcode major version: $XCODE_MAJOR_VERSION" >&5
+$as_echo "$as_me: Xcode major version: $XCODE_MAJOR_VERSION" >&6;}
+    if test $XCODE_MAJOR_VERSION -ge 5; then
+        DEFAULT_TOOLCHAIN="clang"
+    else
+        DEFAULT_TOOLCHAIN="gcc"
+    fi
+  else
+    # First toolchain type in the list is the default
+    DEFAULT_TOOLCHAIN=${VALID_TOOLCHAINS%% *}
+  fi
 
   if test "x$with_toolchain_type" = xlist; then
     # List all toolchains
@@ -41236,6 +41330,26 @@
       SET_SHARED_LIBRARY_NAME='-Xlinker -soname=$1'
       SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=$1'
     fi
+  elif test "x$TOOLCHAIN_TYPE" = xclang; then
+    PICFLAG=''
+    C_FLAG_REORDER=''
+    CXX_FLAG_REORDER=''
+
+    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+      # Linking is different on MacOSX
+      SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
+      SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.'
+      SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
+      SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/$1'
+      SET_SHARED_LIBRARY_MAPFILE=''
+    else
+      # Default works for linux, might work on other platforms as well.
+      SHARED_LIBRARY_FLAGS='-shared'
+      SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker \$$$$ORIGIN$1'
+      SET_SHARED_LIBRARY_ORIGIN="-Xlinker -z -Xlinker origin $SET_EXECUTABLE_ORIGIN"
+      SET_SHARED_LIBRARY_NAME='-Xlinker -soname=$1'
+      SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=$1'
+    fi
   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
     PICFLAG="-KPIC"
     C_FLAG_REORDER='-xF'
@@ -41297,6 +41411,8 @@
   # Generate make dependency files
   if test "x$TOOLCHAIN_TYPE" = xgcc; then
     C_FLAG_DEPS="-MMD -MF"
+  elif test "x$TOOLCHAIN_TYPE" = xclang; then
+    C_FLAG_DEPS="-MMD -MF"
   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
     C_FLAG_DEPS="-xMMD -xMF"
   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
@@ -41315,6 +41431,9 @@
       CFLAGS_DEBUG_SYMBOLS="-g"
       CXXFLAGS_DEBUG_SYMBOLS="-g"
     fi
+  elif test "x$TOOLCHAIN_TYPE" = xclang; then
+    CFLAGS_DEBUG_SYMBOLS="-g"
+    CXXFLAGS_DEBUG_SYMBOLS="-g"
   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
     CFLAGS_DEBUG_SYMBOLS="-g -xs"
     CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs"
@@ -41370,6 +41489,20 @@
         C_O_FLAG_NORM="-O2"
         C_O_FLAG_NONE="-O0"
       fi
+    elif test "x$TOOLCHAIN_TYPE" = xclang; then
+      if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+        # On MacOSX we optimize for size, something
+        # we should do for all platforms?
+        C_O_FLAG_HIGHEST="-Os"
+        C_O_FLAG_HI="-Os"
+        C_O_FLAG_NORM="-Os"
+        C_O_FLAG_NONE=""
+      else
+        C_O_FLAG_HIGHEST="-O3"
+        C_O_FLAG_HI="-O3"
+        C_O_FLAG_NORM="-O2"
+        C_O_FLAG_NONE="-O0"
+      fi
     elif test "x$TOOLCHAIN_TYPE" = xxlc; then
       C_O_FLAG_HIGHEST="-O3"
       C_O_FLAG_HI="-O3 -qstrict"
@@ -46791,6 +46924,118 @@
 
   ###############################################################################
   #
+  # Check for the png library
+  #
+
+
+# Check whether --with-libpng was given.
+if test "${with_libpng+set}" = set; then :
+  withval=$with_libpng;
+fi
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for which libpng to use" >&5
+$as_echo_n "checking for which libpng to use... " >&6; }
+
+  # default is bundled
+  DEFAULT_LIBPNG=bundled
+
+  #
+  # if user didn't specify, use DEFAULT_LIBPNG
+  #
+  if test "x${with_libpng}" = "x"; then
+      with_libpng=${DEFAULT_LIBPNG}
+  fi
+
+  if test "x${with_libpng}" = "xbundled"; then
+      USE_EXTERNAL_LIBPNG=false
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: bundled" >&5
+$as_echo "bundled" >&6; }
+  elif test "x${with_libpng}" = "xsystem"; then
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PNG" >&5
+$as_echo_n "checking for PNG... " >&6; }
+
+if test -n "$PNG_CFLAGS"; then
+    pkg_cv_PNG_CFLAGS="$PNG_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpng\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libpng") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_PNG_CFLAGS=`$PKG_CONFIG --cflags "libpng" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$PNG_LIBS"; then
+    pkg_cv_PNG_LIBS="$PNG_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpng\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libpng") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_PNG_LIBS=`$PKG_CONFIG --libs "libpng" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        PNG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libpng" 2>&1`
+        else
+	        PNG_PKG_ERRORS=`$PKG_CONFIG --print-errors "libpng" 2>&1`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$PNG_PKG_ERRORS" >&5
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+                 LIBPNG_FOUND=no
+elif test $pkg_failed = untried; then
+	 LIBPNG_FOUND=no
+else
+	PNG_CFLAGS=$pkg_cv_PNG_CFLAGS
+	PNG_LIBS=$pkg_cv_PNG_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	 LIBPNG_FOUND=yes
+fi
+      if test "x${LIBPNG_FOUND}" = "xyes"; then
+          USE_EXTERNAL_LIBPNG=true
+          { $as_echo "$as_me:${as_lineno-$LINENO}: result: system" >&5
+$as_echo "system" >&6; }
+      else
+          { $as_echo "$as_me:${as_lineno-$LINENO}: result: system not found" >&5
+$as_echo "system not found" >&6; }
+          as_fn_error $? "--with-libpng=system specified, but no libpng found!" "$LINENO" 5
+      fi
+  else
+      as_fn_error $? "Invalid value of --with-libpng: ${with_libpng}, use 'system' or 'bundled'" "$LINENO" 5
+  fi
+
+
+  ###############################################################################
+  #
   # Check for the zlib library
   #
 
--- a/common/autoconf/libraries.m4	Tue Apr 01 07:46:51 2014 +0200
+++ b/common/autoconf/libraries.m4	Tue Apr 01 15:37:15 2014 +0200
@@ -654,6 +654,46 @@
 
   ###############################################################################
   #
+  # Check for the png library
+  #
+
+  AC_ARG_WITH(libpng, [AS_HELP_STRING([--with-libpng],
+     [use libpng from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
+
+
+  AC_MSG_CHECKING([for which libpng to use])
+
+  # default is bundled
+  DEFAULT_LIBPNG=bundled
+
+  #
+  # if user didn't specify, use DEFAULT_LIBPNG
+  #
+  if test "x${with_libpng}" = "x"; then
+      with_libpng=${DEFAULT_LIBPNG}
+  fi
+
+  if test "x${with_libpng}" = "xbundled"; then
+      USE_EXTERNAL_LIBPNG=false
+      AC_MSG_RESULT([bundled])
+  elif test "x${with_libpng}" = "xsystem"; then
+      PKG_CHECK_MODULES(PNG, libpng,
+                   [ LIBPNG_FOUND=yes ],
+                   [ LIBPNG_FOUND=no ])
+      if test "x${LIBPNG_FOUND}" = "xyes"; then
+          USE_EXTERNAL_LIBPNG=true
+          AC_MSG_RESULT([system])
+      else
+          AC_MSG_RESULT([system not found])
+          AC_MSG_ERROR([--with-libpng=system specified, but no libpng found!])
+      fi
+  else
+      AC_MSG_ERROR([Invalid value of --with-libpng: ${with_libpng}, use 'system' or 'bundled'])
+  fi
+  AC_SUBST(USE_EXTERNAL_LIBPNG)
+
+  ###############################################################################
+  #
   # Check for the zlib library
   #
 
--- a/common/autoconf/spec.gmk.in	Tue Apr 01 07:46:51 2014 +0200
+++ b/common/autoconf/spec.gmk.in	Tue Apr 01 15:37:15 2014 +0200
@@ -254,7 +254,6 @@
 
 # The boot jdk to use
 BOOT_JDK:=@BOOT_JDK@
-BOOT_JDK_JVMARGS:=@BOOT_JDK_JVMARGS@
 BOOT_RTJAR:=@BOOT_RTJAR@
 BOOT_TOOLSJAR=$(BOOT_JDK)/lib/tools.jar
 
@@ -442,8 +441,11 @@
 POST_MCS_CMD:=@POST_MCS_CMD@
 
 JAVA_FLAGS:=@JAVA_FLAGS@
+JAVA_FLAGS_BIG:=@JAVA_FLAGS_BIG@
+JAVA_FLAGS_SMALL:=@JAVA_FLAGS_SMALL@
 
-JAVA=@FIXPATH@ @JAVA@ $(JAVA_FLAGS)
+JAVA=@FIXPATH@ @JAVA@ $(JAVA_FLAGS_BIG) $(JAVA_FLAGS)
+JAVA_SMALL=@FIXPATH@ @JAVA@ $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS)
 
 JAVAC:=@FIXPATH@ @JAVAC@
 # Hotspot sets this variable before reading the SPEC when compiling sa-jdi.jar. Avoid
@@ -454,7 +456,7 @@
 
 JAR:=@FIXPATH@ @JAR@
 
-NATIVE2ASCII:=@FIXPATH@ @NATIVE2ASCII@
+NATIVE2ASCII:=@FIXPATH@ @NATIVE2ASCII@ $(addprefix -J, $(JAVA_FLAGS_SMALL))
 
 JARSIGNER:=@FIXPATH@ @JARSIGNER@
 
@@ -645,6 +647,15 @@
 # Read-only single-machine data
 INSTALL_SYSCONFDIR=@sysconfdir@
 
+####################################################
+#
+# Libraries
+#
+
+USE_EXTERNAL_LIBPNG:=@USE_EXTERNAL_LIBPNG@
+PNG_LIBS:=@PNG_LIBS@
+PNG_CFLAGS:=@PNG_CFLAGS@
+
 
 ####################################################
 #
--- a/common/autoconf/toolchain.m4	Tue Apr 01 07:46:51 2014 +0200
+++ b/common/autoconf/toolchain.m4	Tue Apr 01 15:37:15 2014 +0200
@@ -96,8 +96,27 @@
   # Use indirect variable referencing
   toolchain_var_name=VALID_TOOLCHAINS_$OPENJDK_BUILD_OS
   VALID_TOOLCHAINS=${!toolchain_var_name}
-  # First toolchain type in the list is the default
-  DEFAULT_TOOLCHAIN=${VALID_TOOLCHAINS%% *}
+
+  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+    # On Mac OS X, default toolchain to clang after Xcode 5
+    XCODE_VERSION_OUTPUT=`xcodebuild -version 2>&1 | $HEAD -n 1`
+    $ECHO "$XCODE_VERSION_OUTPUT" | $GREP "Xcode " > /dev/null
+    if test $? -ne 0; then
+      AC_MSG_ERROR([Failed to determine Xcode version.])
+    fi
+    XCODE_MAJOR_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | \
+        $SED -e 's/^Xcode \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/' | \
+        $CUT -f 1 -d .`
+    AC_MSG_NOTICE([Xcode major version: $XCODE_MAJOR_VERSION])
+    if test $XCODE_MAJOR_VERSION -ge 5; then
+        DEFAULT_TOOLCHAIN="clang"
+    else
+        DEFAULT_TOOLCHAIN="gcc"
+    fi
+  else
+    # First toolchain type in the list is the default
+    DEFAULT_TOOLCHAIN=${VALID_TOOLCHAINS%% *}
+  fi
   
   if test "x$with_toolchain_type" = xlist; then
     # List all toolchains
--- a/corba/.hgtags	Tue Apr 01 07:46:51 2014 +0200
+++ b/corba/.hgtags	Tue Apr 01 15:37:15 2014 +0200
@@ -246,3 +246,5 @@
 79a8136b18c1c6848f500088f5a4b39f262f082d jdk9-b01
 8394993063135a42b63a94473280399fb2a13aa7 jdk9-b02
 d338b892a13db19b093f85cf5f949a4504e4d31f jdk9-b03
+1ed19de263e1e0772da0269118cdd9deeb9fff04 jdk9-b04
+167c39eb44731a5d66770d0f00e231164653a2ff jdk9-b05
--- a/corba/make/CompileCorba.gmk	Tue Apr 01 07:46:51 2014 +0200
+++ b/corba/make/CompileCorba.gmk	Tue Apr 01 15:37:15 2014 +0200
@@ -45,16 +45,18 @@
         org/omg/PortableInterceptor/UNKNOWN.java \
         com/sun/tools/corba/se/idl/ResourceBundleUtil.java \
         com/sun/corba/se/impl/presentation/rmi/jndi.properties, \
-    COPY := .prp LogStrings.properties, \
+    COPY := .prp, \
+    CLEAN := .properties, \
     BIN := $(CORBA_OUTPUTDIR)/classes, \
     JAR := $(CORBA_OUTPUTDIR)/dist/lib/classes.jar))
 
+# For the interim version, don't bother cleaning the properties.
 $(eval $(call SetupJavaCompilation,BUILD_INTERIM_CORBA, \
     SETUP := GENERATE_OLDBYTECODE, \
     SRC := $(BUILD_CORBA_SRC), \
     EXCLUDES := $(BUILD_CORBA_EXCLUDES), \
     EXCLUDE_FILES := $(BUILD_CORBA_EXCLUDE_FILES), \
-    COPY := $(BUILD_CORBA_COPY), \
+    COPY := $(BUILD_CORBA_COPY) $(BUILD_CORBA_CLEAN), \
     BIN := $(CORBA_OUTPUTDIR)/interim_classes, \
     JAR := $(INTERIM_CORBA_JAR)))
 
@@ -63,7 +65,6 @@
 $(eval $(call SetupZipArchive,ARCHIVE_CORBA_SRC, \
     SRC := $(CORBA_TOPDIR)/src/share/classes $(CORBA_OUTPUTDIR)/gensrc, \
     ZIP := $(CORBA_OUTPUTDIR)/dist/lib/src.zip))
-    JAR := $(CORBA_OUTPUTDIR)/dist/lib/classes.jar))
 
 ################################################################################
 # Create bin.zip containing the corba specific binaries: orb.idl, ir.idl
@@ -81,6 +82,5 @@
 
 ################################################################################
 
-
 all: $(BUILD_CORBA) $(BUILD_INTERIM_CORBA) $(ARCHIVE_CORBA_SRC) \
     $(CORBA_OUTPUTDIR)/dist/lib/bin.zip
--- a/corba/make/GensrcCorba.gmk	Tue Apr 01 07:46:51 2014 +0200
+++ b/corba/make/GensrcCorba.gmk	Tue Apr 01 15:37:15 2014 +0200
@@ -39,9 +39,6 @@
     SRC := $(CORBA_TOPDIR)/make/src/classes, \
     BIN := $(CORBA_OUTPUTDIR)/tools_classes))
 
-TOOL_STRIPPROP_CMD := $(JAVA) -cp $(CORBA_OUTPUTDIR)/tools_classes \
-    build.tools.stripproperties.StripPropertiesCorba
-
 TOOL_LOGUTIL_CMD := $(JAVA) -cp $(CORBA_OUTPUTDIR)/tools_classes \
     build.tools.logutil.MC
 
@@ -230,27 +227,14 @@
 $(BUILD_IDLS): $(BUILD_IDLJ)
 
 ################################################################################
-# Run stripproperties on all sunorb resource files.
+# zh_HK is just a copy of zh_TW
 
-STRIP_PROP_SRC_FILES := $(shell $(FIND) $(CORBA_TOPDIR)/src/share/classes -name "sunorb*.properties")
-STRIP_PROP_FILES := $(patsubst $(CORBA_TOPDIR)/src/share/classes/%, $(CORBA_OUTPUTDIR)/classes/%, \
-    $(STRIP_PROP_SRC_FILES))
-# Simple delivery of zh_HK properties files just copies zh_TW properties files
-STRIP_PROP_SRC_FILE_ZH_TW := $(shell $(FIND) $(CORBA_TOPDIR)/src/share/classes -name "sunorb_zh_TW.properties")
-STRIP_PROP_SRC_FILES += $(STRIP_PROP_SRC_FILE_ZH_TW)
-STRIP_PROP_FILES += $(patsubst $(CORBA_TOPDIR)/src/share/classes/%_zh_TW.properties, \
-    $(CORBA_OUTPUTDIR)/classes/%_zh_HK.properties, $(STRIP_PROP_SRC_FILE_ZH_TW))
-STRIP_PROP_CMDLINE := $(subst _SPACE_, $(SPACE), \
-    $(join $(addprefix -clean_SPACE_, $(STRIP_PROP_SRC_FILES)), \
-    $(addprefix _SPACE_, $(STRIP_PROP_FILES))))
-
-$(CORBA_OUTPUTDIR)/_the.stripped_properties: $(STRIP_PROP_SRC_FILES) \
-    $(BUILD_TOOLS)
-	$(MKDIR) -p $(sort $(dir $(STRIP_PROP_FILES)))
-	$(call ListPathsSafely,STRIP_PROP_CMDLINE,\n, >> $(CORBA_OUTPUTDIR)/_the.strip_prop.cmdline)
-	$(TOOL_STRIPPROP_CMD) @$(CORBA_OUTPUTDIR)/_the.strip_prop.cmdline
-	$(TOUCH) $@
+$(CORBA_OUTPUTDIR)/gensrc/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties: \
+    $(CORBA_TOPDIR)/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties
+	$(install-file)
 
 ################################################################################
 
-all: $(BUILD_IDLS) $(CORBA_OUTPUTDIR)/_the.stripped_properties $(LOGWRAPPER_TARGETS)
+all: $(BUILD_IDLS) $(LOGWRAPPER_TARGETS) \
+    $(CORBA_OUTPUTDIR)/gensrc/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties
+
--- a/corba/make/src/classes/build/tools/stripproperties/StripPropertiesCorba.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,288 +0,0 @@
-/*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package build.tools.stripproperties;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedWriter;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-
-/**
- * Reads a properties file from standard input and writes an equivalent
- * properties file without comments to standard output.
- */
-public class StripPropertiesCorba {
-
-    private static void error(String msg, Exception e) {
-        System.err.println("ERROR: stripproperties: " + msg);
-        if ( e != null ) {
-            System.err.println("EXCEPTION: " + e.toString());
-            e.printStackTrace();
-        }
-    }
-
-    private static List<String> infiles = new ArrayList<String>();
-    private static List<String> outfiles = new ArrayList<String>();
-
-    private static boolean parseOptions(String args[]) {
-        boolean ok = true;
-
-        for ( int i = 0; i < args.length ; i++ ) {
-            if ( "-clean".equals(args[i]) && i+2 < args.length ) {
-                infiles.add(args[++i]);
-                outfiles.add(args[++i]);
-            } else if ( args[i].charAt(0)=='@') {
-                String filename = args[i].substring(1);
-                FileInputStream finput = null;
-                byte contents[] = null;
-                try {
-                    finput = new FileInputStream(filename);
-                    int byteCount = finput.available();
-                    if ( byteCount <= 0 ) {
-                        error("The @file is empty", null);
-                        ok = false;
-                    } else {
-                        contents = new byte[byteCount];
-                        int bytesRead = finput.read(contents);
-                        if ( byteCount != bytesRead ) {
-                            error("Cannot read all of @file", null);
-                            ok = false;
-                        }
-                    }
-                } catch ( IOException e ) {
-                    error("cannot open " + filename, e);
-                    ok = false;
-                }
-                if ( finput != null ) {
-                    try {
-                        finput.close();
-                    } catch ( IOException e ) {
-                        ok = false;
-                        error("cannot close " + filename, e);
-                    }
-                }
-                if ( ok && contents != null ) {
-                    String tokens[] = (new String(contents)).split("\\s+");
-                    if ( tokens.length > 0 ) {
-                        ok = parseOptions(tokens);
-                    }
-                }
-                if ( !ok ) {
-                    break;
-                }
-            } else {
-                infiles.add(args[i]);
-                outfiles.add(args[i]);
-            }
-        }
-        return ok;
-    }
-
-    private static boolean stripFiles(List<String> infiles, List<String> outfiles) {
-        boolean ok = true;
-        Iterator<String> inIter  = infiles.iterator();
-        Iterator<String> outIter = outfiles.iterator();
-
-        for (; inIter.hasNext(); ) {
-            String infile = inIter.next();
-            String outfile = outIter.next();
-
-            Properties prop = new Properties();
-            InputStream in = null;
-            try {
-                in = new BufferedInputStream(new FileInputStream(infile));
-                prop.load(in);
-            } catch ( FileNotFoundException e ) {
-                error("Cannot access file " + infile, e);
-                ok = false;
-            } catch ( IOException e ) {
-                error("IO exception processing file " + infile, e);
-                ok = false;
-            }
-            if ( in != null ) {
-                try {
-                    in.close();
-                } catch ( IOException e ) {
-                    error("IO exception closing file " + infile, e);
-                    ok = false;
-                }
-            }
-            if ( !ok ) {
-                break;
-            }
-
-            OutputStream out = null;
-            try {
-                out = new FileOutputStream(outfile);
-                storeProperties(prop, out);
-                out.flush();
-            } catch ( IOException e ) {
-                error("IO exception processing file " + outfile, e);
-                ok = false;
-            }
-            if ( out != null ) {
-                try {
-                    out.close();
-                } catch ( IOException e ) {
-                    error("IO exception closing file " + outfile, e);
-                    ok = false;
-                }
-            }
-            if ( !ok ) {
-                break;
-            }
-
-        }
-        return ok;
-    }
-
-    /**
-     * Strip the properties filenames supplied, replacing their contents.
-     * @param args Names of properties files to process and replace contents
-     */
-    public static void main(String args[]) {
-        boolean ok = parseOptions(args);
-        if ( !ok || !stripFiles(infiles, outfiles) ) {
-            System.exit(1);
-        }
-    }
-
-    // --- code below here is adapted from java.util.Properties ---
-
-    private static final String specialSaveChars = "=: \t\r\n\f#!";
-
-    /*
-     * Converts unicodes to encoded &#92;uxxxx
-     * and writes out any of the characters in specialSaveChars
-     * with a preceding slash
-     */
-    private static String saveConvert(String theString, boolean escapeSpace) {
-        int len = theString.length();
-        StringBuffer outBuffer = new StringBuffer(len*2);
-
-        for(int x=0; x<len; x++) {
-            char aChar = theString.charAt(x);
-            switch(aChar) {
-                case ' ':
-                    if (x == 0 || escapeSpace) {
-                        outBuffer.append('\\');
-                    }
-                    outBuffer.append(' ');
-                    break;
-                case '\\':
-                    outBuffer.append('\\');
-                    outBuffer.append('\\');
-                    break;
-                case '\t':
-                    outBuffer.append('\\');
-                    outBuffer.append('t');
-                    break;
-                case '\n':
-                    outBuffer.append('\\');
-                    outBuffer.append('n');
-                    break;
-                case '\r':
-                    outBuffer.append('\\');
-                    outBuffer.append('r');
-                    break;
-                case '\f':
-                    outBuffer.append('\\');
-                    outBuffer.append('f');
-                    break;
-                default:
-                    if ((aChar < 0x0020) || (aChar == 0x007e) || (aChar > 0x00ff)) {
-                        outBuffer.append('\\');
-                        outBuffer.append('u');
-                        outBuffer.append(toHex((aChar >> 12) & 0xF));
-                        outBuffer.append(toHex((aChar >>  8) & 0xF));
-                        outBuffer.append(toHex((aChar >>  4) & 0xF));
-                        outBuffer.append(toHex( aChar        & 0xF));
-                    } else {
-                        if (specialSaveChars.indexOf(aChar) != -1) {
-                            outBuffer.append('\\');
-                        }
-                        outBuffer.append(aChar);
-                    }
-            }
-        }
-        return outBuffer.toString();
-    }
-
-    /**
-     * Writes the content of <code>properties</code> to <code>out</code>.
-     * The format is that of Properties.store with the following modifications:
-     * <ul>
-     * <li>No header or date is written
-     * <li>Latin-1 characters are written as single bytes, not escape sequences
-     * <li>Line breaks are indicated by a single \n independent of platform
-     * <ul>
-     */
-    private static void storeProperties(Properties properties, OutputStream out)
-    throws IOException {
-        BufferedWriter awriter;
-        awriter = new BufferedWriter(new OutputStreamWriter(out, "8859_1"));
-        for (Enumeration<Object> e = properties.keys(); e.hasMoreElements();) {
-            String key = (String)e.nextElement();
-            String val = (String)properties.get(key);
-            key = saveConvert(key, true);
-
-            /* No need to escape embedded and trailing spaces for value, hence
-             * pass false to flag.
-             */
-            val = saveConvert(val, false);
-            writeln(awriter, key + "=" + val);
-        }
-        awriter.flush();
-    }
-
-    private static void writeln(BufferedWriter bw, String s) throws IOException {
-        bw.write(s);
-        bw.write("\n");
-    }
-
-    /**
-     * Convert a nibble to a hex character
-     * @param   nibble  the nibble to convert.
-     */
-    private static char toHex(int nibble) {
-        return hexDigit[(nibble & 0xF)];
-    }
-
-    /** A table of hex digits */
-    private static final char[] hexDigit = {
-        '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
-    };
-}
--- a/hotspot/.hgtags	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/.hgtags	Tue Apr 01 15:37:15 2014 +0200
@@ -406,3 +406,5 @@
 050a626a88951140df874f7b163e304d07b6c296 jdk9-b01
 b188446de75bda5fc52d102cddf242c3ef5ecbdf jdk9-b02
 b2fee789d23f3cdabb3db4e51af43038e5692d3a jdk9-b03
+3812c088b9456ee22c933e88aee1ece71f4e783a jdk9-b04
+bdc5311e1db7598589b77015119b821bf8c828bd jdk9-b05
--- a/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m	Tue Apr 01 15:37:15 2014 +0200
@@ -95,7 +95,9 @@
 #define CHECK_EXCEPTION_CLEAR_(value) if ((*env)->ExceptionOccurred(env)) { (*env)->ExceptionClear(env); return value; } 
 
 static void throw_new_debugger_exception(JNIEnv* env, const char* errMsg) {
-  (*env)->ThrowNew(env, (*env)->FindClass(env, "sun/jvm/hotspot/debugger/DebuggerException"), errMsg);
+  jclass exceptionClass = (*env)->FindClass(env, "sun/jvm/hotspot/debugger/DebuggerException");
+  CHECK_EXCEPTION;
+  (*env)->ThrowNew(env, exceptionClass, errMsg);
 }
 
 static struct ps_prochandle* get_proc_handle(JNIEnv* env, jobject this_obj) {
@@ -129,6 +131,7 @@
 JNIEXPORT void JNICALL 
 Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_init0(JNIEnv *env, jclass cls) {
   symbolicatorID = (*env)->GetFieldID(env, cls, "symbolicator", "J");
+  CHECK_EXCEPTION;
   taskID = (*env)->GetFieldID(env, cls, "task", "J");
   CHECK_EXCEPTION;
 
@@ -236,13 +239,16 @@
   (JNIEnv *env, jobject this_obj, jlong addr) {
   uintptr_t offset;
   const char* sym = NULL;
+  jstring sym_string;
 
   struct ps_prochandle* ph = get_proc_handle(env, this_obj);
   if (ph != NULL && ph->core != NULL) {
     sym = symbol_for_pc(ph, (uintptr_t) addr, &offset);
     if (sym == NULL) return 0;
+    sym_string = (*env)->NewStringUTF(env, sym);
+    CHECK_EXCEPTION_(0);
     return (*env)->CallObjectMethod(env, this_obj, createClosestSymbol_ID,
-                          (*env)->NewStringUTF(env, sym), (jlong)offset);
+                                                sym_string, (jlong)offset);
   }
   return 0;
 }
@@ -749,11 +755,14 @@
      const char* name;
      jobject loadObject;
      jobject loadObjectList;
+     jstring nameString;
 
      base = get_lib_base(ph, i);
      name = get_lib_name(ph, i);
+     nameString = (*env)->NewStringUTF(env, name);
+     CHECK_EXCEPTION;
      loadObject = (*env)->CallObjectMethod(env, this_obj, createLoadObject_ID,
-                                   (*env)->NewStringUTF(env, name), (jlong)0, (jlong)base);
+                                            nameString, (jlong)0, (jlong)base);
      CHECK_EXCEPTION;
      loadObjectList = (*env)->GetObjectField(env, this_obj, loadObjectList_ID);
      CHECK_EXCEPTION;
--- a/hotspot/make/aix/makefiles/vm.make	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/make/aix/makefiles/vm.make	Tue Apr 01 15:37:15 2014 +0200
@@ -101,7 +101,7 @@
 # This is VERY important! The version define must only be supplied to vm_version.o
 # If not, ccache will not re-use the cache at all, since the version string might contain
 # a time and date.
-vm_version.o: CXXFLAGS += ${JRE_VERSION}
+CXXFLAGS/vm_version.o += ${JRE_VERSION}
 
 CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
 
--- a/hotspot/src/cpu/ppc/vm/assembler_ppc.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/assembler_ppc.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,6 @@
  */
 
 #include "precompiled.hpp"
-#include "asm/assembler.hpp"
 #include "asm/assembler.inline.hpp"
 #include "gc_interface/collectedHeap.inline.hpp"
 #include "interpreter/interpreter.hpp"
@@ -37,6 +36,7 @@
 #include "runtime/os.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "utilities/macros.hpp"
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
@@ -384,10 +384,10 @@
       bool load_xa = (xa != 0) || (xb < 0);
       bool return_xd = false;
 
-      if (load_xa) lis(tmp, xa);
-      if (xc) lis(d, xc);
+      if (load_xa) { lis(tmp, xa); }
+      if (xc) { lis(d, xc); }
       if (load_xa) {
-        if (xb) ori(tmp, tmp, xb); // No addi, we support tmp == R0.
+        if (xb) { ori(tmp, tmp, (unsigned short)xb); } // No addi, we support tmp == R0.
       } else {
         li(tmp, xb); // non-negative
       }
@@ -409,18 +409,18 @@
     // opt 4: avoid adding 0
     if (xa) { // Highest 16-bit needed?
       lis(d, xa);
-      if (xb) addi(d, d, xb);
+      if (xb) { addi(d, d, xb); }
     } else {
       li(d, xb);
     }
     sldi(d, d, 32);
-    if (xc) addis(d, d, xc);
+    if (xc) { addis(d, d, xc); }
   }
 
   // opt 5: Return offset to be inserted into following instruction.
   if (return_simm16_rest) return xd;
 
-  if (xd) addi(d, d, xd);
+  if (xd) { addi(d, d, xd); }
   return 0;
 }
 
@@ -696,4 +696,5 @@
   tty->print_cr("\ntest_asm disassembly (0x%lx 0x%lx):", code()->insts_begin(), code()->insts_end());
   code()->decode();
 }
+
 #endif // !PRODUCT
--- a/hotspot/src/cpu/ppc/vm/assembler_ppc.inline.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/assembler_ppc.inline.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -139,7 +139,8 @@
 inline void Assembler::cmplw( ConditionRegister crx, Register a, Register b) { Assembler::cmpl( crx, 0, a, b); }
 inline void Assembler::cmpld( ConditionRegister crx, Register a, Register b) { Assembler::cmpl( crx, 1, a, b); }
 
-inline void Assembler::isel(Register d, Register a, Register b, int c) { emit_int32(ISEL_OPCODE    | rt(d)  | ra(a) | rb(b) | bc(c)); }
+inline void Assembler::isel(Register d, Register a, Register b, int c) { guarantee(VM_Version::has_isel(), "opcode not supported on this hardware");
+                                                                         emit_int32(ISEL_OPCODE    | rt(d)  | ra(a) | rb(b) | bc(c)); }
 
 // PPC 1, section 3.3.11, Fixed-Point Logical Instructions
 inline void Assembler::andi_(   Register a, Register s, int ui16)      { emit_int32(ANDI_OPCODE    | rta(a) | rs(s) | uimm(ui16, 16)); }
@@ -531,9 +532,12 @@
 //inline void Assembler::mffgpr( FloatRegister d, Register b)   { emit_int32( MFFGPR_OPCODE | frt(d) | rb(b) | rc(0)); }
 //inline void Assembler::mftgpr( Register d, FloatRegister b)   { emit_int32( MFTGPR_OPCODE | rt(d) | frb(b) | rc(0)); }
 // add cmpb and popcntb to detect ppc power version.
-inline void Assembler::cmpb(   Register a, Register s, Register b) { emit_int32( CMPB_OPCODE    | rta(a) | rs(s) | rb(b) | rc(0)); }
-inline void Assembler::popcntb(Register a, Register s)             { emit_int32( POPCNTB_OPCODE | rta(a) | rs(s)); };
-inline void Assembler::popcntw(Register a, Register s)             { emit_int32( POPCNTW_OPCODE | rta(a) | rs(s)); };
+inline void Assembler::cmpb(   Register a, Register s, Register b) { guarantee(VM_Version::has_cmpb(), "opcode not supported on this hardware");
+                                                                     emit_int32( CMPB_OPCODE    | rta(a) | rs(s) | rb(b) | rc(0)); }
+inline void Assembler::popcntb(Register a, Register s)             { guarantee(VM_Version::has_popcntb(), "opcode not supported on this hardware");
+                                                                     emit_int32( POPCNTB_OPCODE | rta(a) | rs(s)); };
+inline void Assembler::popcntw(Register a, Register s)             { guarantee(VM_Version::has_popcntw(), "opcode not supported on this hardware");
+                                                                     emit_int32( POPCNTW_OPCODE | rta(a) | rs(s)); };
 inline void Assembler::popcntd(Register a, Register s)             { emit_int32( POPCNTD_OPCODE | rta(a) | rs(s)); };
 
 inline void Assembler::fneg(  FloatRegister d, FloatRegister b) { emit_int32( FNEG_OPCODE  | frt(d) | frb(b) | rc(0)); }
@@ -568,14 +572,17 @@
 inline void Assembler::fctiw( FloatRegister d, FloatRegister b) { emit_int32( FCTIW_OPCODE  | frt(d) | frb(b) | rc(0)); }
 inline void Assembler::fctiwz(FloatRegister d, FloatRegister b) { emit_int32( FCTIWZ_OPCODE | frt(d) | frb(b) | rc(0)); }
 inline void Assembler::fcfid( FloatRegister d, FloatRegister b) { emit_int32( FCFID_OPCODE  | frt(d) | frb(b) | rc(0)); }
-inline void Assembler::fcfids(FloatRegister d, FloatRegister b) { emit_int32( FCFIDS_OPCODE | frt(d) | frb(b) | rc(0)); }
+inline void Assembler::fcfids(FloatRegister d, FloatRegister b) { guarantee(VM_Version::has_fcfids(), "opcode not supported on this hardware");
+                                                                  emit_int32( FCFIDS_OPCODE | frt(d) | frb(b) | rc(0)); }
 
 // PPC 1, section 4.6.7 Floating-Point Compare Instructions
 inline void Assembler::fcmpu( ConditionRegister crx, FloatRegister a, FloatRegister b) { emit_int32( FCMPU_OPCODE | bf(crx) | fra(a) | frb(b)); }
 
 // PPC 1, section 5.2.1 Floating-Point Arithmetic Instructions
-inline void Assembler::fsqrt( FloatRegister d, FloatRegister b) { emit_int32( FSQRT_OPCODE  | frt(d) | frb(b) | rc(0)); }
-inline void Assembler::fsqrts(FloatRegister d, FloatRegister b) { emit_int32( FSQRTS_OPCODE | frt(d) | frb(b) | rc(0)); }
+inline void Assembler::fsqrt( FloatRegister d, FloatRegister b) { guarantee(VM_Version::has_fsqrt(), "opcode not supported on this hardware");
+                                                                  emit_int32( FSQRT_OPCODE  | frt(d) | frb(b) | rc(0)); }
+inline void Assembler::fsqrts(FloatRegister d, FloatRegister b) { guarantee(VM_Version::has_fsqrts(), "opcode not supported on this hardware");
+                                                                  emit_int32( FSQRTS_OPCODE | frt(d) | frb(b) | rc(0)); }
 
 // Vector instructions for >= Power6.
 inline void Assembler::lvebx( VectorRegister d, Register s1, Register s2) { emit_int32( LVEBX_OPCODE  | vrt(d) | ra0mem(s1) | rb(s2)); }
@@ -703,7 +710,8 @@
 inline void Assembler::vcmpgtub_(VectorRegister d,VectorRegister a, VectorRegister b) { emit_int32( VCMPGTUB_OPCODE | vrt(d) | vra(a) | vrb(b) | vcmp_rc(1)); }
 inline void Assembler::vcmpgtuh_(VectorRegister d,VectorRegister a, VectorRegister b) { emit_int32( VCMPGTUH_OPCODE | vrt(d) | vra(a) | vrb(b) | vcmp_rc(1)); }
 inline void Assembler::vcmpgtuw_(VectorRegister d,VectorRegister a, VectorRegister b) { emit_int32( VCMPGTUW_OPCODE | vrt(d) | vra(a) | vrb(b) | vcmp_rc(1)); }
-inline void Assembler::vand(    VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VAND_OPCODE     | vrt(d) | vra(a) | vrb(b)); }
+inline void Assembler::vand(    VectorRegister d, VectorRegister a, VectorRegister b) { guarantee(VM_Version::has_vand(), "opcode not supported on this hardware");
+                                                                                        emit_int32( VAND_OPCODE     | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vandc(   VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VANDC_OPCODE    | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vnor(    VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VNOR_OPCODE     | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vor(     VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VOR_OPCODE      | vrt(d) | vra(a) | vrb(b)); }
--- a/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,7 +87,7 @@
 define_pd_global(uintx, CodeCacheMinBlockLength,     4);
 define_pd_global(uintx, CodeCacheMinimumUseSpace,    400*K);
 
-define_pd_global(bool,  TrapBasedRangeChecks,        false);
+define_pd_global(bool,  TrapBasedRangeChecks,        true);
 
 // Heap related flags
 define_pd_global(uintx,MetaspaceSize,                ScaleForWordSize(16*M));
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,8 +24,6 @@
  */
 
 #include "precompiled.hpp"
-#include "asm/assembler.hpp"
-#include "asm/assembler.inline.hpp"
 #include "asm/macroAssembler.inline.hpp"
 #include "compiler/disassembler.hpp"
 #include "gc_interface/collectedHeap.inline.hpp"
@@ -1120,7 +1118,7 @@
   }
   return _last_calls_return_pc;
 }
-#endif
+#endif // ABI_ELFv2
 
 void MacroAssembler::call_VM_base(Register oop_result,
                                   Register last_java_sp,
@@ -1794,7 +1792,7 @@
   cmpwi(cr_reg, temp_reg, markOopDesc::biased_lock_pattern);
   bne(cr_reg, cas_label);
 
-  load_klass_with_trap_null_check(temp_reg, obj_reg);
+  load_klass(temp_reg, obj_reg);
 
   load_const_optimized(temp2_reg, ~((int) markOopDesc::age_mask_in_place));
   ld(temp_reg, in_bytes(Klass::prototype_header_offset()), temp_reg);
@@ -1891,7 +1889,7 @@
   // the bias from one thread to another directly in this situation.
   andi(temp_reg, mark_reg, markOopDesc::age_mask_in_place);
   orr(temp_reg, R16_thread, temp_reg);
-  load_klass_with_trap_null_check(temp2_reg, obj_reg);
+  load_klass(temp2_reg, obj_reg);
   ld(temp2_reg, in_bytes(Klass::prototype_header_offset()), temp2_reg);
   orr(temp_reg, temp_reg, temp2_reg);
 
@@ -1927,7 +1925,7 @@
   // that another thread raced us for the privilege of revoking the
   // bias of this particular object, so it's okay to continue in the
   // normal locking code.
-  load_klass_with_trap_null_check(temp_reg, obj_reg);
+  load_klass(temp_reg, obj_reg);
   ld(temp_reg, in_bytes(Klass::prototype_header_offset()), temp_reg);
   andi(temp2_reg, mark_reg, markOopDesc::age_mask_in_place);
   orr(temp_reg, temp_reg, temp2_reg);
@@ -2213,8 +2211,7 @@
   stbx(R0, Rtmp, Robj);
 }
 
-#ifndef SERIALGC
-
+#if INCLUDE_ALL_GCS
 // General G1 pre-barrier generator.
 // Goal: record the previous value if it is not null.
 void MacroAssembler::g1_write_barrier_pre(Register Robj, RegisterOrConstant offset, Register Rpre_val,
@@ -2328,14 +2325,17 @@
 
   // Get the address of the card.
   lbzx(/*card value*/ Rtmp3, Rbase, Rcard_addr);
-
-  assert(CardTableModRefBS::dirty_card_val() == 0, "otherwise check this code");
-  cmpwi(CCR0, Rtmp3 /* card value */, 0);
+  cmpwi(CCR0, Rtmp3, (int)G1SATBCardTableModRefBS::g1_young_card_val());
+  beq(CCR0, filtered);
+
+  membar(Assembler::StoreLoad);
+  lbzx(/*card value*/ Rtmp3, Rbase, Rcard_addr);  // Reload after membar.
+  cmpwi(CCR0, Rtmp3 /* card value */, CardTableModRefBS::dirty_card_val());
   beq(CCR0, filtered);
 
   // Storing a region crossing, non-NULL oop, card is clean.
   // Dirty card and log.
-  li(Rtmp3, 0); // dirty
+  li(Rtmp3, CardTableModRefBS::dirty_card_val());
   //release(); // G1: oops are allowed to get visible after dirty marking.
   stbx(Rtmp3, Rbase, Rcard_addr);
 
@@ -2362,7 +2362,7 @@
 
   bind(filtered_int);
 }
-#endif // SERIALGC
+#endif // INCLUDE_ALL_GCS
 
 // Values for last_Java_pc, and last_Java_sp must comply to the rules
 // in frame_ppc64.hpp.
@@ -2453,7 +2453,8 @@
 void MacroAssembler::encode_klass_not_null(Register dst, Register src) {
   Register current = (src != noreg) ? src : dst; // Klass is in dst if no src provided.
   if (Universe::narrow_klass_base() != 0) {
-    load_const(R0, Universe::narrow_klass_base(), (dst != current) ? dst : noreg); // Use dst as temp if it is free.
+    // Use dst as temp if it is free.
+    load_const(R0, Universe::narrow_klass_base(), (dst != current && dst != R0) ? dst : noreg);
     sub(dst, current, R0);
     current = dst;
   }
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -514,14 +514,14 @@
   void card_write_barrier_post(Register Rstore_addr, Register Rnew_val, Register Rtmp);
   void card_table_write(jbyte* byte_map_base, Register Rtmp, Register Robj);
 
-#ifndef SERIALGC
+#if INCLUDE_ALL_GCS
   // General G1 pre-barrier generator.
   void g1_write_barrier_pre(Register Robj, RegisterOrConstant offset, Register Rpre_val,
                             Register Rtmp1, Register Rtmp2, bool needs_frame = false);
   // General G1 post-barrier generator
   void g1_write_barrier_post(Register Rstore_addr, Register Rnew_val, Register Rtmp1,
                              Register Rtmp2, Register Rtmp3, Label *filtered_ext = NULL);
-#endif // SERIALGC
+#endif
 
   // Support for managing the JavaThread pointer (i.e.; the reference to
   // thread-local information).
--- a/hotspot/src/cpu/ppc/vm/methodHandles_ppc.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/methodHandles_ppc.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -119,6 +119,7 @@
 
 void MethodHandles::jump_from_method_handle(MacroAssembler* _masm, Register method, Register target, Register temp,
                                             bool for_compiler_entry) {
+  Label L_no_such_method;
   assert(method == R19_method, "interpreter calling convention");
   assert_different_registers(method, target, temp);
 
@@ -131,17 +132,31 @@
     __ lwz(temp, in_bytes(JavaThread::interp_only_mode_offset()), R16_thread);
     __ cmplwi(CCR0, temp, 0);
     __ beq(CCR0, run_compiled_code);
+    // Null method test is replicated below in compiled case,
+    // it might be able to address across the verify_thread()
+    __ cmplwi(CCR0, R19_method, 0);
+    __ beq(CCR0, L_no_such_method);
     __ ld(target, in_bytes(Method::interpreter_entry_offset()), R19_method);
     __ mtctr(target);
     __ bctr();
     __ BIND(run_compiled_code);
   }
 
+  // Compiled case, either static or fall-through from runtime conditional
+  __ cmplwi(CCR0, R19_method, 0);
+  __ beq(CCR0, L_no_such_method);
+
   const ByteSize entry_offset = for_compiler_entry ? Method::from_compiled_offset() :
                                                      Method::from_interpreted_offset();
   __ ld(target, in_bytes(entry_offset), R19_method);
   __ mtctr(target);
   __ bctr();
+
+  __ bind(L_no_such_method);
+  assert(StubRoutines::throw_AbstractMethodError_entry() != NULL, "not yet generated!");
+  __ load_const_optimized(target, StubRoutines::throw_AbstractMethodError_entry());
+  __ mtctr(target);
+  __ bctr();
 }
 
 
--- a/hotspot/src/cpu/ppc/vm/ppc.ad	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/ppc.ad	Tue Apr 01 15:37:15 2014 +0200
@@ -891,6 +891,13 @@
 // This is a block of C++ code which provides values, functions, and
 // definitions necessary in the rest of the architecture description.
 source_hpp %{
+  // Header information of the source block.
+  // Method declarations/definitions which are used outside
+  // the ad-scope can conveniently be defined here.
+  //
+  // To keep related declarations/definitions/uses close together,
+  // we switch between source %{ }% and source_hpp %{ }% freely as needed.
+
   // Returns true if Node n is followed by a MemBar node that 
   // will do an acquire. If so, this node must not do the acquire
   // operation.
@@ -1114,6 +1121,40 @@
 
 //=============================================================================
 
+%} // interrupt source
+
+source_hpp %{ // Header information of the source block.
+
+//--------------------------------------------------------------
+//---<  Used for optimization in Compile::Shorten_branches  >---
+//--------------------------------------------------------------
+
+const uint trampoline_stub_size     =  6 * BytesPerInstWord;
+
+class CallStubImpl {
+
+ public:
+
+  static void emit_trampoline_stub(MacroAssembler &_masm, int destination_toc_offset, int insts_call_instruction_offset);
+
+  // Size of call trampoline stub.
+  // This doesn't need to be accurate to the byte, but it
+  // must be larger than or equal to the real size of the stub.
+  static uint size_call_trampoline() {
+    return trampoline_stub_size;
+  }
+
+  // number of relocations needed by a call trampoline stub
+  static uint reloc_call_trampoline() {
+    return 5;
+  }
+
+};
+
+%} // end source_hpp
+
+source %{
+
 // Emit a trampoline stub for a call to a target which is too far away.
 //
 // code sequences:
@@ -1125,9 +1166,7 @@
 //   load the call target from the constant pool
 //   branch via CTR (LR/link still points to the call-site above)
 
-const uint trampoline_stub_size = 6 * BytesPerInstWord;
-
-void emit_trampoline_stub(MacroAssembler &_masm, int destination_toc_offset, int insts_call_instruction_offset) {
+void CallStubImpl::emit_trampoline_stub(MacroAssembler &_masm, int destination_toc_offset, int insts_call_instruction_offset) {
   // Start the stub.
   address stub = __ start_a_stub(Compile::MAX_stubs_size/2);
   if (stub == NULL) {
@@ -1170,19 +1209,6 @@
   __ end_a_stub();
 }
 
-// Size of trampoline stub, this doesn't need to be accurate but it must
-// be larger or equal to the real size of the stub.
-// Used for optimization in Compile::Shorten_branches.
-uint size_call_trampoline() {
-  return trampoline_stub_size;
-}
-
-// Number of relocation entries needed by trampoline stub.
-// Used for optimization in Compile::Shorten_branches.
-uint reloc_call_trampoline() {
-  return 5;
-}
-
 //=============================================================================
 
 // Emit an inline branch-and-link call and a related trampoline stub.
@@ -1221,7 +1247,7 @@
     const int     entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr);
 
     // Emit the trampoline stub which will be related to the branch-and-link below.
-    emit_trampoline_stub(_masm, entry_point_toc_offset, offsets.insts_call_instruction_offset);
+    CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, offsets.insts_call_instruction_offset);
     __ relocate(rtype);
   }
 
@@ -2023,17 +2049,34 @@
 
 //=============================================================================
 
-uint size_exception_handler() {
-  // The exception_handler is a b64_patchable.
-  return MacroAssembler::b64_patchable_size;
-}
-
-uint size_deopt_handler() {
-  // The deopt_handler is a bl64_patchable.
-  return MacroAssembler::bl64_patchable_size;
-}
-
-int emit_exception_handler(CodeBuffer &cbuf) {
+%} // interrupt source
+
+source_hpp %{ // Header information of the source block.
+
+class HandlerImpl {
+
+ public:
+
+  static int emit_exception_handler(CodeBuffer &cbuf);
+  static int emit_deopt_handler(CodeBuffer& cbuf);
+
+  static uint size_exception_handler() {
+    // The exception_handler is a b64_patchable.
+    return MacroAssembler::b64_patchable_size;
+  }
+
+  static uint size_deopt_handler() {
+    // The deopt_handler is a bl64_patchable.
+    return MacroAssembler::bl64_patchable_size;
+  }
+
+};
+
+%} // end source_hpp
+
+source %{
+
+int HandlerImpl::emit_exception_handler(CodeBuffer &cbuf) {
   MacroAssembler _masm(&cbuf);
 
   address base = __ start_a_stub(size_exception_handler());
@@ -2050,7 +2093,7 @@
 
 // The deopt_handler is like the exception handler, but it calls to
 // the deoptimization blob instead of jumping to the exception blob.
-int emit_deopt_handler(CodeBuffer& cbuf) {
+int HandlerImpl::emit_deopt_handler(CodeBuffer& cbuf) {
   MacroAssembler _masm(&cbuf);
 
   address base = __ start_a_stub(size_deopt_handler());
@@ -3438,7 +3481,7 @@
         const int     entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr);
 
         // Emit the trampoline stub which will be related to the branch-and-link below.
-        emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset);
+        CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset);
         __ relocate(_optimized_virtual ?
                     relocInfo::opt_virtual_call_type : relocInfo::static_call_type);
       }
@@ -3481,7 +3524,7 @@
       const int     entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr);
 
       // Emit the trampoline stub which will be related to the branch-and-link below.
-      emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset);
+      CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset);
       assert(_optimized_virtual, "methodHandle call should be a virtual call");
       __ relocate(relocInfo::opt_virtual_call_type);
     }
@@ -3531,7 +3574,7 @@
       const address entry_point = !($meth$$method) ? 0 : (address)$meth$$method;
       const address entry_point_const = __ address_constant(entry_point, RelocationHolder::none);
       const int entry_point_const_toc_offset = __ offset_to_method_toc(entry_point_const);
-      emit_trampoline_stub(_masm, entry_point_const_toc_offset, __ offset());
+      CallStubImpl::emit_trampoline_stub(_masm, entry_point_const_toc_offset, __ offset());
 
       if (ra_->C->env()->failing())
         return;
@@ -8755,6 +8798,7 @@
 // Single-precision sqrt.
 instruct sqrtF_reg(regF dst, regF src) %{
   match(Set dst (ConvD2F (SqrtD (ConvF2D src))));
+  predicate(VM_Version::has_fsqrts());
   ins_cost(DEFAULT_COST);
 
   format %{ "FSQRTS  $dst, $src" %}
@@ -11550,8 +11594,7 @@
   // effect no longer needs to be mentioned, since r0 is not contained
   // in a reg_class.
 
-  format %{ "LD      R12, addr of polling page\n\t"
-            "LD      R0, #0, R12 \t// Safepoint poll for GC" %}
+  format %{ "LD      R0, #0, R12 \t// Safepoint poll for GC" %}
   ins_encode( enc_poll(0x0, poll) );
   ins_pipe(pipe_class_default);
 %}
--- a/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -34,6 +34,7 @@
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/vframeArray.hpp"
 #include "vmreg_ppc.inline.hpp"
+#include "adfiles/ad_ppc_64.hpp"
 #ifdef COMPILER1
 #include "c1/c1_Runtime1.hpp"
 #endif
@@ -52,10 +53,6 @@
 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
 
 
-// Used by generate_deopt_blob.  Defined in .ad file.
-extern uint size_deopt_handler();
-
-
 class RegisterSaver {
  // Used for saving volatile registers.
  public:
@@ -2782,7 +2779,7 @@
   // We can't grab a free register here, because all registers may
   // contain live values, so let the RegisterSaver do the adjustment
   // of the return pc.
-  const int return_pc_adjustment_no_exception = -size_deopt_handler();
+  const int return_pc_adjustment_no_exception = -HandlerImpl::size_deopt_handler();
 
   // Push the "unpack frame"
   // Save everything in sight.
--- a/hotspot/src/cpu/ppc/vm/stubRoutines_ppc_64.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/stubRoutines_ppc_64.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,17 +23,6 @@
  *
  */
 
-#include "precompiled.hpp"
-#include "runtime/deoptimization.hpp"
-#include "runtime/frame.inline.hpp"
-#include "runtime/stubRoutines.hpp"
-#ifdef TARGET_OS_FAMILY_aix
-# include "thread_aix.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-
 // Implementation of the platform-specific part of StubRoutines - for
 // a description of how to extend it, see the stubRoutines.hpp file.
 
--- a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -402,6 +402,9 @@
   CodeBuffer cb("detect_cpu_features", code_size, 0);
   MacroAssembler* a = new MacroAssembler(&cb);
 
+  // Must be set to true so we can generate the test code.
+  _features = VM_Version::all_features_m;
+
   // Emit code.
   void (*test)(address addr, uint64_t offset)=(void(*)(address addr, uint64_t offset))(void *)a->function_entry();
   uint32_t *code = (uint32_t *)a->pc();
@@ -409,14 +412,15 @@
   // Keep R3_ARG1 unmodified, it contains &field (see below).
   // Keep R4_ARG2 unmodified, it contains offset = 0 (see below).
   a->fsqrt(F3, F4);                            // code[0] -> fsqrt_m
-  a->isel(R7, R5, R6, 0);                      // code[1] -> isel_m
-  a->ldarx_unchecked(R7, R3_ARG1, R4_ARG2, 1); // code[2] -> lxarx_m
-  a->cmpb(R7, R5, R6);                         // code[3] -> bcmp
-  //a->mftgpr(R7, F3);                         // code[4] -> mftgpr
-  a->popcntb(R7, R5);                          // code[5] -> popcntb
-  a->popcntw(R7, R5);                          // code[6] -> popcntw
-  a->fcfids(F3, F4);                           // code[7] -> fcfids
-  a->vand(VR0, VR0, VR0);                      // code[8] -> vand
+  a->fsqrts(F3, F4);                           // code[1] -> fsqrts_m
+  a->isel(R7, R5, R6, 0);                      // code[2] -> isel_m
+  a->ldarx_unchecked(R7, R3_ARG1, R4_ARG2, 1); // code[3] -> lxarx_m
+  a->cmpb(R7, R5, R6);                         // code[4] -> bcmp
+  //a->mftgpr(R7, F3);                         // code[5] -> mftgpr
+  a->popcntb(R7, R5);                          // code[6] -> popcntb
+  a->popcntw(R7, R5);                          // code[7] -> popcntw
+  a->fcfids(F3, F4);                           // code[8] -> fcfids
+  a->vand(VR0, VR0, VR0);                      // code[9] -> vand
   a->blr();
 
   // Emit function to set one cache line to zero. Emit function descriptor and get pointer to it.
@@ -426,6 +430,7 @@
 
   uint32_t *code_end = (uint32_t *)a->pc();
   a->flush();
+  _features = VM_Version::unknown_m;
 
   // Print the detection code.
   if (PrintAssembly) {
@@ -450,6 +455,7 @@
   // determine which instructions are legal.
   int feature_cntr = 0;
   if (code[feature_cntr++]) features |= fsqrt_m;
+  if (code[feature_cntr++]) features |= fsqrts_m;
   if (code[feature_cntr++]) features |= isel_m;
   if (code[feature_cntr++]) features |= lxarxeh_m;
   if (code[feature_cntr++]) features |= cmpb_m;
--- a/hotspot/src/cpu/ppc/vm/vm_version_ppc.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/vm_version_ppc.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 protected:
   enum Feature_Flag {
     fsqrt,
+    fsqrts,
     isel,
     lxarxeh,
     cmpb,
@@ -46,6 +47,7 @@
   enum Feature_Flag_Set {
     unknown_m             = 0,
     fsqrt_m               = (1 << fsqrt  ),
+    fsqrts_m              = (1 << fsqrts ),
     isel_m                = (1 << isel   ),
     lxarxeh_m             = (1 << lxarxeh),
     cmpb_m                = (1 << cmpb   ),
@@ -72,6 +74,7 @@
   static bool is_determine_features_test_running() { return _is_determine_features_test_running; }
   // CPU instruction support
   static bool has_fsqrt()   { return (_features & fsqrt_m) != 0; }
+  static bool has_fsqrts()  { return (_features & fsqrts_m) != 0; }
   static bool has_isel()    { return (_features & isel_m) != 0; }
   static bool has_lxarxeh() { return (_features & lxarxeh_m) !=0; }
   static bool has_cmpb()    { return (_features & cmpb_m) != 0; }
--- a/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -79,7 +79,7 @@
   address npe_addr = __ pc(); // npe = null pointer exception
   __ load_klass_with_trap_null_check(rcvr_klass, R3);
 
- // Set methodOop (in case of interpreted method), and destination address.
+ // Set method (in case of interpreted method), and destination address.
   int entry_offset = InstanceKlass::vtable_start_offset() + vtable_index*vtableEntry::size();
 
 #ifndef PRODUCT
@@ -161,8 +161,6 @@
   address npe_addr = __ pc(); // npe = null pointer exception
   __ load_klass_with_trap_null_check(rcvr_klass, R3_ARG1);
 
-  //__ ld(rcvr_klass, oopDesc::klass_offset_in_bytes(), R3_ARG1);
-
   BLOCK_COMMENT("Load start of itable entries into itable_entry.");
   __ lwz(vtable_len, InstanceKlass::vtable_length_offset() * wordSize, rcvr_klass);
   __ slwi(vtable_len, vtable_len, exact_log2(vtableEntry::size() * wordSize));
@@ -199,7 +197,7 @@
                                    itable_offset_search_inc;
   __ lwz(vtable_offset, vtable_offset_offset, itable_entry_addr);
 
-  // Compute itableMethodEntry and get methodOop and entry point for compiler.
+  // Compute itableMethodEntry and get method and entry point for compiler.
   const int method_offset = (itableMethodEntry::size() * wordSize * vtable_index) +
     itableMethodEntry::method_offset_in_bytes();
 
@@ -211,7 +209,7 @@
     Label ok;
     __ cmpd(CCR0, R19_method, 0);
     __ bne(CCR0, ok);
-    __ stop("methodOop is null", 103);
+    __ stop("method is null", 103);
     __ bind(ok);
   }
 #endif
--- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -3320,7 +3320,7 @@
 
   // if tmp is invalid, then the function being called doesn't destroy the thread
   if (tmp->is_valid()) {
-    __ save_thread(tmp->as_register());
+    __ save_thread(tmp->as_pointer_register());
   }
   __ call(dest, relocInfo::runtime_call_type);
   __ delayed()->nop();
@@ -3328,7 +3328,7 @@
     add_call_info_here(info);
   }
   if (tmp->is_valid()) {
-    __ restore_thread(tmp->as_register());
+    __ restore_thread(tmp->as_pointer_register());
   }
 
 #ifdef ASSERT
--- a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -69,7 +69,7 @@
 LIR_Opr LIRGenerator::exceptionOopOpr()              { return FrameMap::Oexception_opr;  }
 LIR_Opr LIRGenerator::exceptionPcOpr()               { return FrameMap::Oissuing_pc_opr; }
 LIR_Opr LIRGenerator::syncTempOpr()                  { return new_register(T_OBJECT); }
-LIR_Opr LIRGenerator::getThreadTemp()                { return rlock_callee_saved(T_INT); }
+LIR_Opr LIRGenerator::getThreadTemp()                { return rlock_callee_saved(NOT_LP64(T_INT) LP64_ONLY(T_LONG)); }
 
 LIR_Opr LIRGenerator::result_register_for(ValueType* type, bool callee) {
   LIR_Opr opr;
--- a/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -66,6 +66,4 @@
 define_pd_global(bool, CSEArrayLength,               true );
 define_pd_global(bool, TwoOperandLIRForm,            false);
 
-define_pd_global(intx, SafepointPollOffset,          0    );
-
 #endif // CPU_SPARC_VM_C1_GLOBALS_SPARC_HPP
--- a/hotspot/src/cpu/sparc/vm/sparc.ad	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/sparc/vm/sparc.ad	Tue Apr 01 15:37:15 2014 +0200
@@ -457,6 +457,13 @@
 // This is a block of C++ code which provides values, functions, and
 // definitions necessary in the rest of the architecture description
 source_hpp %{
+// Header information of the source block.
+// Method declarations/definitions which are used outside
+// the ad-scope can conveniently be defined here.
+//
+// To keep related declarations/definitions/uses close together,
+// we switch between source %{ }% and source_hpp %{ }% freely as needed.
+
 // Must be visible to the DFA in dfa_sparc.cpp
 extern bool can_branch_register( Node *bol, Node *cmp );
 
@@ -468,6 +475,46 @@
 #define LONG_HI_REG(x) (x)
 #define LONG_LO_REG(x) (x)
 
+class CallStubImpl {
+
+  //--------------------------------------------------------------
+  //---<  Used for optimization in Compile::Shorten_branches  >---
+  //--------------------------------------------------------------
+
+ public:
+  // Size of call trampoline stub.
+  static uint size_call_trampoline() {
+    return 0; // no call trampolines on this platform
+  }
+
+  // number of relocations needed by a call trampoline stub
+  static uint reloc_call_trampoline() {
+    return 0; // no call trampolines on this platform
+  }
+};
+
+class HandlerImpl {
+
+ public:
+
+  static int emit_exception_handler(CodeBuffer &cbuf);
+  static int emit_deopt_handler(CodeBuffer& cbuf);
+
+  static uint size_exception_handler() {
+    if (TraceJumps) {
+      return (400); // just a guess
+    }
+    return ( NativeJump::instruction_size ); // sethi;jmp;nop
+  }
+
+  static uint size_deopt_handler() {
+    if (TraceJumps) {
+      return (400); // just a guess
+    }
+    return ( 4+  NativeJump::instruction_size ); // save;sethi;jmp;restore
+  }
+};
+
 %}
 
 source %{
@@ -1710,22 +1757,9 @@
 
 //=============================================================================
 
-uint size_exception_handler() {
-  if (TraceJumps) {
-    return (400); // just a guess
-  }
-  return ( NativeJump::instruction_size ); // sethi;jmp;nop
-}
-
-uint size_deopt_handler() {
-  if (TraceJumps) {
-    return (400); // just a guess
-  }
-  return ( 4+  NativeJump::instruction_size ); // save;sethi;jmp;restore
-}
 
 // Emit exception handler code.
-int emit_exception_handler(CodeBuffer& cbuf) {
+int HandlerImpl::emit_exception_handler(CodeBuffer& cbuf) {
   Register temp_reg = G3;
   AddressLiteral exception_blob(OptoRuntime::exception_blob()->entry_point());
   MacroAssembler _masm(&cbuf);
@@ -1746,7 +1780,7 @@
   return offset;
 }
 
-int emit_deopt_handler(CodeBuffer& cbuf) {
+int HandlerImpl::emit_deopt_handler(CodeBuffer& cbuf) {
   // Can't use any of the current frame's registers as we may have deopted
   // at a poll and everything (including G3) can be live.
   Register temp_reg = L0;
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1112,7 +1112,6 @@
 }
 
 void Assembler::bsrl(Register dst, Register src) {
-  assert(!VM_Version::supports_lzcnt(), "encoding is treated as LZCNT");
   int encode = prefix_and_encode(dst->encoding(), src->encoding());
   emit_int8(0x0F);
   emit_int8((unsigned char)0xBD);
@@ -2343,6 +2342,11 @@
   emit_int8(imm8);
 }
 
+void Assembler::pause() {
+  emit_int8((unsigned char)0xF3);
+  emit_int8((unsigned char)0x90);
+}
+
 void Assembler::pcmpestri(XMMRegister dst, Address src, int imm8) {
   assert(VM_Version::supports_sse4_2(), "");
   InstructionMark im(this);
@@ -2667,6 +2671,11 @@
   }
 }
 
+void Assembler::rdtsc() {
+  emit_int8((unsigned char)0x0F);
+  emit_int8((unsigned char)0x31);
+}
+
 // copies data from [esi] to [edi] using rcx pointer sized words
 // generic
 void Assembler::rep_mov() {
@@ -2976,6 +2985,11 @@
   emit_simd_arith_nonds(0x2E, dst, src, VEX_SIMD_NONE);
 }
 
+void Assembler::xabort(int8_t imm8) {
+  emit_int8((unsigned char)0xC6);
+  emit_int8((unsigned char)0xF8);
+  emit_int8((unsigned char)(imm8 & 0xFF));
+}
 
 void Assembler::xaddl(Address dst, Register src) {
   InstructionMark im(this);
@@ -2985,6 +2999,24 @@
   emit_operand(src, dst);
 }
 
+void Assembler::xbegin(Label& abort, relocInfo::relocType rtype) {
+  InstructionMark im(this);
+  relocate(rtype);
+  if (abort.is_bound()) {
+    address entry = target(abort);
+    assert(entry != NULL, "abort entry NULL");
+    intptr_t offset = entry - pc();
+    emit_int8((unsigned char)0xC7);
+    emit_int8((unsigned char)0xF8);
+    emit_int32(offset - 6); // 2 opcode + 4 address
+  } else {
+    abort.add_patch_at(code(), locator());
+    emit_int8((unsigned char)0xC7);
+    emit_int8((unsigned char)0xF8);
+    emit_int32(0);
+  }
+}
+
 void Assembler::xchgl(Register dst, Address src) { // xchg
   InstructionMark im(this);
   prefix(src, dst);
@@ -2998,6 +3030,12 @@
   emit_int8((unsigned char)(0xC0 | encode));
 }
 
+void Assembler::xend() {
+  emit_int8((unsigned char)0x0F);
+  emit_int8((unsigned char)0x01);
+  emit_int8((unsigned char)0xD5);
+}
+
 void Assembler::xgetbv() {
   emit_int8(0x0F);
   emit_int8(0x01);
@@ -4938,7 +4976,6 @@
 }
 
 void Assembler::bsrq(Register dst, Register src) {
-  assert(!VM_Version::supports_lzcnt(), "encoding is treated as LZCNT");
   int encode = prefixq_and_encode(dst->encoding(), src->encoding());
   emit_int8(0x0F);
   emit_int8((unsigned char)0xBD);
--- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1451,6 +1451,8 @@
   // Pemutation of 64bit words
   void vpermq(XMMRegister dst, XMMRegister src, int imm8, bool vector256);
 
+  void pause();
+
   // SSE4.2 string instructions
   void pcmpestri(XMMRegister xmm1, XMMRegister xmm2, int imm8);
   void pcmpestri(XMMRegister xmm1, Address src, int imm8);
@@ -1535,6 +1537,8 @@
 
   void rclq(Register dst, int imm8);
 
+  void rdtsc();
+
   void ret(int imm16);
 
   void sahf();
@@ -1632,16 +1636,22 @@
   void ucomiss(XMMRegister dst, Address src);
   void ucomiss(XMMRegister dst, XMMRegister src);
 
+  void xabort(int8_t imm8);
+
   void xaddl(Address dst, Register src);
 
   void xaddq(Address dst, Register src);
 
+  void xbegin(Label& abort, relocInfo::relocType rtype = relocInfo::none);
+
   void xchgl(Register reg, Address adr);
   void xchgl(Register dst, Register src);
 
   void xchgq(Register reg, Address adr);
   void xchgq(Register dst, Register src);
 
+  void xend();
+
   // Get Value of Extended Control Register
   void xgetbv();
 
--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -604,8 +604,7 @@
 
   // Note: we do not need to round double result; float result has the right precision
   // the poll sets the condition code, but no data registers
-  AddressLiteral polling_page(os::get_polling_page() + (SafepointPollOffset % os::vm_page_size()),
-                              relocInfo::poll_return_type);
+  AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_return_type);
 
   if (Assembler::is_polling_page_far()) {
     __ lea(rscratch1, polling_page);
@@ -619,8 +618,7 @@
 
 
 int LIR_Assembler::safepoint_poll(LIR_Opr tmp, CodeEmitInfo* info) {
-  AddressLiteral polling_page(os::get_polling_page() + (SafepointPollOffset % os::vm_page_size()),
-                              relocInfo::poll_type);
+  AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_type);
   guarantee(info != NULL, "Shouldn't be NULL");
   int offset = __ offset();
   if (Assembler::is_polling_page_far()) {
--- a/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -65,6 +65,4 @@
 define_pd_global(bool, CSEArrayLength,               false);
 define_pd_global(bool, TwoOperandLIRForm,            true );
 
-define_pd_global(intx, SafepointPollOffset,          256  );
-
 #endif // CPU_X86_VM_C1_GLOBALS_X86_HPP
--- a/hotspot/src/cpu/x86/vm/globals_x86.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/globals_x86.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -129,6 +129,42 @@
   product(bool, UseFastStosb, false,                                        \
           "Use fast-string operation for zeroing: rep stosb")               \
                                                                             \
+  /* Use Restricted Transactional Memory for lock eliding */                \
+  product(bool, UseRTMLocking, false,                                       \
+          "Enable RTM lock eliding for inflated locks in compiled code")    \
+                                                                            \
+  experimental(bool, UseRTMForStackLocks, false,                            \
+          "Enable RTM lock eliding for stack locks in compiled code")       \
+                                                                            \
+  product(bool, UseRTMDeopt, false,                                         \
+          "Perform deopt and recompilation based on RTM abort ratio")       \
+                                                                            \
+  product(uintx, RTMRetryCount, 5,                                          \
+          "Number of RTM retries on lock abort or busy")                    \
+                                                                            \
+  experimental(intx, RTMSpinLoopCount, 100,                                 \
+          "Spin count for lock to become free before RTM retry")            \
+                                                                            \
+  experimental(intx, RTMAbortThreshold, 1000,                               \
+          "Calculate abort ratio after this number of aborts")              \
+                                                                            \
+  experimental(intx, RTMLockingThreshold, 10000,                            \
+          "Lock count at which to do RTM lock eliding without "             \
+          "abort ratio calculation")                                        \
+                                                                            \
+  experimental(intx, RTMAbortRatio, 50,                                     \
+          "Lock abort ratio at which to stop use RTM lock eliding")         \
+                                                                            \
+  experimental(intx, RTMTotalCountIncrRate, 64,                             \
+          "Increment total RTM attempted lock count once every n times")    \
+                                                                            \
+  experimental(intx, RTMLockingCalculationDelay, 0,                         \
+          "Number of milliseconds to wait before start calculating aborts " \
+          "for RTM locking")                                                \
+                                                                            \
+  experimental(bool, UseRTMXendForLockBusy, false,                          \
+          "Use RTM Xend instead of Xabort when lock busy")                  \
+                                                                            \
   /* assembler */                                                           \
   product(bool, Use486InstrsOnly, false,                                    \
           "Use 80486 Compliant instruction subset")                         \
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -301,7 +301,9 @@
   mov_literal32(dst, (int32_t)obj, metadata_Relocation::spec_for_immediate());
 }
 
-void MacroAssembler::movptr(Register dst, AddressLiteral src) {
+void MacroAssembler::movptr(Register dst, AddressLiteral src, Register scratch) {
+  // scratch register is not used,
+  // it is defined to match parameters of 64-bit version of this method.
   if (src.is_lval()) {
     mov_literal32(dst, (intptr_t)src.target(), src.rspec());
   } else {
@@ -613,6 +615,15 @@
   /* else */      { subq(dst, value)       ; return; }
 }
 
+void MacroAssembler::incrementq(AddressLiteral dst) {
+  if (reachable(dst)) {
+    incrementq(as_Address(dst));
+  } else {
+    lea(rscratch1, dst);
+    incrementq(Address(rscratch1, 0));
+  }
+}
+
 void MacroAssembler::incrementq(Register reg, int value) {
   if (value == min_jint) { addq(reg, value); return; }
   if (value <  0) { decrementq(reg, -value); return; }
@@ -681,15 +692,15 @@
   movq(dst, rscratch1);
 }
 
-void MacroAssembler::movptr(Register dst, AddressLiteral src) {
+void MacroAssembler::movptr(Register dst, AddressLiteral src, Register scratch) {
   if (src.is_lval()) {
     mov_literal64(dst, (intptr_t)src.target(), src.rspec());
   } else {
     if (reachable(src)) {
       movq(dst, as_Address(src));
     } else {
-      lea(rscratch1, src);
-      movq(dst, Address(rscratch1,0));
+      lea(scratch, src);
+      movq(dst, Address(scratch, 0));
     }
   }
 }
@@ -988,20 +999,37 @@
   LP64_ONLY(andq(dst, imm32)) NOT_LP64(andl(dst, imm32));
 }
 
-void MacroAssembler::atomic_incl(AddressLiteral counter_addr) {
-  pushf();
+void MacroAssembler::atomic_incl(Address counter_addr) {
+  if (os::is_MP())
+    lock();
+  incrementl(counter_addr);
+}
+
+void MacroAssembler::atomic_incl(AddressLiteral counter_addr, Register scr) {
   if (reachable(counter_addr)) {
-    if (os::is_MP())
-      lock();
-    incrementl(as_Address(counter_addr));
+    atomic_incl(as_Address(counter_addr));
   } else {
-    lea(rscratch1, counter_addr);
-    if (os::is_MP())
-      lock();
-    incrementl(Address(rscratch1, 0));
-  }
-  popf();
-}
+    lea(scr, counter_addr);
+    atomic_incl(Address(scr, 0));
+  }
+}
+
+#ifdef _LP64
+void MacroAssembler::atomic_incq(Address counter_addr) {
+  if (os::is_MP())
+    lock();
+  incrementq(counter_addr);
+}
+
+void MacroAssembler::atomic_incq(AddressLiteral counter_addr, Register scr) {
+  if (reachable(counter_addr)) {
+    atomic_incq(as_Address(counter_addr));
+  } else {
+    lea(scr, counter_addr);
+    atomic_incq(Address(scr, 0));
+  }
+}
+#endif
 
 // Writes to stack successive pages until offset reached to check for
 // stack overflow + shadow pages.  This clobbers tmp.
@@ -1274,6 +1302,325 @@
 }
 
 #ifdef COMPILER2
+
+#if INCLUDE_RTM_OPT
+
+// Update rtm_counters based on abort status
+// input: abort_status
+//        rtm_counters (RTMLockingCounters*)
+// flags are killed
+void MacroAssembler::rtm_counters_update(Register abort_status, Register rtm_counters) {
+
+  atomic_incptr(Address(rtm_counters, RTMLockingCounters::abort_count_offset()));
+  if (PrintPreciseRTMLockingStatistics) {
+    for (int i = 0; i < RTMLockingCounters::ABORT_STATUS_LIMIT; i++) {
+      Label check_abort;
+      testl(abort_status, (1<<i));
+      jccb(Assembler::equal, check_abort);
+      atomic_incptr(Address(rtm_counters, RTMLockingCounters::abortX_count_offset() + (i * sizeof(uintx))));
+      bind(check_abort);
+    }
+  }
+}
+
+// Branch if (random & (count-1) != 0), count is 2^n
+// tmp, scr and flags are killed
+void MacroAssembler::branch_on_random_using_rdtsc(Register tmp, Register scr, int count, Label& brLabel) {
+  assert(tmp == rax, "");
+  assert(scr == rdx, "");
+  rdtsc(); // modifies EDX:EAX
+  andptr(tmp, count-1);
+  jccb(Assembler::notZero, brLabel);
+}
+
+// Perform abort ratio calculation, set no_rtm bit if high ratio
+// input:  rtm_counters_Reg (RTMLockingCounters* address)
+// tmpReg, rtm_counters_Reg and flags are killed
+void MacroAssembler::rtm_abort_ratio_calculation(Register tmpReg,
+                                                 Register rtm_counters_Reg,
+                                                 RTMLockingCounters* rtm_counters,
+                                                 Metadata* method_data) {
+  Label L_done, L_check_always_rtm1, L_check_always_rtm2;
+
+  if (RTMLockingCalculationDelay > 0) {
+    // Delay calculation
+    movptr(tmpReg, ExternalAddress((address) RTMLockingCounters::rtm_calculation_flag_addr()), tmpReg);
+    testptr(tmpReg, tmpReg);
+    jccb(Assembler::equal, L_done);
+  }
+  // Abort ratio calculation only if abort_count > RTMAbortThreshold
+  //   Aborted transactions = abort_count * 100
+  //   All transactions = total_count *  RTMTotalCountIncrRate
+  //   Set no_rtm bit if (Aborted transactions >= All transactions * RTMAbortRatio)
+
+  movptr(tmpReg, Address(rtm_counters_Reg, RTMLockingCounters::abort_count_offset()));
+  cmpptr(tmpReg, RTMAbortThreshold);
+  jccb(Assembler::below, L_check_always_rtm2);
+  imulptr(tmpReg, tmpReg, 100);
+
+  Register scrReg = rtm_counters_Reg;
+  movptr(scrReg, Address(rtm_counters_Reg, RTMLockingCounters::total_count_offset()));
+  imulptr(scrReg, scrReg, RTMTotalCountIncrRate);
+  imulptr(scrReg, scrReg, RTMAbortRatio);
+  cmpptr(tmpReg, scrReg);
+  jccb(Assembler::below, L_check_always_rtm1);
+  if (method_data != NULL) {
+    // set rtm_state to "no rtm" in MDO
+    mov_metadata(tmpReg, method_data);
+    if (os::is_MP()) {
+      lock();
+    }
+    orl(Address(tmpReg, MethodData::rtm_state_offset_in_bytes()), NoRTM);
+  }
+  jmpb(L_done);
+  bind(L_check_always_rtm1);
+  // Reload RTMLockingCounters* address
+  lea(rtm_counters_Reg, ExternalAddress((address)rtm_counters));
+  bind(L_check_always_rtm2);
+  movptr(tmpReg, Address(rtm_counters_Reg, RTMLockingCounters::total_count_offset()));
+  cmpptr(tmpReg, RTMLockingThreshold / RTMTotalCountIncrRate);
+  jccb(Assembler::below, L_done);
+  if (method_data != NULL) {
+    // set rtm_state to "always rtm" in MDO
+    mov_metadata(tmpReg, method_data);
+    if (os::is_MP()) {
+      lock();
+    }
+    orl(Address(tmpReg, MethodData::rtm_state_offset_in_bytes()), UseRTM);
+  }
+  bind(L_done);
+}
+
+// Update counters and perform abort ratio calculation
+// input:  abort_status_Reg
+// rtm_counters_Reg, flags are killed
+void MacroAssembler::rtm_profiling(Register abort_status_Reg,
+                                   Register rtm_counters_Reg,
+                                   RTMLockingCounters* rtm_counters,
+                                   Metadata* method_data,
+                                   bool profile_rtm) {
+
+  assert(rtm_counters != NULL, "should not be NULL when profiling RTM");
+  // update rtm counters based on rax value at abort
+  // reads abort_status_Reg, updates flags
+  lea(rtm_counters_Reg, ExternalAddress((address)rtm_counters));
+  rtm_counters_update(abort_status_Reg, rtm_counters_Reg);
+  if (profile_rtm) {
+    // Save abort status because abort_status_Reg is used by following code.
+    if (RTMRetryCount > 0) {
+      push(abort_status_Reg);
+    }
+    assert(rtm_counters != NULL, "should not be NULL when profiling RTM");
+    rtm_abort_ratio_calculation(abort_status_Reg, rtm_counters_Reg, rtm_counters, method_data);
+    // restore abort status
+    if (RTMRetryCount > 0) {
+      pop(abort_status_Reg);
+    }
+  }
+}
+
+// Retry on abort if abort's status is 0x6: can retry (0x2) | memory conflict (0x4)
+// inputs: retry_count_Reg
+//       : abort_status_Reg
+// output: retry_count_Reg decremented by 1
+// flags are killed
+void MacroAssembler::rtm_retry_lock_on_abort(Register retry_count_Reg, Register abort_status_Reg, Label& retryLabel) {
+  Label doneRetry;
+  assert(abort_status_Reg == rax, "");
+  // The abort reason bits are in eax (see all states in rtmLocking.hpp)
+  // 0x6 = conflict on which we can retry (0x2) | memory conflict (0x4)
+  // if reason is in 0x6 and retry count != 0 then retry
+  andptr(abort_status_Reg, 0x6);
+  jccb(Assembler::zero, doneRetry);
+  testl(retry_count_Reg, retry_count_Reg);
+  jccb(Assembler::zero, doneRetry);
+  pause();
+  decrementl(retry_count_Reg);
+  jmp(retryLabel);
+  bind(doneRetry);
+}
+
+// Spin and retry if lock is busy,
+// inputs: box_Reg (monitor address)
+//       : retry_count_Reg
+// output: retry_count_Reg decremented by 1
+//       : clear z flag if retry count exceeded
+// tmp_Reg, scr_Reg, flags are killed
+void MacroAssembler::rtm_retry_lock_on_busy(Register retry_count_Reg, Register box_Reg,
+                                            Register tmp_Reg, Register scr_Reg, Label& retryLabel) {
+  Label SpinLoop, SpinExit, doneRetry;
+  // Clean monitor_value bit to get valid pointer
+  int owner_offset = ObjectMonitor::owner_offset_in_bytes() - markOopDesc::monitor_value;
+
+  testl(retry_count_Reg, retry_count_Reg);
+  jccb(Assembler::zero, doneRetry);
+  decrementl(retry_count_Reg);
+  movptr(scr_Reg, RTMSpinLoopCount);
+
+  bind(SpinLoop);
+  pause();
+  decrementl(scr_Reg);
+  jccb(Assembler::lessEqual, SpinExit);
+  movptr(tmp_Reg, Address(box_Reg, owner_offset));
+  testptr(tmp_Reg, tmp_Reg);
+  jccb(Assembler::notZero, SpinLoop);
+
+  bind(SpinExit);
+  jmp(retryLabel);
+  bind(doneRetry);
+  incrementl(retry_count_Reg); // clear z flag
+}
+
+// Use RTM for normal stack locks
+// Input: objReg (object to lock)
+void MacroAssembler::rtm_stack_locking(Register objReg, Register tmpReg, Register scrReg,
+                                       Register retry_on_abort_count_Reg,
+                                       RTMLockingCounters* stack_rtm_counters,
+                                       Metadata* method_data, bool profile_rtm,
+                                       Label& DONE_LABEL, Label& IsInflated) {
+  assert(UseRTMForStackLocks, "why call this otherwise?");
+  assert(!UseBiasedLocking, "Biased locking is not supported with RTM locking");
+  assert(tmpReg == rax, "");
+  assert(scrReg == rdx, "");
+  Label L_rtm_retry, L_decrement_retry, L_on_abort;
+
+  if (RTMRetryCount > 0) {
+    movl(retry_on_abort_count_Reg, RTMRetryCount); // Retry on abort
+    bind(L_rtm_retry);
+  }
+  if (!UseRTMXendForLockBusy) {
+    movptr(tmpReg, Address(objReg, 0));
+    testptr(tmpReg, markOopDesc::monitor_value);  // inflated vs stack-locked|neutral|biased
+    jcc(Assembler::notZero, IsInflated);
+  }
+  if (PrintPreciseRTMLockingStatistics || profile_rtm) {
+    Label L_noincrement;
+    if (RTMTotalCountIncrRate > 1) {
+      // tmpReg, scrReg and flags are killed
+      branch_on_random_using_rdtsc(tmpReg, scrReg, (int)RTMTotalCountIncrRate, L_noincrement);
+    }
+    assert(stack_rtm_counters != NULL, "should not be NULL when profiling RTM");
+    atomic_incptr(ExternalAddress((address)stack_rtm_counters->total_count_addr()), scrReg);
+    bind(L_noincrement);
+  }
+  xbegin(L_on_abort);
+  movptr(tmpReg, Address(objReg, 0));       // fetch markword
+  andptr(tmpReg, markOopDesc::biased_lock_mask_in_place); // look at 3 lock bits
+  cmpptr(tmpReg, markOopDesc::unlocked_value);            // bits = 001 unlocked
+  jcc(Assembler::equal, DONE_LABEL);        // all done if unlocked
+
+  Register abort_status_Reg = tmpReg; // status of abort is stored in RAX
+  if (UseRTMXendForLockBusy) {
+    xend();
+    movptr(tmpReg, Address(objReg, 0));
+    testptr(tmpReg, markOopDesc::monitor_value);  // inflated vs stack-locked|neutral|biased
+    jcc(Assembler::notZero, IsInflated);
+    movptr(abort_status_Reg, 0x1);                // Set the abort status to 1 (as xabort does)
+    jmp(L_decrement_retry);
+  }
+  else {
+    xabort(0);
+  }
+  bind(L_on_abort);
+  if (PrintPreciseRTMLockingStatistics || profile_rtm) {
+    rtm_profiling(abort_status_Reg, scrReg, stack_rtm_counters, method_data, profile_rtm);
+  }
+  bind(L_decrement_retry);
+  if (RTMRetryCount > 0) {
+    // retry on lock abort if abort status is 'can retry' (0x2) or 'memory conflict' (0x4)
+    rtm_retry_lock_on_abort(retry_on_abort_count_Reg, abort_status_Reg, L_rtm_retry);
+  }
+}
+
+// Use RTM for inflating locks
+// inputs: objReg (object to lock)
+//         boxReg (on-stack box address (displaced header location) - KILLED)
+//         tmpReg (ObjectMonitor address + 2(monitor_value))
+void MacroAssembler::rtm_inflated_locking(Register objReg, Register boxReg, Register tmpReg,
+                                          Register scrReg, Register retry_on_busy_count_Reg,
+                                          Register retry_on_abort_count_Reg,
+                                          RTMLockingCounters* rtm_counters,
+                                          Metadata* method_data, bool profile_rtm,
+                                          Label& DONE_LABEL) {
+  assert(UseRTMLocking, "why call this otherwise?");
+  assert(tmpReg == rax, "");
+  assert(scrReg == rdx, "");
+  Label L_rtm_retry, L_decrement_retry, L_on_abort;
+  // Clean monitor_value bit to get valid pointer
+  int owner_offset = ObjectMonitor::owner_offset_in_bytes() - markOopDesc::monitor_value;
+
+  // Without cast to int32_t a movptr will destroy r10 which is typically obj
+  movptr(Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark()));
+  movptr(boxReg, tmpReg); // Save ObjectMonitor address
+
+  if (RTMRetryCount > 0) {
+    movl(retry_on_busy_count_Reg, RTMRetryCount);  // Retry on lock busy
+    movl(retry_on_abort_count_Reg, RTMRetryCount); // Retry on abort
+    bind(L_rtm_retry);
+  }
+  if (PrintPreciseRTMLockingStatistics || profile_rtm) {
+    Label L_noincrement;
+    if (RTMTotalCountIncrRate > 1) {
+      // tmpReg, scrReg and flags are killed
+      branch_on_random_using_rdtsc(tmpReg, scrReg, (int)RTMTotalCountIncrRate, L_noincrement);
+    }
+    assert(rtm_counters != NULL, "should not be NULL when profiling RTM");
+    atomic_incptr(ExternalAddress((address)rtm_counters->total_count_addr()), scrReg);
+    bind(L_noincrement);
+  }
+  xbegin(L_on_abort);
+  movptr(tmpReg, Address(objReg, 0));
+  movptr(tmpReg, Address(tmpReg, owner_offset));
+  testptr(tmpReg, tmpReg);
+  jcc(Assembler::zero, DONE_LABEL);
+  if (UseRTMXendForLockBusy) {
+    xend();
+    jmp(L_decrement_retry);
+  }
+  else {
+    xabort(0);
+  }
+  bind(L_on_abort);
+  Register abort_status_Reg = tmpReg; // status of abort is stored in RAX
+  if (PrintPreciseRTMLockingStatistics || profile_rtm) {
+    rtm_profiling(abort_status_Reg, scrReg, rtm_counters, method_data, profile_rtm);
+  }
+  if (RTMRetryCount > 0) {
+    // retry on lock abort if abort status is 'can retry' (0x2) or 'memory conflict' (0x4)
+    rtm_retry_lock_on_abort(retry_on_abort_count_Reg, abort_status_Reg, L_rtm_retry);
+  }
+
+  movptr(tmpReg, Address(boxReg, owner_offset)) ;
+  testptr(tmpReg, tmpReg) ;
+  jccb(Assembler::notZero, L_decrement_retry) ;
+
+  // Appears unlocked - try to swing _owner from null to non-null.
+  // Invariant: tmpReg == 0.  tmpReg is EAX which is the implicit cmpxchg comparand.
+#ifdef _LP64
+  Register threadReg = r15_thread;
+#else
+  get_thread(scrReg);
+  Register threadReg = scrReg;
+#endif
+  if (os::is_MP()) {
+    lock();
+  }
+  cmpxchgptr(threadReg, Address(boxReg, owner_offset)); // Updates tmpReg
+
+  if (RTMRetryCount > 0) {
+    // success done else retry
+    jccb(Assembler::equal, DONE_LABEL) ;
+    bind(L_decrement_retry);
+    // Spin and retry if lock is busy.
+    rtm_retry_lock_on_busy(retry_on_busy_count_Reg, boxReg, tmpReg, scrReg, L_rtm_retry);
+  }
+  else {
+    bind(L_decrement_retry);
+  }
+}
+
+#endif //  INCLUDE_RTM_OPT
+
 // Fast_Lock and Fast_Unlock used by C2
 
 // Because the transitions from emitted code to the runtime
@@ -1350,17 +1697,26 @@
 // box: on-stack box address (displaced header location) - KILLED
 // rax,: tmp -- KILLED
 // scr: tmp -- KILLED
-void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg, Register scrReg, BiasedLockingCounters* counters) {
+void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg,
+                               Register scrReg, Register cx1Reg, Register cx2Reg,
+                               BiasedLockingCounters* counters,
+                               RTMLockingCounters* rtm_counters,
+                               RTMLockingCounters* stack_rtm_counters,
+                               Metadata* method_data,
+                               bool use_rtm, bool profile_rtm) {
   // Ensure the register assignents are disjoint
-  guarantee (objReg != boxReg, "");
-  guarantee (objReg != tmpReg, "");
-  guarantee (objReg != scrReg, "");
-  guarantee (boxReg != tmpReg, "");
-  guarantee (boxReg != scrReg, "");
-  guarantee (tmpReg == rax, "");
+  assert(tmpReg == rax, "");
+
+  if (use_rtm) {
+    assert_different_registers(objReg, boxReg, tmpReg, scrReg, cx1Reg, cx2Reg);
+  } else {
+    assert(cx1Reg == noreg, "");
+    assert(cx2Reg == noreg, "");
+    assert_different_registers(objReg, boxReg, tmpReg, scrReg);
+  }
 
   if (counters != NULL) {
-    atomic_incl(ExternalAddress((address)counters->total_entry_count_addr()));
+    atomic_incl(ExternalAddress((address)counters->total_entry_count_addr()), scrReg);
   }
   if (EmitSync & 1) {
       // set box->dhw = unused_mark (3)
@@ -1419,12 +1775,20 @@
       biased_locking_enter(boxReg, objReg, tmpReg, scrReg, true, DONE_LABEL, NULL, counters);
     }
 
+#if INCLUDE_RTM_OPT
+    if (UseRTMForStackLocks && use_rtm) {
+      rtm_stack_locking(objReg, tmpReg, scrReg, cx2Reg,
+                        stack_rtm_counters, method_data, profile_rtm,
+                        DONE_LABEL, IsInflated);
+    }
+#endif // INCLUDE_RTM_OPT
+
     movptr(tmpReg, Address(objReg, 0));          // [FETCH]
-    testl (tmpReg, markOopDesc::monitor_value);  // inflated vs stack-locked|neutral|biased
-    jccb  (Assembler::notZero, IsInflated);
+    testptr(tmpReg, markOopDesc::monitor_value); // inflated vs stack-locked|neutral|biased
+    jccb(Assembler::notZero, IsInflated);
 
     // Attempt stack-locking ...
-    orptr (tmpReg, 0x1);
+    orptr (tmpReg, markOopDesc::unlocked_value);
     movptr(Address(boxReg, 0), tmpReg);          // Anticipate successful CAS
     if (os::is_MP()) {
       lock();
@@ -1434,19 +1798,32 @@
       cond_inc32(Assembler::equal,
                  ExternalAddress((address)counters->fast_path_entry_count_addr()));
     }
-    jccb(Assembler::equal, DONE_LABEL);
-
-    // Recursive locking
+    jcc(Assembler::equal, DONE_LABEL);           // Success
+
+    // Recursive locking.
+    // The object is stack-locked: markword contains stack pointer to BasicLock.
+    // Locked by current thread if difference with current SP is less than one page.
     subptr(tmpReg, rsp);
+    // Next instruction set ZFlag == 1 (Success) if difference is less then one page.
     andptr(tmpReg, (int32_t) (NOT_LP64(0xFFFFF003) LP64_ONLY(7 - os::vm_page_size())) );
     movptr(Address(boxReg, 0), tmpReg);
     if (counters != NULL) {
       cond_inc32(Assembler::equal,
                  ExternalAddress((address)counters->fast_path_entry_count_addr()));
     }
-    jmpb(DONE_LABEL);
+    jmp(DONE_LABEL);
 
     bind(IsInflated);
+    // The object is inflated. tmpReg contains pointer to ObjectMonitor* + 2(monitor_value)
+
+#if INCLUDE_RTM_OPT
+    // Use the same RTM locking code in 32- and 64-bit VM.
+    if (use_rtm) {
+      rtm_inflated_locking(objReg, boxReg, tmpReg, scrReg, cx1Reg, cx2Reg,
+                           rtm_counters, method_data, profile_rtm, DONE_LABEL);
+    } else {
+#endif // INCLUDE_RTM_OPT
+
 #ifndef _LP64
     // The object is inflated.
     //
@@ -1576,7 +1953,7 @@
     // Without cast to int32_t a movptr will destroy r10 which is typically obj
     movptr(Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark()));
 
-    mov    (boxReg, tmpReg);
+    movptr (boxReg, tmpReg);
     movptr (tmpReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2));
     testptr(tmpReg, tmpReg);
     jccb   (Assembler::notZero, DONE_LABEL);
@@ -1587,9 +1964,11 @@
     }
     cmpxchgptr(r15_thread, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2));
     // Intentional fall-through into DONE_LABEL ...
-
+#endif // _LP64
+
+#if INCLUDE_RTM_OPT
+    } // use_rtm()
 #endif
-
     // DONE_LABEL is a hot target - we'd really like to place it at the
     // start of cache line by padding with NOPs.
     // See the AMD and Intel software optimization manuals for the
@@ -1631,11 +2010,9 @@
 // should not be unlocked by "normal" java-level locking and vice-versa.  The specification
 // doesn't specify what will occur if a program engages in such mixed-mode locking, however.
 
-void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpReg) {
-  guarantee (objReg != boxReg, "");
-  guarantee (objReg != tmpReg, "");
-  guarantee (boxReg != tmpReg, "");
-  guarantee (boxReg == rax, "");
+void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpReg, bool use_rtm) {
+  assert(boxReg == rax, "");
+  assert_different_registers(objReg, boxReg, tmpReg);
 
   if (EmitSync & 4) {
     // Disable - inhibit all inlining.  Force control through the slow-path
@@ -1667,14 +2044,41 @@
        biased_locking_exit(objReg, tmpReg, DONE_LABEL);
     }
 
+#if INCLUDE_RTM_OPT
+    if (UseRTMForStackLocks && use_rtm) {
+      assert(!UseBiasedLocking, "Biased locking is not supported with RTM locking");
+      Label L_regular_unlock;
+      movptr(tmpReg, Address(objReg, 0));           // fetch markword
+      andptr(tmpReg, markOopDesc::biased_lock_mask_in_place); // look at 3 lock bits
+      cmpptr(tmpReg, markOopDesc::unlocked_value);            // bits = 001 unlocked
+      jccb(Assembler::notEqual, L_regular_unlock);  // if !HLE RegularLock
+      xend();                                       // otherwise end...
+      jmp(DONE_LABEL);                              // ... and we're done
+      bind(L_regular_unlock);
+    }
+#endif
+
     cmpptr(Address(boxReg, 0), (int32_t)NULL_WORD); // Examine the displaced header
+    jcc   (Assembler::zero, DONE_LABEL);            // 0 indicates recursive stack-lock
     movptr(tmpReg, Address(objReg, 0));             // Examine the object's markword
-    jccb  (Assembler::zero, DONE_LABEL);            // 0 indicates recursive stack-lock
-
-    testptr(tmpReg, 0x02);                          // Inflated?
+    testptr(tmpReg, markOopDesc::monitor_value);    // Inflated?
     jccb  (Assembler::zero, Stacked);
 
     // It's inflated.
+#if INCLUDE_RTM_OPT
+    if (use_rtm) {
+      Label L_regular_inflated_unlock;
+      // Clean monitor_value bit to get valid pointer
+      int owner_offset = ObjectMonitor::owner_offset_in_bytes() - markOopDesc::monitor_value;
+      movptr(boxReg, Address(tmpReg, owner_offset));
+      testptr(boxReg, boxReg);
+      jccb(Assembler::notZero, L_regular_inflated_unlock);
+      xend();
+      jmpb(DONE_LABEL);
+      bind(L_regular_inflated_unlock);
+    }
+#endif
+
     // Despite our balanced locking property we still check that m->_owner == Self
     // as java routines or native JNI code called by this thread might
     // have released the lock.
@@ -2448,7 +2852,9 @@
   Condition negated_cond = negate_condition(cond);
   Label L;
   jcc(negated_cond, L);
+  pushf(); // Preserve flags
   atomic_incl(counter_addr);
+  popf();
   bind(L);
 }
 
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -27,6 +27,7 @@
 
 #include "asm/assembler.hpp"
 #include "utilities/macros.hpp"
+#include "runtime/rtmLocking.hpp"
 
 
 // MacroAssembler extends Assembler by frequently used macros.
@@ -111,7 +112,8 @@
         op == 0xE9 /* jmp */ ||
         op == 0xEB /* short jmp */ ||
         (op & 0xF0) == 0x70 /* short jcc */ ||
-        op == 0x0F && (branch[1] & 0xF0) == 0x80 /* jcc */,
+        op == 0x0F && (branch[1] & 0xF0) == 0x80 /* jcc */ ||
+        op == 0xC7 && branch[1] == 0xF8 /* xbegin */,
         "Invalid opcode at patch point");
 
     if (op == 0xEB || (op & 0xF0) == 0x70) {
@@ -121,7 +123,7 @@
       guarantee(this->is8bit(imm8), "Short forward jump exceeds 8-bit offset");
       *disp = imm8;
     } else {
-      int* disp = (int*) &branch[(op == 0x0F)? 2: 1];
+      int* disp = (int*) &branch[(op == 0x0F || op == 0xC7)? 2: 1];
       int imm32 = target - (address) &disp[1];
       *disp = imm32;
     }
@@ -161,7 +163,6 @@
   void incrementq(Register reg, int value = 1);
   void incrementq(Address dst, int value = 1);
 
-
   // Support optimal SSE move instructions.
   void movflt(XMMRegister dst, XMMRegister src) {
     if (UseXmmRegToRegMoveAll) { movaps(dst, src); return; }
@@ -187,6 +188,8 @@
   void incrementl(AddressLiteral dst);
   void incrementl(ArrayAddress dst);
 
+  void incrementq(AddressLiteral dst);
+
   // Alignment
   void align(int modulus);
 
@@ -654,8 +657,36 @@
 #ifdef COMPILER2
   // Code used by cmpFastLock and cmpFastUnlock mach instructions in .ad file.
   // See full desription in macroAssembler_x86.cpp.
-  void fast_lock(Register obj, Register box, Register tmp, Register scr, BiasedLockingCounters* counters);
-  void fast_unlock(Register obj, Register box, Register tmp);
+  void fast_lock(Register obj, Register box, Register tmp,
+                 Register scr, Register cx1, Register cx2,
+                 BiasedLockingCounters* counters,
+                 RTMLockingCounters* rtm_counters,
+                 RTMLockingCounters* stack_rtm_counters,
+                 Metadata* method_data,
+                 bool use_rtm, bool profile_rtm);
+  void fast_unlock(Register obj, Register box, Register tmp, bool use_rtm);
+#if INCLUDE_RTM_OPT
+  void rtm_counters_update(Register abort_status, Register rtm_counters);
+  void branch_on_random_using_rdtsc(Register tmp, Register scr, int count, Label& brLabel);
+  void rtm_abort_ratio_calculation(Register tmp, Register rtm_counters_reg,
+                                   RTMLockingCounters* rtm_counters,
+                                   Metadata* method_data);
+  void rtm_profiling(Register abort_status_Reg, Register rtm_counters_Reg,
+                     RTMLockingCounters* rtm_counters, Metadata* method_data, bool profile_rtm);
+  void rtm_retry_lock_on_abort(Register retry_count, Register abort_status, Label& retryLabel);
+  void rtm_retry_lock_on_busy(Register retry_count, Register box, Register tmp, Register scr, Label& retryLabel);
+  void rtm_stack_locking(Register obj, Register tmp, Register scr,
+                         Register retry_on_abort_count,
+                         RTMLockingCounters* stack_rtm_counters,
+                         Metadata* method_data, bool profile_rtm,
+                         Label& DONE_LABEL, Label& IsInflated);
+  void rtm_inflated_locking(Register obj, Register box, Register tmp,
+                            Register scr, Register retry_on_busy_count,
+                            Register retry_on_abort_count,
+                            RTMLockingCounters* rtm_counters,
+                            Metadata* method_data, bool profile_rtm,
+                            Label& DONE_LABEL);
+#endif
 #endif
 
   Condition negate_condition(Condition cond);
@@ -721,6 +752,7 @@
 
 
   void imulptr(Register dst, Register src) { LP64_ONLY(imulq(dst, src)) NOT_LP64(imull(dst, src)); }
+  void imulptr(Register dst, Register src, int imm32) { LP64_ONLY(imulq(dst, src, imm32)) NOT_LP64(imull(dst, src, imm32)); }
 
 
   void negptr(Register dst) { LP64_ONLY(negq(dst)) NOT_LP64(negl(dst)); }
@@ -762,7 +794,14 @@
   // Conditionally (atomically, on MPs) increments passed counter address, preserving condition codes.
   void cond_inc32(Condition cond, AddressLiteral counter_addr);
   // Unconditional atomic increment.
-  void atomic_incl(AddressLiteral counter_addr);
+  void atomic_incl(Address counter_addr);
+  void atomic_incl(AddressLiteral counter_addr, Register scr = rscratch1);
+#ifdef _LP64
+  void atomic_incq(Address counter_addr);
+  void atomic_incq(AddressLiteral counter_addr, Register scr = rscratch1);
+#endif
+  void atomic_incptr(AddressLiteral counter_addr, Register scr = rscratch1) { LP64_ONLY(atomic_incq(counter_addr, scr)) NOT_LP64(atomic_incl(counter_addr, scr)) ; }
+  void atomic_incptr(Address counter_addr) { LP64_ONLY(atomic_incq(counter_addr)) NOT_LP64(atomic_incl(counter_addr)) ; }
 
   void lea(Register dst, AddressLiteral adr);
   void lea(Address dst, AddressLiteral adr);
@@ -1074,7 +1113,11 @@
 
   void movptr(Register dst, Address src);
 
-  void movptr(Register dst, AddressLiteral src);
+#ifdef _LP64
+  void movptr(Register dst, AddressLiteral src, Register scratch=rscratch1);
+#else
+  void movptr(Register dst, AddressLiteral src, Register scratch=noreg); // Scratch reg is ignored in 32-bit
+#endif
 
   void movptr(Register dst, intptr_t src);
   void movptr(Register dst, Register src);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/cpu/x86/vm/rtmLocking.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "memory/allocation.inline.hpp"
+#include "runtime/task.hpp"
+#include "runtime/rtmLocking.hpp"
+
+// One-shot PeriodicTask subclass for enabling RTM locking
+uintx RTMLockingCounters::_calculation_flag = 0;
+
+class RTMLockingCalculationTask : public PeriodicTask {
+ public:
+  RTMLockingCalculationTask(size_t interval_time) : PeriodicTask(interval_time){  }
+
+  virtual void task() {
+    RTMLockingCounters::_calculation_flag = 1;
+    // Reclaim our storage and disenroll ourself
+    delete this;
+  }
+};
+
+void RTMLockingCounters::init() {
+  if (UseRTMLocking && RTMLockingCalculationDelay > 0) {
+    RTMLockingCalculationTask* task = new RTMLockingCalculationTask(RTMLockingCalculationDelay);
+    task->enroll();
+  } else {
+    _calculation_flag = 1;
+  }
+}
+
+//------------------------------print_on-------------------------------
+void RTMLockingCounters::print_on(outputStream* st) {
+  tty->print_cr("# rtm locks total (estimated): " UINTX_FORMAT, _total_count * RTMTotalCountIncrRate);
+  tty->print_cr("# rtm lock aborts  : " UINTX_FORMAT, _abort_count);
+  for (int i = 0; i < ABORT_STATUS_LIMIT; i++) {
+    tty->print_cr("# rtm lock aborts %d: " UINTX_FORMAT, i, _abortX_count[i]);
+  }
+}
--- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1817,6 +1817,13 @@
   // Frame is now completed as far as size and linkage.
   int frame_complete = ((intptr_t)__ pc()) - start;
 
+  if (UseRTMLocking) {
+    // Abort RTM transaction before calling JNI
+    // because critical section will be large and will be
+    // aborted anyway. Also nmethod could be deoptimized.
+    __ xabort(0);
+  }
+
   // Calculate the difference between rsp and rbp,. We need to know it
   // after the native call because on windows Java Natives will pop
   // the arguments and it is painful to do rsp relative addressing
@@ -3170,6 +3177,12 @@
   };
 
   address start = __ pc();
+
+  if (UseRTMLocking) {
+    // Abort RTM transaction before possible nmethod deoptimization.
+    __ xabort(0);
+  }
+
   // Push self-frame.
   __ subptr(rsp, return_off*wordSize);     // Epilog!
 
@@ -3355,6 +3368,14 @@
   address call_pc = NULL;
   bool cause_return = (poll_type == POLL_AT_RETURN);
   bool save_vectors = (poll_type == POLL_AT_VECTOR_LOOP);
+
+  if (UseRTMLocking) {
+    // Abort RTM transaction before calling runtime
+    // because critical section will be large and will be
+    // aborted anyway. Also nmethod could be deoptimized.
+    __ xabort(0);
+  }
+
   // If cause_return is true we are at a poll_return and there is
   // the return address on the stack to the caller on the nmethod
   // that is safepoint. We can leave this return on the stack and
--- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -2012,6 +2012,13 @@
   // Frame is now completed as far as size and linkage.
   int frame_complete = ((intptr_t)__ pc()) - start;
 
+    if (UseRTMLocking) {
+      // Abort RTM transaction before calling JNI
+      // because critical section will be large and will be
+      // aborted anyway. Also nmethod could be deoptimized.
+      __ xabort(0);
+    }
+
 #ifdef ASSERT
     {
       Label L;
@@ -3612,6 +3619,11 @@
 
   address start = __ pc();
 
+  if (UseRTMLocking) {
+    // Abort RTM transaction before possible nmethod deoptimization.
+    __ xabort(0);
+  }
+
   // Push self-frame.  We get here with a return address on the
   // stack, so rsp is 8-byte aligned until we allocate our frame.
   __ subptr(rsp, SimpleRuntimeFrame::return_off << LogBytesPerInt); // Epilog!
@@ -3792,6 +3804,13 @@
   bool cause_return = (poll_type == POLL_AT_RETURN);
   bool save_vectors = (poll_type == POLL_AT_VECTOR_LOOP);
 
+  if (UseRTMLocking) {
+    // Abort RTM transaction before calling runtime
+    // because critical section will be large and will be
+    // aborted anyway. Also nmethod could be deoptimized.
+    __ xabort(0);
+  }
+
   // Make room for return address (or push it again)
   if (!cause_return) {
     __ push(rbx);
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -50,8 +50,13 @@
 const char*           VM_Version::_features_str = "";
 VM_Version::CpuidInfo VM_Version::_cpuid_info   = { 0, };
 
+// Address of instruction which causes SEGV
+address VM_Version::_cpuinfo_segv_addr = 0;
+// Address of instruction after the one which causes SEGV
+address VM_Version::_cpuinfo_cont_addr = 0;
+
 static BufferBlob* stub_blob;
-static const int stub_size = 550;
+static const int stub_size = 600;
 
 extern "C" {
   typedef void (*getPsrInfo_stub_t)(void*);
@@ -234,9 +239,9 @@
     // Check if OS has enabled XGETBV instruction to access XCR0
     // (OSXSAVE feature flag) and CPU supports AVX
     //
-    __ andl(rcx, 0x18000000);
+    __ andl(rcx, 0x18000000); // cpuid1 bits osxsave | avx
     __ cmpl(rcx, 0x18000000);
-    __ jccb(Assembler::notEqual, sef_cpuid);
+    __ jccb(Assembler::notEqual, sef_cpuid); // jump if AVX is not supported
 
     //
     // XCR0, XFEATURE_ENABLED_MASK register
@@ -247,6 +252,47 @@
     __ movl(Address(rsi, 0), rax);
     __ movl(Address(rsi, 4), rdx);
 
+    __ andl(rax, 0x6); // xcr0 bits sse | ymm
+    __ cmpl(rax, 0x6);
+    __ jccb(Assembler::notEqual, sef_cpuid); // jump if AVX is not supported
+
+    //
+    // Some OSs have a bug when upper 128bits of YMM
+    // registers are not restored after a signal processing.
+    // Generate SEGV here (reference through NULL)
+    // and check upper YMM bits after it.
+    //
+    VM_Version::set_avx_cpuFeatures(); // Enable temporary to pass asserts
+
+    // load value into all 32 bytes of ymm7 register
+    __ movl(rcx, VM_Version::ymm_test_value());
+
+    __ movdl(xmm0, rcx);
+    __ pshufd(xmm0, xmm0, 0x00);
+    __ vinsertf128h(xmm0, xmm0, xmm0);
+    __ vmovdqu(xmm7, xmm0);
+#ifdef _LP64
+    __ vmovdqu(xmm8,  xmm0);
+    __ vmovdqu(xmm15, xmm0);
+#endif
+
+    __ xorl(rsi, rsi);
+    VM_Version::set_cpuinfo_segv_addr( __ pc() );
+    // Generate SEGV
+    __ movl(rax, Address(rsi, 0));
+
+    VM_Version::set_cpuinfo_cont_addr( __ pc() );
+    // Returns here after signal. Save xmm0 to check it later.
+    __ lea(rsi, Address(rbp, in_bytes(VM_Version::ymm_save_offset())));
+    __ vmovdqu(Address(rsi,  0), xmm0);
+    __ vmovdqu(Address(rsi, 32), xmm7);
+#ifdef _LP64
+    __ vmovdqu(Address(rsi, 64), xmm8);
+    __ vmovdqu(Address(rsi, 96), xmm15);
+#endif
+
+    VM_Version::clean_cpuFeatures();
+
     //
     // cpuid(0x7) Structured Extended Features
     //
@@ -429,7 +475,7 @@
   }
 
   char buf[256];
-  jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+  jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
                cores_per_cpu(), threads_per_core(),
                cpu_family(), _model, _stepping,
                (supports_cmov() ? ", cmov" : ""),
@@ -446,8 +492,9 @@
                (supports_avx()    ? ", avx" : ""),
                (supports_avx2()   ? ", avx2" : ""),
                (supports_aes()    ? ", aes" : ""),
-               (supports_clmul()    ? ", clmul" : ""),
+               (supports_clmul()  ? ", clmul" : ""),
                (supports_erms()   ? ", erms" : ""),
+               (supports_rtm()    ? ", rtm" : ""),
                (supports_mmx_ext() ? ", mmxext" : ""),
                (supports_3dnow_prefetch() ? ", 3dnowpref" : ""),
                (supports_lzcnt()   ? ", lzcnt": ""),
@@ -488,7 +535,7 @@
     }
   } else if (UseAES) {
     if (!FLAG_IS_DEFAULT(UseAES))
-      warning("AES instructions not available on this CPU");
+      warning("AES instructions are not available on this CPU");
     FLAG_SET_DEFAULT(UseAES, false);
   }
 
@@ -521,10 +568,57 @@
     }
   } else if (UseAESIntrinsics) {
     if (!FLAG_IS_DEFAULT(UseAESIntrinsics))
-      warning("AES intrinsics not available on this CPU");
+      warning("AES intrinsics are not available on this CPU");
     FLAG_SET_DEFAULT(UseAESIntrinsics, false);
   }
 
+  // Adjust RTM (Restricted Transactional Memory) flags
+  if (!supports_rtm() && UseRTMLocking) {
+    // Can't continue because UseRTMLocking affects UseBiasedLocking flag
+    // setting during arguments processing. See use_biased_locking().
+    // VM_Version_init() is executed after UseBiasedLocking is used
+    // in Thread::allocate().
+    vm_exit_during_initialization("RTM instructions are not available on this CPU");
+  }
+
+#if INCLUDE_RTM_OPT
+  if (UseRTMLocking) {
+    if (!FLAG_IS_CMDLINE(UseRTMLocking)) {
+      // RTM locking should be used only for applications with
+      // high lock contention. For now we do not use it by default.
+      vm_exit_during_initialization("UseRTMLocking flag should be only set on command line");
+    }
+    if (!is_power_of_2(RTMTotalCountIncrRate)) {
+      warning("RTMTotalCountIncrRate must be a power of 2, resetting it to 64");
+      FLAG_SET_DEFAULT(RTMTotalCountIncrRate, 64);
+    }
+    if (RTMAbortRatio < 0 || RTMAbortRatio > 100) {
+      warning("RTMAbortRatio must be in the range 0 to 100, resetting it to 50");
+      FLAG_SET_DEFAULT(RTMAbortRatio, 50);
+    }
+  } else { // !UseRTMLocking
+    if (UseRTMForStackLocks) {
+      if (!FLAG_IS_DEFAULT(UseRTMForStackLocks)) {
+        warning("UseRTMForStackLocks flag should be off when UseRTMLocking flag is off");
+      }
+      FLAG_SET_DEFAULT(UseRTMForStackLocks, false);
+    }
+    if (UseRTMDeopt) {
+      FLAG_SET_DEFAULT(UseRTMDeopt, false);
+    }
+    if (PrintPreciseRTMLockingStatistics) {
+      FLAG_SET_DEFAULT(PrintPreciseRTMLockingStatistics, false);
+    }
+  }
+#else
+  if (UseRTMLocking) {
+    // Only C2 does RTM locking optimization.
+    // Can't continue because UseRTMLocking affects UseBiasedLocking flag
+    // setting during arguments processing. See use_biased_locking().
+    vm_exit_during_initialization("RTM locking optimization is not supported in this VM");
+  }
+#endif
+
 #ifdef COMPILER2
   if (UseFPUForSpilling) {
     if (UseSSE < 2) {
@@ -540,14 +634,28 @@
     if (MaxVectorSize > 32) {
       FLAG_SET_DEFAULT(MaxVectorSize, 32);
     }
-    if (MaxVectorSize > 16 && UseAVX == 0) {
-      // Only supported with AVX+
+    if (MaxVectorSize > 16 && (UseAVX == 0 || !os_supports_avx_vectors())) {
+      // 32 bytes vectors (in YMM) are only supported with AVX+
       FLAG_SET_DEFAULT(MaxVectorSize, 16);
     }
     if (UseSSE < 2) {
-      // Only supported with SSE2+
+      // Vectors (in XMM) are only supported with SSE2+
       FLAG_SET_DEFAULT(MaxVectorSize, 0);
     }
+#ifdef ASSERT
+    if (supports_avx() && PrintMiscellaneous && Verbose && TraceNewVectors) {
+      tty->print_cr("State of YMM registers after signal handle:");
+      int nreg = 2 LP64_ONLY(+2);
+      const char* ymm_name[4] = {"0", "7", "8", "15"};
+      for (int i = 0; i < nreg; i++) {
+        tty->print("YMM%s:", ymm_name[i]);
+        for (int j = 7; j >=0; j--) {
+          tty->print(" %x", _cpuid_info.ymm_save[i*8 + j]);
+        }
+        tty->cr();
+      }
+    }
+#endif
   }
 #endif
 
@@ -678,14 +786,6 @@
       }
     }
   }
-#if defined(COMPILER2) && defined(_ALLBSD_SOURCE)
-    if (MaxVectorSize > 16) {
-      // Limit vectors size to 16 bytes on BSD until it fixes
-      // restoring upper 128bit of YMM registers on return
-      // from signal handler.
-      FLAG_SET_DEFAULT(MaxVectorSize, 16);
-    }
-#endif // COMPILER2
 
   // Use count leading zeros count instruction if available.
   if (supports_lzcnt()) {
@@ -814,6 +914,11 @@
     if (UseAES) {
       tty->print("  UseAES=1");
     }
+#ifdef COMPILER2
+    if (MaxVectorSize > 0) {
+      tty->print("  MaxVectorSize=%d", MaxVectorSize);
+    }
+#endif
     tty->cr();
     tty->print("Allocation");
     if (AllocatePrefetchStyle <= 0 || UseSSE == 0 && !supports_3dnow_prefetch()) {
@@ -856,6 +961,27 @@
 #endif // !PRODUCT
 }
 
+bool VM_Version::use_biased_locking() {
+#if INCLUDE_RTM_OPT
+  // RTM locking is most useful when there is high lock contention and
+  // low data contention.  With high lock contention the lock is usually
+  // inflated and biased locking is not suitable for that case.
+  // RTM locking code requires that biased locking is off.
+  // Note: we can't switch off UseBiasedLocking in get_processor_features()
+  // because it is used by Thread::allocate() which is called before
+  // VM_Version::initialize().
+  if (UseRTMLocking && UseBiasedLocking) {
+    if (FLAG_IS_DEFAULT(UseBiasedLocking)) {
+      FLAG_SET_DEFAULT(UseBiasedLocking, false);
+    } else {
+      warning("Biased locking is not supported with RTM locking; ignoring UseBiasedLocking flag." );
+      UseBiasedLocking = false;
+    }
+  }
+#endif
+  return UseBiasedLocking;
+}
+
 void VM_Version::initialize() {
   ResourceMark rm;
   // Making this stub must be FIRST use of assembler
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -207,7 +207,9 @@
                         : 2,
                    bmi2 : 1,
                    erms : 1,
-                        : 22;
+                        : 1,
+                   rtm  : 1,
+                        : 20;
     } bits;
   };
 
@@ -229,6 +231,9 @@
                                // 0 if this instruction is not available
   static const char* _features_str;
 
+  static address   _cpuinfo_segv_addr; // address of instruction which causes SEGV
+  static address   _cpuinfo_cont_addr; // address of instruction after the one which causes SEGV
+
   enum {
     CPU_CX8    = (1 << 0), // next bits are from cpuid 1 (EDX)
     CPU_CMOV   = (1 << 1),
@@ -254,7 +259,8 @@
     CPU_ERMS   = (1 << 20), // enhanced 'rep movsb/stosb' instructions
     CPU_CLMUL  = (1 << 21), // carryless multiply for CRC
     CPU_BMI1   = (1 << 22),
-    CPU_BMI2   = (1 << 23)
+    CPU_BMI2   = (1 << 23),
+    CPU_RTM    = (1 << 24)  // Restricted Transactional Memory instructions
   } cpuFeatureFlags;
 
   enum {
@@ -361,6 +367,9 @@
     // extended control register XCR0 (the XFEATURE_ENABLED_MASK register)
     XemXcr0Eax   xem_xcr0_eax;
     uint32_t     xem_xcr0_edx; // reserved
+
+    // Space to save ymm registers after signal handle
+    int          ymm_save[8*4]; // Save ymm0, ymm7, ymm8, ymm15
   };
 
   // The actual cpuid info block
@@ -438,6 +447,8 @@
       result |= CPU_ERMS;
     if (_cpuid_info.std_cpuid1_ecx.bits.clmul != 0)
       result |= CPU_CLMUL;
+    if (_cpuid_info.sef_cpuid7_ebx.bits.rtm != 0)
+      result |= CPU_RTM;
 
     // AMD features.
     if (is_amd()) {
@@ -460,6 +471,21 @@
     return result;
   }
 
+  static bool os_supports_avx_vectors() {
+    if (!supports_avx()) {
+      return false;
+    }
+    // Verify that OS save/restore all bits of AVX registers
+    // during signal processing.
+    int nreg = 2 LP64_ONLY(+2);
+    for (int i = 0; i < 8 * nreg; i++) { // 32 bytes per ymm register
+      if (_cpuid_info.ymm_save[i] != ymm_test_value()) {
+        return false;
+      }
+    }
+    return true;
+  }
+
   static void get_processor_features();
 
 public:
@@ -476,10 +502,26 @@
   static ByteSize tpl_cpuidB1_offset() { return byte_offset_of(CpuidInfo, tpl_cpuidB1_eax); }
   static ByteSize tpl_cpuidB2_offset() { return byte_offset_of(CpuidInfo, tpl_cpuidB2_eax); }
   static ByteSize xem_xcr0_offset() { return byte_offset_of(CpuidInfo, xem_xcr0_eax); }
+  static ByteSize ymm_save_offset() { return byte_offset_of(CpuidInfo, ymm_save); }
+
+  // The value used to check ymm register after signal handle
+  static int ymm_test_value()    { return 0xCAFEBABE; }
+
+  static void set_cpuinfo_segv_addr(address pc) { _cpuinfo_segv_addr = pc; }
+  static bool  is_cpuinfo_segv_addr(address pc) { return _cpuinfo_segv_addr == pc; }
+  static void set_cpuinfo_cont_addr(address pc) { _cpuinfo_cont_addr = pc; }
+  static address  cpuinfo_cont_addr()           { return _cpuinfo_cont_addr; }
+
+  static void clean_cpuFeatures()   { _cpuFeatures = 0; }
+  static void set_avx_cpuFeatures() { _cpuFeatures = (CPU_SSE | CPU_SSE2 | CPU_AVX); }
+
 
   // Initialization
   static void initialize();
 
+  // Override Abstract_VM_Version implementation
+  static bool use_biased_locking();
+
   // Asserts
   static void assert_is_initialized() {
     assert(_cpuid_info.std_cpuid1_eax.bits.family != 0, "VM_Version not initialized");
@@ -572,6 +614,7 @@
   static bool supports_aes()      { return (_cpuFeatures & CPU_AES) != 0; }
   static bool supports_erms()     { return (_cpuFeatures & CPU_ERMS) != 0; }
   static bool supports_clmul()    { return (_cpuFeatures & CPU_CLMUL) != 0; }
+  static bool supports_rtm()      { return (_cpuFeatures & CPU_RTM) != 0; }
   static bool supports_bmi1()     { return (_cpuFeatures & CPU_BMI1) != 0; }
   static bool supports_bmi2()     { return (_cpuFeatures & CPU_BMI2) != 0; }
   // Intel features
--- a/hotspot/src/cpu/x86/vm/x86.ad	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/x86.ad	Tue Apr 01 15:37:15 2014 +0200
@@ -474,7 +474,125 @@
 
 %}
 
+
+//----------SOURCE BLOCK-------------------------------------------------------
+// This is a block of C++ code which provides values, functions, and
+// definitions necessary in the rest of the architecture description
+
+source_hpp %{
+// Header information of the source block.
+// Method declarations/definitions which are used outside
+// the ad-scope can conveniently be defined here.
+//
+// To keep related declarations/definitions/uses close together,
+// we switch between source %{ }% and source_hpp %{ }% freely as needed.
+
+class CallStubImpl {
+ 
+  //--------------------------------------------------------------
+  //---<  Used for optimization in Compile::shorten_branches  >---
+  //--------------------------------------------------------------
+
+ public:
+  // Size of call trampoline stub.
+  static uint size_call_trampoline() {
+    return 0; // no call trampolines on this platform
+  }
+  
+  // number of relocations needed by a call trampoline stub
+  static uint reloc_call_trampoline() { 
+    return 0; // no call trampolines on this platform
+  }
+};
+
+class HandlerImpl {
+
+ public:
+
+  static int emit_exception_handler(CodeBuffer &cbuf);
+  static int emit_deopt_handler(CodeBuffer& cbuf);
+
+  static uint size_exception_handler() {
+    // NativeCall instruction size is the same as NativeJump.
+    // exception handler starts out as jump and can be patched to
+    // a call be deoptimization.  (4932387)
+    // Note that this value is also credited (in output.cpp) to
+    // the size of the code section.
+    return NativeJump::instruction_size;
+  }
+
+#ifdef _LP64
+  static uint size_deopt_handler() {
+    // three 5 byte instructions
+    return 15;
+  }
+#else
+  static uint size_deopt_handler() {
+    // NativeCall instruction size is the same as NativeJump.
+    // exception handler starts out as jump and can be patched to
+    // a call be deoptimization.  (4932387)
+    // Note that this value is also credited (in output.cpp) to
+    // the size of the code section.
+    return 5 + NativeJump::instruction_size; // pushl(); jmp;
+  }
+#endif
+};
+
+%} // end source_hpp
+
 source %{
+
+// Emit exception handler code.
+// Stuff framesize into a register and call a VM stub routine.
+int HandlerImpl::emit_exception_handler(CodeBuffer& cbuf) {
+
+  // Note that the code buffer's insts_mark is always relative to insts.
+  // That's why we must use the macroassembler to generate a handler.
+  MacroAssembler _masm(&cbuf);
+  address base = __ start_a_stub(size_exception_handler());
+  if (base == NULL)  return 0;  // CodeBuffer::expand failed
+  int offset = __ offset();
+  __ jump(RuntimeAddress(OptoRuntime::exception_blob()->entry_point()));
+  assert(__ offset() - offset <= (int) size_exception_handler(), "overflow");
+  __ end_a_stub();
+  return offset;
+}
+
+// Emit deopt handler code.
+int HandlerImpl::emit_deopt_handler(CodeBuffer& cbuf) {
+
+  // Note that the code buffer's insts_mark is always relative to insts.
+  // That's why we must use the macroassembler to generate a handler.
+  MacroAssembler _masm(&cbuf);
+  address base = __ start_a_stub(size_deopt_handler());
+  if (base == NULL)  return 0;  // CodeBuffer::expand failed
+  int offset = __ offset();
+
+#ifdef _LP64
+  address the_pc = (address) __ pc();
+  Label next;
+  // push a "the_pc" on the stack without destroying any registers
+  // as they all may be live.
+
+  // push address of "next"
+  __ call(next, relocInfo::none); // reloc none is fine since it is a disp32
+  __ bind(next);
+  // adjust it so it matches "the_pc"
+  __ subptr(Address(rsp, 0), __ offset() - offset);
+#else
+  InternalAddress here(__ pc());
+  __ pushptr(here.addr());
+#endif
+
+  __ jump(RuntimeAddress(SharedRuntime::deopt_blob()->unpack()));
+  assert(__ offset() - offset <= (int) size_deopt_handler(), "overflow");
+  __ end_a_stub();
+  return offset;
+}
+
+
+//=============================================================================
+
   // Float masks come from different places depending on platform.
 #ifdef _LP64
   static address float_signmask()  { return StubRoutines::x86::float_sign_mask(); }
--- a/hotspot/src/cpu/x86/vm/x86_32.ad	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/x86_32.ad	Tue Apr 01 15:37:15 2014 +0200
@@ -1297,59 +1297,6 @@
 
 
 //=============================================================================
-uint size_exception_handler() {
-  // NativeCall instruction size is the same as NativeJump.
-  // exception handler starts out as jump and can be patched to
-  // a call be deoptimization.  (4932387)
-  // Note that this value is also credited (in output.cpp) to
-  // the size of the code section.
-  return NativeJump::instruction_size;
-}
-
-// Emit exception handler code.  Stuff framesize into a register
-// and call a VM stub routine.
-int emit_exception_handler(CodeBuffer& cbuf) {
-
-  // Note that the code buffer's insts_mark is always relative to insts.
-  // That's why we must use the macroassembler to generate a handler.
-  MacroAssembler _masm(&cbuf);
-  address base =
-  __ start_a_stub(size_exception_handler());
-  if (base == NULL)  return 0;  // CodeBuffer::expand failed
-  int offset = __ offset();
-  __ jump(RuntimeAddress(OptoRuntime::exception_blob()->entry_point()));
-  assert(__ offset() - offset <= (int) size_exception_handler(), "overflow");
-  __ end_a_stub();
-  return offset;
-}
-
-uint size_deopt_handler() {
-  // NativeCall instruction size is the same as NativeJump.
-  // exception handler starts out as jump and can be patched to
-  // a call be deoptimization.  (4932387)
-  // Note that this value is also credited (in output.cpp) to
-  // the size of the code section.
-  return 5 + NativeJump::instruction_size; // pushl(); jmp;
-}
-
-// Emit deopt handler code.
-int emit_deopt_handler(CodeBuffer& cbuf) {
-
-  // Note that the code buffer's insts_mark is always relative to insts.
-  // That's why we must use the macroassembler to generate a handler.
-  MacroAssembler _masm(&cbuf);
-  address base =
-  __ start_a_stub(size_exception_handler());
-  if (base == NULL)  return 0;  // CodeBuffer::expand failed
-  int offset = __ offset();
-  InternalAddress here(__ pc());
-  __ pushptr(here.addr());
-
-  __ jump(RuntimeAddress(SharedRuntime::deopt_blob()->unpack()));
-  assert(__ offset() - offset <= (int) size_deopt_handler(), "overflow");
-  __ end_a_stub();
-  return offset;
-}
 
 int Matcher::regnum_to_fpu_offset(int regnum) {
   return regnum - 32; // The FP registers are in the second chunk
@@ -12925,13 +12872,31 @@
 
 // inlined locking and unlocking
 
+instruct cmpFastLockRTM(eFlagsReg cr, eRegP object, eBXRegP box, eAXRegI tmp, eDXRegI scr, rRegI cx1, rRegI cx2) %{
+  predicate(Compile::current()->use_rtm());
+  match(Set cr (FastLock object box));
+  effect(TEMP tmp, TEMP scr, TEMP cx1, TEMP cx2, USE_KILL box);
+  ins_cost(300);
+  format %{ "FASTLOCK $object,$box\t! kills $box,$tmp,$scr,$cx1,$cx2" %}
+  ins_encode %{
+    __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
+                 $scr$$Register, $cx1$$Register, $cx2$$Register,
+                 _counters, _rtm_counters, _stack_rtm_counters,
+                 ((Method*)(ra_->C->method()->constant_encoding()))->method_data(),
+                 true, ra_->C->profile_rtm());
+  %}
+  ins_pipe(pipe_slow);
+%}
+
 instruct cmpFastLock(eFlagsReg cr, eRegP object, eBXRegP box, eAXRegI tmp, eRegP scr) %{
+  predicate(!Compile::current()->use_rtm());
   match(Set cr (FastLock object box));
   effect(TEMP tmp, TEMP scr, USE_KILL box);
   ins_cost(300);
   format %{ "FASTLOCK $object,$box\t! kills $box,$tmp,$scr" %}
   ins_encode %{
-    __ fast_lock($object$$Register, $box$$Register, $tmp$$Register, $scr$$Register, _counters);
+    __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
+                 $scr$$Register, noreg, noreg, _counters, NULL, NULL, NULL, false, false);
   %}
   ins_pipe(pipe_slow);
 %}
@@ -12942,7 +12907,7 @@
   ins_cost(300);
   format %{ "FASTUNLOCK $object,$box\t! kills $box,$tmp" %}
   ins_encode %{
-    __ fast_unlock($object$$Register, $box$$Register, $tmp$$Register);
+    __ fast_unlock($object$$Register, $box$$Register, $tmp$$Register, ra_->C->use_rtm());
   %}
   ins_pipe(pipe_slow);
 %}
--- a/hotspot/src/cpu/x86/vm/x86_64.ad	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/x86_64.ad	Tue Apr 01 15:37:15 2014 +0200
@@ -1439,66 +1439,9 @@
   return MachNode::size(ra_); // too many variables; just compute it
                               // the hard way
 }
-
+ 
 
 //=============================================================================
-uint size_exception_handler()
-{
-  // NativeCall instruction size is the same as NativeJump.
-  // Note that this value is also credited (in output.cpp) to
-  // the size of the code section.
-  return NativeJump::instruction_size;
-}
-
-// Emit exception handler code.
-int emit_exception_handler(CodeBuffer& cbuf)
-{
-
-  // Note that the code buffer's insts_mark is always relative to insts.
-  // That's why we must use the macroassembler to generate a handler.
-  MacroAssembler _masm(&cbuf);
-  address base =
-  __ start_a_stub(size_exception_handler());
-  if (base == NULL)  return 0;  // CodeBuffer::expand failed
-  int offset = __ offset();
-  __ jump(RuntimeAddress(OptoRuntime::exception_blob()->entry_point()));
-  assert(__ offset() - offset <= (int) size_exception_handler(), "overflow");
-  __ end_a_stub();
-  return offset;
-}
-
-uint size_deopt_handler()
-{
-  // three 5 byte instructions
-  return 15;
-}
-
-// Emit deopt handler code.
-int emit_deopt_handler(CodeBuffer& cbuf)
-{
-
-  // Note that the code buffer's insts_mark is always relative to insts.
-  // That's why we must use the macroassembler to generate a handler.
-  MacroAssembler _masm(&cbuf);
-  address base =
-  __ start_a_stub(size_deopt_handler());
-  if (base == NULL)  return 0;  // CodeBuffer::expand failed
-  int offset = __ offset();
-  address the_pc = (address) __ pc();
-  Label next;
-  // push a "the_pc" on the stack without destroying any registers
-  // as they all may be live.
-
-  // push address of "next"
-  __ call(next, relocInfo::none); // reloc none is fine since it is a disp32
-  __ bind(next);
-  // adjust it so it matches "the_pc"
-  __ subptr(Address(rsp, 0), __ offset() - offset);
-  __ jump(RuntimeAddress(SharedRuntime::deopt_blob()->unpack()));
-  assert(__ offset() - offset <= (int) size_deopt_handler(), "overflow");
-  __ end_a_stub();
-  return offset;
-}
 
 int Matcher::regnum_to_fpu_offset(int regnum)
 {
@@ -11387,13 +11330,31 @@
 // ============================================================================
 // inlined locking and unlocking
 
+instruct cmpFastLockRTM(rFlagsReg cr, rRegP object, rbx_RegP box, rax_RegI tmp, rdx_RegI scr, rRegI cx1, rRegI cx2) %{
+  predicate(Compile::current()->use_rtm());
+  match(Set cr (FastLock object box));
+  effect(TEMP tmp, TEMP scr, TEMP cx1, TEMP cx2, USE_KILL box);
+  ins_cost(300);
+  format %{ "fastlock $object,$box\t! kills $box,$tmp,$scr,$cx1,$cx2" %}
+  ins_encode %{
+    __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
+                 $scr$$Register, $cx1$$Register, $cx2$$Register,
+                 _counters, _rtm_counters, _stack_rtm_counters,
+                 ((Method*)(ra_->C->method()->constant_encoding()))->method_data(),
+                 true, ra_->C->profile_rtm());
+  %}
+  ins_pipe(pipe_slow);
+%}
+
 instruct cmpFastLock(rFlagsReg cr, rRegP object, rbx_RegP box, rax_RegI tmp, rRegP scr) %{
+  predicate(!Compile::current()->use_rtm());
   match(Set cr (FastLock object box));
   effect(TEMP tmp, TEMP scr, USE_KILL box);
   ins_cost(300);
   format %{ "fastlock $object,$box\t! kills $box,$tmp,$scr" %}
   ins_encode %{
-    __ fast_lock($object$$Register, $box$$Register, $tmp$$Register, $scr$$Register, _counters);
+    __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
+                 $scr$$Register, noreg, noreg, _counters, NULL, NULL, NULL, false, false);
   %}
   ins_pipe(pipe_slow);
 %}
@@ -11404,7 +11365,7 @@
   ins_cost(300);
   format %{ "fastunlock $object,$box\t! kills $box,$tmp" %}
   ins_encode %{
-    __ fast_unlock($object$$Register, $box$$Register, $tmp$$Register);
+    __ fast_unlock($object$$Register, $box$$Register, $tmp$$Register, ra_->C->use_rtm());
   %}
   ins_pipe(pipe_slow);
 %}
--- a/hotspot/src/os/aix/vm/mutex_aix.inline.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/os/aix/vm/mutex_aix.inline.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,6 @@
 
 #include "os_aix.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
-#include "thread_aix.inline.hpp"
+#include "runtime/thread.inline.hpp"
 
 #endif // OS_AIX_VM_MUTEX_AIX_INLINE_HPP
--- a/hotspot/src/os/aix/vm/os_aix.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/os/aix/vm/os_aix.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,10 +61,10 @@
 #include "runtime/statSampler.hpp"
 #include "runtime/stubRoutines.hpp"
 #include "runtime/threadCritical.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/timer.hpp"
 #include "services/attachListener.hpp"
 #include "services/runtimeService.hpp"
-#include "thread_aix.inline.hpp"
 #include "utilities/decoder.hpp"
 #include "utilities/defaultStream.hpp"
 #include "utilities/events.hpp"
--- a/hotspot/src/os/aix/vm/threadCritical_aix.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/os/aix/vm/threadCritical_aix.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 
 #include "precompiled.hpp"
 #include "runtime/threadCritical.hpp"
-#include "thread_aix.inline.hpp"
+#include "runtime/thread.inline.hpp"
 
 // put OS-includes here
 # include <pthread.h>
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -109,6 +109,8 @@
 
 #define MAX_PATH    (2 * K)
 
+#define MAX_SECS 100000000
+
 // for timer info max values which include all bits
 #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
 
@@ -2434,7 +2436,6 @@
     sem_t _semaphore;
 };
 
-
 Semaphore::Semaphore() {
   sem_init(&_semaphore, 0, 0);
 }
@@ -2456,8 +2457,22 @@
 }
 
 bool Semaphore::timedwait(unsigned int sec, int nsec) {
+
   struct timespec ts;
-  unpackTime(&ts, false, (sec * NANOSECS_PER_SEC) + nsec);
+  // Semaphore's are always associated with CLOCK_REALTIME
+  os::Linux::clock_gettime(CLOCK_REALTIME, &ts);
+  // see unpackTime for discussion on overflow checking
+  if (sec >= MAX_SECS) {
+    ts.tv_sec += MAX_SECS;
+    ts.tv_nsec = 0;
+  } else {
+    ts.tv_sec += sec;
+    ts.tv_nsec += nsec;
+    if (ts.tv_nsec >= NANOSECS_PER_SEC) {
+      ts.tv_nsec -= NANOSECS_PER_SEC;
+      ++ts.tv_sec; // note: this must be <= max_secs
+    }
+  }
 
   while (1) {
     int result = sem_timedwait(&_semaphore, &ts);
@@ -5661,7 +5676,6 @@
  * is no need to track notifications.
  */
 
-#define MAX_SECS 100000000
 /*
  * This code is common to linux and solaris and will be moved to a
  * common place in dolphin.
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -2425,6 +2425,12 @@
     }
   }
 
+  if ((exception_code == EXCEPTION_ACCESS_VIOLATION) &&
+      VM_Version::is_cpuinfo_segv_addr(pc)) {
+    // Verify that OS save/restore AVX registers.
+    return Handle_Exception(exceptionInfo, VM_Version::cpuinfo_cont_addr());
+  }
+
   if (t != NULL && t->is_Java_thread()) {
     JavaThread* thread = (JavaThread*) t;
     bool in_java = thread->thread_state() == _thread_in_Java;
--- a/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,8 +49,8 @@
 #include "runtime/osThread.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/timer.hpp"
-#include "thread_aix.inline.hpp"
 #include "utilities/events.hpp"
 #include "utilities/vmError.hpp"
 #ifdef COMPILER1
--- a/hotspot/src/os_cpu/aix_ppc/vm/threadLS_aix_ppc.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/os_cpu/aix_ppc/vm/threadLS_aix_ppc.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,14 +25,14 @@
 
 #include "precompiled.hpp"
 #include "runtime/threadLocalStorage.hpp"
-#include "thread_aix.inline.hpp"
+#include "runtime/thread.hpp"
 
 void ThreadLocalStorage::generate_code_for_get_thread() {
-    // nothing we can do here for user-level thread
+  // Nothing we can do here for user-level thread.
 }
 
 void ThreadLocalStorage::pd_init() {
-  // Nothing to do
+  // Nothing to do.
 }
 
 void ThreadLocalStorage::pd_set_thread(Thread* thread) {
--- a/hotspot/src/os_cpu/aix_ppc/vm/thread_aix_ppc.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/os_cpu/aix_ppc/vm/thread_aix_ppc.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,8 +24,8 @@
  */
 
 #include "precompiled.hpp"
-#include "runtime/frame.inline.hpp"
-#include "thread_aix.inline.hpp"
+#include "runtime/frame.hpp"
+#include "runtime/thread.hpp"
 
 // Forte Analyzer AsyncGetCallTrace profiling support is not implemented on Aix/PPC.
 bool JavaThread::pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext, bool isInJava) {
--- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -492,6 +492,11 @@
       }
     }
 
+    if ((sig == SIGSEGV || sig == SIGBUS) && VM_Version::is_cpuinfo_segv_addr(pc)) {
+      // Verify that OS save/restore AVX registers.
+      stub = VM_Version::cpuinfo_cont_addr();
+    }
+
     // We test if stub is already set (by the stack overflow code
     // above) so it is not overwritten by the code that follows. This
     // check is not required on other platforms, because on other
--- a/hotspot/src/os_cpu/linux_ppc/vm/thread_linux_ppc.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/os_cpu/linux_ppc/vm/thread_linux_ppc.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,8 +24,8 @@
  */
 
 #include "precompiled.hpp"
-#include "runtime/frame.inline.hpp"
-#include "thread_linux.inline.hpp"
+#include "runtime/frame.hpp"
+#include "runtime/thread.hpp"
 
 // Forte Analyzer AsyncGetCallTrace profiling support is not implemented on Linux/PPC.
 bool JavaThread::pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext, bool isInJava) {
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -338,6 +338,11 @@
       }
     }
 
+    if ((sig == SIGSEGV) && VM_Version::is_cpuinfo_segv_addr(pc)) {
+      // Verify that OS save/restore AVX registers.
+      stub = VM_Version::cpuinfo_cont_addr();
+    }
+
     if (thread->thread_state() == _thread_in_Java) {
       // Java thread running in Java code => find exception handler if any
       // a fault inside compiled code, the interpreter, or a stub
--- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -459,6 +459,11 @@
       }
     }
 
+    if ((sig == SIGSEGV) && VM_Version::is_cpuinfo_segv_addr(pc)) {
+      // Verify that OS save/restore AVX registers.
+      stub = VM_Version::cpuinfo_cont_addr();
+    }
+
     if (thread->thread_state() == _thread_in_vm) {
       if (sig == SIGBUS && info->si_code == BUS_OBJERR && thread->doing_unsafe_access()) {
         stub = StubRoutines::handler_for_unsafe_access();
--- a/hotspot/src/share/vm/adlc/output_c.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/adlc/output_c.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1582,6 +1582,8 @@
 
       if( node->is_ideal_fastlock() && new_inst->is_ideal_fastlock() ) {
         fprintf(fp, "  ((MachFastLockNode*)n%d)->_counters = _counters;\n",cnt);
+        fprintf(fp, "  ((MachFastLockNode*)n%d)->_rtm_counters = _rtm_counters;\n",cnt);
+        fprintf(fp, "  ((MachFastLockNode*)n%d)->_stack_rtm_counters = _stack_rtm_counters;\n",cnt);
       }
 
       // Fill in the bottom_type where requested
@@ -3963,6 +3965,8 @@
   }
   if( inst->is_ideal_fastlock() ) {
     fprintf(fp_cpp, "%s node->_counters = _leaf->as_FastLock()->counters();\n", indent);
+    fprintf(fp_cpp, "%s node->_rtm_counters = _leaf->as_FastLock()->rtm_counters();\n", indent);
+    fprintf(fp_cpp, "%s node->_stack_rtm_counters = _leaf->as_FastLock()->stack_rtm_counters();\n", indent);
   }
 
 }
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -2526,7 +2526,7 @@
     // need to free up storage used for OSR entry point
     LIR_Opr osrBuffer = block()->next()->operand();
     BasicTypeList signature;
-    signature.append(T_INT);
+    signature.append(NOT_LP64(T_INT) LP64_ONLY(T_LONG)); // pass a pointer to osrBuffer
     CallingConvention* cc = frame_map()->c_calling_convention(&signature);
     __ move(osrBuffer, cc->args()->at(0));
     __ call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_end),
--- a/hotspot/src/share/vm/c1/c1_globals.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/c1/c1_globals.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -308,9 +308,6 @@
   develop(intx, InstructionCountCutoff, 37000,                              \
           "If GraphBuilder adds this many instructions, bails out")         \
                                                                             \
-  product_pd(intx, SafepointPollOffset,                                     \
-          "Offset added to polling address (Intel only)")                   \
-                                                                            \
   develop(bool, ComputeExactFPURegisterUsage, true,                         \
           "Compute additional live set for fpu registers to simplify fpu stack merge (Intel only)") \
                                                                             \
--- a/hotspot/src/share/vm/ci/ciEnv.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -961,7 +961,8 @@
                             AbstractCompiler* compiler,
                             int comp_level,
                             bool has_unsafe_access,
-                            bool has_wide_vectors) {
+                            bool has_wide_vectors,
+                            RTMState  rtm_state) {
   VM_ENTRY_MARK;
   nmethod* nm = NULL;
   {
@@ -1002,6 +1003,15 @@
 
     methodHandle method(THREAD, target->get_Method());
 
+#if INCLUDE_RTM_OPT
+    if (!failing() && (rtm_state != NoRTM) &&
+        (method()->method_data() != NULL) &&
+        (method()->method_data()->rtm_state() != rtm_state)) {
+      // Preemptive decompile if rtm state was changed.
+      record_failure("RTM state change invalidated rtm code");
+    }
+#endif
+
     if (failing()) {
       // While not a true deoptimization, it is a preemptive decompile.
       MethodData* mdo = method()->method_data();
@@ -1028,13 +1038,15 @@
                                frame_words, oop_map_set,
                                handler_table, inc_table,
                                compiler, comp_level);
-
     // Free codeBlobs
     code_buffer->free_blob();
 
     if (nm != NULL) {
       nm->set_has_unsafe_access(has_unsafe_access);
       nm->set_has_wide_vectors(has_wide_vectors);
+#if INCLUDE_RTM_OPT
+      nm->set_rtm_state(rtm_state);
+#endif
 
       // Record successful registration.
       // (Put nm into the task handle *before* publishing to the Java heap.)
--- a/hotspot/src/share/vm/ci/ciEnv.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/ci/ciEnv.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -365,7 +365,8 @@
                        AbstractCompiler*         compiler,
                        int                       comp_level,
                        bool                      has_unsafe_access,
-                       bool                      has_wide_vectors);
+                       bool                      has_wide_vectors,
+                       RTMState                  rtm_state = NoRTM);
 
 
   // Access to certain well known ciObjects.
--- a/hotspot/src/share/vm/ci/ciMethodData.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/ci/ciMethodData.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -478,6 +478,18 @@
 
   int invocation_count() { return _invocation_counter; }
   int backedge_count()   { return _backedge_counter;   }
+
+#if INCLUDE_RTM_OPT
+  // return cached value
+  int rtm_state() {
+    if (is_empty()) {
+      return NoRTM;
+    } else {
+      return get_MethodData()->rtm_state();
+    }
+  }
+#endif
+
   // Transfer information about the method to MethodData*.
   // would_profile means we would like to profile this method,
   // meaning it's not trivial.
--- a/hotspot/src/share/vm/code/nmethod.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -460,7 +460,9 @@
   _scavenge_root_link      = NULL;
   _scavenge_root_state     = 0;
   _compiler                = NULL;
-
+#if INCLUDE_RTM_OPT
+  _rtm_state               = NoRTM;
+#endif
 #ifdef HAVE_DTRACE_H
   _trap_offset             = 0;
 #endif // def HAVE_DTRACE_H
--- a/hotspot/src/share/vm/code/nmethod.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/code/nmethod.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -193,6 +193,12 @@
 
   jbyte _scavenge_root_state;
 
+#if INCLUDE_RTM_OPT
+  // RTM state at compile time. Used during deoptimization to decide
+  // whether to restart collecting RTM locking abort statistic again.
+  RTMState _rtm_state;
+#endif
+
   // Nmethod Flushing lock. If non-zero, then the nmethod is not removed
   // and is not made into a zombie. However, once the nmethod is made into
   // a zombie, it will be locked one final time if CompiledMethodUnload
@@ -414,6 +420,12 @@
   bool  is_zombie() const                         { return _state == zombie; }
   bool  is_unloaded() const                       { return _state == unloaded;   }
 
+#if INCLUDE_RTM_OPT
+  // rtm state accessing and manipulating
+  RTMState  rtm_state() const                     { return _rtm_state; }
+  void set_rtm_state(RTMState state)              { _rtm_state = state; }
+#endif
+
   // Make the nmethod non entrant. The nmethod will continue to be
   // alive.  It is used when an uncommon trap happens.  Returns true
   // if this thread changed the state of the nmethod or false if
--- a/hotspot/src/share/vm/oops/method.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/oops/method.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -273,7 +273,7 @@
 }
 
 address Method::bcp_from(int bci) const {
-  assert((is_native() && bci == 0)  || (!is_native() && 0 <= bci && bci < code_size()), "illegal bci");
+  assert((is_native() && bci == 0)  || (!is_native() && 0 <= bci && bci < code_size()), err_msg("illegal bci: %d", bci));
   address bcp = code_base() + bci;
   assert(is_native() && bcp == code_base() || contains(bcp), "bcp doesn't belong to this method");
   return bcp;
--- a/hotspot/src/share/vm/oops/methodData.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/oops/methodData.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/systemDictionary.hpp"
+#include "compiler/compilerOracle.hpp"
 #include "interpreter/bytecode.hpp"
 #include "interpreter/bytecodeStream.hpp"
 #include "interpreter/linkResolver.hpp"
@@ -1153,6 +1154,21 @@
   _highest_osr_comp_level = 0;
   _would_profile = true;
 
+#if INCLUDE_RTM_OPT
+  _rtm_state = NoRTM; // No RTM lock eliding by default
+  if (UseRTMLocking &&
+      !CompilerOracle::has_option_string(_method, "NoRTMLockEliding")) {
+    if (CompilerOracle::has_option_string(_method, "UseRTMLockEliding") || !UseRTMDeopt) {
+      // Generate RTM lock eliding code without abort ratio calculation code.
+      _rtm_state = UseRTM;
+    } else if (UseRTMDeopt) {
+      // Generate RTM lock eliding code and include abort ratio calculation
+      // code if UseRTMDeopt is on.
+      _rtm_state = ProfileRTM;
+    }
+  }
+#endif
+
   // Initialize flags and trap history.
   _nof_decompiles = 0;
   _nof_overflow_recompiles = 0;
--- a/hotspot/src/share/vm/oops/methodData.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/oops/methodData.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -2052,7 +2052,7 @@
 
   // Whole-method sticky bits and flags
   enum {
-    _trap_hist_limit    = 18,   // decoupled from Deoptimization::Reason_LIMIT
+    _trap_hist_limit    = 19,   // decoupled from Deoptimization::Reason_LIMIT
     _trap_hist_mask     = max_jubyte,
     _extra_data_count   = 4     // extra DataLayout headers, for trap history
   }; // Public flag values
@@ -2083,6 +2083,12 @@
   // Counter values at the time profiling started.
   int               _invocation_counter_start;
   int               _backedge_counter_start;
+
+#if INCLUDE_RTM_OPT
+  // State of RTM code generation during compilation of the method
+  int               _rtm_state;
+#endif
+
   // Number of loops and blocks is computed when compiling the first
   // time with C1. It is used to determine if method is trivial.
   short             _num_loops;
@@ -2246,6 +2252,22 @@
   InvocationCounter* invocation_counter()     { return &_invocation_counter; }
   InvocationCounter* backedge_counter()       { return &_backedge_counter;   }
 
+#if INCLUDE_RTM_OPT
+  int rtm_state() const {
+    return _rtm_state;
+  }
+  void set_rtm_state(RTMState rstate) {
+    _rtm_state = (int)rstate;
+  }
+  void atomic_set_rtm_state(RTMState rstate) {
+    Atomic::store((int)rstate, &_rtm_state);
+  }
+
+  static int rtm_state_offset_in_bytes() {
+    return offset_of(MethodData, _rtm_state);
+  }
+#endif
+
   void set_would_profile(bool p)              { _would_profile = p;    }
   bool would_profile() const                  { return _would_profile; }
 
--- a/hotspot/src/share/vm/opto/c2_globals.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/c2_globals.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -446,6 +446,9 @@
   diagnostic(bool, PrintPreciseBiasedLockingStatistics, false,              \
           "Print per-lock-site statistics of biased locking in JVM")        \
                                                                             \
+  diagnostic(bool, PrintPreciseRTMLockingStatistics, false,                 \
+          "Print per-lock-site statistics of rtm locking in JVM")           \
+                                                                            \
   notproduct(bool, PrintEliminateLocks, false,                              \
           "Print out when locks are eliminated")                            \
                                                                             \
--- a/hotspot/src/share/vm/opto/classes.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/classes.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -198,6 +198,7 @@
 macro(NeverBranch)
 macro(Opaque1)
 macro(Opaque2)
+macro(Opaque3)
 macro(OrI)
 macro(OrL)
 macro(OverflowAddI)
--- a/hotspot/src/share/vm/opto/compile.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/compile.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -694,9 +694,10 @@
   set_print_inlining(PrintInlining || method()->has_option("PrintInlining") NOT_PRODUCT( || PrintOptoInlining));
   set_print_intrinsics(PrintIntrinsics || method()->has_option("PrintIntrinsics"));
 
-  if (ProfileTraps) {
+  if (ProfileTraps RTM_OPT_ONLY( || UseRTMLocking )) {
     // Make sure the method being compiled gets its own MDO,
     // so we can at least track the decompile_count().
+    // Need MDO to record RTM code generation state.
     method()->ensure_method_data();
   }
 
@@ -907,7 +908,8 @@
                            compiler,
                            env()->comp_level(),
                            has_unsafe_access(),
-                           SharedRuntime::is_wide_vector(max_vector_size())
+                           SharedRuntime::is_wide_vector(max_vector_size()),
+                           rtm_state()
                            );
 
     if (log() != NULL) // Print code cache state into compiler log
@@ -1073,7 +1075,23 @@
   set_do_scheduling(OptoScheduling);
   set_do_count_invocations(false);
   set_do_method_data_update(false);
-
+  set_rtm_state(NoRTM); // No RTM lock eliding by default
+#if INCLUDE_RTM_OPT
+  if (UseRTMLocking && has_method() && (method()->method_data_or_null() != NULL)) {
+    int rtm_state = method()->method_data()->rtm_state();
+    if (method_has_option("NoRTMLockEliding") || ((rtm_state & NoRTM) != 0)) {
+      // Don't generate RTM lock eliding code.
+      set_rtm_state(NoRTM);
+    } else if (method_has_option("UseRTMLockEliding") || ((rtm_state & UseRTM) != 0) || !UseRTMDeopt) {
+      // Generate RTM lock eliding code without abort ratio calculation code.
+      set_rtm_state(UseRTM);
+    } else if (UseRTMDeopt) {
+      // Generate RTM lock eliding code and include abort ratio calculation
+      // code if UseRTMDeopt is on.
+      set_rtm_state(ProfileRTM);
+    }
+  }
+#endif
   if (debug_info()->recording_non_safepoints()) {
     set_node_note_array(new(comp_arena()) GrowableArray<Node_Notes*>
                         (comp_arena(), 8, 0, NULL));
@@ -2581,6 +2599,7 @@
     break;
   case Op_Opaque1:              // Remove Opaque Nodes before matching
   case Op_Opaque2:              // Remove Opaque Nodes before matching
+  case Op_Opaque3:
     n->subsume_by(n->in(1), this);
     break;
   case Op_CallStaticJava:
--- a/hotspot/src/share/vm/opto/compile.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/compile.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -319,9 +319,9 @@
   bool                  _trace_opto_output;
   bool                  _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing
 #endif
-
   // JSR 292
   bool                  _has_method_handle_invokes; // True if this method has MethodHandle invokes.
+  RTMState              _rtm_state;             // State of Restricted Transactional Memory usage
 
   // Compilation environment.
   Arena                 _comp_arena;            // Arena with lifetime equivalent to Compile
@@ -591,6 +591,10 @@
   void          set_print_inlining(bool z)       { _print_inlining = z; }
   bool              print_intrinsics() const     { return _print_intrinsics; }
   void          set_print_intrinsics(bool z)     { _print_intrinsics = z; }
+  RTMState          rtm_state()  const           { return _rtm_state; }
+  void          set_rtm_state(RTMState s)        { _rtm_state = s; }
+  bool              use_rtm() const              { return (_rtm_state & NoRTM) == 0; }
+  bool          profile_rtm() const              { return _rtm_state == ProfileRTM; }
   // check the CompilerOracle for special behaviours for this compile
   bool          method_has_option(const char * option) {
     return method() != NULL && method()->has_option(option);
--- a/hotspot/src/share/vm/opto/connode.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/connode.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -642,6 +642,19 @@
   virtual const Type *bottom_type() const { return TypeInt::INT; }
 };
 
+//------------------------------Opaque3Node------------------------------------
+// A node to prevent unwanted optimizations. Will be optimized only during
+// macro nodes expansion.
+class Opaque3Node : public Opaque2Node {
+  int _opt; // what optimization it was used for
+public:
+  enum { RTM_OPT };
+  Opaque3Node(Compile* C, Node *n, int opt) : Opaque2Node(C, n), _opt(opt) {}
+  virtual int Opcode() const;
+  bool rtm_opt() const { return (_opt == RTM_OPT); }
+};
+
+
 //----------------------PartialSubtypeCheckNode--------------------------------
 // The 2nd slow-half of a subtype check.  Scan the subklass's 2ndary superklass
 // array for an instance of the superklass.  Set a hidden internal cache on a
--- a/hotspot/src/share/vm/opto/graphKit.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/graphKit.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1125,6 +1125,17 @@
   }
   return _gvn.transform( new (C) ConvI2LNode(offset));
 }
+
+Node* GraphKit::ConvI2UL(Node* offset) {
+  juint offset_con = (juint) find_int_con(offset, Type::OffsetBot);
+  if (offset_con != (juint) Type::OffsetBot) {
+    return longcon((julong) offset_con);
+  }
+  Node* conv = _gvn.transform( new (C) ConvI2LNode(offset));
+  Node* mask = _gvn.transform( ConLNode::make(C, (julong) max_juint) );
+  return _gvn.transform( new (C) AndLNode(conv, mask) );
+}
+
 Node* GraphKit::ConvL2I(Node* offset) {
   // short-circuit a common case
   jlong offset_con = find_long_con(offset, (jlong)Type::OffsetBot);
@@ -3151,10 +3162,14 @@
   Node* mem = reset_memory();
 
   FastLockNode * flock = _gvn.transform(new (C) FastLockNode(0, obj, box) )->as_FastLock();
-  if (PrintPreciseBiasedLockingStatistics) {
+  if (UseBiasedLocking && PrintPreciseBiasedLockingStatistics) {
     // Create the counters for this fast lock.
     flock->create_lock_counter(sync_jvms()); // sync_jvms used to get current bci
   }
+
+  // Create the rtm counters for this fast lock if needed.
+  flock->create_rtm_lock_counter(sync_jvms()); // sync_jvms used to get current bci
+
   // Add monitor to debug info for the slow path.  If we block inside the
   // slow path and de-opt, we need the monitor hanging around
   map()->push_monitor( flock );
--- a/hotspot/src/share/vm/opto/graphKit.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/graphKit.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -338,6 +338,7 @@
   // Convert between int and long, and size_t.
   // (See macros ConvI2X, etc., in type.hpp for ConvI2X, etc.)
   Node* ConvI2L(Node* offset);
+  Node* ConvI2UL(Node* offset);
   Node* ConvL2I(Node* offset);
   // Find out the klass of an object.
   Node* load_object_klass(Node* object);
--- a/hotspot/src/share/vm/opto/library_call.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -2600,7 +2600,7 @@
     case T_ADDRESS:
       // Cast to an int type.
       p = _gvn.transform(new (C) CastP2XNode(NULL, p));
-      p = ConvX2L(p);
+      p = ConvX2UL(p);
       break;
     default:
       fatal(err_msg_res("unexpected type %d: %s", type, type2name(type)));
--- a/hotspot/src/share/vm/opto/locknode.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/locknode.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -136,6 +136,8 @@
 //-----------------------------hash--------------------------------------------
 uint FastLockNode::hash() const { return NO_HASH; }
 
+uint FastLockNode::size_of() const { return sizeof(*this); }
+
 //------------------------------cmp--------------------------------------------
 uint FastLockNode::cmp( const Node &n ) const {
   return (&n == this);                // Always fail except on self
@@ -159,6 +161,22 @@
   _counters = blnc->counters();
 }
 
+void FastLockNode::create_rtm_lock_counter(JVMState* state) {
+#if INCLUDE_RTM_OPT
+  Compile* C = Compile::current();
+  if (C->profile_rtm() || (PrintPreciseRTMLockingStatistics && C->use_rtm())) {
+    RTMLockingNamedCounter* rlnc = (RTMLockingNamedCounter*)
+           OptoRuntime::new_named_counter(state, NamedCounter::RTMLockingCounter);
+    _rtm_counters = rlnc->counters();
+    if (UseRTMForStackLocks) {
+      rlnc = (RTMLockingNamedCounter*)
+           OptoRuntime::new_named_counter(state, NamedCounter::RTMLockingCounter);
+      _stack_rtm_counters = rlnc->counters();
+    }
+  }
+#endif
+}
+
 //=============================================================================
 //------------------------------do_monitor_enter-------------------------------
 void Parse::do_monitor_enter() {
--- a/hotspot/src/share/vm/opto/locknode.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/locknode.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -92,13 +92,17 @@
 //------------------------------FastLockNode-----------------------------------
 class FastLockNode: public CmpNode {
 private:
-  BiasedLockingCounters* _counters;
+  BiasedLockingCounters*        _counters;
+  RTMLockingCounters*       _rtm_counters; // RTM lock counters for inflated locks
+  RTMLockingCounters* _stack_rtm_counters; // RTM lock counters for stack locks
 
 public:
   FastLockNode(Node *ctrl, Node *oop, Node *box) : CmpNode(oop,box) {
     init_req(0,ctrl);
     init_class_id(Class_FastLock);
     _counters = NULL;
+    _rtm_counters = NULL;
+    _stack_rtm_counters = NULL;
   }
   Node* obj_node() const { return in(1); }
   Node* box_node() const { return in(2); }
@@ -107,13 +111,17 @@
   // FastLock and FastUnlockNode do not hash, we need one for each correspoding
   // LockNode/UnLockNode to avoid creating Phi's.
   virtual uint hash() const ;                  // { return NO_HASH; }
+  virtual uint size_of() const;
   virtual uint cmp( const Node &n ) const ;    // Always fail, except on self
   virtual int Opcode() const;
   virtual const Type *Value( PhaseTransform *phase ) const { return TypeInt::CC; }
   const Type *sub(const Type *t1, const Type *t2) const { return TypeInt::CC;}
 
   void create_lock_counter(JVMState* s);
-  BiasedLockingCounters* counters() const { return _counters; }
+  void create_rtm_lock_counter(JVMState* state);
+  BiasedLockingCounters*        counters() const { return _counters; }
+  RTMLockingCounters*       rtm_counters() const { return _rtm_counters; }
+  RTMLockingCounters* stack_rtm_counters() const { return _stack_rtm_counters; }
 };
 
 
--- a/hotspot/src/share/vm/opto/loopTransform.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -617,6 +617,15 @@
       case Op_AryEq: {
         return false;
       }
+#if INCLUDE_RTM_OPT
+      case Op_FastLock:
+      case Op_FastUnlock: {
+        // Don't unroll RTM locking code because it is large.
+        if (UseRTMLocking) {
+          return false;
+        }
+      }
+#endif
     } // switch
   }
 
@@ -722,6 +731,15 @@
         // String intrinsics are large and have loops.
         return false;
       }
+#if INCLUDE_RTM_OPT
+      case Op_FastLock:
+      case Op_FastUnlock: {
+        // Don't unroll RTM locking code because it is large.
+        if (UseRTMLocking) {
+          return false;
+        }
+      }
+#endif
     } // switch
   }
 
--- a/hotspot/src/share/vm/opto/machnode.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/machnode.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -53,6 +53,7 @@
 class Matcher;
 class PhaseRegAlloc;
 class RegMask;
+class RTMLockingCounters;
 class State;
 
 //---------------------------MachOper------------------------------------------
@@ -714,8 +715,9 @@
 class MachFastLockNode : public MachNode {
   virtual uint size_of() const { return sizeof(*this); } // Size is bigger
 public:
-  BiasedLockingCounters* _counters;
-
+  BiasedLockingCounters*        _counters;
+  RTMLockingCounters*       _rtm_counters; // RTM lock counters for inflated locks
+  RTMLockingCounters* _stack_rtm_counters; // RTM lock counters for stack locks
   MachFastLockNode() : MachNode() {}
 };
 
--- a/hotspot/src/share/vm/opto/macro.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/macro.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -2439,6 +2439,7 @@
     }
   }
   // Next, attempt to eliminate allocations
+  _has_locks = false;
   progress = true;
   while (progress) {
     progress = false;
@@ -2457,11 +2458,13 @@
       case Node::Class_Lock:
       case Node::Class_Unlock:
         assert(!n->as_AbstractLock()->is_eliminated(), "sanity");
+        _has_locks = true;
         break;
       default:
         assert(n->Opcode() == Op_LoopLimit ||
                n->Opcode() == Op_Opaque1   ||
-               n->Opcode() == Op_Opaque2, "unknown node type in macro list");
+               n->Opcode() == Op_Opaque2   ||
+               n->Opcode() == Op_Opaque3, "unknown node type in macro list");
       }
       assert(success == (C->macro_count() < old_macro_count), "elimination reduces macro count");
       progress = progress || success;
@@ -2502,6 +2505,30 @@
       } else if (n->Opcode() == Op_Opaque1 || n->Opcode() == Op_Opaque2) {
         _igvn.replace_node(n, n->in(1));
         success = true;
+#if INCLUDE_RTM_OPT
+      } else if ((n->Opcode() == Op_Opaque3) && ((Opaque3Node*)n)->rtm_opt()) {
+        assert(C->profile_rtm(), "should be used only in rtm deoptimization code");
+        assert((n->outcnt() == 1) && n->unique_out()->is_Cmp(), "");
+        Node* cmp = n->unique_out();
+#ifdef ASSERT
+        // Validate graph.
+        assert((cmp->outcnt() == 1) && cmp->unique_out()->is_Bool(), "");
+        BoolNode* bol = cmp->unique_out()->as_Bool();
+        assert((bol->outcnt() == 1) && bol->unique_out()->is_If() &&
+               (bol->_test._test == BoolTest::ne), "");
+        IfNode* ifn = bol->unique_out()->as_If();
+        assert((ifn->outcnt() == 2) &&
+               ifn->proj_out(1)->is_uncommon_trap_proj(Deoptimization::Reason_rtm_state_change), "");
+#endif
+        Node* repl = n->in(1);
+        if (!_has_locks) {
+          // Remove RTM state check if there are no locks in the code.
+          // Replace input to compare the same value.
+          repl = (cmp->in(1) == n) ? cmp->in(2) : cmp->in(1);
+        }
+        _igvn.replace_node(n, repl);
+        success = true;
+#endif
       }
       assert(success == (C->macro_count() < old_macro_count), "elimination reduces macro count");
       progress = progress || success;
--- a/hotspot/src/share/vm/opto/macro.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/macro.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -76,6 +76,8 @@
   ProjNode *_memproj_catchall;
   ProjNode *_resproj;
 
+  // Additional data collected during macro expansion
+  bool _has_locks;
 
   void expand_allocate(AllocateNode *alloc);
   void expand_allocate_array(AllocateArrayNode *alloc);
@@ -118,7 +120,7 @@
                             Node* length);
 
 public:
-  PhaseMacroExpand(PhaseIterGVN &igvn) : Phase(Macro_Expand), _igvn(igvn) {
+  PhaseMacroExpand(PhaseIterGVN &igvn) : Phase(Macro_Expand), _igvn(igvn), _has_locks(false) {
     _igvn.set_delay_transform(true);
   }
   void eliminate_macro_nodes();
--- a/hotspot/src/share/vm/opto/output.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/output.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -42,18 +42,12 @@
 #include "runtime/handles.inline.hpp"
 #include "utilities/xmlstream.hpp"
 
-extern uint size_exception_handler();
-extern uint size_deopt_handler();
-
 #ifndef PRODUCT
 #define DEBUG_ARG(x) , x
 #else
 #define DEBUG_ARG(x)
 #endif
 
-extern int emit_exception_handler(CodeBuffer &cbuf);
-extern int emit_deopt_handler(CodeBuffer &cbuf);
-
 // Convert Nodes to instruction bits and pass off to the VM
 void Compile::Output() {
   // RootNode goes
@@ -394,6 +388,11 @@
         blk_size += (mach->alignment_required() - 1) * relocInfo::addr_unit(); // assume worst case padding
         reloc_size += mach->reloc();
         if (mach->is_MachCall()) {
+          // add size information for trampoline stub
+          // class CallStubImpl is platform-specific and defined in the *.ad files.
+          stub_size  += CallStubImpl::size_call_trampoline();
+          reloc_size += CallStubImpl::reloc_call_trampoline();
+
           MachCallNode *mcall = mach->as_MachCall();
           // This destination address is NOT PC-relative
 
@@ -1133,10 +1132,9 @@
   shorten_branches(blk_starts, code_req, locs_req, stub_req);
 
   // nmethod and CodeBuffer count stubs & constants as part of method's code.
-  int exception_handler_req = size_exception_handler();
-  int deopt_handler_req = size_deopt_handler();
-  exception_handler_req += MAX_stubs_size; // add marginal slop for handler
-  deopt_handler_req += MAX_stubs_size; // add marginal slop for handler
+  // class HandlerImpl is platform-specific and defined in the *.ad files.
+  int exception_handler_req = HandlerImpl::size_exception_handler() + MAX_stubs_size; // add marginal slop for handler
+  int deopt_handler_req     = HandlerImpl::size_deopt_handler()     + MAX_stubs_size; // add marginal slop for handler
   stub_req += MAX_stubs_size;   // ensure per-stub margin
   code_req += MAX_inst_size;    // ensure per-instruction margin
 
@@ -1622,17 +1620,18 @@
   FillExceptionTables(inct_cnt, call_returns, inct_starts, blk_labels);
 
   // Only java methods have exception handlers and deopt handlers
+  // class HandlerImpl is platform-specific and defined in the *.ad files.
   if (_method) {
     // Emit the exception handler code.
-    _code_offsets.set_value(CodeOffsets::Exceptions, emit_exception_handler(*cb));
+    _code_offsets.set_value(CodeOffsets::Exceptions, HandlerImpl::emit_exception_handler(*cb));
     // Emit the deopt handler code.
-    _code_offsets.set_value(CodeOffsets::Deopt, emit_deopt_handler(*cb));
+    _code_offsets.set_value(CodeOffsets::Deopt, HandlerImpl::emit_deopt_handler(*cb));
 
     // Emit the MethodHandle deopt handler code (if required).
     if (has_method_handle_invokes()) {
       // We can use the same code as for the normal deopt handler, we
       // just need a different entry point address.
-      _code_offsets.set_value(CodeOffsets::DeoptMH, emit_deopt_handler(*cb));
+      _code_offsets.set_value(CodeOffsets::DeoptMH, HandlerImpl::emit_deopt_handler(*cb));
     }
   }
 
--- a/hotspot/src/share/vm/opto/parse.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/parse.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -486,6 +486,8 @@
   // Helper function to compute array addressing
   Node* array_addressing(BasicType type, int vals, const Type* *result2=NULL);
 
+  void rtm_deopt();
+
   // Pass current map to exits
   void return_current(Node* value);
 
--- a/hotspot/src/share/vm/opto/parse1.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/parse1.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -567,6 +567,10 @@
     set_map(entry_map);
     do_method_entry();
   }
+  if (depth() == 1) {
+    // Add check to deoptimize the nmethod if RTM state was changed
+    rtm_deopt();
+  }
 
   // Check for bailouts during method entry.
   if (failing()) {
@@ -2006,6 +2010,42 @@
   set_control( _gvn.transform(result_rgn) );
 }
 
+// Add check to deoptimize if RTM state is not ProfileRTM
+void Parse::rtm_deopt() {
+#if INCLUDE_RTM_OPT
+  if (C->profile_rtm()) {
+    assert(C->method() != NULL, "only for normal compilations");
+    assert(!C->method()->method_data()->is_empty(), "MDO is needed to record RTM state");
+    assert(depth() == 1, "generate check only for main compiled method");
+
+    // Set starting bci for uncommon trap.
+    set_parse_bci(is_osr_parse() ? osr_bci() : 0);
+
+    // Load the rtm_state from the MethodData.
+    const TypePtr* adr_type = TypeMetadataPtr::make(C->method()->method_data());
+    Node* mdo = makecon(adr_type);
+    int offset = MethodData::rtm_state_offset_in_bytes();
+    Node* adr_node = basic_plus_adr(mdo, mdo, offset);
+    Node* rtm_state = make_load(control(), adr_node, TypeInt::INT, T_INT, adr_type, MemNode::unordered);
+
+    // Separate Load from Cmp by Opaque.
+    // In expand_macro_nodes() it will be replaced either
+    // with this load when there are locks in the code
+    // or with ProfileRTM (cmp->in(2)) otherwise so that
+    // the check will fold.
+    Node* profile_state = makecon(TypeInt::make(ProfileRTM));
+    Node* opq   = _gvn.transform( new (C) Opaque3Node(C, rtm_state, Opaque3Node::RTM_OPT) );
+    Node* chk   = _gvn.transform( new (C) CmpINode(opq, profile_state) );
+    Node* tst   = _gvn.transform( new (C) BoolNode(chk, BoolTest::eq) );
+    // Branch to failure if state was changed
+    { BuildCutout unless(this, tst, PROB_ALWAYS);
+      uncommon_trap(Deoptimization::Reason_rtm_state_change,
+                    Deoptimization::Action_make_not_entrant);
+    }
+  }
+#endif
+}
+
 //------------------------------return_current---------------------------------
 // Append current _map to _exit_return
 void Parse::return_current(Node* value) {
--- a/hotspot/src/share/vm/opto/runtime.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/runtime.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1310,6 +1310,14 @@
         tty->print_cr("%s", c->name());
         blc->print_on(tty);
       }
+#if INCLUDE_RTM_OPT
+    } else if (c->tag() == NamedCounter::RTMLockingCounter) {
+      RTMLockingCounters* rlc = ((RTMLockingNamedCounter*)c)->counters();
+      if (rlc->nonzero()) {
+        tty->print_cr("%s", c->name());
+        rlc->print_on(tty);
+      }
+#endif
     }
     c = c->next();
   }
@@ -1349,6 +1357,8 @@
   NamedCounter* c;
   if (tag == NamedCounter::BiasedLockingCounter) {
     c = new BiasedLockingNamedCounter(strdup(st.as_string()));
+  } else if (tag == NamedCounter::RTMLockingCounter) {
+    c = new RTMLockingNamedCounter(strdup(st.as_string()));
   } else {
     c = new NamedCounter(strdup(st.as_string()), tag);
   }
@@ -1357,6 +1367,7 @@
   // add counters so this is safe.
   NamedCounter* head;
   do {
+    c->set_next(NULL);
     head = _named_counters;
     c->set_next(head);
   } while (Atomic::cmpxchg_ptr(c, &_named_counters, head) != head);
--- a/hotspot/src/share/vm/opto/runtime.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/runtime.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -29,6 +29,7 @@
 #include "opto/machnode.hpp"
 #include "opto/type.hpp"
 #include "runtime/biasedLocking.hpp"
+#include "runtime/rtmLocking.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/vframe.hpp"
 
@@ -61,7 +62,8 @@
     NoTag,
     LockCounter,
     EliminatedLockCounter,
-    BiasedLockingCounter
+    BiasedLockingCounter,
+    RTMLockingCounter
   };
 
 private:
@@ -85,7 +87,7 @@
 
   NamedCounter* next() const    { return _next; }
   void set_next(NamedCounter* next) {
-    assert(_next == NULL, "already set");
+    assert(_next == NULL || next == NULL, "already set");
     _next = next;
   }
 
@@ -102,6 +104,18 @@
   BiasedLockingCounters* counters() { return &_counters; }
 };
 
+
+class RTMLockingNamedCounter : public NamedCounter {
+ private:
+ RTMLockingCounters _counters;
+
+ public:
+  RTMLockingNamedCounter(const char *n) :
+    NamedCounter(n, RTMLockingCounter), _counters() {}
+
+  RTMLockingCounters* counters() { return &_counters; }
+};
+
 typedef const TypeFunc*(*TypeFunc_generator)();
 
 class OptoRuntime : public AllStatic {
--- a/hotspot/src/share/vm/opto/type.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/type.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -4380,7 +4380,7 @@
       // else fall through:
     case TopPTR:
     case AnyNull: {
-      return make(ptr, NULL, offset);
+      return make(ptr, _metadata, offset);
     }
     case BotPTR:
     case NotNull:
--- a/hotspot/src/share/vm/opto/type.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/opto/type.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1716,6 +1716,7 @@
 #define ConvL2X(x)   (x)
 #define ConvX2I(x)   ConvL2I(x)
 #define ConvX2L(x)   (x)
+#define ConvX2UL(x)  (x)
 
 #else
 
@@ -1760,6 +1761,7 @@
 #define ConvL2X(x)   ConvL2I(x)
 #define ConvX2I(x)   (x)
 #define ConvX2L(x)   ConvI2L(x)
+#define ConvX2UL(x)  ConvI2UL(x)
 
 #endif
 
--- a/hotspot/src/share/vm/prims/whitebox.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/prims/whitebox.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -500,6 +500,54 @@
   c = *p;
 WB_END
 
+WB_ENTRY(jstring, WB_GetCPUFeatures(JNIEnv* env, jobject o))
+  const char* cpu_features = VM_Version::cpu_features();
+  ThreadToNativeFromVM ttn(thread);
+  jstring features_string = env->NewStringUTF(cpu_features);
+
+  CHECK_JNI_EXCEPTION_(env, NULL);
+
+  return features_string;
+WB_END
+
+
+WB_ENTRY(jobjectArray, WB_GetNMethod(JNIEnv* env, jobject o, jobject method, jboolean is_osr))
+  ResourceMark rm(THREAD);
+  jmethodID jmid = reflected_method_to_jmid(thread, env, method);
+  CHECK_JNI_EXCEPTION_(env, NULL);
+  methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
+  nmethod* code = is_osr ? mh->lookup_osr_nmethod_for(InvocationEntryBci, CompLevel_none, false) : mh->code();
+  jobjectArray result = NULL;
+  if (code == NULL) {
+    return result;
+  }
+  int insts_size = code->insts_size();
+
+  ThreadToNativeFromVM ttn(thread);
+  jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string());
+  CHECK_JNI_EXCEPTION_(env, NULL);
+  result = env->NewObjectArray(2, clazz, NULL);
+  if (result == NULL) {
+    return result;
+  }
+
+  clazz = env->FindClass(vmSymbols::java_lang_Integer()->as_C_string());
+  CHECK_JNI_EXCEPTION_(env, NULL);
+  jmethodID constructor = env->GetMethodID(clazz, vmSymbols::object_initializer_name()->as_C_string(), vmSymbols::int_void_signature()->as_C_string());
+  CHECK_JNI_EXCEPTION_(env, NULL);
+  jobject obj = env->NewObject(clazz, constructor, code->comp_level());
+  CHECK_JNI_EXCEPTION_(env, NULL);
+  env->SetObjectArrayElement(result, 0, obj);
+
+  jbyteArray insts = env->NewByteArray(insts_size);
+  CHECK_JNI_EXCEPTION_(env, NULL);
+  env->SetByteArrayRegion(insts, 0, insts_size, (jbyte*) code->insts_begin());
+  env->SetObjectArrayElement(result, 1, insts);
+
+  return result;
+WB_END
+
+
 //Some convenience methods to deal with objects from java
 int WhiteBox::offset_for_field(const char* field_name, oop object,
     Symbol* signature_symbol) {
@@ -611,6 +659,9 @@
   {CC"isInStringTable",   CC"(Ljava/lang/String;)Z",  (void*)&WB_IsInStringTable  },
   {CC"fullGC",   CC"()V",                             (void*)&WB_FullGC },
   {CC"readReservedMemory", CC"()V",                   (void*)&WB_ReadReservedMemory },
+  {CC"getCPUFeatures",     CC"()Ljava/lang/String;",  (void*)&WB_GetCPUFeatures     },
+  {CC"getNMethod",         CC"(Ljava/lang/reflect/Executable;Z)[Ljava/lang/Object;",
+                                                      (void*)&WB_GetNMethod         },
 };
 
 #undef CC
--- a/hotspot/src/share/vm/prims/whitebox.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/prims/whitebox.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,6 @@
   do {                                                                 \
     JavaThread* THREAD = JavaThread::thread_from_jni_environment(env); \
     if (HAS_PENDING_EXCEPTION) {                                       \
-      CLEAR_PENDING_EXCEPTION;                                         \
       return(value);                                                   \
     }                                                                  \
   } while (0)
@@ -49,7 +48,6 @@
   do {                                                                 \
     JavaThread* THREAD = JavaThread::thread_from_jni_environment(env); \
     if (HAS_PENDING_EXCEPTION) {                                       \
-      CLEAR_PENDING_EXCEPTION;                                         \
       return;                                                          \
     }                                                                  \
   } while (0)
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -301,6 +301,7 @@
   { "UseMPSS",                       JDK_Version::jdk(8), JDK_Version::jdk(9) },
   { "UseStringCache",                JDK_Version::jdk(8), JDK_Version::jdk(9) },
   { "UseOldInlining",                JDK_Version::jdk(9), JDK_Version::jdk(10) },
+  { "SafepointPollOffset",           JDK_Version::jdk(9), JDK_Version::jdk(10) },
 #ifdef PRODUCT
   { "DesiredMethodLimit",
                            JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) },
@@ -3789,9 +3790,6 @@
 #endif // CC_INTERP
 
 #ifdef COMPILER2
-  if (!UseBiasedLocking || EmitSync != 0) {
-    UseOptoBiasInlining = false;
-  }
   if (!EliminateLocks) {
     EliminateNestedLocks = false;
   }
@@ -3852,6 +3850,11 @@
       UseBiasedLocking = false;
     }
   }
+#ifdef COMPILER2
+  if (!UseBiasedLocking || EmitSync != 0) {
+    UseOptoBiasInlining = false;
+  }
+#endif
 
   return JNI_OK;
 }
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1288,7 +1288,8 @@
     gather_statistics(reason, action, trap_bc);
 
     // Ensure that we can record deopt. history:
-    bool create_if_missing = ProfileTraps;
+    // Need MDO to record RTM code generation state.
+    bool create_if_missing = ProfileTraps RTM_OPT_ONLY( || UseRTMLocking );
 
     MethodData* trap_mdo =
       get_method_data(thread, trap_method, create_if_missing);
@@ -1569,6 +1570,17 @@
         if (tstate1 != tstate0)
           pdata->set_trap_state(tstate1);
       }
+
+#if INCLUDE_RTM_OPT
+      // Restart collecting RTM locking abort statistic if the method
+      // is recompiled for a reason other than RTM state change.
+      // Assume that in new recompiled code the statistic could be different,
+      // for example, due to different inlining.
+      if ((reason != Reason_rtm_state_change) && (trap_mdo != NULL) &&
+          UseRTMDeopt && (nm->rtm_state() != ProfileRTM)) {
+        trap_mdo->atomic_set_rtm_state(ProfileRTM);
+      }
+#endif
     }
 
     if (inc_recompile_count) {
@@ -1826,7 +1838,8 @@
   "age",
   "predicate",
   "loop_limit_check",
-  "speculate_class_check"
+  "speculate_class_check",
+  "rtm_state_change"
 };
 const char* Deoptimization::_trap_action_name[Action_LIMIT] = {
   // Note:  Keep this in sync. with enum DeoptAction.
--- a/hotspot/src/share/vm/runtime/deoptimization.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/runtime/deoptimization.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -60,6 +60,7 @@
     Reason_predicate,             // compiler generated predicate failed
     Reason_loop_limit_check,      // compiler generated loop limits check failed
     Reason_speculate_class_check, // saw unexpected object class from type speculation
+    Reason_rtm_state_change,      // rtm state change detected
     Reason_LIMIT,
     // Note:  Keep this enum in sync. with _trap_reason_name.
     Reason_RECORDED_LIMIT = Reason_bimorphic  // some are not recorded per bc
--- a/hotspot/src/share/vm/runtime/frame.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/runtime/frame.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -531,13 +531,16 @@
   // Number of elements on the interpreter expression stack
   // Callers should span by stackElementWords
   int element_size = Interpreter::stackElementWords;
+  size_t stack_size = 0;
   if (frame::interpreter_frame_expression_stack_direction() < 0) {
-    return (interpreter_frame_expression_stack() -
-            interpreter_frame_tos_address() + 1)/element_size;
+    stack_size = (interpreter_frame_expression_stack() -
+                  interpreter_frame_tos_address() + 1)/element_size;
   } else {
-    return (interpreter_frame_tos_address() -
-            interpreter_frame_expression_stack() + 1)/element_size;
+    stack_size = (interpreter_frame_tos_address() -
+                  interpreter_frame_expression_stack() + 1)/element_size;
   }
+  assert( stack_size <= (size_t)max_jint, "stack size too big");
+  return ((jint)stack_size);
 }
 
 
--- a/hotspot/src/share/vm/runtime/java.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/runtime/java.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -265,7 +265,7 @@
     os::print_statistics();
   }
 
-  if (PrintLockStatistics || PrintPreciseBiasedLockingStatistics) {
+  if (PrintLockStatistics || PrintPreciseBiasedLockingStatistics || PrintPreciseRTMLockingStatistics) {
     OptoRuntime::print_named_counters();
   }
 
@@ -387,7 +387,7 @@
   }
 
 #ifdef COMPILER2
-  if (PrintPreciseBiasedLockingStatistics) {
+  if (PrintPreciseBiasedLockingStatistics || PrintPreciseRTMLockingStatistics) {
     OptoRuntime::print_named_counters();
   }
 #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/runtime/rtmLocking.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -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.
+ *
+ */
+
+#ifndef SHARE_VM_RUNTIME_RTMLOCKING_HPP
+#define SHARE_VM_RUNTIME_RTMLOCKING_HPP
+
+// Generate RTM (Restricted Transactional Memory) locking code for all inflated
+// locks when "UseRTMLocking" option is on with normal locking mechanism as fall back
+// handler.
+//
+// On abort/lock busy the lock will be retried a fixed number of times under RTM
+// as specified by "RTMRetryCount" option. The locks which abort too often
+// can be auto tuned or manually tuned.
+//
+// Auto-tuning can be done on an option like UseRTMDeopt and it will need abort
+// ratio calculation for each lock. The abort ratio will be calculated after
+// "RTMAbortThreshold" number of aborts is reached. The formulas are:
+//
+//     Aborted transactions = abort_count * 100
+//     All transactions = total_count *  RTMTotalCountIncrRate
+//
+//     Aborted transactions >= All transactions * RTMAbortRatio
+//
+// If "UseRTMDeopt" is on and the aborts ratio reaches "RTMAbortRatio"
+// the method containing the lock will be deoptimized and recompiled with
+// all locks as normal locks. If the abort ratio continues to remain low after
+// "RTMLockingThreshold" locks are attempted, then the method will be deoptimized
+// and recompiled with all locks as RTM locks without abort ratio calculation code.
+// The abort ratio calculation can be delayed by specifying flag
+// -XX:RTMLockingCalculationDelay in millisecond.
+//
+// For manual tuning the abort statistics for each lock needs to be provided
+// to the user on some JVM option like "PrintPreciseRTMLockingStatistics".
+// Based on the abort statistics users can create a .hotspot_compiler file
+// or use -XX:CompileCommand=option,class::method,NoRTMLockEliding
+// to specify for which methods to disable RTM locking.
+//
+// When UseRTMForStackLocks option is enabled along with UseRTMLocking option,
+// the RTM locking code is generated for stack locks too.
+// The retries, auto-tuning support and rtm locking statistics are all
+// supported for stack locks just like inflated locks.
+
+// RTM locking counters
+class RTMLockingCounters VALUE_OBJ_CLASS_SPEC {
+ private:
+  uintx _total_count; // Total RTM locks count
+  uintx _abort_count; // Total aborts count
+
+ public:
+  enum { ABORT_STATUS_LIMIT = 6 };
+  // Counters per RTM Abort Status. Incremented with +PrintPreciseRTMLockingStatistics
+  // RTM uses the EAX register to communicate abort status to software.
+  // Following an RTM abort the EAX register has the following definition.
+  //
+  //   EAX register bit position   Meaning
+  //     0     Set if abort caused by XABORT instruction.
+  //     1     If set, the transaction may succeed on a retry. This bit is always clear if bit 0 is set.
+  //     2     Set if another logical processor conflicted with a memory address that was part of the transaction that aborted.
+  //     3     Set if an internal buffer overflowed.
+  //     4     Set if a debug breakpoint was hit.
+  //     5     Set if an abort occurred during execution of a nested transaction.
+ private:
+  uintx _abortX_count[ABORT_STATUS_LIMIT];
+
+ public:
+  static uintx _calculation_flag;
+  static uintx* rtm_calculation_flag_addr() { return &_calculation_flag; }
+
+  static void init();
+
+  RTMLockingCounters() : _total_count(0), _abort_count(0) {
+    for (int i = 0; i < ABORT_STATUS_LIMIT; i++) {
+      _abortX_count[i] = 0;
+    }
+  }
+
+  uintx* total_count_addr()               { return &_total_count; }
+  uintx* abort_count_addr()               { return &_abort_count; }
+  uintx* abortX_count_addr()              { return &_abortX_count[0]; }
+
+  static int total_count_offset()         { return (int)offset_of(RTMLockingCounters, _total_count); }
+  static int abort_count_offset()         { return (int)offset_of(RTMLockingCounters, _abort_count); }
+  static int abortX_count_offset()        { return (int)offset_of(RTMLockingCounters, _abortX_count[0]); }
+
+
+  bool nonzero() {  return (_abort_count + _total_count) > 0; }
+
+  void print_on(outputStream* st);
+  void print() { print_on(tty); }
+};
+
+#endif // SHARE_VM_RUNTIME_RTMLOCKING_HPP
--- a/hotspot/src/share/vm/runtime/task.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/runtime/task.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -105,7 +105,6 @@
   _counter(0), _interval((int) interval_time) {
   // Sanity check the interval time
   assert(_interval >= PeriodicTask::min_interval &&
-         _interval <= PeriodicTask::max_interval &&
          _interval %  PeriodicTask::interval_gran == 0,
               "improper PeriodicTask interval time");
 }
--- a/hotspot/src/share/vm/runtime/thread.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -107,6 +107,9 @@
 #include "opto/c2compiler.hpp"
 #include "opto/idealGraphPrinter.hpp"
 #endif
+#if INCLUDE_RTM_OPT
+#include "runtime/rtmLocking.hpp"
+#endif
 
 #ifdef DTRACE_ENABLED
 
@@ -3621,6 +3624,10 @@
 
   BiasedLocking::init();
 
+#if INCLUDE_RTM_OPT
+  RTMLockingCounters::init();
+#endif
+
   if (JDK_Version::current().post_vm_init_hook_enabled()) {
     call_postVMInitHook(THREAD);
     // The Java side of PostVMInitHook.run must deal with all
--- a/hotspot/src/share/vm/services/management.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/services/management.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -152,11 +152,14 @@
     // Load and initialize the sun.management.Agent class
     // invoke startAgent method to start the management server
     Handle loader = Handle(THREAD, SystemDictionary::java_system_loader());
-    Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::sun_management_Agent(),
+    Klass* k = SystemDictionary::resolve_or_null(vmSymbols::sun_management_Agent(),
                                                    loader,
                                                    Handle(),
-                                                   true,
-                                                   CHECK);
+                                                   THREAD);
+    if (k == NULL) {
+      vm_exit_during_initialization("Management agent initialization failure: "
+          "class sun.management.Agent not found.");
+    }
     instanceKlassHandle ik (THREAD, k);
 
     JavaValue result(T_VOID);
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Tue Apr 01 15:37:15 2014 +0200
@@ -373,6 +373,21 @@
 
 // Machine dependent stuff
 
+#if defined(X86) && defined(COMPILER2) && !defined(JAVASE_EMBEDDED)
+// Include Restricted Transactional Memory lock eliding optimization
+#define INCLUDE_RTM_OPT 1
+#define RTM_OPT_ONLY(code) code
+#else
+#define INCLUDE_RTM_OPT 0
+#define RTM_OPT_ONLY(code)
+#endif
+// States of Restricted Transactional Memory usage.
+enum RTMState {
+  NoRTM      = 0x2, // Don't use RTM
+  UseRTM     = 0x1, // Use RTM
+  ProfileRTM = 0x0  // Use RTM with abort ratio calculation
+};
+
 #ifdef TARGET_ARCH_x86
 # include "globalDefinitions_x86.hpp"
 #endif
--- a/hotspot/test/compiler/6792161/Test6792161.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/test/compiler/6792161/Test6792161.java	Tue Apr 01 15:37:15 2014 +0200
@@ -27,7 +27,7 @@
  * @bug 6792161
  * @summary assert("No dead instructions after post-alloc")
  *
- * @run main/othervm/timeout=300 -Xcomp -XX:MaxInlineSize=120 Test6792161
+ * @run main/othervm/timeout=600 -Xcomp -XX:MaxInlineSize=120 Test6792161
  */
 
 import java.lang.reflect.Constructor;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/arguments/BMICommandLineOptionTestBase.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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.
+ */
+
+import com.oracle.java.testlibrary.cli.*;
+
+/**
+ * Base class for all X86 bit manipulation related command line options.
+ */
+public abstract class BMICommandLineOptionTestBase
+              extends CPUSpecificCommandLineOptionTest {
+
+    public static final String LZCNT_WARNING =
+        "lzcnt instruction is not available on this CPU";
+    public static final String TZCNT_WARNING =
+        "tzcnt instruction is not available on this CPU";
+    public static final String BMI1_WARNING =
+        "BMI1 instructions are not available on this CPU";
+
+    protected final String optionName;
+    protected final String warningMessage;
+    protected final String errorMessage;
+
+    /**
+     * Construct new test on {@code optionName} option.
+     *
+     * @param optionName Name of the option to be tested
+     *                   without -XX:[+-] prefix.
+     * @param warningMessage Message that can occur in VM output
+     *                       if CPU on test box does not support
+     *                       features required by the option.
+     * @param supportedCPUFeatures CPU features requires by the option,
+     *                             that should be supported on test box.
+     * @param unsupportedCPUFeatures CPU features requires by the option,
+     *                               that should not be supported on test box.
+     */
+    public BMICommandLineOptionTestBase(String optionName,
+                                        String warningMessage,
+                                        String supportedCPUFeatures[],
+                                        String unsupportedCPUFeatures[]) {
+        super(".*", supportedCPUFeatures, unsupportedCPUFeatures);
+            this.optionName = optionName;
+            this.warningMessage = warningMessage;
+            this.errorMessage = CommandLineOptionTest.
+                UNRECOGNIZED_OPTION_ERROR_FORMAT.format(optionName);
+    }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/arguments/BMISupportedCPUTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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.*;
+import com.oracle.java.testlibrary.cli.*;
+
+/**
+ * Test on bit manipulation related command line options,
+ * that should be executed on CPU that supports all required
+ * features.
+ */
+public class BMISupportedCPUTest extends BMICommandLineOptionTestBase {
+
+    /**
+     * Construct new test on {@code optionName} option.
+     *
+     * @param optionName Name of the option to be tested
+     *                   without -XX:[+-] prefix.
+     * @param warningMessage Message that can occur in VM output
+     *                       if CPU on test box does not support
+     *                       features required by the option.
+     * @param cpuFeatures CPU features requires by the option.
+     */
+    public BMISupportedCPUTest(String optionName,
+                               String warningMessage,
+                               String... cpuFeatures) {
+        super(optionName, warningMessage, cpuFeatures, null);
+    }
+
+    @Override
+    public void runTestCases() throws Throwable {
+        // verify that VM will succesfully start up whithout warnings
+        CommandLineOptionTest.
+            verifyJVMStartup("-XX:+" + optionName,
+                             null, new String[] { warningMessage },
+                             ExitCode.OK);
+
+        // verify that VM will succesfully start up whithout warnings
+        CommandLineOptionTest.
+            verifyJVMStartup("-XX:-" + optionName,
+                             null, new String[] { warningMessage },
+                             ExitCode.OK);
+
+        // verify that on appropriate CPU option in on by default
+        CommandLineOptionTest.verifyOptionValue(optionName, "true");
+
+        // verify that option could be explicitly turned off
+        CommandLineOptionTest.verifyOptionValue(optionName, "false",
+                                                "-XX:-" + optionName);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/arguments/BMIUnsupportedCPUTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,114 @@
+/*
+ * 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.*;
+import com.oracle.java.testlibrary.cli.*;
+
+/**
+ * Test on bit manipulation related command line options,
+ * that should be executed on CPU that does not support
+ * required features.
+ */
+public class BMIUnsupportedCPUTest extends BMICommandLineOptionTestBase {
+
+    /**
+     * Construct new test on {@code optionName} option.
+     *
+     * @param optionName Name of the option to be tested
+     *                   without -XX:[+-] prefix.
+     * @param warningMessage Message that can occur in VM output
+     *                       if CPU on test box does not support
+     *                       features required by the option.
+     * @param cpuFeatures CPU features requires by the option.
+     */
+    public BMIUnsupportedCPUTest(String optionName,
+                                 String warningMessage,
+                                 String... cpuFeatures) {
+        super(optionName, warningMessage, null, cpuFeatures);
+    }
+
+    @Override
+    public void runTestCases() throws Throwable {
+        if (Platform.isX86() || Platform.isX64()) {
+            unsupportedX86CPUTestCases();
+        } else {
+            unsupportedNonX86CPUTestCases();
+        }
+    }
+
+    /**
+     * Run test cases common for all bit manipulation related VM options
+     * targeted to X86 CPU that does not support required features.
+     *
+     * @throws Throwable if test failed.
+     */
+    public void unsupportedX86CPUTestCases() throws Throwable {
+
+        // verify that VM will succesfully start up, but output will
+        // contain a warning
+        CommandLineOptionTest.
+            verifyJVMStartup("-XX:+" + optionName,
+                             new String[] { warningMessage },
+                             new String[] { errorMessage },
+                             ExitCode.OK);
+
+        // verify that VM will succesfully startup without any warnings
+        CommandLineOptionTest.
+            verifyJVMStartup("-XX:-" + optionName,
+                             null,
+                             new String[] { warningMessage, errorMessage },
+                             ExitCode.OK);
+
+        // verify that on unsupported CPUs option is off by default
+        CommandLineOptionTest.verifyOptionValue(optionName, "false");
+
+        // verify that on unsupported CPUs option will be off even if
+        // it was explicitly turned on by uset
+        CommandLineOptionTest.verifyOptionValue(optionName, "false",
+                                                     "-XX:+" + optionName);
+
+    }
+
+    /**
+     * Run test cases common for all bit manipulation related VM options
+     * targeted to non-X86 CPU that does not support required features.
+     *
+     * @throws Throwable if test failed.
+     */
+    public void unsupportedNonX86CPUTestCases() throws Throwable {
+
+        // verify that VM known nothing about tested option
+        CommandLineOptionTest.
+            verifyJVMStartup("-XX:+" + optionName,
+                             new String[] { errorMessage },
+                             null,
+                             ExitCode.FAIL);
+
+        CommandLineOptionTest.
+            verifyJVMStartup("-XX:-" + optionName,
+                             new String[] { errorMessage },
+                             null,
+                             ExitCode.FAIL);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnSupportedCPU.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8031321
+ * @summary Verify processing of UseBMI1Instructions option on CPU with
+ *          BMI1 feature support.
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestUseBMI1InstructionsOnSupportedCPU
+ *        BMISupportedCPUTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI TestUseBMI1InstructionsOnSupportedCPU
+ */
+
+import sun.hotspot.cpuinfo.CPUInfo;
+import com.oracle.java.testlibrary.*;
+
+public class TestUseBMI1InstructionsOnSupportedCPU
+     extends BMISupportedCPUTest {
+
+    public TestUseBMI1InstructionsOnSupportedCPU() {
+        super("UseBMI1Instructions", BMI1_WARNING, "bmi1");
+    }
+
+    public static void main(String args[]) throws Throwable {
+        new TestUseBMI1InstructionsOnSupportedCPU().test();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnUnsupportedCPU.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,52 @@
+/*
+ * 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 8031321
+ * @summary Verify processing of UseBMI1Instructions option on CPU without
+ *          BMI1 feature support.
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestUseBMI1InstructionsOnUnsupportedCPU
+ *        BMIUnsupportedCPUTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI TestUseBMI1InstructionsOnUnsupportedCPU
+ */
+
+import sun.hotspot.cpuinfo.CPUInfo;
+import com.oracle.java.testlibrary.*;
+import com.oracle.java.testlibrary.cli.*;
+
+public class TestUseBMI1InstructionsOnUnsupportedCPU
+      extends BMIUnsupportedCPUTest {
+
+    public TestUseBMI1InstructionsOnUnsupportedCPU() {
+        super("UseBMI1Instructions", BMI1_WARNING, "bmi1");
+    }
+
+    public static void main(String args[]) throws Throwable {
+        new TestUseBMI1InstructionsOnUnsupportedCPU().test();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnSupportedCPU.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,52 @@
+/*
+ * 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 8031321
+ * @summary Verify processing of UseCountLeadingZerosInstruction option
+ *          on CPU with LZCNT support.
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestUseCountLeadingZerosInstructionOnSupportedCPU
+ *        BMISupportedCPUTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI
+ *                   TestUseCountLeadingZerosInstructionOnSupportedCPU
+ */
+
+import sun.hotspot.cpuinfo.CPUInfo;
+import com.oracle.java.testlibrary.*;
+
+public class TestUseCountLeadingZerosInstructionOnSupportedCPU
+     extends BMISupportedCPUTest {
+
+    public TestUseCountLeadingZerosInstructionOnSupportedCPU() {
+        super("UseCountLeadingZerosInstruction", LZCNT_WARNING, "lzcnt");
+    }
+
+    public static void main(String args[]) throws Throwable {
+        new TestUseCountLeadingZerosInstructionOnSupportedCPU().test();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnUnsupportedCPU.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,52 @@
+/*
+ * 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 8031321
+ * @summary Verify processing of UseCountLeadingZerosInstruction option
+ *          on CPU without LZCNT support.
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestUseCountLeadingZerosInstructionOnUnsupportedCPU
+ *        BMIUnsupportedCPUTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI
+ *                   TestUseCountLeadingZerosInstructionOnUnsupportedCPU
+ */
+
+import sun.hotspot.cpuinfo.CPUInfo;
+import com.oracle.java.testlibrary.*;
+
+public class TestUseCountLeadingZerosInstructionOnUnsupportedCPU
+     extends BMIUnsupportedCPUTest {
+
+    public TestUseCountLeadingZerosInstructionOnUnsupportedCPU() {
+        super("UseCountLeadingZerosInstruction", LZCNT_WARNING, "lzcnt");
+    }
+
+    public static void main(String args[]) throws Throwable {
+        new TestUseCountLeadingZerosInstructionOnUnsupportedCPU().test();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
+ * @bug 8031321
+ * @summary Verify processing of UseCountTrailingZerosInstruction option
+ *          on CPU with TZCNT (BMI1 feature) support.
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestUseCountTrailingZerosInstructionOnSupportedCPU
+ *        BMISupportedCPUTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI
+ *                   TestUseCountTrailingZerosInstructionOnSupportedCPU
+ */
+
+import sun.hotspot.cpuinfo.CPUInfo;
+import com.oracle.java.testlibrary.*;
+import com.oracle.java.testlibrary.cli.*;
+
+public class TestUseCountTrailingZerosInstructionOnSupportedCPU
+     extends BMISupportedCPUTest {
+
+    public TestUseCountTrailingZerosInstructionOnSupportedCPU() {
+        super("UseCountTrailingZerosInstruction", TZCNT_WARNING, "bmi1");
+    }
+
+    @Override
+    public void runTestCases() throws Throwable {
+
+        super.runTestCases();
+
+        // verify that option will be disabled if all BMI1 instuctions
+        // are explicitly disabled
+        CommandLineOptionTest.
+            verifyOptionValue("UseCountTrailingZerosInstruction", "false",
+                              "-XX:-UseBMI1Instructions");
+
+        // verify that option could be turned on even if other BMI1
+        // instructions were turned off
+        CommandLineOptionTest.
+            verifyOptionValue("UseCountTrailingZerosInstruction", "true",
+                              "-XX:-UseBMI1Instructions",
+                              "-XX:+UseCountTrailingZerosInstruction");
+    }
+
+    public static void main(String args[]) throws Throwable {
+        new TestUseCountTrailingZerosInstructionOnSupportedCPU().test();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8031321
+ * @summary Verify processing of UseCountTrailingZerosInstruction option
+ *          on CPU without TZCNT instuction (BMI1 feature) support.
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestUseCountTrailingZerosInstructionOnUnsupportedCPU
+ *        BMIUnsupportedCPUTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI
+ *                   TestUseCountTrailingZerosInstructionOnUnsupportedCPU
+ */
+
+import sun.hotspot.cpuinfo.CPUInfo;
+import com.oracle.java.testlibrary.*;
+import com.oracle.java.testlibrary.cli.*;
+
+public class TestUseCountTrailingZerosInstructionOnUnsupportedCPU
+     extends BMIUnsupportedCPUTest {
+
+    public TestUseCountTrailingZerosInstructionOnUnsupportedCPU() {
+        super("UseCountTrailingZerosInstruction", TZCNT_WARNING, "bmi1");
+    }
+
+    @Override
+    public void unsupportedX86CPUTestCases() throws Throwable {
+
+        super.unsupportedX86CPUTestCases();
+
+        // verify that option will not be turned on during
+        // UseBMI1Instuctions processing
+        CommandLineOptionTest.
+            verifyOptionValue("UseCountTrailingZerosInstruction", "false",
+                              "-XX:+UseBMI1Instructions");
+
+        CommandLineOptionTest.
+            verifyOptionValue("UseCountTrailingZerosInstruction", "false",
+                              "-XX:+UseCountTrailingZerosInstruction",
+                              "-XX:+UseBMI1Instructions");
+    }
+
+    public static void main(String args[]) throws Throwable {
+        new TestUseCountTrailingZerosInstructionOnUnsupportedCPU().test();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/bmi/BMITestRunner.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,442 @@
+/*
+ * 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.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.charset.StandardCharsets;
+
+import com.oracle.java.testlibrary.*;
+
+/**
+ * Test runner that invokes all methods implemented by particular Expr
+ * with random arguments in two different JVM processes and compares output.
+ * JVMs being started in different modes - one in int and other in comp
+ * with C2 and disabled tiered compilation.
+ */
+public class BMITestRunner {
+
+    enum VMMode {
+        COMP, INT;
+    };
+
+    public static int DEFAULT_ITERATIONS_COUNT = 4000;
+
+    /**
+     * Execute all methods implemented by <b>expr</b> in int and comp modes
+     * and compare output.
+     * Test pass only of output obtained with different VM modes is equal.
+     * To control behaviour of test following options could be passed:
+     * <ul>
+     *   <li>-iterations=&lt;N&gt; each operation implemented by
+     *       <b>expr</b> will be executed <i>N</i> times. Default value
+     *       is 4000.</li>
+     *   <li>-seed=&lt;SEED&gt; arguments for <b>expr</b>'s methods
+     *       obtained via RNG initiated with seed <i>SEED</i>. By default
+     *       some random seed will be used.</li>
+     * </ul>
+     *
+     * @param expr operation that should be tested
+     * @param testOpts options to control test behaviour
+     * @param additionalVMOpts additional options for VM
+     *
+     * @throws Throwable if test failed.
+     */
+    public static void runTests(Class<? extends Expr> expr,
+                                String testOpts[],
+                                String... additionalVMOpts)
+                         throws Throwable {
+
+        int seed = new Random().nextInt();
+        int iterations = DEFAULT_ITERATIONS_COUNT;
+
+        for (String testOption : testOpts) {
+            if (testOption.startsWith("-iterations=")) {
+                iterations = Integer.valueOf(testOption.
+                                             replace("-iterations=", ""));
+            } else if (testOption.startsWith("-seed=")) {
+                seed = Integer.valueOf(testOption.replace("-seed=", ""));
+            }
+        }
+
+        System.out.println("Running test with seed: " + seed);
+
+        OutputAnalyzer intOutput = runTest(expr, VMMode.INT,
+                                           additionalVMOpts,
+                                           seed, iterations);
+        OutputAnalyzer compOutput = runTest(expr, VMMode.COMP,
+                                            additionalVMOpts,
+                                            seed, iterations);
+
+        dumpOutput(intOutput, "int");
+        dumpOutput(compOutput, "comp");
+
+        Asserts.assertStringsEqual(intOutput.getStdout(),
+                                   compOutput.getStdout(),
+                                   "Results obtained in -Xint and " +
+                                   "-Xcomp should be the same.");
+    }
+
+    /**
+     * Execute tests on methods implemented by <b>expr</b> in new VM
+     * started in <b>testVMMode</b> mode.
+     *
+     * @param expr operation that should be tested
+     * @param testVMMode VM mode for test
+     * @param additionalVMOpts additional options for VM
+     * @param seed for RNG used it tests
+     * @param iterations that will be used to invoke <b>expr</b>'s methods.
+     *
+     * @return OutputAnalyzer for executed test.
+     * @throws Throwable when something goes wrong.
+     */
+    public static OutputAnalyzer runTest(Class<? extends Expr> expr,
+                                         VMMode testVMMode,
+                                         String additionalVMOpts[],
+                                         int seed, int iterations)
+                                  throws Throwable {
+
+        List<String> vmOpts = new LinkedList<String>();
+
+        Collections.addAll(vmOpts, additionalVMOpts);
+
+        //setup mode-specific options
+        switch (testVMMode) {
+        case INT:
+            Collections.addAll(vmOpts, new String[] { "-Xint" });
+            break;
+        case COMP:
+            Collections.addAll(vmOpts, new String[] {
+                    "-Xcomp",
+                    "-XX:-TieredCompilation",
+                    String.format("-XX:CompileCommand=compileonly,%s::*",
+                                  expr.getName())
+                });
+            break;
+        }
+
+        Collections.addAll(vmOpts, new String[] {
+                "-XX:+DisplayVMOutputToStderr",
+                Executor.class.getName(),
+                expr.getName(),
+                new Integer(seed).toString(),
+                new Integer(iterations).toString()
+            });
+
+        OutputAnalyzer outputAnalyzer = ProcessTools.
+            executeTestJvm(vmOpts.toArray(new String[vmOpts.size()]));
+
+        outputAnalyzer.shouldHaveExitValue(0);
+
+        return outputAnalyzer;
+    }
+
+    /**
+     * Dump stdout and stderr of test process to <i>prefix</i>.test.out
+     * and <i>prefix</i>.test.err respectively.
+     *
+     * @param outputAnalyzer OutputAnalyzer whom output should be dumped
+     * @param prefix Prefix that will be used in file names.
+     * @throws IOException if unable to dump output to file.
+     */
+    protected static void dumpOutput(OutputAnalyzer outputAnalyzer,
+                                     String prefix)
+                              throws IOException {
+        Files.write(Paths.get(prefix + ".test.out"),
+                    outputAnalyzer.getStdout().getBytes());
+
+        Files.write(Paths.get(prefix + ".test.err"),
+                    outputAnalyzer.getStderr().getBytes());
+    }
+
+
+    /**
+     * Executor that invoke all methods implemented by particular
+     * Expr instance.
+     */
+    public static class Executor {
+
+        /**
+         * Usage: BMITestRunner$Executor <ExprClassName> <seed> <iterations>
+         */
+        public static void main(String args[]) throws Exception {
+            @SuppressWarnings("unchecked")
+            Class<? extends Expr> exprClass =
+                (Class<? extends Expr>)Class.forName(args[0]);
+            Expr expr = exprClass.getConstructor().newInstance();
+            Random rng = new Random(Integer.valueOf(args[1]));
+            int iterations = Integer.valueOf(args[2]);
+            runTests(expr, iterations, rng);
+        }
+
+
+        public static int[] getIntBitShifts() {
+            //SIZE+1 shift is for zero.
+            int data[] = new int[Integer.SIZE+1];
+            for (int s = 0; s < data.length; s++) {
+                data[s] = 1<<s;
+            }
+            return data;
+        }
+
+        public static long[] getLongBitShifts() {
+            //SIZE+1 shift is for zero.
+            long data[] = new long[Long.SIZE+1];
+            for (int s = 0; s < data.length; s++) {
+                data[s] = 1L<<s;
+            }
+            return data;
+        }
+
+        public static void log(String format, Object... args) {
+            System.out.println(String.format(format, args));
+        }
+
+        public static void runTests(Expr expr, int iterations, Random rng) {
+            runUnaryIntRegTest(expr, iterations, rng);
+            runUnaryIntMemTest(expr, iterations, rng);
+            runUnaryLongRegTest(expr, iterations, rng);
+            runUnaryLongMemTest(expr, iterations, rng);
+            runBinaryRegRegIntTest(expr, iterations, rng);
+            runBinaryRegMemIntTest(expr, iterations, rng);
+            runBinaryMemRegIntTest(expr, iterations, rng);
+            runBinaryMemMemIntTest(expr, iterations, rng);
+            runBinaryRegRegLongTest(expr, iterations, rng);
+            runBinaryRegMemLongTest(expr, iterations, rng);
+            runBinaryMemRegLongTest(expr, iterations, rng);
+            runBinaryMemMemLongTest(expr, iterations, rng);
+        }
+
+        public static void runUnaryIntRegTest(Expr expr, int iterations,
+                                              Random rng) {
+            if (!(expr.isUnaryArgumentSupported()
+                  && expr.isIntExprSupported())) {
+                return;
+            }
+
+            for (int value : getIntBitShifts()) {
+                log("UnaryIntReg(0X%x) -> 0X%x",
+                    value, expr.intExpr(value));
+            }
+
+            for (int i = 0; i < iterations; i++) {
+                int value = rng.nextInt();
+                log("UnaryIntReg(0X%x) -> 0X%x",
+                    value, expr.intExpr(value));
+            }
+        }
+
+        public static void runUnaryIntMemTest(Expr expr, int iterations,
+                                              Random rng) {
+            if (!(expr.isUnaryArgumentSupported()
+                  && expr.isIntExprSupported()
+                  && expr.isMemExprSupported())) {
+                return;
+            }
+
+            for (int value : getIntBitShifts()) {
+                log("UnaryIntMem(0X%x) -> 0X%x",
+                    value, expr.intExpr(new Expr.MemI(value)));
+            }
+
+            for (int i = 0; i < iterations; i++) {
+                int value = rng.nextInt();
+                log("UnaryIntMem(0X%x) -> 0X%x",
+                    value, expr.intExpr(new Expr.MemI(value)));
+            }
+        }
+
+        public static void runUnaryLongRegTest(Expr expr, int iterations,
+                                               Random rng) {
+            if (!(expr.isUnaryArgumentSupported()
+                  && expr.isLongExprSupported())) {
+                return;
+            }
+
+            for (long value : getLongBitShifts()) {
+                log("UnaryLongReg(0X%x) -> 0X%x",
+                    value, expr.longExpr(value));
+            }
+
+            for (int i = 0; i < iterations; i++) {
+                long value = rng.nextLong();
+                log("UnaryLongReg(0X%x) -> 0X%x",
+                    value, expr.longExpr(value));
+            }
+        }
+
+        public static void runUnaryLongMemTest(Expr expr, int iterations,
+                                               Random rng) {
+            if (!(expr.isUnaryArgumentSupported()
+                  && expr.isLongExprSupported()
+                  && expr.isMemExprSupported())) {
+                return;
+            }
+
+            for (long value : getLongBitShifts()) {
+                log("UnaryLongMem(0X%x) -> 0X%x",
+                    value, expr.longExpr(new Expr.MemL(value)));
+            }
+
+            for (int i = 0; i < iterations; i++) {
+                long value = rng.nextLong();
+                log("UnaryLongMem(0X%x) -> 0X%x",
+                    value, expr.longExpr(new Expr.MemL(value)));
+            }
+        }
+
+        public static void runBinaryRegRegIntTest(Expr expr, int iterations,
+                                                  Random rng) {
+            if (!(expr.isIntExprSupported()
+                  && expr.isBinaryArgumentSupported())) {
+                return;
+            }
+
+            for (int i = 0; i < iterations; i++) {
+                int aValue = rng.nextInt();
+                int bValue = rng.nextInt();
+                log("BinaryIntRegReg(0X%x, 0X%x) -> 0X%x",
+                    aValue, bValue, expr.intExpr(aValue, bValue));
+            }
+        }
+
+        public static void runBinaryRegMemIntTest(Expr expr, int iterations,
+                                                  Random rng) {
+            if (!(expr.isIntExprSupported()
+                  && expr.isBinaryArgumentSupported()
+                  && expr.isMemExprSupported())) {
+                return;
+            }
+
+            for (int i = 0; i < iterations; i++) {
+                int aValue = rng.nextInt();
+                int bValue = rng.nextInt();
+                log("BinaryIntRegMem(0X%x, 0X%x) -> 0X%x", aValue, bValue,
+                    expr.intExpr(aValue, new Expr.MemI(bValue)));
+            }
+        }
+
+        public static void runBinaryMemRegIntTest(Expr expr, int iterations,
+                                                  Random rng) {
+            if (!(expr.isIntExprSupported()
+                  && expr.isBinaryArgumentSupported()
+                  && expr.isMemExprSupported())) {
+                return;
+            }
+
+            for (int i = 0; i < iterations; i++) {
+                int aValue = rng.nextInt();
+                int bValue = rng.nextInt();
+                log("BinaryIntMemReg(0X%x, 0X%x) -> 0X%x", aValue, bValue,
+                    expr.intExpr(new Expr.MemI(aValue), bValue));
+            }
+        }
+
+        public static void runBinaryMemMemIntTest(Expr expr, int iterations,
+                                                  Random rng) {
+            if (!(expr.isIntExprSupported()
+                  && expr.isBinaryArgumentSupported()
+                  && expr.isMemExprSupported())) {
+                return;
+            }
+
+            for (int i = 0; i < iterations; i++) {
+                int aValue = rng.nextInt();
+                int bValue = rng.nextInt();
+                log("BinaryIntMemMem(0X%x, 0X%x) -> 0X%x", aValue, bValue,
+                    expr.intExpr(new Expr.MemI(aValue),
+                                 new Expr.MemI(bValue)));
+            }
+        }
+
+        public static void runBinaryRegRegLongTest(Expr expr,
+                                                   int iterations,
+                                                   Random rng) {
+            if (!(expr.isLongExprSupported()
+                  && expr.isBinaryArgumentSupported())) {
+                return;
+            }
+
+            for (int i = 0; i < iterations; i++) {
+                long aValue = rng.nextLong();
+                long bValue = rng.nextLong();
+                log("BinaryLongRegReg(0X%x, 0X%x) -> 0X%x", aValue, bValue,
+                    expr.longExpr(aValue, bValue));
+            }
+        }
+
+        public static void runBinaryRegMemLongTest(Expr expr,
+                                                   int iterations,
+                                                   Random rng) {
+            if (!(expr.isLongExprSupported()
+                  && expr.isBinaryArgumentSupported()
+                  && expr.isMemExprSupported())) {
+                return;
+            }
+
+            for (int i = 0; i < iterations; i++) {
+                long aValue = rng.nextLong();
+                long bValue = rng.nextLong();
+                log("BinaryLongRegMem(0X%x, 0X%x) -> 0X%x", aValue, bValue,
+                    expr.longExpr(aValue, new Expr.MemL(bValue)));
+            }
+        }
+
+        public static void runBinaryMemRegLongTest(Expr expr,
+                                                   int iterations,
+                                                   Random rng) {
+            if (!(expr.isLongExprSupported()
+                  && expr.isBinaryArgumentSupported()
+                  && expr.isMemExprSupported())) {
+                return;
+            }
+
+            for (int i = 0; i < iterations; i++) {
+                long aValue = rng.nextLong();
+                long bValue = rng.nextLong();
+                log("BinaryLongMemReg(0X%x, 0X%x) -> 0X%x", aValue, bValue,
+                    expr.longExpr(new Expr.MemL(aValue), bValue));
+            }
+        }
+
+        public static void runBinaryMemMemLongTest(Expr expr,
+                                                   int iterations,
+                                                   Random rng) {
+            if (!(expr.isLongExprSupported()
+                  && expr.isBinaryArgumentSupported()
+                  && expr.isMemExprSupported())) {
+                return;
+            }
+
+            for (int i = 0; i < iterations; i++) {
+                long aValue = rng.nextLong();
+                long bValue = rng.nextLong();
+                log("BinaryLongMemMem(0X%x, 0X%x) -> 0X%x", aValue, bValue,
+                    expr.longExpr(new Expr.MemL(aValue),
+                                  new Expr.MemL(bValue)));
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/bmi/Expr.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,178 @@
+/*
+ * 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.
+ *
+ */
+
+/**
+ * Expression that should be replaced by particular instrinsic
+ * or intruction during compilation.
+ */
+
+public abstract class Expr {
+
+    public static class MemI {
+        public MemI(int i) {
+            this.value = i;
+        }
+
+        public int value;
+    }
+
+    public static class MemL {
+        public MemL(long l) {
+            this.value = l;
+        }
+
+        public long value;
+    }
+
+    public boolean isUnaryArgumentSupported() {
+        return false;
+    }
+
+    public boolean isIntExprSupported() {
+        return false;
+    }
+
+    public boolean isBinaryArgumentSupported() {
+        return false;
+    }
+
+    public boolean isLongExprSupported() {
+        return false;
+    }
+
+    public boolean isMemExprSupported() {
+        return false;
+    }
+
+    public int intExpr(int reg) {
+        throw new UnsupportedOperationException();
+    }
+
+    public int intExpr(MemI mem) {
+        throw new UnsupportedOperationException();
+    }
+
+    public int intExpr(int a, int b) {
+        throw new UnsupportedOperationException();
+    }
+
+    public int intExpr(int a, MemI b) {
+        throw new UnsupportedOperationException();
+    }
+
+    public int intExpr(MemI a, int b) {
+        throw new UnsupportedOperationException();
+    }
+
+    public int intExpr(MemI a, MemI b) {
+        throw new UnsupportedOperationException();
+    }
+
+    public long longExpr(long reg) {
+        throw new UnsupportedOperationException();
+    }
+
+    public long longExpr(MemL mem) {
+        throw new UnsupportedOperationException();
+    }
+
+    public long longExpr(long a, long b) {
+        throw new UnsupportedOperationException();
+    }
+
+    public long longExpr(long a, MemL b) {
+        throw new UnsupportedOperationException();
+    }
+
+    public long longExpr(MemL a, long b) {
+        throw new UnsupportedOperationException();
+    }
+
+    public long longExpr(MemL a, MemL b) {
+        throw new UnsupportedOperationException();
+    }
+
+    public static class BMIExpr extends Expr {
+
+        public boolean isMemExprSupported() {
+            return true;
+        }
+    }
+
+    public static class BMIBinaryExpr extends BMIExpr {
+
+        public boolean isBinaryArgumentSupported() {
+            return true;
+        }
+
+    }
+
+    public static class BMIUnaryExpr extends BMIExpr {
+        public boolean isUnaryArgumentSupported() {
+            return true;
+        }
+    }
+
+    public static class BMIBinaryIntExpr extends BMIBinaryExpr {
+        public boolean isIntExprSupported() {
+            return true;
+        }
+    }
+
+    public static class BMIBinaryLongExpr extends BMIBinaryExpr {
+        public boolean isLongExprSupported() {
+            return true;
+        }
+    }
+
+    public static class BMIUnaryIntExpr extends BMIUnaryExpr {
+        public boolean isIntExprSupported() {
+            return true;
+        }
+    }
+
+    public static class BMIUnaryLongExpr extends BMIUnaryExpr {
+        public boolean isLongExprSupported() {
+            return true;
+        }
+    }
+
+    public static class BitCountingExpr extends Expr {
+        public boolean isUnaryArgumentSupported() {
+            return true;
+        }
+    }
+
+    public static class BitCountingIntExpr extends BitCountingExpr {
+        public boolean isIntExprSupported() {
+            return true;
+        }
+    }
+
+    public static class BitCountingLongExpr extends BitCountingExpr {
+        public boolean isLongExprSupported() {
+            return true;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 8031321
+ * @summary Verify that results of computations are the same w/
+ *          and w/o usage of ANDN instruction
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestAndnI BMITestRunner Expr
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI TestAndnI
+ */
+
+import sun.hotspot.cpuinfo.CPUInfo;
+
+public class TestAndnI {
+
+    public static void main(String args[]) throws Throwable {
+        if (!CPUInfo.hasFeature("bmi1")) {
+            System.out.println("CPU does not support bmi1 feature. "+
+                               "Test skipped.");
+            return;
+        }
+
+        BMITestRunner.runTests(AndnIExpr.class, args,
+                               "-XX:+UseBMI1Instructions");
+        BMITestRunner.runTests(AndnICommutativeExpr.class, args,
+                               "-XX:+UseBMI1Instructions");
+    }
+
+    public static class AndnIExpr extends Expr.BMIBinaryIntExpr {
+
+        public int intExpr(int src1, int src2) {
+            return ~src1 & src2;
+        }
+
+        public int intExpr(int src1, Expr.MemI src2) {
+            return ~src1 & src2.value;
+        }
+
+        public int intExpr(Expr.MemI src1, int src2) {
+            return ~src1.value & src2;
+        }
+
+        public int intExpr(Expr.MemI src1, Expr.MemI src2) {
+            return ~src1.value & src2.value;
+        }
+    }
+
+    public static class AndnICommutativeExpr extends Expr.BMIBinaryIntExpr {
+
+        public int intExpr(int src1, int src2) {
+            return src1 & ~src2;
+        }
+
+        public int intExpr(int src1, Expr.MemI src2) {
+            return src1 & ~src2.value;
+        }
+
+        public int intExpr(Expr.MemI src1, int src2) {
+            return src1.value & ~src2;
+        }
+
+        public int intExpr(Expr.MemI src1, Expr.MemI src2) {
+            return src1.value & ~src2.value;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/bmi/TestAndnL.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,95 @@
+/*
+ * 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 8031321
+ * @summary Verify that results of computations are the same w/
+ *          and w/o usage of ANDN instruction
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestAndnL BMITestRunner Expr
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI TestAndnL
+ */
+
+import sun.hotspot.cpuinfo.CPUInfo;
+
+public class TestAndnL {
+
+    public static void main(String args[]) throws Throwable {
+        if (!CPUInfo.hasFeature("bmi1")) {
+            System.out.println("CPU does not support bmi1 feature. " +
+                               "Test skipped.");
+            return;
+        }
+
+        BMITestRunner.runTests(AndnLExpr.class, args,
+                               "-XX:+UseBMI1Instructions");
+        BMITestRunner.runTests(AndnLCommutativeExpr.class, args,
+                               "-XX:+UseBMI1Instructions");
+    }
+
+    public static class AndnLExpr extends Expr.BMIBinaryLongExpr {
+
+        public long longExpr(long src1, long src2) {
+            return ~src1 & src2;
+        }
+
+        public long longExpr(long src1, Expr.MemL src2) {
+            return ~src1 & src2.value;
+        }
+
+        public long longExpr(Expr.MemL src1, long src2) {
+            return ~src1.value & src2;
+        }
+
+        public long longExpr(Expr.MemL src1, Expr.MemL src2) {
+            return ~src1.value & src2.value;
+        }
+
+
+    }
+
+    public static class AndnLCommutativeExpr extends Expr.BMIBinaryLongExpr {
+
+        public long longExpr(long src1, long src2) {
+            return src1 & ~src2;
+        }
+
+        public long longExpr(long src1, Expr.MemL src2) {
+            return src1 & ~src2.value;
+        }
+
+        public long longExpr(Expr.MemL src1, long src2) {
+            return src1.value & ~src2;
+        }
+
+        public long longExpr(Expr.MemL src1, Expr.MemL src2) {
+            return src1.value & ~src2.value;
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,78 @@
+/*
+ * 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 8031321
+ * @summary Verify that results of computations are the same w/
+ *          and w/o usage of BLSI instruction
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestBlsiI BMITestRunner Expr
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI TestBlsiI
+ */
+
+import sun.hotspot.cpuinfo.CPUInfo;
+
+public class TestBlsiI {
+
+    public static void main(String args[]) throws Throwable {
+        if (!CPUInfo.hasFeature("bmi1")) {
+            System.out.println("CPU does not support bmi1 feature. " +
+                               "Test skipped.");
+            return;
+        }
+
+        BMITestRunner.runTests(BlsiIExpr.class, args,
+                               "-XX:+UseBMI1Instructions");
+        BMITestRunner.runTests(BlsiICommutativeExpr.class, args,
+                               "-XX:+UseBMI1Instructions");
+    }
+
+    public static class BlsiIExpr extends Expr.BMIUnaryIntExpr {
+
+        public int intExpr(int src) {
+            return -src & src;
+        }
+
+        public int intExpr(Expr.MemI src) {
+            return -src.value & src.value;
+        }
+
+    }
+
+    public static class BlsiICommutativeExpr extends Expr.BMIUnaryIntExpr {
+
+        public int intExpr(int src) {
+            return src & -src;
+        }
+
+        public int intExpr(Expr.MemI src) {
+            return src.value & -src.value;
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,78 @@
+/*
+ * 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 8031321
+ * @summary Verify that results of computations are the same w/
+ *          and w/o usage of BLSI instruction
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestBlsiL BMITestRunner Expr
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI TestBlsiL
+ */
+
+import sun.hotspot.cpuinfo.CPUInfo;
+
+public class TestBlsiL {
+
+    public static void main(String args[]) throws Throwable {
+        if (!CPUInfo.hasFeature("bmi1")) {
+            System.out.println("CPU does not support bmi1 feature. " +
+                               "Test skipped.");
+            return;
+        }
+
+        BMITestRunner.runTests(BlsiLExpr.class, args,
+                               "-XX:+UseBMI1Instructions");
+        BMITestRunner.runTests(BlsiLCommutativeExpr.class, args,
+                               "-XX:+UseBMI1Instructions");
+    }
+
+    public static class BlsiLExpr extends Expr.BMIUnaryLongExpr {
+
+        public long longExpr(long src) {
+            return -src & src;
+        }
+
+        public long longExpr(Expr.MemL src) {
+            return -src.value & src.value;
+        }
+
+    }
+
+    public static class BlsiLCommutativeExpr extends Expr.BMIUnaryLongExpr {
+
+        public long longExpr(long src) {
+            return src & -src;
+        }
+
+        public long longExpr(Expr.MemL src) {
+            return src.value & -src.value;
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,78 @@
+/*
+ * 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 8031321
+ * @summary Verify that results of computations are the same w/
+ *          and w/o usage of BLSMSK instruction
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestBlsmskI BMITestRunner Expr
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI TestBlsmskI
+ */
+
+import sun.hotspot.cpuinfo.CPUInfo;
+
+public class TestBlsmskI {
+
+    public static void main(String args[]) throws Throwable {
+        if (!CPUInfo.hasFeature("bmi1")) {
+            System.out.println("CPU does not support bmi1 feature. " +
+                               "Test skipped.");
+            return;
+        }
+
+        BMITestRunner.runTests(BlsmskIExpr.class, args,
+                               "-XX:+UseBMI1Instructions");
+        BMITestRunner.runTests(BlsmskICommutativeExpr.class, args,
+                               "-XX:+UseBMI1Instructions");
+    }
+
+    public static class BlsmskIExpr extends Expr.BMIUnaryIntExpr {
+
+        public int intExpr(int src) {
+            return (src - 1) ^ src;
+        }
+
+        public int intExpr(Expr.MemI src) {
+            return (src.value - 1) ^ src.value;
+        }
+
+    }
+
+    public static class BlsmskICommutativeExpr extends Expr.BMIUnaryIntExpr {
+
+        public int intExpr(int src) {
+            return src ^ (src - 1);
+        }
+
+        public int intExpr(Expr.MemI src) {
+            return src.value ^ (src.value - 1);
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,80 @@
+/*
+ * 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 8031321
+ * @summary Verify that results of computations are the same w/
+ *          and w/o usage of BLSMSK instruction
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestBlsmskL BMITestRunner Expr
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI TestBlsmskL
+ */
+
+import sun.hotspot.cpuinfo.CPUInfo;
+
+public class TestBlsmskL {
+
+    public static void main(String args[]) throws Throwable {
+        if (!CPUInfo.hasFeature("bmi1")) {
+            System.out.println("CPU does not support bmi1 feature. " +
+                               "Test skipped.");
+            return;
+        }
+
+        BMITestRunner.runTests(BlsmskLExpr.class, args,
+                               "-XX:+UseBMI1Instructions");
+        BMITestRunner.runTests(BlsmskLCommutativeExpr.class, args,
+                               "-XX:+UseBMI1Instructions");
+    }
+
+    public static class BlsmskLExpr
+        extends Expr.BMIUnaryLongExpr {
+
+        public long longExpr(long src) {
+            return (src - 1) ^ src;
+        }
+
+        public long longExpr(Expr.MemL src) {
+            return (src.value - 1) ^ src.value;
+        }
+
+    }
+
+    public static class BlsmskLCommutativeExpr
+        extends Expr.BMIUnaryLongExpr {
+
+        public long longExpr(long src) {
+            return src ^ (src - 1);
+        }
+
+        public long longExpr(Expr.MemL src) {
+            return src.value ^ (src.value - 1);
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,78 @@
+/*
+ * 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 8031321
+ * @summary Verify that results of computations are the same w/
+ *          and w/o usage of BLSR instruction
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestBlsrI BMITestRunner Expr
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI TestBlsrI
+ */
+
+import sun.hotspot.cpuinfo.CPUInfo;
+
+public class TestBlsrI {
+
+    public static void main(String args[]) throws Throwable {
+        if (!CPUInfo.hasFeature("bmi1")) {
+            System.out.println("CPU does not support bmi1 feature. " +
+                               "Test skipped.");
+            return;
+        }
+
+        BMITestRunner.runTests(BlsrIExpr.class, args,
+                               "-XX:+UseBMI1Instructions");
+        BMITestRunner.runTests(BlsrICommutativeExpr.class, args,
+                               "-XX:+UseBMI1Instructions");
+    }
+
+    public static class BlsrIExpr extends Expr.BMIUnaryIntExpr {
+
+        public int intExpr(int src) {
+            return (src - 1) & src;
+        }
+
+        public int intExpr(Expr.MemI src) {
+            return (src.value - 1) & src.value;
+        }
+
+    }
+
+    public static class BlsrICommutativeExpr extends Expr.BMIUnaryIntExpr {
+
+        public int intExpr(int src) {
+            return src & (src - 1);
+        }
+
+        public int intExpr(Expr.MemI src) {
+            return src.value & (src.value - 1);
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,78 @@
+/*
+ * 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 8031321
+ * @summary Verify that results of computations are the same w/
+ *          and w/o usage of BLSR instruction
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestBlsrL BMITestRunner Expr
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI TestBlsrL
+ */
+
+import sun.hotspot.cpuinfo.CPUInfo;
+
+public class TestBlsrL {
+
+    public static void main(String args[]) throws Throwable {
+        if (!CPUInfo.hasFeature("bmi1")) {
+            System.out.println("CPU does not support bmi1 feature. " +
+                               "Test skipped.");
+            return;
+        }
+
+        BMITestRunner.runTests(BlsrLExpr.class, args,
+                               "-XX:+UseBMI1Instructions");
+        BMITestRunner.runTests(BlsrLCommutativeExpr.class, args,
+                               "-XX:+UseBMI1Instructions");
+    }
+
+    public static class BlsrLExpr extends Expr.BMIUnaryLongExpr {
+
+        public long longExpr(long src) {
+            return (src - 1) & src;
+        }
+
+        public long longExpr(Expr.MemL src) {
+            return (src.value - 1) & src.value;
+        }
+
+    }
+
+    public static class BlsrLCommutativeExpr extends Expr.BMIUnaryLongExpr {
+
+        public long longExpr(long src) {
+            return src & (src - 1);
+        }
+
+        public long longExpr(Expr.MemL src) {
+            return src.value & (src.value - 1);
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 8031321
+ * @summary Verify that results of computations are the same w/
+ *          and w/o usage of intrinsic
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestLzcntI BMITestRunner Expr
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI TestLzcntI
+ */
+
+import sun.hotspot.cpuinfo.CPUInfo;
+
+public class TestLzcntI {
+
+    public static void main(String args[]) throws Throwable {
+        if (!CPUInfo.hasFeature("lzcnt")) {
+            System.out.println("CPU does not support lzcnt feature. " +
+                               "Test skipped.");
+            return;
+        }
+
+        BMITestRunner.runTests(LzcntIExpr.class, args,
+                               "-XX:+UseCountLeadingZerosInstruction");
+    }
+
+    public static class LzcntIExpr extends Expr.BitCountingIntExpr {
+
+        public int intExpr(int src) {
+            return Integer.numberOfLeadingZeros(src);
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 8031321
+ * @summary Verify that results of computations are the same w/
+ *          and w/o usage of intrinsic
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestLzcntL BMITestRunner Expr
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI TestLzcntL
+ */
+
+import sun.hotspot.cpuinfo.CPUInfo;
+
+public class TestLzcntL {
+
+    public static void main(String args[]) throws Throwable {
+        if (!CPUInfo.hasFeature("lzcnt")) {
+            System.out.println("CPU does not support lzcnt feature. " +
+                               "Test skipped.");
+            return;
+        }
+
+        BMITestRunner.runTests(LzcntLExpr.class, args,
+                               "-XX:+UseCountLeadingZerosInstruction");
+    }
+
+    public static class LzcntLExpr extends Expr.BitCountingLongExpr {
+
+        public long longExpr(long src) {
+            return Long.numberOfLeadingZeros(src);
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 8031321
+ * @summary Verify that results of computations are the same w/
+ *          and w/o usage of intrinsic
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestTzcntI BMITestRunner Expr
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI TestTzcntI
+ */
+
+import sun.hotspot.cpuinfo.CPUInfo;
+
+public class TestTzcntI {
+
+    public static void main(String args[]) throws Throwable {
+        if (!CPUInfo.hasFeature("bmi1")) {
+            System.out.println("CPU does not support bmi1 feature. " +
+                               "Test skipped.");
+            return;
+        }
+
+        BMITestRunner.runTests(TzcntIExpr.class, args,
+                               "-XX:+UseCountTrailingZerosInstruction");
+    }
+
+    public static class TzcntIExpr extends Expr.BitCountingIntExpr {
+
+        public int intExpr(int src) {
+            return Integer.numberOfTrailingZeros(src);
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 8031321
+ * @summary Verify that results of computations are the same w/
+ *          and w/o usage of intrinsic
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestTzcntL BMITestRunner Expr
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI TestTzcntL
+ */
+
+import sun.hotspot.cpuinfo.CPUInfo;
+
+public class TestTzcntL {
+
+    public static void main(String args[]) throws Throwable {
+        if (!CPUInfo.hasFeature("bmi1")) {
+            System.out.println("CPU does not support bmi1 feature. " +
+                               "Test skipped.");
+            return;
+        }
+
+        BMITestRunner.runTests(TzcntLExpr.class, args,
+                               "-XX:+UseCountTrailingZerosInstruction");
+    }
+
+    public static class TzcntLExpr extends Expr.BitCountingLongExpr {
+
+        public long longExpr(long src) {
+            return Long.numberOfTrailingZeros(src);
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/unsafe/UnsafeGetAddressTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug 6653795
+ * @summary C2 intrinsic for Unsafe.getAddress performs pointer sign extension on 32-bit systems
+ * @run main UnsafeGetAddressTest
+ *
+ */
+
+import sun.misc.Unsafe;
+import java.lang.reflect.*;
+
+public class UnsafeGetAddressTest {
+    private static Unsafe unsafe;
+
+    public static void main(String[] args) throws Exception {
+        Class c = UnsafeGetAddressTest.class.getClassLoader().loadClass("sun.misc.Unsafe");
+        Field f = c.getDeclaredField("theUnsafe");
+        f.setAccessible(true);
+        unsafe = (Unsafe)f.get(c);
+
+        long address = unsafe.allocateMemory(unsafe.addressSize());
+        unsafe.putAddress(address, 0x0000000080000000L);
+        // from sun.misc.Unsafe.getAddress' documentation:
+        // "If the native pointer is less than 64 bits wide, it is
+        // extended as an unsigned number to a Java long."
+        result = unsafe.getAddress(address);
+        System.out.printf("1: was 0x%x, expected 0x%x\n", result,
+                0x0000000080000000L);
+        for (int i = 0; i < 1000000; i++) {
+            result = unsafe.getAddress(address);
+        }
+
+        // The code has got compiled, check the result now
+        System.out.printf("2: was 0x%x, expected 0x%x\n", result,
+                0x0000000080000000L);
+        if (result != 0x0000000080000000L) {
+            System.out.println("Test Failed");
+            System.exit(97);
+        } else {
+            System.out.println("Test Passed");
+        }
+    }
+    static volatile long result;
+}
+
--- a/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -24,6 +24,7 @@
 import com.sun.management.HotSpotDiagnosticMXBean;
 import com.sun.management.VMOption;
 import sun.hotspot.WhiteBox;
+import sun.hotspot.code.NMethod;
 import sun.management.ManagementFactoryHelper;
 
 import java.lang.reflect.Constructor;
@@ -278,7 +279,8 @@
     }
 
     protected final int getCompLevel() {
-        return WHITE_BOX.getMethodCompilationLevel(method, testCase.isOsr());
+        NMethod nm = NMethod.get(method, testCase.isOsr());
+        return nm == null ? COMP_LEVEL_NONE : nm.comp_level;
     }
 
     protected final boolean isCompilable() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/whitebox/GetNMethodTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+import sun.hotspot.code.NMethod;
+
+/*
+ * @test GetNMethodTest
+ * @bug 8038240
+ * @library /testlibrary /testlibrary/whitebox
+ * @build GetNMethodTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* GetNMethodTest
+ * @summary testing of WB::getNMethod()
+ * @author igor.ignatyev@oracle.com
+ */
+public class GetNMethodTest extends CompilerWhiteBoxTest {
+    public static void main(String[] args) throws Exception {
+        CompilerWhiteBoxTest.main(GetNMethodTest::new, args);
+    }
+
+    private GetNMethodTest(TestCase testCase) {
+        super(testCase);
+        // to prevent inlining of #method
+        WHITE_BOX.testSetDontInlineMethod(method, true);
+    }
+
+    @Override
+    protected void test() throws Exception {
+        checkNotCompiled();
+
+        compile();
+        checkCompiled();
+        NMethod nmethod = NMethod.get(method, testCase.isOsr());
+        if (IS_VERBOSE) {
+            System.out.println("nmethod = " + nmethod);
+        }
+        if (nmethod == null) {
+            throw new RuntimeException("nmethod of compiled method is null");
+        }
+        if (nmethod.insts.length == 0) {
+            throw new RuntimeException("compiled method's instructions is empty");
+        }
+        deoptimize();
+        checkNotCompiled();
+        nmethod = NMethod.get(method, testCase.isOsr());
+        if (nmethod != null) {
+            throw new RuntimeException("nmethod of non-compiled method isn't null");
+        }
+    }
+}
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Asserts.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Asserts.java	Tue Apr 01 15:37:15 2014 +0200
@@ -378,6 +378,64 @@
         }
     }
 
+    /**
+     * Asserts that two strings are equal.
+     *
+     * If strings are not equals, then exception message
+     * will contain {@code msg} followed by list of mismatched lines.
+     *
+     * @param str1 First string to compare.
+     * @param str2 Second string to compare.
+     * @param msg A description of the assumption.
+     * @throws RuntimeException if strings are not equal.
+     */
+    public static void assertStringsEqual(String str1, String str2,
+                                          String msg) {
+        String lineSeparator = System.getProperty("line.separator");
+        String str1Lines[] = str1.split(lineSeparator);
+        String str2Lines[] = str2.split(lineSeparator);
+
+        int minLength = Math.min(str1Lines.length, str2Lines.length);
+        String longestStringLines[] = ((str1Lines.length == minLength) ?
+                                       str2Lines : str1Lines);
+
+        boolean stringsAreDifferent = false;
+
+        StringBuilder messageBuilder = new StringBuilder(msg);
+
+        messageBuilder.append("\n");
+
+        for (int line = 0; line < minLength; line++) {
+            if (!str1Lines[line].equals(str2Lines[line])) {
+                messageBuilder.append(String.
+                                      format("[line %d] '%s' differs " +
+                                             "from '%s'\n",
+                                             line,
+                                             str1Lines[line],
+                                             str2Lines[line]));
+                stringsAreDifferent = true;
+            }
+        }
+
+        if (minLength < longestStringLines.length) {
+            String stringName = ((longestStringLines == str1Lines) ?
+                                 "first" : "second");
+            messageBuilder.append(String.format("Only %s string contains " +
+                                                "following lines:\n",
+                                                stringName));
+            stringsAreDifferent = true;
+            for(int line = minLength; line < longestStringLines.length; line++) {
+                messageBuilder.append(String.
+                                      format("[line %d] '%s'", line,
+                                             longestStringLines[line]));
+            }
+        }
+
+        if (stringsAreDifferent) {
+            error(messageBuilder.toString());
+        }
+    }
+
     private static <T extends Comparable<T>> int compare(T lhs, T rhs, String msg) {
         assertNotNull(lhs, msg);
         assertNotNull(rhs, msg);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/ExitCode.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.oracle.java.testlibrary;
+
+/**
+ * Exit code values that could be returned by the JVM.
+ */
+public enum ExitCode {
+    OK(0),
+    FAIL(1),
+    CRASH(134);
+
+    public final int value;
+
+    ExitCode(int value) {
+        this.value = value;
+    }
+}
+
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Utils.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Utils.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -108,6 +108,40 @@
     }
 
     /**
+     * Returns the default JTReg arguments for a jvm running a test without
+     * options that matches regular expresions in {@code filters}.
+     * This is the combination of JTReg arguments test.vm.opts and test.java.opts.
+     * @param filters Regular expressions used to filter out options.
+     * @return An array of options, or an empty array if no opptions.
+     */
+    public static String[] getFilteredTestJavaOpts(String... filters) {
+        String options[] = getTestJavaOpts();
+
+        if (filters.length == 0) {
+            return options;
+        }
+
+        List<String> filteredOptions = new ArrayList<String>(options.length);
+        Pattern patterns[] = new Pattern[filters.length];
+        for (int i = 0; i < filters.length; i++) {
+            patterns[i] = Pattern.compile(filters[i]);
+        }
+
+        for (String option : options) {
+            boolean matched = false;
+            for (int i = 0; i < patterns.length && !matched; i++) {
+                Matcher matcher = patterns[i].matcher(option);
+                matched = matcher.find();
+            }
+            if (!matched) {
+                filteredOptions.add(option);
+            }
+        }
+
+        return filteredOptions.toArray(new String[filteredOptions.size()]);
+    }
+
+    /**
      * Combines given arguments with default JTReg arguments for a jvm running a test.
      * This is the combination of JTReg arguments test.vm.opts and test.java.opts
      * @return The combination of JTReg test java options and user args.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/cli/CPUSpecificCommandLineOptionTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,110 @@
+/*
+ * 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 com.oracle.java.testlibrary.cli;
+
+import sun.hotspot.cpuinfo.CPUInfo;
+import com.oracle.java.testlibrary.*;
+
+/**
+ * Base class for command line options tests that
+ * requires specific CPU arch or specific CPU features.
+ */
+public abstract class CPUSpecificCommandLineOptionTest
+              extends CommandLineOptionTest {
+
+    private String cpuArchPattern;
+    private String supportedCPUFeatures[];
+    private String unsupportedCPUFeatures[];
+
+    /**
+     * Create new CPU specific test instance that does not
+     * require any CPU features.
+     *
+     * @param cpuArchPattern Regular expression that should
+     *                       match os.arch.
+     */
+    public CPUSpecificCommandLineOptionTest(String cpuArchPattern) {
+        this(cpuArchPattern, null, null);
+    }
+
+    /**
+     * Create new CPU specific test instance that does not
+     * require from CPU support of {@code supportedCPUFeatures} features
+     * and no support of {@code unsupportedCPUFeatures}.
+     *
+     * @param cpuArchPattern Regular expression that should
+     *                       match os.arch.
+     * @param supportedCPUFeatures Array with names of features that
+     *                             should be supported by CPU. If <b>null</b>,
+     *                             then no features have to be supported.
+     * @param unsupportedCPUFeatures Array with names of features that
+     *                               should not be supported by CPU.
+     *                               If <b>null</b>, then CPU may support any
+     *                               features.
+     */
+    public CPUSpecificCommandLineOptionTest(String cpuArchPattern,
+                                            String supportedCPUFeatures[],
+                                            String unsupportedCPUFeatures[]) {
+        this.cpuArchPattern = cpuArchPattern;
+        this.supportedCPUFeatures = supportedCPUFeatures;
+        this.unsupportedCPUFeatures = unsupportedCPUFeatures;
+    }
+
+    /**
+     * Check that CPU on test box has appropriate architecture, support all
+     * required features and does not support all features that should not be
+     * supported.
+     *
+     * @return <b>true</b> if CPU on test box fulfill all requirements.
+     */
+    @Override
+    public boolean checkPreconditions() {
+        if (!Platform.getOsArch().matches(cpuArchPattern)) {
+            System.out.println("CPU arch does not match " + cpuArchPattern);
+            return false;
+        }
+
+        if (supportedCPUFeatures != null) {
+            for (String feature : supportedCPUFeatures) {
+                if (!CPUInfo.hasFeature(feature)) {
+                    System.out.println("CPU does not support " + feature +
+                                       " feature");
+                    return false;
+                }
+            }
+        }
+
+        if (unsupportedCPUFeatures != null) {
+            for (String feature : unsupportedCPUFeatures) {
+                if (CPUInfo.hasFeature(feature)) {
+                    System.out.println("CPU support " + feature + " feature");
+                    return false;
+                }
+            }
+        }
+
+        return true;
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/cli/CommandLineOptionTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,173 @@
+/*
+ * 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 com.oracle.java.testlibrary.cli;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collections;
+
+import com.oracle.java.testlibrary.*;
+
+/**
+ * Base class for command line option tests.
+ */
+public abstract class CommandLineOptionTest {
+
+    public static final String UNRECOGNIZED_OPTION_ERROR_FORMAT =
+        "Unrecognized VM option '[+-]?%s'";
+
+    public static final String printFlagsFinalFormat = "%s\\s*:?=\\s*%s";
+
+    /**
+     * Verify that JVM startup behaviour matches our expectations.
+     *
+     * @param option The option that should be passed to JVM
+     * @param excpectedMessages Array of patterns that should occur
+     *                          in JVM output. If <b>null</b> then
+     *                          JVM output could be empty.
+     * @param unexpectedMessages Array of patterns that should not
+     *                           occur in JVM output. If <b>null</b> then
+     *                          JVM output could be empty.
+     * @param exitCode expected exit code.
+     * @throws Throwable if verification fails or some other issues occur.
+     */
+    public static void verifyJVMStartup(String option,
+                                        String expectedMessages[],
+                                        String unexpectedMessages[],
+                                        ExitCode exitCode)
+                                 throws Throwable {
+
+        OutputAnalyzer outputAnalyzer =
+            ProcessTools.executeTestJvm(option, "-version");
+
+        outputAnalyzer.shouldHaveExitValue(exitCode.value);
+
+        if (expectedMessages != null) {
+            for (String expectedMessage : expectedMessages) {
+                outputAnalyzer.shouldMatch(expectedMessage);
+            }
+        }
+
+        if (unexpectedMessages != null) {
+            for (String unexpectedMessage : unexpectedMessages) {
+                outputAnalyzer.shouldNotMatch(unexpectedMessage);
+            }
+        }
+    }
+
+    /**
+     * Verify that value of specified JVM option is the same as
+     * expected value.
+     * This method filter out option with {@code optionName}
+     * name from test java options.
+     *
+     * @param optionName Name of tested option.
+     * @param expectedValue Expected value of tested option.
+     * @param additionalVMOpts Additonal options that should be
+     *                         passed to JVM.
+     * @throws Throwable if verification fails or some other issues occur.
+     */
+    public static void verifyOptionValue(String optionName,
+                                         String expectedValue,
+                                         String... additionalVMOpts)
+                                  throws Throwable {
+        verifyOptionValue(optionName, expectedValue, true, additionalVMOpts);
+    }
+
+    /**
+     * Verify that value of specified JVM option is the same as
+     * expected value.
+     * This method filter out option with {@code optionName}
+     * name from test java options.
+     *
+     * @param optionName Name of tested option.
+     * @param expectedValue Expected value of tested option.
+     * @param addTestVmOptions If <b>true</b>, then test VM options
+     *                         will be used.
+     * @param additionalVMOpts Additonal options that should be
+     *                         passed to JVM.
+     * @throws Throwable if verification fails or some other issues occur.
+     */
+    public static void verifyOptionValue(String optionName,
+                                         String expectedValue,
+                                         boolean addTestVmOptions,
+                                         String... additionalVMOpts)
+                                  throws Throwable {
+
+        List<String> vmOpts = new ArrayList<String>();
+
+        if (addTestVmOptions) {
+            Collections.addAll(vmOpts,
+                               Utils.getFilteredTestJavaOpts(optionName));
+        }
+        Collections.addAll(vmOpts, additionalVMOpts);
+        Collections.addAll(vmOpts, new String[] {
+                "-XX:+PrintFlagsFinal",
+                "-version"
+            });
+
+        ProcessBuilder processBuilder =
+            ProcessTools.
+            createJavaProcessBuilder(vmOpts.
+                                     toArray(new String[vmOpts.size()]));
+
+        OutputAnalyzer outputAnalyzer =
+            new OutputAnalyzer(processBuilder.start());
+
+        outputAnalyzer.shouldHaveExitValue(0);
+        outputAnalyzer.shouldMatch(String.
+                                   format(printFlagsFinalFormat,
+                                          optionName,
+                                          expectedValue));
+    }
+
+
+    /**
+     * Run command line option test.
+     *
+     * @throws Throwable if test failed.
+     */
+    public final void test() throws Throwable {
+        if (checkPreconditions()) {
+            runTestCases();
+        }
+    }
+
+    /**
+     * Check that all preconditions for test execution are met.
+     *
+     * @return <b>true</b> if test could be executed.
+     */
+    public boolean checkPreconditions() {
+        return true;
+    }
+
+    /**
+     * Run test cases.
+     *
+     * @throws Throwable if test failed.
+     */
+    public abstract void runTestCases() throws Throwable;
+}
+
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -135,6 +135,7 @@
   public native boolean enqueueMethodForCompilation(Executable method, int compLevel, int entry_bci);
   public native void    clearMethodState(Executable method);
   public native int     getMethodEntryBci(Executable method);
+  public native Object[] getNMethod(Executable method, boolean isOsr);
 
   // Intered strings
   public native boolean isInStringTable(String str);
@@ -150,4 +151,7 @@
   public native void runMemoryUnitTests();
   public native void readFromNoaccessArea();
 
+  // CPU features
+  public native String getCPUFeatures();
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/NMethod.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.hotspot.code;
+
+import java.lang.reflect.Executable;
+import sun.hotspot.WhiteBox;
+
+public class NMethod {
+  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) {
+    assert obj.length == 2;
+    comp_level = (Integer) obj[0];
+    insts = (byte[]) obj[1];
+  }
+  public byte[] insts;
+  public int comp_level;
+
+  @Override
+  public String toString() {
+    return "NMethod{" +
+        "insts=" + insts +
+        ", comp_level=" + comp_level +
+        '}';
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/cpuinfo/CPUInfo.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,98 @@
+/*
+ * 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.ArrayList;
+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());
+    }
+}
--- a/jaxp/.hgtags	Tue Apr 01 07:46:51 2014 +0200
+++ b/jaxp/.hgtags	Tue Apr 01 15:37:15 2014 +0200
@@ -246,3 +246,5 @@
 e5256f530a9b5f2d677ca245de44a617ffb58f52 jdk9-b01
 02f60a253e15240087c043bad77a106792e4d56a jdk9-b02
 fb92ed0399424193f444489ad49a16748816dc12 jdk9-b03
+2846d8fc31490897817a122a668af4f44fc913d0 jdk9-b04
+b92a20e303d24c74078888cd7084b14d7626d48f jdk9-b05
--- a/jaxp/make/BuildJaxp.gmk	Tue Apr 01 07:46:51 2014 +0200
+++ b/jaxp/make/BuildJaxp.gmk	Tue Apr 01 15:37:15 2014 +0200
@@ -45,27 +45,11 @@
 $(eval $(call SetupJavaCompilation,BUILD_JAXP, \
     SETUP := GENERATE_NEWBYTECODE_DEBUG, \
     SRC := $(JAXP_TOPDIR)/src, \
+    CLEAN := .properties, \
     BIN := $(JAXP_OUTPUTDIR)/classes, \
-    SRCZIP := $(JAXP_OUTPUTDIR)/dist/lib/src.zip))
-
-# Imitate the property cleaning mechanism in the old build. This will likely be replaced
-# by the unified functionality in JavaCompilation.gmk, but keep it the same as old build
-# for now, even though it actually breaks properties containing # in the value.
-# Using nawk to avoid solaris sed.
-$(JAXP_OUTPUTDIR)/classes/%.properties: $(JAXP_TOPDIR)/src/%.properties
-	$(MKDIR) -p $(@D)
-	$(RM) $@ $@.tmp
-	$(CAT) $< | LANG=C $(NAWK) '{ sub(/#.*$$/,"#"); print }' > $@.tmp
-	$(MV) $@.tmp $@
-
-SRC_PROP_FILES := $(shell $(FIND) $(JAXP_TOPDIR)/src -name "*.properties")
-TARGET_PROP_FILES := $(patsubst $(JAXP_TOPDIR)/src/%, $(JAXP_OUTPUTDIR)/classes/%, $(SRC_PROP_FILES))
-
-$(eval $(call SetupArchive,ARCHIVE_JAXP, $(BUILD_JAXP) $(TARGET_PROP_FILES), \
-    SRCS := $(JAXP_OUTPUTDIR)/classes, \
-    SUFFIXES := .class .properties, \
+    SRCZIP := $(JAXP_OUTPUTDIR)/dist/lib/src.zip, \
     JAR := $(JAXP_OUTPUTDIR)/dist/lib/classes.jar))
 
-all: $(JAXP_OUTPUTDIR)/dist/lib/classes.jar $(JAXP_OUTPUTDIR)/dist/lib/src.zip
+all: $(BUILD_JAXP)
 
 .PHONY: default all
--- a/jaxws/.hgtags	Tue Apr 01 07:46:51 2014 +0200
+++ b/jaxws/.hgtags	Tue Apr 01 15:37:15 2014 +0200
@@ -249,3 +249,5 @@
 9c9fabbcd3d526d7ca29165169155f49a107533a jdk9-b01
 efe2bc258c78af49de9517a4a5699d3a2e630c44 jdk9-b02
 1cd9786257ed4f82a3371fd606b162e5bb6fcd81 jdk9-b03
+da44a8bdf1f3fdd518e7d785d60cc1b15983b176 jdk9-b04
+eae966c8133fec0a8bf9e16d1274a4ede3c0fb52 jdk9-b05
--- a/jaxws/make/BuildJaxws.gmk	Tue Apr 01 07:46:51 2014 +0200
+++ b/jaxws/make/BuildJaxws.gmk	Tue Apr 01 15:37:15 2014 +0200
@@ -42,11 +42,10 @@
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
     SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
 
-# Dummy here is needed to trigger copying of META-INF
 $(eval $(call SetupJavaCompilation,BUILD_JAF, \
     SETUP := GENERATE_NEWBYTECODE_DEBUG, \
     SRC := $(JAXWS_TOPDIR)/src/share/jaf_classes, \
-    COPY := "dummy", \
+    CLEAN := .properties, \
     BIN := $(JAXWS_OUTPUTDIR)/jaf_classes))
 
 $(eval $(call SetupJavaCompilation,BUILD_JAXWS, \
@@ -57,6 +56,7 @@
     COPY_FILES := $(JAXWS_TOPDIR)/src/share/jaxws_classes/com/sun/tools/internal/xjc/runtime/JAXBContextFactory.java \
         $(JAXWS_TOPDIR)/src/share/jaxws_classes/com/sun/tools/internal/xjc/runtime/ZeroOneBooleanAdapter.java \
         $(JAXWS_TOPDIR)/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/jaxws-tubes-default.xml, \
+    CLEAN := .properties, \
     ADD_JAVAC_FLAGS = -Xbootclasspath/p:$(OUTPUT_ROOT)/jaxp/dist/lib/classes.jar))
 
 $(JAXWS_OUTPUTDIR)/jaxws_classes/META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin: \
@@ -73,30 +73,6 @@
 BUILD_JAXWS += $(JAXWS_OUTPUTDIR)/jaxws_classes/META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin \
                $(JAXWS_OUTPUTDIR)/jaxws_classes/META-INF/services/com.sun.tools.internal.xjc.Plugin
 
-# Imitate the property cleaning mechanism in the old build. This will likely be replaced
-# by the unified functionality in JavaCompilation.gmk, but keep it the same as old build
-# for now, even though it actually breaks properties containing # in the value.
-# Using nawk to avoid solaris sed.
-$(JAXWS_OUTPUTDIR)/jaxws_classes/%.properties: $(JAXWS_TOPDIR)/src/share/jaxws_classes/%.properties
-	$(MKDIR) -p $(@D)
-	$(RM) $@ $@.tmp
-	$(CAT) $< | LANG=C $(NAWK) '{ sub(/#.*$$/,"#"); print }' > $@.tmp
-	$(MV) $@.tmp $@
-
-JAXWS_SRC_PROP_FILES := $(shell $(FIND) $(JAXWS_TOPDIR)/src/share/jaxws_classes -name "*.properties")
-TARGET_PROP_FILES := $(patsubst $(JAXWS_TOPDIR)/src/share/jaxws_classes/%, \
-    $(JAXWS_OUTPUTDIR)/jaxws_classes/%, $(JAXWS_SRC_PROP_FILES))
-
-$(JAXWS_OUTPUTDIR)/jaf_classes/%.properties: $(JAXWS_TOPDIR)/src/share/jaf_classes/%.properties
-	$(MKDIR) -p $(@D)
-	$(RM) $@ $@.tmp
-	$(CAT) $< | LANG=C $(NAWK) '{ sub(/#.*$$/,"#"); print }' > $@.tmp
-	$(MV) $@.tmp $@
-
-JAF_SRC_PROP_FILES := $(shell $(FIND) $(JAXWS_TOPDIR)/src/share/jaf_classes -name "*.properties")
-TARGET_PROP_FILES += $(patsubst $(JAXWS_TOPDIR)/src/share/jaf_classes/%, \
-    $(JAXWS_OUTPUTDIR)/jaf_classes/%, $(JAF_SRC_PROP_FILES))
-
 $(eval $(call SetupArchive,ARCHIVE_JAXWS, $(BUILD_JAXWS) $(BUILD_JAF) $(TARGET_PROP_FILES), \
     SRCS := $(JAXWS_OUTPUTDIR)/jaxws_classes $(JAXWS_OUTPUTDIR)/jaf_classes, \
     SUFFIXES := .class .properties .xsd .xml .java \
--- a/jdk/.hgtags	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/.hgtags	Tue Apr 01 15:37:15 2014 +0200
@@ -246,3 +246,5 @@
 3b4ac8d1b76fc6bec9815f0ab714f15b552e4c7b jdk9-b01
 8c8275426a3207d91393354f7a7f9bc362ec25cf jdk9-b02
 4111af6151ed8ca8e3f5603c69729a68427e1d5b jdk9-b03
+627deed79b595a4789fc9151455b663a47381257 jdk9-b04
+263198a1d8f1f4cb97d35f40c61704b08ebd3686 jdk9-b05
--- a/jdk/make/CompileJavaClasses.gmk	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/make/CompileJavaClasses.gmk	Tue Apr 01 15:37:15 2014 +0200
@@ -307,12 +307,6 @@
       $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
 endif
 
-# The exception handling of swing beaninfo
-# These resources violates the convention of having code and resources together under
-# $(JDK_TOPDIR)/src/.../classes directories
-$(JDK_OUTPUTDIR)/classes/javax/swing/beaninfo/images/%.gif: $(JDK_TOPDIR)/make/data/swingbeaninfo/images/%.gif
-	$(call install-file)
-
 # The JDK_USER_DEFINED_FILTER is a poor man's incremental build: by specifying
 # JDK_FILTER at the make command line, only a subset of the JDK java files will
 # be recompiled. If multiple paths are separated by comma, convert that into a
@@ -341,6 +335,7 @@
     BIN:=$(JDK_OUTPUTDIR)/classes,\
     COPY:=$(COPY_PATTERNS),\
     COPY_FILES:=$(COPY_FILES),\
+    CLEAN_FILES:=$(CLEAN_FILES),\
     HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers,\
     ADD_JAVAC_FLAGS:=$(BUILD_JDK_SOURCEPATH)))
 
@@ -378,7 +373,8 @@
           SETUP := GENERATE_JDKBYTECODE, \
           JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
           SRC := $(JDK_OUTPUTDIR)/gensrc_ab/32bit, \
-          BIN := $(JDK_OUTPUTDIR)/classes_ab/32bit))
+          BIN := $(JDK_OUTPUTDIR)/classes_ab/32bit, \
+          HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
 
       $(BUILD_ACCESSBRIDGE_32): $(BUILD_JDK)
 
@@ -386,7 +382,8 @@
           SETUP := GENERATE_JDKBYTECODE, \
           JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
           SRC := $(JDK_OUTPUTDIR)/gensrc_ab/legacy, \
-          BIN := $(JDK_OUTPUTDIR)/classes_ab/legacy))
+          BIN := $(JDK_OUTPUTDIR)/classes_ab/legacy, \
+          HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
 
       $(BUILD_ACCESSBRIDGE_LEGACY): $(BUILD_JDK)
 
@@ -396,7 +393,8 @@
           SETUP := GENERATE_JDKBYTECODE, \
           JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
           SRC := $(JDK_OUTPUTDIR)/gensrc_ab/64bit, \
-          BIN := $(JDK_OUTPUTDIR)/classes_ab/64bit))
+          BIN := $(JDK_OUTPUTDIR)/classes_ab/64bit, \
+          HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
 
       $(BUILD_ACCESSBRIDGE_64): $(BUILD_JDK)
 
--- a/jdk/make/CompileLaunchers.gmk	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/make/CompileLaunchers.gmk	Tue Apr 01 15:37:15 2014 +0200
@@ -32,7 +32,7 @@
 # Setup the java compilers for the JDK build.
 include Setup.gmk
 
-# Prepare the find cache. Only used on windows.
+# Prepare the find cache.
 $(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/share/bin))
 
 # Build tools
--- a/jdk/make/CompileNativeLibraries.gmk	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/make/CompileNativeLibraries.gmk	Tue Apr 01 15:37:15 2014 +0200
@@ -35,7 +35,7 @@
 # Copy files (can now depend on $(COPY_FILES))
 include CopyFiles.gmk
 
-# Prepare the find cache. Only used if running on windows.
+# Prepare the find cache.
 $(eval $(call FillCacheFind, $(JDK_TOPDIR)/src))
 
 # Build tools
--- a/jdk/make/CopyIntoClasses.gmk	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/make/CopyIntoClasses.gmk	Tue Apr 01 15:37:15 2014 +0200
@@ -25,121 +25,53 @@
 
 # Copy icu and _dict files used by the text break iterator
 
-COPY_PATTERNS = .icu _dict
-
-# Copy config files for com.sun.org.apache.xml.internal.security
-
-XMLSECURITY_RESOURCEDIR = $(JDK_TOPDIR)/src/share/classes/com/sun/org/apache/xml/internal/security/resource
-COPY_FILES += \
-    $(XMLSECURITY_RESOURCEDIR)/config.dtd \
-    $(XMLSECURITY_RESOURCEDIR)/config.xml
-
-# Copy sun/tools related files into the classes directory.
-
-# Extra jstat files
-JSTAT_RESOURCEDIR = $(JDK_TOPDIR)/src/share/classes/sun/tools/jstat/resources
-COPY_FILES += \
-    $(JSTAT_RESOURCEDIR)/jstat_options \
-    $(JSTAT_RESOURCEDIR)/jstat_unsupported_options
-
-# Extra jhat files
-JHAT_RESOURCEDIR = $(JDK_TOPDIR)/src/share/classes/com/sun/tools/hat/resources
-COPY_FILES += \
-    $(JHAT_RESOURCEDIR)/hat.js \
-    $(JHAT_RESOURCEDIR)/oqlhelp.html \
-    $(JHAT_RESOURCEDIR)/platform_names.txt
+COPY_PATTERNS := .icu _dict .dat _options .js aliasmap .spp .wav .css \
+    .png .gif .xml .dtd .txt oqlhelp.html
 
-# Extra jrunscript files
-JRUNSCRIPT_RESOURCEDIR = $(JDK_TOPDIR)/src/share/classes/com/sun/tools/script/shell
-COPY_FILES += \
-    $(JRUNSCRIPT_RESOURCEDIR)/init.js \
-    $(JRUNSCRIPT_RESOURCEDIR)/messages.properties
-
-# Extra jvmstat files
-COPY_FILES += \
-    $(JDK_TOPDIR)/src/share/classes/sun/jvmstat/perfdata/resources/aliasmap
-
-# JConsole resources
-JCONSOLE_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/sun/tools/jconsole/resources
-COPY_FILES += \
-    $(wildcard $(JCONSOLE_RESOURCES_DIR)/*.png) \
-    $(wildcard $(JCONSOLE_RESOURCES_DIR)/*.gif)
+# These directories should not be copied at all
+EXCLUDES += \
+    com/sun/org/apache/xml/internal/security/resource/schema \
+    java/awt/doc-files \
+    java/lang/doc-files \
+    javax/swing/doc-files \
+    javax/swing/text/doc-files \
+    javax/swing/plaf/synth/doc-files \
+    javax/swing/undo/doc-files \
+    sun/awt/X11/doc-files \
+    sun/util/cldr/resources \
+    #
 
-# Print resources
-PRINT_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/sun/print/resources
-COPY_FILES += \
-    $(wildcard $(PRINT_RESOURCES_DIR)/*.png)
+# These files should never be included
+EXFILES += build.xml README.txt version.txt
 
-# IDN resources
-COPY_FILES += \
-    $(JDK_TOPDIR)/src/share/classes/sun/net/idn/uidna.spp
-
-#
-# Swing plaf resources
-#
-SWING_PLAF_WINDOWS_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows
-COPY_FILES += \
-    $(wildcard $(SWING_PLAF_WINDOWS_RESOURCES_DIR)/icons/*.gif) \
-    $(wildcard $(SWING_PLAF_WINDOWS_RESOURCES_DIR)/icons/*.png)
+# These icons are handled in GensrcIcons.gmk
+EXFILES += \
+    sun/awt/X11/java-icon16.png \
+    sun/awt/X11/java-icon24.png \
+    sun/awt/X11/java-icon32.png \
+    sun/awt/X11/java-icon48.png \
+    $(wildcard $(JDK_TOPDIR)/src/share/classes/sun/awt/resources/*.png) \
+    #
 
 ifndef OPENJDK
-  SWING_PLAF_WINDOWS_RESOURCES_DIR_CLOSED = $(JDK_TOPDIR)/src/closed/share/classes/com/sun/java/swing/plaf/windows
-  # Filter out JavaCup32.png from OpenJDK
-  COPY_FILES := $(filter-out $(SWING_PLAF_WINDOWS_RESOURCES_DIR)/icons/JavaCup32.png, $(COPY_FILES))
-  # Alter JavaCup32.png from ClosedJDK
-  COPY_FILES += \
-      $(SWING_PLAF_WINDOWS_RESOURCES_DIR_CLOSED)/icons/JavaCup32.png
+  # Theses icons have closed replacements
+  SWING_PLAF_MOTIF_RESOURCES_DIR := $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif
+  EXFILES += \
+      $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows/icons/JavaCup32.png \
+      $(JDK_TOPDIR)/src/share/classes/javax/swing/plaf/basic/icons/JavaCup16.png \
+      $(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR)/icons/*.gif) \
+      $(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR)/icons/*.png) \
+      #
+
+  EXFILES += mib_core.txt
 endif
 
 ifeq ($(ENABLE_JFR), true)
-  JFR_CONFIGURATION_DIR_CLOSED = $(JDK_TOPDIR)/src/closed/share/classes/oracle/jrockit/jfr/settings
+  JFR_CONFIGURATION_DIR_CLOSED := $(JDK_TOPDIR)/src/closed/share/classes/oracle/jrockit/jfr/settings
   COPY_FILES += \
       $(JFR_CONFIGURATION_DIR_CLOSED)/jfc.xsd
 endif
 
-SWING_PLAF_BASIC_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/javax/swing/plaf/basic
-COPY_FILES += \
-    $(wildcard $(SWING_PLAF_BASIC_RESOURCES_DIR)/icons/*.png)
-
-ifndef OPENJDK
-  SWING_PLAF_BASIC_RESOURCES_DIR_CLOSED = $(JDK_TOPDIR)/src/closed/share/classes/javax/swing/plaf/basic
-  # Filter out JavaCup16.png from OpenJDK
-  COPY_FILES := $(filter-out $(SWING_PLAF_BASIC_RESOURCES_DIR)/icons/JavaCup16.png, $(COPY_FILES))
-  # Alter JavaCup16.png from ClosedJDK
-  COPY_FILES += \
-      $(SWING_PLAF_BASIC_RESOURCES_DIR_CLOSED)/icons/JavaCup16.png
-endif
-
-ifdef OPENJDK
-  SWING_PLAF_MOTIF_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif
-  COPY_FILES += \
-      $(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR)/icons/*.gif) \
-      $(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR)/icons/*.png)
-else
-  SWING_PLAF_MOTIF_RESOURCES_DIR_CLOSED = $(JDK_TOPDIR)/src/closed/share/classes/com/sun/java/swing/plaf/motif
-  COPY_FILES += \
-      $(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR_CLOSED)/icons/*.gif) \
-      $(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR_CLOSED)/icons/*.png)
-endif
-
-SWING_PLAF_METAL_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/javax/swing/plaf/metal
-COPY_FILES += \
-    $(wildcard $(SWING_PLAF_METAL_RESOURCES_DIR)/icons/*.gif) \
-    $(wildcard $(SWING_PLAF_METAL_RESOURCES_DIR)/icons/*.png) \
-    $(wildcard $(SWING_PLAF_METAL_RESOURCES_DIR)/icons/ocean/*.gif) \
-    $(wildcard $(SWING_PLAF_METAL_RESOURCES_DIR)/icons/ocean/*.png) \
-    $(wildcard $(SWING_PLAF_METAL_RESOURCES_DIR)/sounds/*.wav)
-
-ifneq ($(OPENJDK_TARGET_OS), windows)
-  # Only copy GTK resources on Solaris/Linux
-  SWING_PLAF_GTK_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/gtk
-  COPY_FILES += \
-      $(wildcard $(SWING_PLAF_GTK_RESOURCES_DIR)/icons/*.gif) \
-      $(wildcard $(SWING_PLAF_GTK_RESOURCES_DIR)/icons/*.png) \
-      $(wildcard $(SWING_PLAF_GTK_RESOURCES_DIR)/resources/metacity/SwingFallbackTheme/metacity-1/*.xml)
-endif
-# END: Swing plaf resources
-
 SWING_BEANINFO_RESOURCES_SRC_DIR = $(JDK_TOPDIR)/make/data/swingbeaninfo/images
 SWING_BEANINFO_RESOURCES_SRC = $(wildcard $(SWING_BEANINFO_RESOURCES_SRC_DIR)/*.gif)
 OUT_BEANINFO_RESOURCES = $(patsubst $(SWING_BEANINFO_RESOURCES_SRC_DIR)%, \
@@ -147,13 +79,13 @@
     $(SWING_BEANINFO_RESOURCES_SRC))
 
 COPY_EXTRA += $(OUT_BEANINFO_RESOURCES)
-# END: Swing beaninfo resources
 
-# Swing text resources
-SWING_TEXT_RESOURCEDIR = $(JDK_TOPDIR)/src/share/classes/javax/swing/text
-COPY_FILES += \
-    $(SWING_TEXT_RESOURCEDIR)/html/default.css \
-    $(wildcard $(SWING_TEXT_RESOURCEDIR)/rtf/charsets/*.txt)
+# The exception handling of swing beaninfo
+# These resources violates the convention of having code and resources together under
+# $(JDK_TOPDIR)/src/.../classes directories
+$(JDK_OUTPUTDIR)/classes/javax/swing/beaninfo/images/%.gif: \
+    $(JDK_TOPDIR)/make/data/swingbeaninfo/images/%.gif
+	$(call install-file)
 
 ##########################################################################################
 #
@@ -222,14 +154,7 @@
 COPY_EXTRA += $(OUT_SERVICES_FILES)
 COPY_EXTRA += $(OUT_SERVICES_FILES_PRINT)
 
-###
-
-$(JDK_OUTPUTDIR)/classes/sun/nio/cs/ext/sjis0213.dat: $(JDK_OUTPUTDIR)/gensrc/sun/nio/cs/ext/sjis0213.dat
-	$(call install-file)
-
-COPY_EXTRA += $(JDK_OUTPUTDIR)/classes/sun/nio/cs/ext/sjis0213.dat
-
-###
+################################################################################
 
 JAVAX_SOUND_SRC := $(JDK_TOPDIR)/src/share/classes/com/sun/media/sound/services
 
@@ -248,3 +173,30 @@
 JAVAX_SOUND_RULES := $(foreach F, $(JAVAX_SOUND_SRC_FILES), $(JDK_OUTPUTDIR)/classes/META-INF/services/$(notdir $F):$(JAVAX_SOUND_SRC)/$F)
 
 $(foreach R, $(JAVAX_SOUND_RULES), $(eval $(call addto_meta-inf_services, $R)))
+
+################################################################################
+
+CLEAN_FILES := $(wildcard \
+    $(JDK_TOPDIR)/src/share/classes/com/sun/imageio/plugins/common/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/com/sun/java/util/jar/pack/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/com/sun/jndi/cosnaming/jndiprovider.properties \
+    $(JDK_TOPDIR)/src/share/classes/com/sun/jndi/ldap/jndiprovider.properties \
+    $(JDK_TOPDIR)/src/share/classes/com/sun/org/apache/xml/internal/security/resource/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/com/sun/rowset/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/com/sun/tools/script/shell/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/javax/sql/rowset/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/sun/rmi/registry/resources/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/sun/rmi/rmic/resources/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/sun/rmi/server/resources/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/sun/tools/javac/resources/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/sun/tools/jconsole/resources/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/sun/tools/serialver/resources/*.properties \
+    )
+
+# Copy zh_HK files from zh_TW
+
+$(JDK_OUTPUTDIR)/classes/%_zh_HK.properties: $(JDK_OUTPUTDIR)/classes/%_zh_TW.properties
+	$(install-file)
+
+COPY_EXTRA += $(patsubst $(JDK_TOPDIR)/src/share/classes/%, $(JDK_OUTPUTDIR)/classes/%, \
+    $(subst _zh_TW,_zh_HK, $(filter %_zh_TW.properties, $(CLEAN_FILES))))
--- a/jdk/make/CreateJars.gmk	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/make/CreateJars.gmk	Tue Apr 01 15:37:15 2014 +0200
@@ -30,9 +30,6 @@
 
 default: all
 
-# Prepare the find cache. Only used if running on windows.
-$(eval $(call FillCacheFind, $(JDK_OUTPUTDIR)/classes))
-
 include Tools.gmk
 
 include Profiles.gmk
--- a/jdk/make/Images.gmk	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/make/Images.gmk	Tue Apr 01 15:37:15 2014 +0200
@@ -30,7 +30,7 @@
 
 default: images
 
-# Prepare the find cache. Only used if running on windows.
+# Prepare the find cache.
 $(eval $(call FillCacheFind, \
     $(wildcard $(JDK_OUTPUTDIR)/bin \
         $(JDK_OUTPUTDIR)/lib \
--- a/jdk/make/Import.gmk	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/make/Import.gmk	Tue Apr 01 15:37:15 2014 +0200
@@ -252,7 +252,7 @@
 	$(ECHO) Unzipping $(<F)
 	$(MKDIR) -p $(@D)
 	$(RM) $@
-	($(CD) $(JDK_OUTPUTDIR) && $(UNZIP) $< > $@.tmp)
+	($(CD) $(JDK_OUTPUTDIR) && $(UNZIP) -q -o $< > $@.tmp)
 	$(MV) $@.tmp $@
 endef
 
--- a/jdk/make/Setup.gmk	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/make/Setup.gmk	Tue Apr 01 15:37:15 2014 +0200
@@ -38,7 +38,7 @@
 # boot jdk to generate tools that need to be run with the boot jdk.
 # Thus we force the target bytecode to the previous JDK version.
 $(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
-    JVM := $(JAVA), \
+    JVM := $(JAVA_SMALL), \
     JAVAC := $(NEW_JAVAC), \
     FLAGS := $(BOOT_JDK_SOURCETARGET) -bootclasspath $(BOOT_RTJAR) $(DISABLE_WARNINGS), \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
@@ -60,7 +60,7 @@
 # I.e. the rt.jar, but since rt.jar has not yet been generated
 # (it will be in "make images") therefore we use classes instead.
 $(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE, \
-    JVM := $(JAVA), \
+    JVM := $(JAVA_SMALL), \
     JAVAC := $(NEW_JAVAC), \
     FLAGS := -bootclasspath $(JDK_OUTPUTDIR)/classes $(DISABLE_WARNINGS), \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
--- a/jdk/make/Tools.gmk	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/make/Tools.gmk	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 # questions.
 #
 
-# Cache all finds needed for this file. Only used on windows.
+# Cache all finds needed for this file.
 $(eval $(call FillCacheFind, $(JDK_TOPDIR)/make/src/classes))
 
 # The exception handling of swing beaninfo which have the own tool directory
@@ -48,79 +48,76 @@
 BUILD_TOOLS += $(JDK_OUTPUTDIR)/btclasses/build/tools/deps/refs.allowed
 
 # Add a checksum ("jsum") to the end of a text file. Prevents trivial tampering with class lists.
-TOOL_ADDJSUM = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_ADDJSUM = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.addjsum.AddJsum
 
 # The buildmetaindex tool creates a meta-index to make core class loaders lazier.
-TOOL_BUILDMETAINDEX = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_BUILDMETAINDEX = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.buildmetaindex.BuildMetaIndex
 
-TOOL_COMPILEFONTCONFIG = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_COMPILEFONTCONFIG = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.compilefontconfig.CompileFontConfig
 
-TOOL_COMPILEPROPERTIES = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_COMPILEPROPERTIES = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.compileproperties.CompileProperties
 
-TOOL_STRIPPROPERTIES = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
-    build.tools.stripproperties.StripProperties
-
-TOOL_JARREORDER = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_JARREORDER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.jarreorder.JarReorder
 
-TOOL_GENERATECHARACTER = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_GENERATECHARACTER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.generatecharacter.GenerateCharacter
 
-TOOL_CHARACTERNAME = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_CHARACTERNAME = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.generatecharacter.CharacterName
 
-TOOL_DTDBUILDER = $(JAVA) -Ddtd_home=$(JDK_TOPDIR)/make/data/dtdbuilder \
+TOOL_DTDBUILDER = $(JAVA_SMALL) -Ddtd_home=$(JDK_TOPDIR)/make/data/dtdbuilder \
     -cp $(JDK_OUTPUTDIR)/btclasses build.tools.dtdbuilder.DTDBuilder
 
-TOOL_GENERATEBREAKITERATORDATA = $(JAVA) \
+TOOL_GENERATEBREAKITERATORDATA = $(JAVA_SMALL) \
     -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.generatebreakiteratordata.GenerateBreakIteratorData
 
-TOOL_GENERATECURRENCYDATA = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_GENERATECURRENCYDATA = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.generatecurrencydata.GenerateCurrencyData
 
-TOOL_HASHER = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_HASHER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.hasher.Hasher
 
-TOOL_TZDB = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_TZDB = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.tzdb.TzdbZoneRulesCompiler
 
 
 # TODO: There are references to the jdwpgen.jar in jdk/make/netbeans/jdwpgen/build.xml
 # and nbproject/project.properties in the same dir. Needs to be looked at.
-TOOL_JDWPGEN = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.jdwpgen.Main
+TOOL_JDWPGEN = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.jdwpgen.Main
 
 # TODO: Lots of files in jdk/make/tools/CharsetMapping dir
-TOOL_CHARSETMAPPING = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_CHARSETMAPPING = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.charsetmapping.Main $(LOG_INFO)
 
-TOOL_SPP = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.spp.Spp
+TOOL_SPP = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.spp.Spp
 
 # Nimbus is used somewhere in the swing build.
-TOOL_GENERATENIMBUS = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_GENERATENIMBUS = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.generatenimbus.Generator
 
-TOOL_WRAPPERGENERATOR = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_WRAPPERGENERATOR = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.x11wrappergen.WrapperGenerator
 
-TOOL_AWT_TOBIN = $(JAVA) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_AWT_TOBIN = $(JAVA_SMALL) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.icondata.awt.ToBin
 
-TOOL_OSX_TOBIN = $(JAVA) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_OSX_TOBIN = $(JAVA_SMALL) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.icondata.osxapp.ToBin
 
-TOOL_CLDRCONVERTER = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_CLDRCONVERTER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.cldrconverter.CLDRConverter
 
-TOOL_CHECKDEPS = $(JAVA) -Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR) \
+TOOL_CHECKDEPS = $(JAVA_SMALL) -Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR) \
     -cp $(JDK_OUTPUTDIR)/btclasses:$(JDK_OUTPUTDIR) \
     build.tools.deps.CheckDeps
 
-TOOL_ADDTORESTRICTEDPKGS=$(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_ADDTORESTRICTEDPKGS = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.addtorestrictedpkgs.AddToRestrictedPkgs
 
 ##########################################################################################
--- a/jdk/make/data/tzdata/VERSION	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/make/data/tzdata/VERSION	Tue Apr 01 15:37:15 2014 +0200
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2013i
+tzdata2014a
--- a/jdk/make/data/tzdata/asia	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/make/data/tzdata/asia	Tue Apr 01 15:37:15 2014 +0200
@@ -1113,8 +1113,13 @@
 Rule	Zion	1986	only	-	Sep	 7	0:00	0	S
 Rule	Zion	1987	only	-	Apr	15	0:00	1:00	D
 Rule	Zion	1987	only	-	Sep	13	0:00	0	S
-Rule	Zion	1988	only	-	Apr	 9	0:00	1:00	D
-Rule	Zion	1988	only	-	Sep	 3	0:00	0	S
+
+# From Avigdor Finkelstein (2014-03-05):
+# I check the Parliament (Knesset) records and there it's stated that the
+# [1988] transition should take place on Saturday night, when the Sabbath
+# ends and changes to Sunday.
+Rule	Zion	1988	only	-	Apr	10	0:00	1:00	D
+Rule	Zion	1988	only	-	Sep	 4	0:00	0	S
 
 # From Ephraim Silverberg
 # (1997-03-04, 1998-03-16, 1998-12-28, 2000-01-17, 2000-07-25, 2004-12-22,
--- a/jdk/make/data/tzdata/australasia	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/make/data/tzdata/australasia	Tue Apr 01 15:37:15 2014 +0200
@@ -377,16 +377,18 @@
 # http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=6702&catid=71&Itemid=155
 
 # From the Fijian Government Media Center (2013-08-30) via David Wheeler:
-# Fiji will start daylight savings on Sunday 27th October, 2013 and end at 3am
-# on Sunday 19th January, 2014....  move clocks forward by one hour from 2am
+# Fiji will start daylight savings on Sunday 27th October, 2013 ...
+# move clocks forward by one hour from 2am
 # http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVING-STARTS-ON-SUNDAY,-27th-OCTOBER-201.aspx
-#
-# From Paul Eggert (2013-09-09):
+
+# From Steffen Thorsen (2013-01-10):
+# Fiji will end DST on 2014-01-19 02:00:
+# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVINGS-TO-END-THIS-MONTH-%281%29.aspx
+
+# From Paul Eggert (2014-01-10):
 # For now, guess that Fiji springs forward the Sunday before the fourth
-# Monday in October.  This matches both recent practice and
-# timeanddate.com's current spring-forward prediction.
-# For the January 2014 transition we guessed right while timeanddate.com
-# guessed wrong, so leave the fall-back prediction alone.
+# Monday in October, and springs back the penultimate Sunday in January.
+# This is ad hoc, but matches recent practice.
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Fiji	1998	1999	-	Nov	Sun>=1	2:00	1:00	S
@@ -395,7 +397,8 @@
 Rule	Fiji	2010	only	-	Mar	lastSun	3:00	0	-
 Rule	Fiji	2010	max	-	Oct	Sun>=21	2:00	1:00	S
 Rule	Fiji	2011	only	-	Mar	Sun>=1	3:00	0	-
-Rule	Fiji	2012	max	-	Jan	Sun>=18	3:00	0	-
+Rule	Fiji	2012	2013	-	Jan	Sun>=18	3:00	0	-
+Rule	Fiji	2014	max	-	Jan	Sun>=18	2:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Pacific/Fiji	11:55:44 -	LMT	1915 Oct 26	# Suva
 			12:00	Fiji	FJ%sT	# Fiji Time
--- a/jdk/make/data/tzdata/europe	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/make/data/tzdata/europe	Tue Apr 01 15:37:15 2014 +0200
@@ -2768,14 +2768,18 @@
 # According to the articles linked below, Turkey will change into summer
 # time zone (GMT+3) on March 28, 2011 at 3:00 a.m. instead of March 27.
 # This change is due to a nationwide exam on 27th.
-#
-# <a href="http://www.worldbulletin.net/?aType=haber&ArticleID=70872">
 # http://www.worldbulletin.net/?aType=haber&ArticleID=70872
-# </a>
 # Turkish:
-# <a href="http://www.hurriyet.com.tr/ekonomi/17230464.asp?gid=373">
 # http://www.hurriyet.com.tr/ekonomi/17230464.asp?gid=373
-# </a>
+
+# From Faruk Pasin (2014-02-14):
+# The DST for Turkey has been changed for this year because of the
+# Turkish Local election....
+# http://www.sabah.com.tr/Ekonomi/2014/02/12/yaz-saatinde-onemli-degisiklik
+# ... so Turkey will move clocks forward one hour on March 31 at 3:00 a.m.
+# From Paul Eggert (2014-02-17):
+# Here is an English-language source:
+# http://www.worldbulletin.net/turkey/129016/turkey-switches-to-daylight-saving-time-march-31
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Turkey	1916	only	-	May	 1	0:00	1:00	S
@@ -2844,6 +2848,8 @@
 			2:00	Turkey	EE%sT	2007
 			2:00	EU	EE%sT	2011 Mar 27 1:00u
 			2:00	-	EET	2011 Mar 28 1:00u
+			2:00	EU	EE%sT	2014 Mar 30 1:00u
+			2:00	-	EET	2014 Mar 31 1:00u
 			2:00	EU	EE%sT
 Link	Europe/Istanbul	Asia/Istanbul	# Istanbul is in both continents.
 
@@ -2865,19 +2871,13 @@
 # approval from 266 deputies.
 #
 # Ukraine abolishes transter back to the winter time (in Russian)
-# <a href="http://news.mail.ru/politics/6861560/">
 # http://news.mail.ru/politics/6861560/
-# </a>
 #
 # The Ukrainians will no longer change the clock (in Russian)
-# <a href="http://www.segodnya.ua/news/14290482.html">
 # http://www.segodnya.ua/news/14290482.html
-# </a>
 #
 # Deputies cancelled the winter time (in Russian)
-# <a href="http://www.pravda.com.ua/rus/news/2011/09/20/6600616/">
 # http://www.pravda.com.ua/rus/news/2011/09/20/6600616/
-# </a>
 #
 # From Philip Pizzey (2011-10-18):
 # Today my Ukrainian colleagues have informed me that the
@@ -2888,18 +2888,39 @@
 # As far as I understand, the recent change to the Ukrainian time zone
 # (Europe/Kiev) to introduce permanent daylight saving time (similar
 # to Russia) was reverted today:
-#
-# <a href="http://portal.rada.gov.ua/rada/control/en/publish/article/info_left?art_id=287324&cat_id=105995">
 # http://portal.rada.gov.ua/rada/control/en/publish/article/info_left?art_id=287324&cat_id=105995
-# </a>
 #
 # Also reported by Alexander Bokovoy (2011-10-18) who also noted:
 # The law documents themselves are at
+# http://w1.c1.rada.gov.ua/pls/zweb_n/webproc4_1?id=&pf3511=41484
+
+# From Vladimir in Moscow via Alois Treindl re Kiev time 1991/2 (2014-02-28):
+# First in Ukraine they changed Time zone from UTC+3 to UTC+2 with DST:
+#       03 25 1990 02:00 -03.00 1       Time Zone 3 with DST
+#       07 01 1990 02:00 -02.00 1       Time Zone 2 with DST
+# * Ukrainian Government's Resolution of 18.06.1990, No. 134.
+# http://search.ligazakon.ua/l_doc2.nsf/link1/T001500.html
 #
-# <a href="http://w1.c1.rada.gov.ua/pls/zweb_n/webproc4_1?id=&pf3511=41484">
-# http://w1.c1.rada.gov.ua/pls/zweb_n/webproc4_1?id=&pf3511=41484
-# </a>
-
+# They did not end DST in September, 1990 (according to the law,
+# "summer time" was still in action):
+#       09 30 1990 03:00 -02.00 1       Time Zone 2 with DST
+# * Ukrainian Government's Resolution of 21.09.1990, No. 272.
+# http://search.ligazakon.ua/l_doc2.nsf/link1/KP900272.html
+#
+# Again no change in March, 1991 ("summer time" in action):
+#       03 31 1991 02:00 -02.00 1       Time Zone 2 with DST
+#
+# DST ended in September 1991 ("summer time" ended):
+#       09 29 1991 03:00 -02.00 0       Time Zone 2, no DST
+# * Ukrainian Government's Resolution of 25.09.1991, No. 225.
+# http://www.uazakon.com/documents/date_21/pg_iwgdoc.htm
+# This is an answer.
+#
+# Since 1992 they had normal DST procedure:
+#       03 29 1992 02:00 -02.00 1       DST started
+#       09 27 1992 03:00 -02.00 0       DST ended
+# * Ukrainian Government's Resolution of 20.03.1992, No. 139.
+# http://www.uazakon.com/documents/date_8u/pg_grcasa.htm
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 # Most of Ukraine since 1970 has been like Kiev.
@@ -2910,9 +2931,8 @@
 			2:00	-	EET	1930 Jun 21
 			3:00	-	MSK	1941 Sep 20
 			1:00	C-Eur	CE%sT	1943 Nov  6
-			3:00	Russia	MSK/MSD	1990
-			3:00	-	MSK	1990 Jul  1 2:00
-			2:00	-	EET	1992
+			3:00	Russia	MSK/MSD	1990 Jul  1 2:00
+			2:00	1:00	EEST	1991 Sep 29 3:00
 			2:00	E-Eur	EE%sT	1995
 			2:00	EU	EE%sT
 # Ruthenia used CET 1990/1991.
--- a/jdk/make/data/tzdata/northamerica	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/make/data/tzdata/northamerica	Tue Apr 01 15:37:15 2014 +0200
@@ -414,9 +414,10 @@
 # US Pacific time, represented by Los Angeles
 #
 # California, northern Idaho (Benewah, Bonner, Boundary, Clearwater,
-# Idaho, Kootenai, Latah, Lewis, Nez Perce, and Shoshone counties,
-# and the northern three-quarters of Idaho county),
-# most of Nevada, most of Oregon, and Washington
+# Kootenai, Latah, Lewis, Nez Perce, and Shoshone counties, Idaho county
+# north of the Salmon River, and the towns of Burgdorf and Warren),
+# Nevada (except West Wendover), Oregon (except the northern 3/4 of
+# Malheur county), and Washington
 #
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
 Rule	CA	1948	only	-	Mar	14	2:00	1:00	D
--- a/jdk/make/data/tzdata/southamerica	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/make/data/tzdata/southamerica	Tue Apr 01 15:37:15 2014 +0200
@@ -1298,6 +1298,13 @@
 # start date is 2013-09-08 00:00....
 # http://www.gob.cl/informa/2013/02/15/gobierno-anuncia-fechas-de-cambio-de-hora-para-el-ano-2013.htm
 
+# From Jose Miguel Garrido (2014-02-19):
+# Today appeared in the Diario Oficial a decree amending the time change
+# dates to 2014.
+# DST End: last Saturday of April 2014 (Sun 27 Apr 2014 03:00 UTC)
+# DST Start: first Saturday of September 2014 (Sun 07 Sep 2014 04:00 UTC)
+# http://www.diariooficial.interior.gob.cl//media/2014/02/19/do-20140219.pdf
+
 # NOTE: ChileAQ rules for Antarctic bases are stored separately in the
 # 'antarctica' file.
 
@@ -1631,6 +1638,9 @@
 # From Carlos Raul Perasso (2013-03-15):
 # The change in Paraguay is now final.  Decree number 10780
 # http://www.presidencia.gov.py/uploads/pdf/presidencia-3b86ff4b691c79d4f5927ca964922ec74772ce857c02ca054a52a37b49afc7fb.pdf
+# From Carlos Raul Perasso (2014-02-28):
+# Decree 1264 can be found at:
+# http://www.presidencia.gov.py/archivos/documentos/DECRETO1264_ey9r8zai.pdf
 Rule	Para	2013	max	-	Mar	Sun>=22	0:00	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -1689,18 +1699,19 @@
 Zone America/Port_of_Spain -4:06:04 -	LMT	1912 Mar 2
 			-4:00	-	AST
 
+# These all agree with Trinidad and Tobago since 1970.
 Link America/Port_of_Spain America/Anguilla
 Link America/Port_of_Spain America/Dominica
 Link America/Port_of_Spain America/Grenada
 Link America/Port_of_Spain America/Guadeloupe
-Link America/Port_of_Spain America/Marigot
+Link America/Port_of_Spain America/Marigot	# St Martin (French part)
 Link America/Port_of_Spain America/Montserrat
 Link America/Port_of_Spain America/St_Barthelemy
-Link America/Port_of_Spain America/St_Kitts
+Link America/Port_of_Spain America/St_Kitts	# St Kitts & Nevis
 Link America/Port_of_Spain America/St_Lucia
-Link America/Port_of_Spain America/St_Thomas
+Link America/Port_of_Spain America/St_Thomas	# Virgin Islands (US)
 Link America/Port_of_Spain America/St_Vincent
-Link America/Port_of_Spain America/Tortola
+Link America/Port_of_Spain America/Tortola	# Virgin Islands (UK)
 
 # Uruguay
 # From Paul Eggert (1993-11-18):
--- a/jdk/make/gensrc/GensrcProperties.gmk	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/make/gensrc/GensrcProperties.gmk	Tue Apr 01 15:37:15 2014 +0200
@@ -23,8 +23,10 @@
 # questions.
 #
 
-# Prepare the find cache. This is only used on windows.
-$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/share/classes $(JDK_TOPDIR)/src/windows/classes))
+# Prepare the find cache.
+$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/share/classes \
+    $(JDK_TOPDIR)/src/windows/classes \
+    $(JDK_TOPDIR)/src/macosx/classes))
 
 # All .properties files to be compiled are appended to this variable.
 ALL_COMPILED_PROPSOURCES :=
@@ -33,19 +35,10 @@
 # The (very long) command line for compilation, stored in a file, prior to use.
 COMPILE_PROPCMDLINE :=
 
-# All .properties files to be cleaned are appended to this variable.
-ALL_CLEANED_PROPSOURCES :=
-# All generated cleaned .properties files from cleaning are appended to this variable.
-ALL_CLEANED_PROPOUTPUT :=
-# The (very long) command line for cleaning, stored in a file, prior to use.
-CLEAN_PROPCMDLINE :=
-
 define add_properties_to_compile
   # $1 is the name of the properties group
   # $2 is the files belonging to this group
   # $3 is the super class for the generated java file.
-  # $4 is a from pattern for translating stripped name from source to target
-  # $5 is the to pattern replacing $3 in the target
 
   # Strip away prefix and suffix,
   # leaving for example: sun/util/resources/CurrencyNames_sv
@@ -53,16 +46,14 @@
       $$(patsubst $(JDK_TOPDIR)/src/macosx/classes/%.properties, %, \
       $$(patsubst $(JDK_TOPDIR)/src/share/classes/%.properties, %, $2)))
 
-  # Apply optional name transformation, example: hz_TW -> hz_HK
-  $(if $4, $1_PROPPATHS := $$(patsubst $4, $5, $$($1_PROPPATHS)))
-
   # Accumulate all found properties files.
   ALL_COMPILED_PROPSOURCES += $2
 
   # Generate the list of to be created java files.
   ALL_COMPILED_PROPJAVAS += $$(patsubst %, $(JDK_OUTPUTDIR)/gensrc/%.java, $$($1_PROPPATHS))
 
-  # Now generate a sequence of "-compile ...CurrencyNames_sv.properties ...CurrencyNames_sv.java ListResourceBundle"
+  # Now generate a sequence of 
+  # "-compile ...CurrencyNames_sv.properties ...CurrencyNames_sv.java ListResourceBundle"
   # suitable to be fed into the CompileProperties command.
   COMPILE_PROPCMDLINE += $$(subst _SPACE_,$(SPACE),$$(join $$(addprefix -compile_SPACE_, $2), \
       $$(addsuffix _SPACE_$(strip $3), \
@@ -70,290 +61,55 @@
       $$(addsuffix .java, $$($1_PROPPATHS))))))
 endef
 
-define add_properties_to_clean
-  # $1 is the name of the properties group
-  # $2 is the files belonging to this group
-  # $3 is a from pattern for translating stripped name from source to target
-  # $4 is the to pattern replacing $3 in the target
-  # $5 optional name of extra directory to put properties files in (ex: resources)
-
-  # Strip away prefix and suffix,
-  # leaving for example: sun/util/resources/CurrencyNames_sv
-  $1_PROPPATHS := $$(patsubst $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes/%.properties, %, \
-      $$(patsubst $(JDK_TOPDIR)/src/share/classes/%.properties, %, $2))
-
-  # Apply optional name transformation, example: hz_TW -> hz_HK
-  $(if $3, $1_PROPPATHS := $$(patsubst $3, $4, $$($1_PROPPATHS)))
-
-  # Accumulate all found properties files.
-  ALL_CLEANED_PROPSOURCES += $2
-
-  # Generate the list of to be created java files.
-  $1_PROPOUTPUT := $$(patsubst %, $(JDK_OUTPUTDIR)/classes/%.properties, $$($1_PROPPATHS))
-  # If the properties target file isn't in a "resources" dir, add one.
-  ifneq ($5, )
-    $1_PROPOUTPUT := $$(foreach p, $$($1_PROPOUTPUT), $$(dir $$p)$5/$$(notdir $$p))
-  endif
-
-  ALL_CLEANED_PROPOUTPUT += $$($1_PROPOUTPUT)
+################################################################################
+# Some packages have properties that need to be converted to java source files.
+COMPILE_PROP_SRC_FILES := \
+    $(filter %.properties, $(call CacheFind, \
+        $(JDK_TOPDIR)/src/share/classes/com/sun/accessibility/internal/resources \
+        $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif/resources \
+        $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows/resources \
+        $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/basic/resources \
+        $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/metal/resources \
+        $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/synth/resources \
+        $(JDK_TOPDIR)/src/share/classes/com/sun/tools/jdi/resources \
+        $(JDK_TOPDIR)/src/share/classes/sun/awt/resources \
+        $(JDK_TOPDIR)/src/share/classes/sun/launcher/resources \
+        $(JDK_TOPDIR)/src/share/classes/sun/management/resources \
+        $(JDK_TOPDIR)/src/share/classes/sun/print/resources \
+        $(JDK_TOPDIR)/src/share/classes/sun/tools/jar/resources \
+        $(JDK_TOPDIR)/src/share/classes/sun/util/logging/resources)) \
+    #
 
-  # Now generate a sequence of "-clean ...[src]...CurrencyNames_sv.properties ...[build]...CurrencyNames_sv.properties"
-  # suitable to be fed into the StripProperties command.
-  CLEAN_PROPCMDLINE += $$(subst _SPACE_,$(SPACE),$$(join $$(addprefix -clean_SPACE_,$2), \
-      $$(addprefix _SPACE_, $$($1_PROPOUTPUT))))
-endef
-
-# Some packages contain pregenerated java files instead of properties files.
-# But unfortunately not all properties should be converted, some should be
-# copied....argggghhh.
-
-# For example:
-#    sun/applet/resources
-#    sun/misc/resources
-#    sun/text/resources
-#    sun/tools/jconsole/resources
-#    sun/tools/native2ascii/resources
-#    sun/util/resources
-
-# Some packages have properties that need to be converted to java source files.
-
-#com/apple/laf/resources
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-  $(eval $(call add_properties_to_compile,COM_APPLE_LAF, \
-      $(filter %.properties, \
-      $(call CacheFind, $(JDK_TOPDIR)/src/macosx/classes/com/apple/laf/resources)), \
-      ListResourceBundle))
+  COMPILE_PROP_SRC_FILES += \
+      $(filter %.properties, $(call CacheFind, \
+          $(JDK_TOPDIR)/src/macosx/classes/com/apple/laf/resources \
+          $(JDK_TOPDIR)/src/macosx/classes/sun/awt/resources)) \
+      #
 endif
 
-#com/sun/accessibility/internal/resources
-$(eval $(call add_properties_to_compile,COM_SUN_ACCESSIBILITY, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/accessibility/internal/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,COM_SUN_ACCESSIBILITY_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/accessibility/internal/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-#com/sun/imageio/plugins/common
-$(eval $(call add_properties_to_clean,COM_SUN_IMAGEIO, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/imageio))))
-#com/sun/java/swing/plaf/gtk/resources
-ifneq ($(OPENJDK_TARGET_OS), windows)
-  # Only compile GTK resource bundles on Solaris/Linux
-  $(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_GTK, \
-      $(filter %.properties, \
-      $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/gtk/resources)), \
-      ListResourceBundle))
-  $(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_GTK_HK, \
-      $(filter %.properties, \
-      $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/gtk/resources)), \
-      ListResourceBundle, %zh_TW, %zh_HK))
-endif
-#com/sun/java/swing/plaf/motif/resources
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_MOTIF, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_MOTIF_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-#com/sun/java/swing/plaf/windows/resources
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_WINDOWS, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_WINDOWS_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-#com/sun/java/util/jar/pack
-$(eval $(call add_properties_to_clean,JNDI_COSNAMING, \
-    $(JDK_TOPDIR)/src/share/classes/com/sun/java/util/jar/pack/intrinsic.properties))
-#com/sun/jndi/cosnaming
-$(eval $(call add_properties_to_clean,JNDI_COSNAMING, \
-    $(JDK_TOPDIR)/src/share/classes/com/sun/jndi/cosnaming/jndiprovider.properties))
-#com/sun/jndi/ldap
-$(eval $(call add_properties_to_clean,JNDI_COSNAMING, \
-    $(JDK_TOPDIR)/src/share/classes/com/sun/jndi/ldap/jndiprovider.properties))
-
-#com/sun/org/apache/xml/internal/security/resource
-#FIXME: The "xmlsecurity*.properties" pattern is not ideal; we might want to find
-#a better way to select the properties files that are needed.
-$(eval $(call add_properties_to_clean,XML_SECURITY, \
-    $(filter $(JDK_TOPDIR)/src/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity%.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/org/apache/xml/internal/security/resource))))
-
-#com/sun/rowset
-$(eval $(call add_properties_to_clean,COM_SUN_ROWSET, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/rowset))))
-$(eval $(call add_properties_to_clean,COM_SUN_ROWSET_HK, \
-    $(filter %zh_TW.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/rowset)), \
-    %zh_TW, %zh_HK))
-
-#com/sun/swing/internal/plaf/basic/resources
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_BASIC, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/basic/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_BASIC_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/basic/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-#com/sun/swing/internal/plaf/metal/resources
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_METAL, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/metal/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_METAL_HK, \
-    $(filter %.properties, $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/metal/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-#com/sun/swing/internal/plaf/synth/resources
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_SYNTH, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/synth/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_SYNTH_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/synth/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-
-#com/sun/tools/jdi/resources
-$(eval $(call add_properties_to_compile,COM_SUN_TOOLS_JDI, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/tools/jdi/resources)), \
-    ListResourceBundle))
-
-#com/sun/tools/script/shell
-#java/util
-#javax/sql/rowset
-$(eval $(call add_properties_to_clean,JAVAX_SQL_ROWSET, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/javax/sql/rowset))))
-#sun/awt/resources
-$(eval $(call add_properties_to_compile,SUN_AWT, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/awt/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,SUN_AWT_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/awt/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-#sun/awt/windows/
 ifeq ($(OPENJDK_TARGET_OS), windows)
-  $(eval $(call add_properties_to_compile,SUN_AWT, \
-      $(filter $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows/awtLocalization%.properties, \
-      $(call CacheFind, $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows)), \
-      ListResourceBundle))
-  $(eval $(call add_properties_to_compile,SUN_AWT_HK, \
-      $(filter $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows/awtLocalization%.properties, \
-      $(call CacheFind, $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows)), \
-      ListResourceBundle, %zh_TW, %zh_HK))
-endif
-# os x specific awt properties
-ifeq ($(OPENJDK_TARGET_OS),macosx)
-$(eval $(call add_properties_to_compile,SUN_AWT,\
-	$(filter $(JDK_TOPDIR)/src/macosx/classes/sun/awt/resources/%.properties,\
-	$(call CacheFind,$(JDK_TOPDIR)/src/macosx/classes/sun/awt/resources)),\
-	ListResourceBundle))
+  COMPILE_PROP_SRC_FILES += \
+      $(filter %.properties, $(call CacheFind, \
+          $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows)) \
+      #
+else # ! windows
+  COMPILE_PROP_SRC_FILES += \
+      $(filter %.properties, $(call CacheFind, \
+          $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/gtk/resources)) \
+      #
 endif
 
-#sun/launcher/resources
-$(eval $(call add_properties_to_compile,SUN_LAUNCHER, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/launcher/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,SUN_LAUNCHER_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/launcher/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-#sun/management/resources
-$(eval $(call add_properties_to_compile,SUN_MANAGEMENT, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/management/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,SUN_MANAGEMENT_KH, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/management/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-#sun/print
-#sun/print/resources
-$(eval $(call add_properties_to_compile,SUN_PRINT, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/print/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,SUN_PRINT_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/print/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-#sun/rmi/registry/resources
-$(eval $(call add_properties_to_clean,SUN_RMI_REGISTRY, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/rmi/registry/resources))))
-$(eval $(call add_properties_to_clean,SUN_RMI_REGISTRY_HK, \
-    $(filter %zh_TW.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/rmi/registry/resources)), \
-    %zh_TW, %zh_HK))
-
-#sun/rmi/rmic/resources
-$(eval $(call add_properties_to_clean,SUN_RMI_RMIC, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/rmi/rmic/resources))))
+$(eval $(call add_properties_to_compile,LIST_RESOURCE_BUNDLE, \
+    $(COMPILE_PROP_SRC_FILES), ListResourceBundle))
 
-#sun/rmi/server/resources
-$(eval $(call add_properties_to_clean,SUN_RMI_SERVER, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/rmi/server/resources))))
-$(eval $(call add_properties_to_clean,SUN_RMI_SERVER_HK, \
-    $(filter %zh_TW.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/rmi/server/resources)), \
-    %zh_TW, %zh_HK))
-
-# sun/tools/jar/resources
-$(eval $(call add_properties_to_compile,SUN_TOOLS_JAR, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/tools/jar/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,SUN_TOOLS_JAR_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/tools/jar/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-
-#sun/tools/javac/resources
-# It's unclear if the other localized property files here are supposed to be copied or not
-# but the old build system didn't copy them.
-$(eval $(call add_properties_to_clean,SUN_TOOLS_SERIALVER, \
-    $(filter %javac.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/tools/javac/resources))))
-
-#sun/tools/jconsole/resources
-$(eval $(call add_properties_to_clean,SUN_TOOLS_JCONSOLE, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/tools/jconsole/resources))))
-
-#sun/tools/serialver
-$(eval $(call add_properties_to_clean,SUN_TOOLS_SERIALVER, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/tools/serialver)), , ,resources))
-
-#sun/util/logging/resources
-$(eval $(call add_properties_to_compile,SUN_UTIL_LOGGING, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/util/logging/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,SUN_UTIL_LOGGING_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/util/logging/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
 # sun/util/resources
 $(eval $(call add_properties_to_compile,SUN_UTIL, \
     $(filter %.properties, \
     $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/util/resources)), \
     sun.util.resources.LocaleNamesBundle))
 
+################################################################################
 # Now setup the rule for the generation of the resource bundles.
 $(JDK_OUTPUTDIR)/gensrc/_the.compiled_properties: $(ALL_COMPILED_PROPSOURCES) $(BUILD_TOOLS)
         # Generate all output directories in advance since the build tool does not do that...
@@ -363,33 +119,31 @@
 	$(TOOL_COMPILEPROPERTIES) -quiet @$(JDK_OUTPUTDIR)/gensrc/_the.cmdline
 	$(TOUCH) $@
 
-# Now setup the rule for the generation of the cleaned properties.
-# FIXME: We currently don't handle removed properties incrementally.
-$(JDK_OUTPUTDIR)/classes/_the.cleaned_properties: $(ALL_CLEANED_PROPSOURCES) $(BUILD_TOOLS)
-	$(RM) $(JDK_OUTPUTDIR)/classes/_the.cleaned_properties.cmdline
-        # Generate all output directories in advance since the build tool does not do that...
-	$(MKDIR) -p $(sort $(dir $(ALL_CLEANED_PROPOUTPUT)))
-	$(ECHO) Copying and cleaning $(words $(ALL_CLEANED_PROPSOURCES)) properties
-	$(call ListPathsSafely,CLEAN_PROPCMDLINE,\n, >> $(JDK_OUTPUTDIR)/classes/_the.cleaned_properties.cmdline)
-	$(TOOL_STRIPPROPERTIES) @$(JDK_OUTPUTDIR)/classes/_the.cleaned_properties.cmdline
-	$(TOUCH) $@
-
 $(ALL_COMPILED_PROPJAVAS): $(JDK_OUTPUTDIR)/gensrc/_the.compiled_properties
 
-$(ALL_CLEANED_PROPOUTPUT): $(JDK_OUTPUTDIR)/classes/_the.cleaned_properties
-
+################################################################################
+# Some zh_HK resources are just copies of zh_TW
 
-# Some zh_HK resources are just copied of zh_TW
+define convert_tw_to_hk
+  $(MKDIR) -p $(@D)
+  $(CAT) $< | $(SED) -e '/class/s/_zh_TW/_zh_HK/' > $@
+endef
+
 $(JDK_OUTPUTDIR)/gensrc/%_zh_HK.java: $(JDK_TOPDIR)/src/share/classes/%_zh_TW.java
-	$(MKDIR) -p $(@D)
-	$(CAT) $< | $(SED) -e '/class/s/_zh_TW/_zh_HK/' > $@
+	$(call convert_tw_to_hk)
+
+$(JDK_OUTPUTDIR)/gensrc/%_zh_HK.java: $(JDK_OUTPUTDIR)/gensrc/%_zh_TW.java
+	$(call convert_tw_to_hk)
 
 ZH_HK_JAVA := sun/applet/resources/MsgAppletViewer_zh_HK.java \
     sun/misc/resources/Messages_zh_HK.java \
     sun/security/util/AuthResources_zh_HK.java \
     sun/security/util/Resources_zh_HK.java
 
-ZH_HK_JAVA_FILES := $(addprefix $(JDK_OUTPUTDIR)/gensrc/, $(ZH_HK_JAVA))
+ZH_HK_JAVA_FILES := $(addprefix $(JDK_OUTPUTDIR)/gensrc/, $(ZH_HK_JAVA)) \
+    $(filter-out $(JDK_OUTPUTDIR)/gensrc/sun/util/resources/zh/%, \
+    $(subst _zh_TW,_zh_HK,$(filter %_zh_TW.java, $(ALL_COMPILED_PROPJAVAS))))
 
+################################################################################
 
-GENSRC_PROPERTIES := $(ALL_COMPILED_PROPJAVAS) $(ALL_CLEANED_PROPOUTPUT) $(ZH_HK_JAVA_FILES)
+GENSRC_PROPERTIES := $(ALL_COMPILED_PROPJAVAS) $(ZH_HK_JAVA_FILES)
--- a/jdk/make/lib/Awt2dLibraries.gmk	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/make/lib/Awt2dLibraries.gmk	Tue Apr 01 15:37:15 2014 +0200
@@ -1196,7 +1196,6 @@
 ifndef BUILD_HEADLESS_ONLY
   LIBSPLASHSCREEN_DIRS := \
     $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg \
-    $(JDK_TOPDIR)/src/share/native/sun/awt/libpng \
     $(JDK_TOPDIR)/src/share/native/sun/awt/splashscreen
 
   ifeq ($(USE_EXTERNAL_LIBGIF), true)
@@ -1206,6 +1205,11 @@
     GIFLIB_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/giflib
   endif
 
+  ifeq ($(USE_EXTERNAL_LIBPNG), false)
+    LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/sun/awt/libpng
+    LIBPNG_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/libpng
+  endif
+
   ifneq ($(OPENJDK_TARGET_OS), macosx)
     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen
   else
@@ -1268,11 +1272,13 @@
       EXCLUDE_FILES := imageioJPEG.c jpegdecoder.c pngtest.c, \
       LANG := C, \
       OPTIMIZATION := LOW, \
-      CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) $(GIFLIB_CFLAGS), \
+      CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
+                $(GIFLIB_CFLAGS) $(PNG_CFLAGS), \
       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
-      LDFLAGS_SUFFIX := $(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ) $(GIFLIB_LDFLAGS), \
+      LDFLAGS_SUFFIX := $(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ) \
+                        $(GIFLIB_LDFLAGS) $(PNG_LIBS), \
       LDFLAGS_SUFFIX_solaris := -lc, \
       VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
       RC_FLAGS := $(RC_FLAGS) \
@@ -1315,6 +1321,7 @@
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LDFLAGS_SUFFIX := $(LIBM) $(LDFLAGS_JDKLIB_SUFFIX), \
+      LDFLAGS_SUFFIX_windows := $(WIN_JAVA_LIB), \
       LDFLAGS_SUFFIX_posix := -lm, \
       VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
       RC_FLAGS := $(RC_FLAGS) \
--- a/jdk/make/lib/ServiceabilityLibraries.gmk	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/make/lib/ServiceabilityLibraries.gmk	Tue Apr 01 15:37:15 2014 +0200
@@ -203,7 +203,6 @@
 ##########################################################################################
 
 LIBINSTRUMENT_SRC := $(JDK_TOPDIR)/src/share/instrument \
-    $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io \
     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/instrument
 
 LIBINSTRUMENT_FILES := \
@@ -218,9 +217,8 @@
     JavaExceptions.c \
     PathCharsValidator.c \
     Reentrancy.c \
-    Utilities.c \
-    canonicalize_md.c
-
+    Utilities.c
+    
 LIBINSTRUMENT_DIR := $(JDK_OUTPUTDIR)/objs/libinstrument
 LIBINSTRUMENT_CFLAGS := $(CFLAGS_JDKLIB) \
     -I$(JDK_TOPDIR)/src/share/instrument \
@@ -239,6 +237,8 @@
   LIBINSTRUMENT_CFLAGS := $(filter-out -MD, $(LIBINSTRUMENT_CFLAGS))
   # equivalent of strcasecmp is stricmp on Windows
   LIBINSTRUMENT_CFLAGS += -Dstrcasecmp=stricmp
+else
+  LIBINSTRUMENT_LDFLAGS_SUFFIX := -ljava
 endif
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBINSTRUMENT, \
--- a/jdk/make/src/classes/build/tools/stripproperties/StripProperties.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,288 +0,0 @@
-/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package build.tools.stripproperties;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedWriter;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-
-/**
- * Reads a properties file from standard input and writes an equivalent
- * properties file without comments to standard output.
- */
-public class StripProperties {
-
-    private static void error(String msg, Exception e) {
-        System.err.println("ERROR: stripproperties: " + msg);
-        if ( e != null ) {
-            System.err.println("EXCEPTION: " + e.toString());
-            e.printStackTrace();
-        }
-    }
-
-    private static List<String> infiles = new ArrayList<String>();
-    private static List<String> outfiles = new ArrayList<String>();
-
-    private static boolean parseOptions(String args[]) {
-        boolean ok = true;
-
-        for ( int i = 0; i < args.length ; i++ ) {
-            if ( "-clean".equals(args[i]) && i+2 < args.length ) {
-                infiles.add(args[++i]);
-                outfiles.add(args[++i]);
-            } else if ( args[i].charAt(0)=='@') {
-                String filename = args[i].substring(1);
-                FileInputStream finput = null;
-                byte contents[] = null;
-                try {
-                    finput = new FileInputStream(filename);
-                    int byteCount = finput.available();
-                    if ( byteCount <= 0 ) {
-                        error("The @file is empty", null);
-                        ok = false;
-                    } else {
-                        contents = new byte[byteCount];
-                        int bytesRead = finput.read(contents);
-                        if ( byteCount != bytesRead ) {
-                            error("Cannot read all of @file", null);
-                            ok = false;
-                        }
-                    }
-                } catch ( IOException e ) {
-                    error("cannot open " + filename, e);
-                    ok = false;
-                }
-                if ( finput != null ) {
-                    try {
-                        finput.close();
-                    } catch ( IOException e ) {
-                        ok = false;
-                        error("cannot close " + filename, e);
-                    }
-                }
-                if ( ok && contents != null ) {
-                    String tokens[] = (new String(contents)).split("\\s+");
-                    if ( tokens.length > 0 ) {
-                        ok = parseOptions(tokens);
-                    }
-                }
-                if ( !ok ) {
-                    break;
-                }
-            } else {
-                infiles.add(args[i]);
-                outfiles.add(args[i]);
-            }
-        }
-        return ok;
-    }
-
-    private static boolean stripFiles(List<String> infiles, List<String> outfiles) {
-        boolean ok = true;
-        Iterator<String> inIter  = infiles.iterator();
-        Iterator<String> outIter = outfiles.iterator();
-
-        for (; inIter.hasNext(); ) {
-            String infile = inIter.next();
-            String outfile = outIter.next();
-
-            Properties prop = new Properties();
-            InputStream in = null;
-            try {
-                in = new BufferedInputStream(new FileInputStream(infile));
-                prop.load(in);
-            } catch ( FileNotFoundException e ) {
-                error("Cannot access file " + infile, e);
-                ok = false;
-            } catch ( IOException e ) {
-                error("IO exception processing file " + infile, e);
-                ok = false;
-            }
-            if ( in != null ) {
-                try {
-                    in.close();
-                } catch ( IOException e ) {
-                    error("IO exception closing file " + infile, e);
-                    ok = false;
-                }
-            }
-            if ( !ok ) {
-                break;
-            }
-
-            OutputStream out = null;
-            try {
-                out = new FileOutputStream(outfile);
-                storeProperties(prop, out);
-                out.flush();
-            } catch ( IOException e ) {
-                error("IO exception processing file " + outfile, e);
-                ok = false;
-            }
-            if ( out != null ) {
-                try {
-                    out.close();
-                } catch ( IOException e ) {
-                    error("IO exception closing file " + outfile, e);
-                    ok = false;
-                }
-            }
-            if ( !ok ) {
-                break;
-            }
-
-        }
-        return ok;
-    }
-
-    /**
-     * Strip the properties filenames supplied, replacing their contents.
-     * @param args Names of properties files to process and replace contents
-     */
-    public static void main(String args[]) {
-        boolean ok = parseOptions(args);
-        if ( !ok || !stripFiles(infiles, outfiles) ) {
-            System.exit(1);
-        }
-    }
-
-    // --- code below here is adapted from java.util.Properties ---
-
-    private static final String specialSaveChars = "=: \t\r\n\f#!";
-
-    /*
-     * Converts unicodes to encoded &#92;uxxxx
-     * and writes out any of the characters in specialSaveChars
-     * with a preceding slash
-     */
-    private static String saveConvert(String theString, boolean escapeSpace) {
-        int len = theString.length();
-        StringBuffer outBuffer = new StringBuffer(len*2);
-
-        for(int x=0; x<len; x++) {
-            char aChar = theString.charAt(x);
-            switch(aChar) {
-                case ' ':
-                    if (x == 0 || escapeSpace) {
-                        outBuffer.append('\\');
-                    }
-                    outBuffer.append(' ');
-                    break;
-                case '\\':
-                    outBuffer.append('\\');
-                    outBuffer.append('\\');
-                    break;
-                case '\t':
-                    outBuffer.append('\\');
-                    outBuffer.append('t');
-                    break;
-                case '\n':
-                    outBuffer.append('\\');
-                    outBuffer.append('n');
-                    break;
-                case '\r':
-                    outBuffer.append('\\');
-                    outBuffer.append('r');
-                    break;
-                case '\f':
-                    outBuffer.append('\\');
-                    outBuffer.append('f');
-                    break;
-                default:
-                    if ((aChar < 0x0020) || (aChar == 0x007e) || (aChar > 0x00ff)) {
-                        outBuffer.append('\\');
-                        outBuffer.append('u');
-                        outBuffer.append(toHex((aChar >> 12) & 0xF));
-                        outBuffer.append(toHex((aChar >>  8) & 0xF));
-                        outBuffer.append(toHex((aChar >>  4) & 0xF));
-                        outBuffer.append(toHex( aChar        & 0xF));
-                    } else {
-                        if (specialSaveChars.indexOf(aChar) != -1) {
-                            outBuffer.append('\\');
-                        }
-                        outBuffer.append(aChar);
-                    }
-            }
-        }
-        return outBuffer.toString();
-    }
-
-    /**
-     * Writes the content of <code>properties</code> to <code>out</code>.
-     * The format is that of Properties.store with the following modifications:
-     * <ul>
-     * <li>No header or date is written
-     * <li>Latin-1 characters are written as single bytes, not escape sequences
-     * <li>Line breaks are indicated by a single \n independent of platform
-     * <ul>
-     */
-    private static void storeProperties(Properties properties, OutputStream out)
-    throws IOException {
-        BufferedWriter awriter;
-        awriter = new BufferedWriter(new OutputStreamWriter(out, "8859_1"));
-        for (Enumeration<Object> e = properties.keys(); e.hasMoreElements();) {
-            String key = (String)e.nextElement();
-            String val = (String)properties.get(key);
-            key = saveConvert(key, true);
-
-            /* No need to escape embedded and trailing spaces for value, hence
-             * pass false to flag.
-             */
-            val = saveConvert(val, false);
-            writeln(awriter, key + "=" + val);
-        }
-        awriter.flush();
-    }
-
-    private static void writeln(BufferedWriter bw, String s) throws IOException {
-        bw.write(s);
-        bw.write("\n");
-    }
-
-    /**
-     * Convert a nibble to a hex character
-     * @param   nibble  the nibble to convert.
-     */
-    private static char toHex(int nibble) {
-        return hexDigit[(nibble & 0xF)];
-    }
-
-    /** A table of hex digits */
-    private static final char[] hexDigit = {
-        '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
-    };
-}
--- a/jdk/src/macosx/classes/apple/laf/JRSUIUtils.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/apple/laf/JRSUIUtils.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,9 @@
 import com.apple.laf.AquaImageFactory.NineSliceMetrics;
 
 import apple.laf.JRSUIConstants.*;
+import sun.security.action.GetPropertyAction;
+
+import java.security.AccessController;
 
 public class JRSUIUtils {
     static boolean isLeopard = isMacOSXLeopard();
@@ -47,7 +50,7 @@
 
     static boolean currentMacOSXVersionMatchesGivenVersionRange(final int version, final boolean inclusive, final boolean matchBelow, final boolean matchAbove) {
         // split the "10.x.y" version number
-        String osVersion = System.getProperty("os.version");
+        String osVersion = AccessController.doPrivileged(new GetPropertyAction("os.version"));
         String[] fragments = osVersion.split("\\.");
 
         // sanity check the "10." part of the version
--- a/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java	Tue Apr 01 15:37:15 2014 +0200
@@ -42,7 +42,6 @@
 import javax.swing.plaf.*;
 import javax.swing.table.*;
 
-import sun.swing.AbstractFilterComboBoxModel;
 import sun.swing.SwingUtilities2;
 
 public class AquaFileChooserUI extends FileChooserUI {
@@ -1267,9 +1266,70 @@
     /**
      * Data model for a type-face selection combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
-        protected JFileChooser getFileChooser() {
-            return AquaFileChooserUI.this.getFileChooser();
+    protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
+            PropertyChangeListener {
+        protected FileFilter[] filters;
+        protected FilterComboBoxModel() {
+            super();
+            filters = getFileChooser().getChoosableFileFilters();
+        }
+
+        public void propertyChange(PropertyChangeEvent e) {
+            String prop = e.getPropertyName();
+            if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
+                filters = (FileFilter[]) e.getNewValue();
+                fireContentsChanged(this, -1, -1);
+            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public void setSelectedItem(Object filter) {
+            if(filter != null) {
+                getFileChooser().setFileFilter((FileFilter) filter);
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public Object getSelectedItem() {
+            // Ensure that the current filter is in the list.
+            // NOTE: we shouldnt' have to do this, since JFileChooser adds
+            // the filter to the choosable filters list when the filter
+            // is set. Lets be paranoid just in case someone overrides
+            // setFileFilter in JFileChooser.
+            FileFilter currentFilter = getFileChooser().getFileFilter();
+            boolean found = false;
+            if(currentFilter != null) {
+                for (FileFilter filter : filters) {
+                    if (filter == currentFilter) {
+                        found = true;
+                    }
+                }
+                if(found == false) {
+                    getFileChooser().addChoosableFileFilter(currentFilter);
+                }
+            }
+            return getFileChooser().getFileFilter();
+        }
+
+        public int getSize() {
+            if(filters != null) {
+                return filters.length;
+            } else {
+                return 0;
+            }
+        }
+
+        public FileFilter getElementAt(int index) {
+            if(index > getSize() - 1) {
+                // This shouldn't happen. Try to recover gracefully.
+                return getFileChooser().getFileFilter();
+            }
+            if(filters != null) {
+                return filters[index];
+            } else {
+                return null;
+            }
         }
     }
 
--- a/jdk/src/macosx/classes/com/apple/laf/AquaIcon.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaIcon.java	Tue Apr 01 15:37:15 2014 +0200
@@ -295,7 +295,14 @@
         }
 
         Image createImage() {
-            return AquaUtils.getCImageCreator().createSystemImageFromSelector(selector, getIconWidth(), getIconHeight());
+            int w = getIconWidth();
+            int h = getIconHeight();
+            return new AquaImageFactory.MultiResolutionIconImage(
+                    AquaUtils.getCImageCreator().createSystemImageFromSelector(
+                            selector, w, h),
+                    AquaUtils.getCImageCreator().createSystemImageFromSelector(
+                            selector, 2 * w, 2 * h)
+            );
         }
     }
 }
--- a/jdk/src/macosx/classes/com/apple/laf/AquaImageFactory.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaImageFactory.java	Tue Apr 01 15:37:15 2014 +0200
@@ -46,6 +46,10 @@
 import com.apple.laf.AquaIcon.SystemIcon;
 import com.apple.laf.AquaUtils.RecyclableObject;
 import com.apple.laf.AquaUtils.RecyclableSingleton;
+import java.util.Arrays;
+import java.util.List;
+import sun.awt.image.MultiResolutionBufferedImage;
+import sun.awt.image.MultiResolutionImage;
 
 public class AquaImageFactory {
     public static IconUIResource getConfirmImageIcon() {
@@ -120,28 +124,48 @@
 
     private static final int kAlertIconSize = 64;
     static IconUIResource getAppIconCompositedOn(final Image background) {
-        final double scaleFactor = 1.0; // revise for HiDPI
+
+        final BufferedImage iconImage = getAppIconImageCompositedOn(background, 1);
+
+        if (background instanceof MultiResolutionIconImage) {
+            BufferedImage background2x
+                    = ((MultiResolutionIconImage) background).resolutionVariant;
+            BufferedImage icon2xImage = getAppIconImageCompositedOn(background2x, 2);
+
+            return new IconUIResource(new ImageIcon(
+                    new MultiResolutionIconImage(iconImage, icon2xImage)));
+        }
+        return new IconUIResource(new ImageIcon(iconImage));
+    }
+
+    static BufferedImage getAppIconImageCompositedOn(final Image background, int scaleFactor) {
 
-        final int kAlertSubIconSize = (int)(kAlertIconSize * 0.5 * scaleFactor);
-        final int kAlertSubIconInset = (int)(kAlertIconSize * scaleFactor) - kAlertSubIconSize;
-        final Icon smallAppIconScaled = new AquaIcon.CachingScalingIcon(kAlertSubIconSize, kAlertSubIconSize) {
-            Image createImage() {
-                return getThisApplicationsIcon(kAlertSubIconSize, kAlertSubIconSize);
-            }
-        };
+        final int scaledAlertIconSize = kAlertIconSize * scaleFactor;
+        final int kAlertSubIconSize = (int) (scaledAlertIconSize * 0.5);
+        final int kAlertSubIconInset = scaledAlertIconSize - kAlertSubIconSize;
+        final Icon smallAppIconScaled = new AquaIcon.CachingScalingIcon(
+                kAlertSubIconSize, kAlertSubIconSize) {
+                    Image createImage() {
+                        return getThisApplicationsIcon(kAlertSubIconSize, kAlertSubIconSize);
+                    }
+                };
 
-        final BufferedImage image = new BufferedImage(kAlertIconSize, kAlertIconSize, BufferedImage.TYPE_INT_ARGB);
+        final BufferedImage image = new BufferedImage(scaledAlertIconSize,
+                scaledAlertIconSize, BufferedImage.TYPE_INT_ARGB);
         final Graphics g = image.getGraphics();
-        g.drawImage(background, 0, 0, (int)(kAlertIconSize * scaleFactor), (int)(kAlertIconSize * scaleFactor), null);
+        g.drawImage(background, 0, 0,
+                scaledAlertIconSize, scaledAlertIconSize, null);
         if (g instanceof Graphics2D) {
             // improves icon rendering quality in Quartz
-            ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+            ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_RENDERING,
+                    RenderingHints.VALUE_RENDER_QUALITY);
         }
 
-        smallAppIconScaled.paintIcon(null, g, kAlertSubIconInset, kAlertSubIconInset);
+        smallAppIconScaled.paintIcon(null, g,
+                kAlertSubIconInset, kAlertSubIconInset);
         g.dispose();
 
-        return new IconUIResource(new ImageIcon(image));
+        return image;
     }
 
     public static IconUIResource getTreeFolderIcon() {
@@ -207,7 +231,7 @@
 
         @Override
         protected Image getInstance() {
-            return Toolkit.getDefaultToolkit().getImage("NSImage://" + namedImage);
+            return getNSIcon(namedImage);
         }
     }
 
@@ -271,11 +295,27 @@
     }
 
     public static Icon getMenuItemCheckIcon() {
-        return new InvertableImageIcon(AquaUtils.generateLightenedImage(Toolkit.getDefaultToolkit().getImage("NSImage://NSMenuItemSelection"), 25));
+        return new InvertableImageIcon(AquaUtils.generateLightenedImage(
+                getNSIcon("NSMenuItemSelection"), 25));
     }
 
     public static Icon getMenuItemDashIcon() {
-        return new InvertableImageIcon(AquaUtils.generateLightenedImage(Toolkit.getDefaultToolkit().getImage("NSImage://NSMenuMixedState"), 25));
+        return new InvertableImageIcon(AquaUtils.generateLightenedImage(
+                getNSIcon("NSMenuMixedState"), 25));
+    }
+
+    private static Image getNSIcon(String imageName) {
+        Image icon = Toolkit.getDefaultToolkit()
+                .getImage("NSImage://" + imageName);
+
+        if (icon instanceof MultiResolutionImage) {
+            return icon;
+        }
+
+        Image icon2x = AquaUtils.getCImageCreator().createImageFromName(
+                imageName, 2 * icon.getWidth(null), 2 * icon.getHeight(null));
+        return new MultiResolutionBufferedImage(
+                BufferedImage.TYPE_INT_ARGB_PRE, 0, icon, icon2x);
     }
 
     public static class NineSliceMetrics {
@@ -484,4 +524,29 @@
     public static Color getSelectionInactiveForegroundColorUIResource() {
         return new SystemColorProxy(LWCToolkit.getAppleColor(LWCToolkit.INACTIVE_SELECTION_FOREGROUND_COLOR));
     }
+
+    static class MultiResolutionIconImage extends BufferedImage
+            implements MultiResolutionImage {
+
+        BufferedImage resolutionVariant;
+
+        public MultiResolutionIconImage(BufferedImage image, BufferedImage resolutionVariant) {
+            super(image.getWidth(), image.getHeight(), image.getType());
+            this.resolutionVariant = resolutionVariant;
+            Graphics g = getGraphics();
+            g.drawImage(image, 0, 0, null);
+            g.dispose();
+        }
+
+        @Override
+        public Image getResolutionVariant(int width, int height) {
+            return ((width <= getWidth() && height <= getHeight()))
+                    ? this : resolutionVariant;
+        }
+
+        @Override
+        public List<Image> getResolutionVariants() {
+            return Arrays.asList(this, resolutionVariant);
+        }
+    }
 }
--- a/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java	Tue Apr 01 15:37:15 2014 +0200
@@ -48,6 +48,7 @@
 import sun.swing.SwingUtilities2;
 
 import com.apple.laf.AquaImageFactory.SlicedImageControl;
+import sun.awt.image.MultiResolutionBufferedImage;
 
 final class AquaUtils {
 
@@ -123,6 +124,13 @@
 
     static Image generateLightenedImage(final Image image, final int percent) {
         final GrayFilter filter = new GrayFilter(true, percent);
+        return (image instanceof MultiResolutionBufferedImage)
+                ? ((MultiResolutionBufferedImage) image).map(
+                        rv -> generateLightenedImage(rv, filter))
+                : generateLightenedImage(image, filter);
+    }
+
+    static Image generateLightenedImage(Image image, ImageFilter filter) {
         final ImageProducer prod = new FilteredImageSource(image.getSource(), filter);
         return Toolkit.getDefaultToolkit().createImage(prod);
     }
--- a/jdk/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,9 +30,6 @@
 import java.awt.Component;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
 import java.awt.Image;
 import java.awt.ImageCapabilities;
 import java.awt.Rectangle;
@@ -80,23 +77,34 @@
     private ContextCapabilities oglCaps;
     private OGLContext context;
     private final Object disposerReferent = new Object();
+    private final int maxTextureSize;
+
     private static native boolean initCGL();
     private static native long getCGLConfigInfo(int displayID, int visualnum,
                                                 int swapInterval);
     private static native int getOGLCapabilities(long configInfo);
 
+    /**
+     * Returns GL_MAX_TEXTURE_SIZE from the shared opengl context. Must be
+     * called under OGLRQ lock, because this method change current context.
+     *
+     * @return GL_MAX_TEXTURE_SIZE
+     */
+    private static native int nativeGetMaxTextureSize();
+
     static {
         cglAvailable = initCGL();
     }
 
     private CGLGraphicsConfig(CGraphicsDevice device, int pixfmt,
-                                long configInfo, ContextCapabilities oglCaps)
-    {
+                              long configInfo, int maxTextureSize,
+                              ContextCapabilities oglCaps) {
         super(device);
 
         this.pixfmt = pixfmt;
         this.pConfigInfo = configInfo;
         this.oglCaps = oglCaps;
+        this.maxTextureSize = maxTextureSize;
         context = new OGLContext(OGLRenderQueue.getInstance(), this);
 
         // add a record to the Disposer so that we destroy the native
@@ -126,6 +134,7 @@
         }
 
         long cfginfo = 0;
+        int textureSize = 0;
         final String ids[] = new String[1];
         OGLRenderQueue rq = OGLRenderQueue.getInstance();
         rq.lock();
@@ -138,11 +147,14 @@
             cfginfo = getCGLConfigInfo(device.getCGDisplayID(), pixfmt,
                                        kOpenGLSwapInterval);
             if (cfginfo != 0L) {
+                textureSize = nativeGetMaxTextureSize();
+                // 7160609: GL still fails to create a square texture of this
+                // size. Half should be safe enough.
+                // Explicitly not support a texture more than 2^14, see 8010999.
+                textureSize = textureSize <= 16384 ? textureSize / 2 : 8192;
                 OGLContext.setScratchSurface(cfginfo);
-                rq.flushAndInvokeNow(new Runnable() {
-                    public void run() {
-                        ids[0] = OGLContext.getOGLIdString();
-                    }
+                rq.flushAndInvokeNow(() -> {
+                    ids[0] = OGLContext.getOGLIdString();
                 });
             }
         } finally {
@@ -154,8 +166,7 @@
 
         int oglCaps = getOGLCapabilities(cfginfo);
         ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);
-
-        return new CGLGraphicsConfig(device, pixfmt, cfginfo, caps);
+        return new CGLGraphicsConfig(device, pixfmt, cfginfo, textureSize, caps);
     }
 
     public static boolean isCGLAvailable() {
@@ -246,8 +257,6 @@
         } finally {
             rq.unlock();
         }
-
-        updateTotalDisplayBounds();
     }
 
     @Override
@@ -421,57 +430,15 @@
         AccelDeviceEventNotifier.removeListener(l);
     }
 
-    private static final Rectangle totalDisplayBounds = new Rectangle();
-
-    private static void updateTotalDisplayBounds() {
-        synchronized (totalDisplayBounds) {
-            Rectangle virtualBounds = new Rectangle();
-            for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
-                for (GraphicsConfiguration gc : gd.getConfigurations()) {
-                    virtualBounds = virtualBounds.union(gc.getBounds());
-                }
-            }
-            totalDisplayBounds.setBounds(virtualBounds);
-        }
-    }
-
-    // 7160609: GL still fails to create a square texture of this size,
-    //          so we use this value to cap the total display bounds.
-    native private static int getMaxTextureSize();
-
     @Override
     public int getMaxTextureWidth() {
-        //Temporary disable this logic and use some magic constrain.
-        /*
-         int width;
-
-         synchronized (totalDisplayBounds) {
-         if (totalDisplayBounds.width == 0) {
-         updateTotalDisplayBounds();
-         }
-         width = totalDisplayBounds.width;
-         }
-
-         return Math.min(width, getMaxTextureSize());
-         */
-        return getMaxTextureSize() / (getDevice().getScaleFactor() * 2);
+        return Math.max(maxTextureSize / getDevice().getScaleFactor(),
+                        getBounds().width);
     }
 
     @Override
     public int getMaxTextureHeight() {
-        //Temporary disable this logic and use some magic constrain.
-        /*
-         int height;
-
-         synchronized (totalDisplayBounds) {
-         if (totalDisplayBounds.height == 0) {
-         updateTotalDisplayBounds();
-         }
-         height = totalDisplayBounds.height;
-         }
-
-         return Math.min(height, getMaxTextureSize());
-         */
-        return getMaxTextureSize() / (getDevice().getScaleFactor() * 2);
+        return Math.max(maxTextureSize / getDevice().getScaleFactor(),
+                        getBounds().height);
     }
 }
--- a/jdk/src/macosx/classes/sun/lwawt/LWChoicePeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/LWChoicePeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -168,16 +168,16 @@
         @Override
         public void firePopupMenuWillBecomeVisible() {
             super.firePopupMenuWillBecomeVisible();
-            SwingUtilities.invokeLater(new Runnable() {
-                @Override
-                public void run() {
-                    JPopupMenu popupMenu = getPopupMenu();
-                    if (popupMenu != null) {
-                        if (popupMenu.getInvoker() != LWChoicePeer.this.getTarget()) {
-                            popupMenu.setVisible(false);
-                            popupMenu.show(LWChoicePeer.this.getTarget(), 0, 0);
-                        }
-                    }
+            SwingUtilities.invokeLater(() -> {
+                JPopupMenu popupMenu = getPopupMenu();
+                // Need to override the invoker for proper grab handling
+                if (popupMenu != null && popupMenu.getInvoker() != getTarget()) {
+                    // The popup is now visible with correct location
+                    // Save it and restore after toggling visibility and changing invoker
+                    Point loc = popupMenu.getLocationOnScreen();
+                    SwingUtilities.convertPointFromScreen(loc, this);
+                    popupMenu.setVisible(false);
+                    popupMenu.show(getTarget(), loc.x, loc.y);
                 }
             });
         }
--- a/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,17 +28,16 @@
 import java.awt.*;
 import java.awt.List;
 import java.awt.datatransfer.*;
-import java.awt.dnd.*;
-import java.awt.dnd.peer.*;
 import java.awt.image.*;
 import java.awt.peer.*;
 import java.security.*;
 import java.util.*;
 
 import sun.awt.*;
-import sun.lwawt.macosx.*;
 import sun.print.*;
 
+import static sun.lwawt.LWWindowPeer.PeerType;
+
 public abstract class LWToolkit extends SunToolkit implements Runnable {
 
     private final static int STATE_NONE = 0;
@@ -114,7 +113,7 @@
     /*
      * Sends a request to stop the message pump.
      */
-    public void shutdown() {
+    public final void shutdown() {
         setRunState(STATE_SHUTDOWN);
         platformShutdown();
     }
@@ -145,7 +144,7 @@
         notifyAll();
     }
 
-    public boolean isTerminating() {
+    public final boolean isTerminating() {
         return getRunState() >= STATE_SHUTDOWN;
     }
 
@@ -162,7 +161,8 @@
         }
     }
 
-    public void run() {
+    @Override
+    public final void run() {
         setRunState(STATE_INIT);
         platformInit();
         AWTAutoShutdown.notifyToolkitThreadFree();
@@ -214,80 +214,51 @@
      * Note that LWWindowPeer implements WindowPeer, FramePeer
      * and DialogPeer interfaces.
      */
-    private LWWindowPeer createDelegatedPeer(Window target, PlatformComponent platformComponent,
-                                             PlatformWindow platformWindow, LWWindowPeer.PeerType peerType)
-    {
+    protected LWWindowPeer createDelegatedPeer(Window target,
+                                               PlatformComponent platformComponent,
+                                               PlatformWindow platformWindow,
+                                               PeerType peerType) {
         LWWindowPeer peer = new LWWindowPeer(target, platformComponent, platformWindow, peerType);
         targetCreatedPeer(target, peer);
         peer.initialize();
         return peer;
     }
 
-    private LWLightweightFramePeer createDelegatedLwPeer(LightweightFrame target,
-                                                         PlatformComponent platformComponent,
-                                                         PlatformWindow platformWindow)
-    {
-        LWLightweightFramePeer peer = new LWLightweightFramePeer(target, platformComponent, platformWindow);
+    @Override
+    public final FramePeer createLightweightFrame(LightweightFrame target) {
+        PlatformComponent platformComponent = createLwPlatformComponent();
+        PlatformWindow platformWindow = createPlatformWindow(PeerType.LW_FRAME);
+        LWLightweightFramePeer peer = new LWLightweightFramePeer(target,
+                                                                 platformComponent,
+                                                                 platformWindow);
         targetCreatedPeer(target, peer);
         peer.initialize();
         return peer;
     }
 
     @Override
-    public FramePeer createLightweightFrame(LightweightFrame target) {
-        PlatformComponent platformComponent = createLwPlatformComponent();
-        PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.LW_FRAME);
-        return createDelegatedLwPeer(target, platformComponent, platformWindow);
-    }
-
-    @Override
-    public WindowPeer createWindow(Window target) {
+    public final WindowPeer createWindow(Window target) {
         PlatformComponent platformComponent = createPlatformComponent();
-        PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.SIMPLEWINDOW);
-        return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.SIMPLEWINDOW);
+        PlatformWindow platformWindow = createPlatformWindow(PeerType.SIMPLEWINDOW);
+        return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.SIMPLEWINDOW);
     }
 
     @Override
-    public FramePeer createFrame(Frame target) {
-        PlatformComponent platformComponent = createPlatformComponent();
-        PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.FRAME);
-        return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.FRAME);
-    }
-
-    public LWWindowPeer createEmbeddedFrame(CEmbeddedFrame target) {
+    public final FramePeer createFrame(Frame target) {
         PlatformComponent platformComponent = createPlatformComponent();
-        PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.EMBEDDED_FRAME);
-        return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.EMBEDDED_FRAME);
-    }
-
-    public LWWindowPeer createEmbeddedFrame(CViewEmbeddedFrame target) {
-        PlatformComponent platformComponent = createPlatformComponent();
-        PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.VIEW_EMBEDDED_FRAME);
-        return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.VIEW_EMBEDDED_FRAME);
-    }
-
-
-    CPrinterDialogPeer createCPrinterDialog(CPrinterDialog target) {
-        PlatformComponent platformComponent = createPlatformComponent();
-        PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.DIALOG);
-        CPrinterDialogPeer peer = new CPrinterDialogPeer(target, platformComponent, platformWindow);
-        targetCreatedPeer(target, peer);
-        return peer;
+        PlatformWindow platformWindow = createPlatformWindow(PeerType.FRAME);
+        return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.FRAME);
     }
 
     @Override
     public DialogPeer createDialog(Dialog target) {
-        if (target instanceof CPrinterDialog) {
-            return createCPrinterDialog((CPrinterDialog)target);
-        }
-
         PlatformComponent platformComponent = createPlatformComponent();
-        PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.DIALOG);
-        return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.DIALOG);
+        PlatformWindow platformWindow = createPlatformWindow(PeerType.DIALOG);
+        return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.DIALOG);
     }
 
     @Override
-    public FileDialogPeer createFileDialog(FileDialog target) {
+    public final FileDialogPeer createFileDialog(FileDialog target) {
         FileDialogPeer peer = createFileDialogPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
@@ -296,7 +267,7 @@
     // ---- LIGHTWEIGHT COMPONENT PEERS ---- //
 
     @Override
-    public ButtonPeer createButton(Button target) {
+    public final ButtonPeer createButton(Button target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWButtonPeer peer = new LWButtonPeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -305,7 +276,7 @@
     }
 
     @Override
-    public CheckboxPeer createCheckbox(Checkbox target) {
+    public final CheckboxPeer createCheckbox(Checkbox target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWCheckboxPeer peer = new LWCheckboxPeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -314,12 +285,7 @@
     }
 
     @Override
-    public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) {
-        throw new RuntimeException("not implemented");
-    }
-
-    @Override
-    public ChoicePeer createChoice(Choice target) {
+    public final ChoicePeer createChoice(Choice target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWChoicePeer peer = new LWChoicePeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -328,7 +294,7 @@
     }
 
     @Override
-    public LabelPeer createLabel(Label target) {
+    public final LabelPeer createLabel(Label target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWLabelPeer peer = new LWLabelPeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -337,7 +303,7 @@
     }
 
     @Override
-    public CanvasPeer createCanvas(Canvas target) {
+    public final CanvasPeer createCanvas(Canvas target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWCanvasPeer<?, ?> peer = new LWCanvasPeer<>(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -346,7 +312,7 @@
     }
 
     @Override
-    public ListPeer createList(List target) {
+    public final ListPeer createList(List target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWListPeer peer = new LWListPeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -355,22 +321,7 @@
     }
 
     @Override
-    public MenuPeer createMenu(Menu target) {
-        throw new RuntimeException("not implemented");
-    }
-
-    @Override
-    public MenuBarPeer createMenuBar(MenuBar target) {
-        throw new RuntimeException("not implemented");
-    }
-
-    @Override
-    public MenuItemPeer createMenuItem(MenuItem target) {
-        throw new RuntimeException("not implemented");
-    }
-
-    @Override
-    public PanelPeer createPanel(Panel target) {
+    public final PanelPeer createPanel(Panel target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWPanelPeer peer = new LWPanelPeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -379,12 +330,7 @@
     }
 
     @Override
-    public PopupMenuPeer createPopupMenu(PopupMenu target) {
-        throw new RuntimeException("not implemented");
-    }
-
-    @Override
-    public ScrollPanePeer createScrollPane(ScrollPane target) {
+    public final ScrollPanePeer createScrollPane(ScrollPane target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWScrollPanePeer peer = new LWScrollPanePeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -393,7 +339,7 @@
     }
 
     @Override
-    public ScrollbarPeer createScrollbar(Scrollbar target) {
+    public final ScrollbarPeer createScrollbar(Scrollbar target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWScrollBarPeer peer = new LWScrollBarPeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -402,7 +348,7 @@
     }
 
     @Override
-    public TextAreaPeer createTextArea(TextArea target) {
+    public final TextAreaPeer createTextArea(TextArea target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWTextAreaPeer peer = new LWTextAreaPeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -411,7 +357,7 @@
     }
 
     @Override
-    public TextFieldPeer createTextField(TextField target) {
+    public final TextFieldPeer createTextField(TextField target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWTextFieldPeer peer = new LWTextFieldPeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -422,56 +368,51 @@
     // ---- NON-COMPONENT PEERS ---- //
 
     @Override
-    public ColorModel getColorModel() throws HeadlessException {
-        return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getColorModel();
+    public final ColorModel getColorModel() throws HeadlessException {
+        return GraphicsEnvironment.getLocalGraphicsEnvironment()
+                                  .getDefaultScreenDevice()
+                                  .getDefaultConfiguration().getColorModel();
     }
 
     @Override
-    public boolean isDesktopSupported() {
+    public final boolean isDesktopSupported() {
         return true;
     }
 
     @Override
-    protected DesktopPeer createDesktopPeer(Desktop target) {
-       return new CDesktopPeer();
-    }
-
-    @Override
-    public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) {
-        DragSourceContextPeer dscp = CDragSourceContextPeer.createDragSourceContextPeer(dge);
-
-        return dscp;
-    }
-
-    @Override
-    public KeyboardFocusManagerPeer getKeyboardFocusManagerPeer() {
+    public final KeyboardFocusManagerPeer getKeyboardFocusManagerPeer() {
         return LWKeyboardFocusManagerPeer.getInstance();
     }
 
     @Override
-    public synchronized MouseInfoPeer getMouseInfoPeer() {
+    public final synchronized MouseInfoPeer getMouseInfoPeer() {
         if (mouseInfoPeer == null) {
             mouseInfoPeer = createMouseInfoPeerImpl();
         }
         return mouseInfoPeer;
     }
 
-    protected MouseInfoPeer createMouseInfoPeerImpl() {
+    protected final MouseInfoPeer createMouseInfoPeerImpl() {
         return new LWMouseInfoPeer();
     }
 
-    public PrintJob getPrintJob(Frame frame, String doctitle, Properties props) {
+    @Override
+    public final PrintJob getPrintJob(Frame frame, String doctitle,
+                                      Properties props) {
         return getPrintJob(frame, doctitle, null, null);
     }
 
-    public PrintJob getPrintJob(Frame frame, String doctitle, JobAttributes jobAttributes, PageAttributes pageAttributes) {
+    @Override
+    public final PrintJob getPrintJob(Frame frame, String doctitle,
+                                      JobAttributes jobAttributes,
+                                      PageAttributes pageAttributes) {
         if (GraphicsEnvironment.isHeadless()) {
             throw new IllegalArgumentException();
         }
 
         PrintJob2D printJob = new PrintJob2D(frame, doctitle, jobAttributes, pageAttributes);
 
-        if (printJob.printDialog() == false) {
+        if (!printJob.printDialog()) {
             printJob = null;
         }
 
@@ -479,27 +420,7 @@
     }
 
     @Override
-    public RobotPeer createRobot(Robot target, GraphicsDevice screen) {
-        throw new RuntimeException("not implemented");
-    }
-
-    @Override
-    public boolean isTraySupported() {
-        throw new RuntimeException("not implemented");
-    }
-
-    @Override
-    public SystemTrayPeer createSystemTray(SystemTray target) {
-        throw new RuntimeException("not implemented");
-    }
-
-    @Override
-    public TrayIconPeer createTrayIcon(TrayIcon target) {
-        throw new RuntimeException("not implemented");
-    }
-
-    @Override
-    public Clipboard getSystemClipboard() {
+    public final Clipboard getSystemClipboard() {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
             security.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
@@ -513,7 +434,8 @@
         return clipboard;
     }
 
-    protected abstract SecurityWarningWindow createSecurityWarning(Window ownerWindow, LWWindowPeer ownerPeer);
+    protected abstract SecurityWarningWindow createSecurityWarning(
+            Window ownerWindow, LWWindowPeer ownerPeer);
 
     // ---- DELEGATES ---- //
 
@@ -522,7 +444,7 @@
     /*
      * Creates a delegate for the given peer type (window, frame, dialog, etc.)
      */
-    protected abstract PlatformWindow createPlatformWindow(LWWindowPeer.PeerType peerType);
+    protected abstract PlatformWindow createPlatformWindow(PeerType peerType);
 
     protected abstract PlatformComponent createPlatformComponent();
 
@@ -556,7 +478,7 @@
     }
 
     @Override
-    public void grab(final Window w) {
+    public final void grab(final Window w) {
         final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
         if (peer != null) {
             ((LWWindowPeer) peer).grab();
@@ -564,7 +486,7 @@
     }
 
     @Override
-    public void ungrab(final Window w) {
+    public final void ungrab(final Window w) {
         final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
         if (peer != null) {
             ((LWWindowPeer) peer).ungrab(false);
--- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -629,6 +629,7 @@
         final boolean isNewDevice = updateGraphicsDevice();
         if (resized || isNewDevice) {
             replaceSurfaceData();
+            updateMinimumSize();
         }
 
         // Third, COMPONENT_MOVED/COMPONENT_RESIZED/PAINT events
@@ -1046,7 +1047,9 @@
 
     @Override
     public final void displayChanged() {
-        updateGraphicsDevice();
+        if (updateGraphicsDevice()) {
+            updateMinimumSize();
+        }
         // Replace surface unconditionally, because internal state of the
         // GraphicsDevice could be changed.
         replaceSurfaceData();
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CClipboard.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CClipboard.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,20 +40,23 @@
  * sun.awt.datatransfer.DataTransferer.
  */
 
-public class CClipboard extends SunClipboard {
+final class CClipboard extends SunClipboard {
 
     public CClipboard(String name) {
         super(name);
     }
 
+    @Override
     public long getID() {
         return 0;
     }
 
+    @Override
     protected void clearNativeContext() {
         // Leaving Empty, as WClipboard.clearNativeContext is empty as well.
     }
 
+    @Override
     protected void setContentsNative(Transferable contents) {
 
         // Don't use delayed Clipboard rendering for the Transferable's data.
@@ -89,6 +92,39 @@
         notifyChanged();
     }
 
+    @Override
+    protected native long[] getClipboardFormats();
+    @Override
+    protected native byte[] getClipboardData(long format) throws IOException;
+
+    // 1.5 peer method
+    @Override
+    protected void unregisterClipboardViewerChecked() {
+        // no-op because we lack OS support. This requires 4048791, which requires 4048792
+    }
+
+    // 1.5 peer method
+    @Override
+    protected void registerClipboardViewerChecked()    {
+        // no-op because we lack OS support. This requires 4048791, which requires 4048792
+    }
+
+    // 1.5 peer method
+    // no-op. This appears to be win32 specific. Filed 4048790 for investigation
+    //protected Transferable createLocaleTransferable(long[] formats) throws IOException;
+
+    private native void declareTypes(long[] formats, SunClipboard newOwner);
+    private native void setData(byte[] data, long format);
+
+    /**
+     * Invokes native check whether a change count on the general pasteboard is different
+     * than when we set it. The different count value means the current owner lost
+     * pasteboard ownership and someone else put data on the clipboard.
+     * @since 1.7
+     */
+    native void checkPasteboard();
+
+    /*** Native Callbacks ***/
     private void notifyLostOwnership() {
         lostOwnershipImpl();
     }
@@ -100,32 +136,4 @@
         }
         clipboard.checkChange(clipboard.getClipboardFormats());
     }
-
-    protected native long[] getClipboardFormats();
-    protected native byte[] getClipboardData(long format) throws IOException;
-
-    // 1.5 peer method
-    protected void unregisterClipboardViewerChecked() {
-        // no-op because we lack OS support. This requires 4048791, which requires 4048792
-    }
-
-    // 1.5 peer method
-    protected void registerClipboardViewerChecked()    {
-        // no-op because we lack OS support. This requires 4048791, which requires 4048792
-    }
-
-    // 1.5 peer method
-    // no-op. This appears to be win32 specific. Filed 4048790 for investigation
-    //protected Transferable createLocaleTransferable(long[] formats) throws IOException;
-
-    public native void declareTypes(long[] formats, SunClipboard newOwner);
-    public native void setData(byte[] data, long format);
-
-    /**
-     * Invokes native check whether a change count on the general pasteboard is different
-     * than when we set it. The different count value means the current owner lost
-     * pasteboard ownership and someone else put data on the clipboard.
-     * @since 1.7
-     */
-    public native void checkPasteboard();
 }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CCustomCursor.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CCustomCursor.java	Tue Apr 01 15:37:15 2014 +0200
@@ -38,6 +38,8 @@
 
     Image fImage;
     Point fHotspot;
+    int fWidth;
+    int fHeight;
 
     public CCustomCursor(final Image cursor, final Point hotSpot, final String name) throws IndexOutOfBoundsException, HeadlessException {
         super(name);
@@ -50,6 +52,7 @@
         // Make sure image is fully loaded.
         final Component c = new Canvas(); // for its imageUpdate method
         final MediaTracker tracker = new MediaTracker(c);
+        // MediaTracker loads resolution variants from MultiResolution Toolkit image
         tracker.addImage(fImage, 0);
         try {
             tracker.waitForAll();
@@ -67,15 +70,15 @@
             width = height = 1;
             fImage = createTransparentImage(width, height);
         } else {
-            // Scale image to nearest supported size
+            // Get the nearest supported cursor size
             final Dimension nativeSize = toolkit.getBestCursorSize(width, height);
-            if (nativeSize.width != width || nativeSize.height != height) {
-                fImage = fImage.getScaledInstance(nativeSize.width, nativeSize.height, Image.SCALE_DEFAULT);
-                width = nativeSize.width;
-                height = nativeSize.height;
-            }
+            width = nativeSize.width;
+            height = nativeSize.height;
         }
 
+        fWidth = width;
+        fHeight = height;
+
         // NOTE: this was removed for 3169146, but in 1.5 the JCK tests for an exception and fails if one isn't thrown.
         // See what JBuilder does.
         // Verify that the hotspot is within cursor bounds.
@@ -138,6 +141,7 @@
                 // failed to do its job. Return null to keep the cursor unchanged.
                 return 0L;
             } else {
+                fCImage.resizeRepresentations(fWidth, fHeight);
                 return fCImage.ptr;
             }
         } catch (IllegalArgumentException iae) {
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,11 +56,11 @@
     };
 
     static {
-        Map<String, Long> nameMap = new HashMap<String, Long>(predefinedClipboardNames.length, 1.0f);
-        Map<Long, String> formatMap = new HashMap<Long, String>(predefinedClipboardNames.length, 1.0f);
+        Map<String, Long> nameMap = new HashMap<>(predefinedClipboardNames.length, 1.0f);
+        Map<Long, String> formatMap = new HashMap<>(predefinedClipboardNames.length, 1.0f);
         for (int i = 1; i < predefinedClipboardNames.length; i++) {
-            nameMap.put(predefinedClipboardNames[i], new Long(i));
-            formatMap.put(new Long(i), predefinedClipboardNames[i]);
+            nameMap.put(predefinedClipboardNames[i], (long) i);
+            formatMap.put((long) i, predefinedClipboardNames[i]);
         }
         predefinedClipboardNameMap = Collections.synchronizedMap(nameMap);
         predefinedClipboardFormatMap = Collections.synchronizedMap(formatMap);
@@ -77,19 +77,11 @@
     public static final int CF_PNG         = 10;
     public static final int CF_JPEG        = 11;
 
-    public static final Long L_CF_TIFF = predefinedClipboardNameMap.get(predefinedClipboardNames[CF_TIFF]);
-
-    // Image file formats with java.awt.Image representation:
-    private static final Long[] imageFormats = new Long[] {
-        L_CF_TIFF
-    };
-
-
     private CDataTransferer() {}
 
     private static CDataTransferer fTransferer;
 
-    public static synchronized CDataTransferer getInstanceImpl() {
+    static synchronized CDataTransferer getInstanceImpl() {
         if (fTransferer == null) {
             fTransferer = new CDataTransferer();
         }
@@ -97,18 +89,22 @@
         return fTransferer;
     }
 
+    @Override
     public String getDefaultUnicodeEncoding() {
         return "utf-16le";
     }
 
+    @Override
     public boolean isLocaleDependentTextFormat(long format) {
         return format == CF_STRING;
     }
 
+    @Override
     public boolean isFileFormat(long format) {
         return format == CF_FILE;
     }
 
+    @Override
     public boolean isImageFormat(long format) {
         int ifmt = (int)format;
         switch(ifmt) {
@@ -122,43 +118,12 @@
         }
     }
 
-    protected Long[] getImageFormatsAsLongArray() {
-        return imageFormats;
-    }
-
-    public byte[] translateTransferable(Transferable contents, DataFlavor flavor, long format) throws IOException
-        {
-            byte[] bytes = super.translateTransferable(contents, flavor, format);
-
-            // 9-12-02 VL: we may need to do something like Windows here.
-            //if (format == CF_HTML) {
-            //    bytes = HTMLSupport.convertToHTMLFormat(bytes);
-            //}
-
-            return bytes;
-        }
-
-    protected Object translateBytesOrStream(InputStream stream, byte[] bytes, DataFlavor flavor, long format,
-                                            Transferable transferable) throws IOException
-        {
-            // 5-28-03 VL: [Radar 3266030]
-            // We need to do like Windows does here.
-            if (format == CF_HTML && flavor.isFlavorTextType()) {
-                if (stream == null) {
-                    stream = new ByteArrayInputStream(bytes);
-                    bytes = null;
-                }
-
-                stream = new HTMLDecodingInputStream(stream);
-            }
+    @Override
+    public Object translateBytes(byte[] bytes, DataFlavor flavor,
+                                    long format, Transferable transferable) throws IOException {
 
             if (format == CF_URL && URL.class.equals(flavor.getRepresentationClass()))
             {
-                if (bytes == null) {
-                    bytes = inputStreamToByteArray(stream);
-                    stream = null;
-                }
-
                 String charset = getDefaultTextCharset();
                 if (transferable != null && transferable.isDataFlavorSupported(javaTextEncodingFlavor)) {
                     try {
@@ -175,9 +140,9 @@
             }
 
             return super.translateBytes(bytes, flavor, format, transferable);
-        }
+    }
 
-
+    @Override
     synchronized protected Long getFormatForNativeAsLong(String str) {
         Long format = predefinedClipboardNameMap.get(str);
 
@@ -202,6 +167,7 @@
     // Get registered native format string for an index, return null if unknown:
     private native String formatForIndex(long index);
 
+    @Override
     protected String getNativeForFormat(long format) {
         String returnValue = null;
 
@@ -209,7 +175,7 @@
         if (format >= 0 && format < predefinedClipboardNames.length) {
             returnValue = predefinedClipboardNames[(int) format];
         } else {
-            Long formatObj = new Long(format);
+            Long formatObj = format;
             returnValue = predefinedClipboardFormatMap.get(formatObj);
 
             // predefinedClipboardFormatMap may not know this format:
@@ -233,10 +199,13 @@
 
     private final ToolkitThreadBlockedHandler handler = new CToolkitThreadBlockedHandler();
 
+    @Override
     public ToolkitThreadBlockedHandler getToolkitThreadBlockedHandler() {
         return handler;
     }
 
+    private native byte[] imageDataToPlatformImageBytes(int[] rData, int nW, int nH);
+    @Override
     protected byte[] imageToPlatformBytes(Image image, long format) {
         int w = image.getWidth(null);
         int h = image.getHeight(null);
@@ -252,32 +221,28 @@
     }
 
     private static native String[] nativeDragQueryFile(final byte[] bytes);
+    @Override
     protected String[] dragQueryFile(final byte[] bytes) {
         if (bytes == null) return null;
         if (new String(bytes).startsWith("Unsupported type")) return null;
         return nativeDragQueryFile(bytes);
     }
 
-    private native byte[] imageDataToPlatformImageBytes(int[] rData, int nW, int nH);
-
+    private native Image getImageForByteStream(byte[] bytes);
     /**
      * Translates a byte array which contains
      * platform-specific image data in the given format into an Image.
      */
-    protected Image platformImageBytesToImage(byte[] bytes, long format)
-        throws IOException
-    {
+    @Override
+    protected Image platformImageBytesToImage(byte[] bytes, long format) throws IOException {
         return getImageForByteStream(bytes);
     }
 
-    private native Image getImageForByteStream(byte[] bytes);
-
     @Override
     protected ByteArrayOutputStream convertFileListToBytes(ArrayList<String> fileList) throws IOException {
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        for (int i = 0; i < fileList.size(); i++)
-        {
-            byte[] bytes = fileList.get(i).getBytes();
+        for (String file : fileList) {
+            byte[] bytes = file.getBytes();
             bos.write(bytes, 0, bytes.length);
             bos.write(0);
         }
@@ -303,246 +268,3 @@
 }
 
 
-// ---- Code borrowed from WDataTransferer: ----
-// This will come handy for supporting HTML data.
-
-final class HTMLSupport {
-    public static final String ENCODING = "UTF-8";
-
-    public static final String VERSION = "Version:";
-    public static final String START_HTML = "StartHTML:";
-    public static final String END_HTML = "EndHTML:";
-    public static final String START_FRAGMENT = "StartFragment:";
-    public static final String END_FRAGMENT = "EndFragment:";
-    public static final String START_FRAGMENT_CMT = "<!--StartFragment-->";
-    public static final String END_FRAGMENT_CMT = "<!--EndFragment-->";
-    public static final String EOLN = "\r\n";
-
-    private static final String VERSION_NUM = "0.9";
-    private static final String HTML_START_END = "-1";
-
-    private static final int PADDED_WIDTH = 10;
-
-    private static final int HEADER_LEN =
-        VERSION.length() + VERSION_NUM.length() + EOLN.length() +
-        START_HTML.length() + HTML_START_END.length() + EOLN.length() +
-        END_HTML.length() + HTML_START_END.length() + EOLN.length() +
-        START_FRAGMENT.length() + PADDED_WIDTH + EOLN.length() +
-        END_FRAGMENT.length() + PADDED_WIDTH + EOLN.length() +
-        START_FRAGMENT_CMT.length() + EOLN.length();
-    private static final String HEADER_LEN_STR =
-        toPaddedString(HEADER_LEN, PADDED_WIDTH);
-
-    private static final String TRAILER = END_FRAGMENT_CMT + EOLN + '\0';
-
-    private static String toPaddedString(int n, int width) {
-        String string = "" + n;
-        int len = string.length();
-        if (n >= 0 && len < width) {
-            char[] array = new char[width - len];
-            Arrays.fill(array, '0');
-            StringBuffer buffer = new StringBuffer();
-            buffer.append(array);
-            buffer.append(string);
-            string = buffer.toString();
-        }
-        return string;
-    }
-
-    public static byte[] convertToHTMLFormat(byte[] bytes) {
-        StringBuffer header = new StringBuffer(HEADER_LEN);
-        header.append(VERSION);
-        header.append(VERSION_NUM);
-        header.append(EOLN);
-        header.append(START_HTML);
-        header.append(HTML_START_END);
-        header.append(EOLN);
-        header.append(END_HTML);
-        header.append(HTML_START_END);
-        header.append(EOLN);
-        header.append(START_FRAGMENT);
-        header.append(HEADER_LEN_STR);
-        header.append(EOLN);
-        header.append(END_FRAGMENT);
-        // Strip terminating NUL byte from array
-        header.append(toPaddedString(HEADER_LEN + bytes.length - 1,
-                                     PADDED_WIDTH));
-        header.append(EOLN);
-        header.append(START_FRAGMENT_CMT);
-        header.append(EOLN);
-
-        byte[] headerBytes = null, trailerBytes = null;
-
-        try {
-            headerBytes = new String(header).getBytes(ENCODING);
-            trailerBytes = TRAILER.getBytes(ENCODING);
-        } catch (UnsupportedEncodingException cannotHappen) {
-        }
-
-        byte[] retval = new byte[headerBytes.length + bytes.length - 1 +
-            trailerBytes.length];
-
-        System.arraycopy(headerBytes, 0, retval, 0, headerBytes.length);
-        System.arraycopy(bytes, 0, retval, headerBytes.length,
-                         bytes.length - 1);
-        System.arraycopy(trailerBytes, 0, retval,
-                         headerBytes.length + bytes.length - 1,
-                         trailerBytes.length);
-
-        return retval;
-    }
-}
-
-/**
-* This stream takes an InputStream which provides data in CF_HTML format,
- * strips off the description and context to extract the original HTML data.
- */
-class HTMLDecodingInputStream extends InputStream {
-
-    private final BufferedInputStream bufferedStream;
-    private boolean descriptionParsed = false;
-    private boolean closed = false;
-    private int index;
-    private int end;
-
-    // InputStreamReader uses an 8K buffer. The size is not customizable.
-    public static final int BYTE_BUFFER_LEN = 8192;
-
-    // CharToByteUTF8.getMaxBytesPerChar returns 3, so we should not buffer
-    // more chars than 3 times the number of bytes we can buffer.
-    public static final int CHAR_BUFFER_LEN = BYTE_BUFFER_LEN / 3;
-
-    private static final String FAILURE_MSG =
-        "Unable to parse HTML description: ";
-    private static final String INVALID_MSG = " invalid";
-
-    public HTMLDecodingInputStream(InputStream bytestream) throws IOException {
-        bufferedStream = new BufferedInputStream(bytestream, BYTE_BUFFER_LEN);
-    }
-
-    private void parseDescription() throws IOException {
-        bufferedStream.mark(BYTE_BUFFER_LEN);
-
-        BufferedReader bufferedReader = new BufferedReader
-            (new InputStreamReader(bufferedStream, HTMLSupport.ENCODING),
-             CHAR_BUFFER_LEN);
-        String version = bufferedReader.readLine().trim();
-        if (version == null || !version.startsWith(HTMLSupport.VERSION)) {
-            // Not MS-compliant HTML text. Return raw text from read().
-            index = 0;
-            end = -1;
-            bufferedStream.reset();
-            return;
-        }
-
-        String input;
-        boolean startHTML, endHTML, startFragment, endFragment;
-        startHTML = endHTML = startFragment = endFragment = false;
-
-        try {
-            do {
-                input = bufferedReader.readLine().trim();
-                if (input == null) {
-                    close();
-                    throw new IOException(FAILURE_MSG);
-                } else if (input.startsWith(HTMLSupport.START_HTML)) {
-                    int val = Integer.parseInt
-                    (input.substring(HTMLSupport.START_HTML.length(),
-                                     input.length()).trim());
-                    if (val >= 0) {
-                        index = val;
-                        startHTML = true;
-                    } else if (val != -1) {
-                        close();
-                        throw new IOException(FAILURE_MSG +
-                                              HTMLSupport.START_HTML +
-                                              INVALID_MSG);
-                    }
-                } else if (input.startsWith(HTMLSupport.END_HTML)) {
-                    int val = Integer.parseInt
-                    (input.substring(HTMLSupport.END_HTML.length(),
-                                     input.length()).trim());
-                    if (val >= 0) {
-                        end = val;
-                        endHTML = true;
-                    } else if (val != -1) {
-                        close();
-                        throw new IOException(FAILURE_MSG +
-                                              HTMLSupport.END_HTML +
-                                              INVALID_MSG);
-                    }
-                } else if (!startHTML && !endHTML &&
-                           input.startsWith(HTMLSupport.START_FRAGMENT)) {
-                    index = Integer.parseInt
-                    (input.substring(HTMLSupport.START_FRAGMENT.length(),
-                                     input.length()).trim());
-                    if (index < 0) {
-                        close();
-                        throw new IOException(FAILURE_MSG +
-                                              HTMLSupport.START_FRAGMENT +
-                                              INVALID_MSG);
-                    }
-                    startFragment = true;
-                } else if (!startHTML && !endHTML &&
-                           input.startsWith(HTMLSupport.END_FRAGMENT)) {
-                    end = Integer.parseInt
-                    (input.substring(HTMLSupport.END_FRAGMENT.length(),
-                                     input.length()).trim());
-                    if (end < 0) {
-                        close();
-                        throw new IOException(FAILURE_MSG +
-                                              HTMLSupport.END_FRAGMENT +
-                                              INVALID_MSG);
-                    }
-                    endFragment = true;
-                }
-            } while (!((startHTML && endHTML) ||
-                       (startFragment && endFragment)));
-        } catch (NumberFormatException e) {
-            close();
-            throw new IOException(FAILURE_MSG + e);
-        }
-
-        bufferedStream.reset();
-
-        for (int i = 0; i < index; i++) {
-            if (bufferedStream.read() == -1) {
-                close();
-                throw new IOException(FAILURE_MSG +
-                                      "Byte stream ends in description.");
-            }
-        }
-    }
-
-    public int read() throws IOException {
-        if (closed) {
-            throw new IOException("Stream closed");
-        }
-
-        if (!descriptionParsed) {
-            parseDescription(); // initializes 'index' and 'end'
-            descriptionParsed = true;
-        }
-
-        if (end != -1 && index >= end) {
-            return -1;
-        }
-
-        int retval = bufferedStream.read();
-        if (retval == -1) {
-            index = end = 0; // so future read() calls will fail quickly
-            return -1;
-        }
-
-        index++;
-    //    System.out.print((char)retval);
-        return retval;
-    }
-
-    public void close() throws IOException {
-        if (!closed) {
-            closed = true;
-            bufferedStream.close();
-        }
-    }
-}
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -141,7 +141,7 @@
             // Create native dragging source:
             final long nativeDragSource = createNativeDragSource(component, nativeViewPtr, transferable, triggerEvent,
                 (int) (dragOrigin.getX()), (int) (dragOrigin.getY()), extModifiers,
-                clickCount, timestamp, fDragCImage, dragImageOffset.x, dragImageOffset.y,
+                clickCount, timestamp, fDragCImage != null ? fDragCImage.ptr : 0L, dragImageOffset.x, dragImageOffset.y,
                 getDragSourceContext().getSourceActions(), formats, formatMap);
 
             if (nativeDragSource == 0)
@@ -484,7 +484,7 @@
     // Native support:
     private native long createNativeDragSource(Component component, long nativePeer, Transferable transferable,
         InputEvent triggerEvent, int dragPosX, int dragPosY, int extModifiers, int clickCount, long timestamp,
-        CImage nsDragImage, int dragImageOffsetX, int dragImageOffsetY,
+        long nsDragImagePtr, int dragImageOffsetX, int dragImageOffsetY,
         int sourceActions, long[] formats, Map formatMap);
 
     private native void doDragging(long nativeDragSource);
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,17 +23,15 @@
  * questions.
  */
 
+
 package sun.lwawt.macosx;
 
-import sun.lwawt.LWToolkit;
-import sun.lwawt.LWWindowPeer;
-import sun.lwawt.macosx.CocoaConstants;
-import sun.lwawt.macosx.event.NSEvent;
+import java.awt.AWTKeyStroke;
+import java.awt.Point;
+import java.awt.Toolkit;
 
 import sun.awt.EmbeddedFrame;
-
-import java.awt.*;
-import java.awt.event.*;
+import sun.lwawt.LWWindowPeer;
 
 public class CEmbeddedFrame extends EmbeddedFrame {
 
@@ -48,7 +46,7 @@
 
     public void addNotify() {
         if (getPeer() == null) {
-            LWToolkit toolkit = (LWToolkit)Toolkit.getDefaultToolkit();
+            LWCToolkit toolkit = (LWCToolkit)Toolkit.getDefaultToolkit();
             LWWindowPeer peer = toolkit.createEmbeddedFrame(this);
             setPeer(peer);
             responder = new CPlatformResponder(peer, true);
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java	Tue Apr 01 15:37:15 2014 +0200
@@ -46,17 +46,16 @@
         @Override
         public void run() {
             try {
-                boolean navigateApps = false;
-                int dialogMode = target.getMode();
+                boolean navigateApps = !AccessController.doPrivileged(
+                        new GetBooleanAction("apple.awt.use-file-dialog-packages"));
+                boolean chooseDirectories = AccessController.doPrivileged(
+                        new GetBooleanAction("apple.awt.fileDialogForDirectories"));
 
-                navigateApps = true;
-
+                int dialogMode = target.getMode();
                 String title = target.getTitle();
                 if (title == null) {
                     title = " ";
                 }
-                Boolean chooseDirectories = AccessController.doPrivileged(
-                        new GetBooleanAction("apple.awt.fileDialogForDirectories"));
 
                 String[] userFileNames = nativeRunFileDialog(title,
                         dialogMode,
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CImage.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CImage.java	Tue Apr 01 15:37:15 2014 +0200
@@ -31,6 +31,7 @@
 
 import java.util.Arrays;
 import java.util.List;
+import sun.awt.image.MultiResolutionImage;
 
 import sun.awt.image.SunWritableRaster;
 
@@ -44,6 +45,7 @@
     private static native void nativeCopyNSImageIntoArray(long image, int[] buffer, int w, int h);
     private static native Dimension2D nativeGetNSImageSize(long image);
     private static native void nativeSetNSImageSize(long image, double w, double h);
+    private static native void nativeResizeNSImageRepresentations(long image, double w, double h);
 
     static Creator creator = new Creator();
     static Creator getCreator() {
@@ -145,6 +147,12 @@
 
         // This is used to create a CImage from a Image
         public CImage createFromImage(final Image image) {
+            if (image instanceof MultiResolutionImage) {
+                List<Image> resolutionVariants
+                        = ((MultiResolutionImage) image).getResolutionVariants();
+                return createFromImages(resolutionVariants);
+            }
+
             int[] buffer = imageToArray(image, true);
             if (buffer == null) {
                 return null;
@@ -223,4 +231,8 @@
         if (ptr != 0) nativeSetNSImageSize(ptr, w, h);
         return this;
     }
+
+    void resizeRepresentations(double w, double h) {
+        if (ptr != 0) nativeResizeNSImageRepresentations(ptr, w, h);
+    }
 }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
 import sun.awt.SunToolkit;
 import sun.lwawt.LWWindowPeer;
 import sun.lwawt.PlatformEventNotifier;
-import sun.lwawt.macosx.event.NSEvent;
+
 import java.awt.Toolkit;
 import java.awt.event.MouseEvent;
 import java.awt.event.InputEvent;
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,6 @@
 import sun.awt.CGraphicsConfig;
 import sun.awt.CGraphicsEnvironment;
 import sun.lwawt.LWWindowPeer;
-import sun.lwawt.macosx.event.NSEvent;
 
 import sun.java2d.SurfaceData;
 import sun.java2d.opengl.CGLLayer;
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -583,7 +583,12 @@
                     // setVisible could have changed the native maximized state
                     deliverZoom(true);
                 } else {
-                    switch (((Frame)target).getExtendedState()) {
+                    int frameState = ((Frame)target).getExtendedState();
+                    if ((frameState & Frame.ICONIFIED) != 0) {
+                        // Treat all state bit masks with ICONIFIED bit as ICONIFIED state.
+                        frameState = Frame.ICONIFIED;
+                    }
+                    switch (frameState) {
                         case Frame.ICONIFIED:
                             CWrapper.NSWindow.miniaturize(nsWindowPtr);
                             break;
@@ -608,9 +613,7 @@
             // Add myself as a child
             if (owner != null && owner.isVisible()) {
                 CWrapper.NSWindow.addChildWindow(owner.getNSWindowPtr(), nsWindowPtr, CWrapper.NSWindow.NSWindowAbove);
-                if (target.isAlwaysOnTop()) {
-                    CWrapper.NSWindow.setLevel(nsWindowPtr, CWrapper.NSWindow.NSFloatingWindowLevel);
-                }
+                applyWindowLevel(target);
             }
 
             // Add my own children to myself
@@ -620,9 +623,7 @@
                     CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
                     if (pw != null && pw.isVisible()) {
                         CWrapper.NSWindow.addChildWindow(nsWindowPtr, pw.getNSWindowPtr(), CWrapper.NSWindow.NSWindowAbove);
-                        if (w.isAlwaysOnTop()) {
-                            CWrapper.NSWindow.setLevel(pw.getNSWindowPtr(), CWrapper.NSWindow.NSFloatingWindowLevel);
-                        }
+                        pw.applyWindowLevel(w);
                     }
                 }
             }
@@ -788,6 +789,10 @@
         if (prevWindowState == windowState) return;
 
         final long nsWindowPtr = getNSWindowPtr();
+        if ((windowState & Frame.ICONIFIED) != 0) {
+            // Treat all state bit masks with ICONIFIED bit as ICONIFIED state.
+            windowState = Frame.ICONIFIED;
+        }
         switch (windowState) {
             case Frame.ICONIFIED:
                 if (prevWindowState == Frame.MAXIMIZED_BOTH) {
@@ -1041,8 +1046,14 @@
             CWrapper.NSWindow.addChildWindow(nsWindowOwnerPtr, nsWindowSelfPtr, CWrapper.NSWindow.NSWindowAbove);
         }
 
-        if (target.isAlwaysOnTop()) {
+        applyWindowLevel(target);
+    }
+
+    protected void applyWindowLevel(Window target) {
+        if (target.isAlwaysOnTop() && target.getType() != Window.Type.POPUP) {
             CWrapper.NSWindow.setLevel(getNSWindowPtr(), CWrapper.NSWindow.NSFloatingWindowLevel);
+        } else if (target.getType() == Window.Type.POPUP) {
+            CWrapper.NSWindow.setLevel(getNSWindowPtr(), CWrapper.NSWindow.NSPopUpMenuWindowLevel);
         }
     }
 
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Tue Apr 01 15:37:15 2014 +0200
@@ -41,7 +41,7 @@
 import sun.java2d.*;
 import sun.print.*;
 
-public class CPrinterJob extends RasterPrinterJob {
+final class CPrinterJob extends RasterPrinterJob {
     // NOTE: This uses RasterPrinterJob as a base, but it doesn't use
     // all of the RasterPrinterJob functions. RasterPrinterJob will
     // break down printing to pieces that aren't necessary under MacOSX
@@ -89,6 +89,7 @@
      * returns true.
      * @see java.awt.GraphicsEnvironment#isHeadless
      */
+    @Override
     public boolean printDialog() throws HeadlessException {
         if (GraphicsEnvironment.isHeadless()) {
             throw new HeadlessException();
@@ -131,6 +132,7 @@
      * @see java.awt.GraphicsEnvironment#isHeadless
      * @since     1.2
      */
+    @Override
     public PageFormat pageDialog(PageFormat page) throws HeadlessException {
         if (GraphicsEnvironment.isHeadless()) {
             throw new HeadlessException();
@@ -156,12 +158,14 @@
      * @return clone of <code>page</code>, altered to describe a default
      *                      <code>PageFormat</code>.
      */
+    @Override
     public PageFormat defaultPage(PageFormat page) {
         PageFormat newPage = (PageFormat)page.clone();
         getDefaultPage(newPage);
         return newPage;
     }
 
+    @Override
     protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
         super.setAttributes(attributes);
 
@@ -216,7 +220,7 @@
         }
     }
 
-
+    @Override
     public void print(PrintRequestAttributeSet attributes) throws PrinterException {
         // NOTE: Some of this code is copied from RasterPrinterJob.
 
@@ -343,6 +347,7 @@
      * Returns the resolution in dots per inch across the width
      * of the page.
      */
+    @Override
     protected double getXRes() {
         // NOTE: This is not used in the CPrinterJob code path.
         return 0;
@@ -352,6 +357,7 @@
      * Returns the resolution in dots per inch down the height
      * of the page.
      */
+    @Override
     protected double getYRes() {
         // NOTE: This is not used in the CPrinterJob code path.
         return 0;
@@ -362,6 +368,7 @@
      * Value is in device pixels.
      * Not adjusted for orientation of the paper.
      */
+    @Override
     protected double getPhysicalPrintableX(Paper p) {
         // NOTE: This is not used in the CPrinterJob code path.
         return 0;
@@ -372,6 +379,7 @@
      * Value is in device pixels.
      * Not adjusted for orientation of the paper.
      */
+    @Override
     protected double getPhysicalPrintableY(Paper p) {
         // NOTE: This is not used in the CPrinterJob code path.
         return 0;
@@ -382,6 +390,7 @@
      * Value is in device pixels.
      * Not adjusted for orientation of the paper.
      */
+    @Override
     protected double getPhysicalPrintableWidth(Paper p) {
         // NOTE: This is not used in the CPrinterJob code path.
         return 0;
@@ -392,6 +401,7 @@
      * Value is in device pixels.
      * Not adjusted for orientation of the paper.
      */
+    @Override
     protected double getPhysicalPrintableHeight(Paper p) {
         // NOTE: This is not used in the CPrinterJob code path.
         return 0;
@@ -402,6 +412,7 @@
      * Value is in device pixels.
      * Not adjusted for orientation of the paper.
      */
+    @Override
     protected double getPhysicalPageWidth(Paper p) {
         // NOTE: This is not used in the CPrinterJob code path.
         return 0;
@@ -412,6 +423,7 @@
      * Value is in device pixels.
      * Not adjusted for orientation of the paper.
      */
+    @Override
     protected double getPhysicalPageHeight(Paper p) {
         // NOTE: This is not used in the CPrinterJob code path.
         return 0;
@@ -429,6 +441,7 @@
     /**
      * End a page.
      */
+    @Override
     protected void endPage(PageFormat format, Printable painter, int index) throws PrinterException {
         // NOTE: This is not used in the CPrinterJob code path.
         throw new PrinterException(sShouldNotReachHere);
@@ -441,6 +454,7 @@
      * page. The width and height of the band is
      * specified by the caller.
      */
+    @Override
     protected void printBand(byte[] data, int x, int y, int width, int height) throws PrinterException {
         // NOTE: This is not used in the CPrinterJob code path.
         throw new PrinterException(sShouldNotReachHere);
@@ -450,6 +464,7 @@
      * Called by the print() method at the start of
      * a print job.
      */
+    @Override
     protected void startDoc() throws PrinterException {
         // NOTE: This is not used in the CPrinterJob code path.
         throw new PrinterException(sShouldNotReachHere);
@@ -459,12 +474,14 @@
      * Called by the print() method at the end of
      * a print job.
      */
+    @Override
     protected void endDoc() throws PrinterException {
         // NOTE: This is not used in the CPrinterJob code path.
         throw new PrinterException(sShouldNotReachHere);
     }
 
     /* Called by cancelDoc */
+    @Override
     protected native void abortDoc();
 
     /**
@@ -502,10 +519,12 @@
     /**
      * validate the paper size against the current printer.
      */
+    @Override
     protected native void validatePaper(Paper origPaper, Paper newPaper );
 
     // The following methods are CPrinterJob specific.
 
+    @Override
     protected void finalize() {
         if (fNSPrintInfo != -1) {
             dispose(fNSPrintInfo);
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJobDialog.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJobDialog.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
 import java.awt.*;
 import java.awt.print.*;
 
-public class CPrinterJobDialog extends CPrinterDialog {
+final class CPrinterJobDialog extends CPrinterDialog {
     private Pageable fPageable;
     private boolean fAllowPrintToFile;
 
@@ -39,5 +39,6 @@
         fAllowPrintToFile = allowPrintToFile;
     }
 
+    @Override
     protected native boolean showDialog();
 }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterPageDialog.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterPageDialog.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
 import java.awt.*;
 import java.awt.print.*;
 
-public class CPrinterPageDialog extends CPrinterDialog {
+final class CPrinterPageDialog extends CPrinterDialog {
     private PageFormat fPage;
     private Printable fPainter;
 
@@ -39,5 +39,6 @@
         fPainter = painter;
     }
 
+    @Override
     protected native boolean showDialog();
 }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterSurfaceData.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterSurfaceData.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,11 +40,11 @@
 //    public static final SurfaceType IntArgbPQ = SurfaceType.IntArgb.deriveSubType(DESC_INT_ARGB_PQ);
     public static final SurfaceType IntRgbPQ = SurfaceType.IntRgb.deriveSubType(DESC_INT_RGB_PQ);
 
-    public static SurfaceData createData(PageFormat pf, long context) {
+    static SurfaceData createData(PageFormat pf, long context) {
         return new CPrinterSurfaceData(CPrinterGraphicsConfig.getConfig(pf), context);
     }
 
-    public CPrinterSurfaceData(GraphicsConfiguration gc, long context) {
+    private CPrinterSurfaceData(GraphicsConfiguration gc, long context) {
         super(IntRgbPQ, gc.getColorModel(), gc, gc.getBounds());
         initOps(context, this.fGraphicsStates, this.fGraphicsStatesObject, gc.getBounds().width, gc.getBounds().height);
     }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,6 @@
 
 import sun.awt.AWTAccessor;
 import sun.awt.SunToolkit;
-import sun.lwawt.macosx.event.NSEvent;
 
 import javax.swing.*;
 import java.awt.*;
@@ -76,8 +75,9 @@
                 menuPeer = (CPopupMenu)popup.getPeer();
                 if (menuPeer == null) {
                     popup.addNotify();
+                    menuPeer = (CPopupMenu)popup.getPeer();
                 }
-            }catch (Exception e){
+            } catch (Exception e) {
                 e.printStackTrace();
             }
         }
@@ -97,7 +97,12 @@
     //invocation from the AWTTrayIcon.m
     public long getPopupMenuModel(){
         if(popup == null) {
-            return 0L;
+            PopupMenu popupMenu = target.getPopupMenu();
+            if (popupMenu != null) {
+                popup = popupMenu;
+            } else {
+                return 0L;
+            }
         }
         return checkAndCreatePopupPeer().getModel();
     }
@@ -134,6 +139,10 @@
 
         dummyFrame.dispose();
 
+        if (popup != null) {
+            popup.removeNotify();
+        }
+
         LWCToolkit.targetDisposedPeer(target, this);
         target = null;
 
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,14 +22,17 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
+
 package sun.lwawt.macosx;
 
 import java.awt.AWTKeyStroke;
 import java.awt.Toolkit;
 import java.lang.reflect.InvocationTargetException;
+
 import sun.awt.EmbeddedFrame;
-import sun.lwawt.LWToolkit;
 import sun.lwawt.LWWindowPeer;
+
 /*
  * The CViewEmbeddedFrame class is used in the SWT_AWT bridge.
  * This is a part of public API and should not be renamed or moved
@@ -48,7 +51,7 @@
     @Override
     public void addNotify() {
         if (getPeer() == null) {
-            LWToolkit toolkit = (LWToolkit) Toolkit.getDefaultToolkit();
+            LWCToolkit toolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
             setPeer(toolkit.createEmbeddedFrame(this));
         }
         super.addNotify();
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java	Tue Apr 01 15:37:15 2014 +0200
@@ -247,10 +247,7 @@
                             nsWindowPtr, CWrapper.NSWindow.NSWindowAbove);
 
                     // do not allow security warning to be obscured by other windows
-                    if (ownerWindow.isAlwaysOnTop()) {
-                        CWrapper.NSWindow.setLevel(nsWindowPtr,
-                                CWrapper.NSWindow.NSFloatingWindowLevel);
-                    }
+                    applyWindowLevel(ownerWindow);
                 }
             }
         }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,73 +25,65 @@
 
 package sun.lwawt.macosx;
 
-import java.awt.geom.Rectangle2D;
-
-public final class CWrapper {
+final class CWrapper {
     private CWrapper() { }
 
-    public static final class NSWindow {
+    static final class NSWindow {
         // NSWindowOrderingMode
-        public static final int NSWindowAbove = 1;
-        public static final int NSWindowBelow = -1;
-        public static final int NSWindowOut = 0;
+        static final int NSWindowAbove = 1;
+        static final int NSWindowBelow = -1;
+        static final int NSWindowOut = 0;
 
         // Window level constants
         // The number of supported levels: (we'll use more in the future)
-        public static final int MAX_WINDOW_LEVELS = 2;
+        static final int MAX_WINDOW_LEVELS = 3;
         // The levels: (these are NOT real constants, these are keys. See native code.)
-        public static final int NSNormalWindowLevel = 0;
-        public static final int NSFloatingWindowLevel = 1;
+        static final int NSNormalWindowLevel = 0;
+        static final int NSFloatingWindowLevel = 1;
+        static final int NSPopUpMenuWindowLevel = 2;
 
         // 'level' is one of the keys defined above
-        public static native void setLevel(long window, int level);
+        static native void setLevel(long window, int level);
 
-        public static native void makeKeyAndOrderFront(long window);
-        public static native void makeKeyWindow(long window);
-        public static native void makeMainWindow(long window);
-        public static native boolean canBecomeMainWindow(long window);
-        public static native boolean isKeyWindow(long window);
+        static native void makeKeyAndOrderFront(long window);
+        static native void makeKeyWindow(long window);
+        static native void makeMainWindow(long window);
+        static native boolean canBecomeMainWindow(long window);
+        static native boolean isKeyWindow(long window);
 
-        public static native void orderFront(long window);
-        public static native void orderFrontRegardless(long window);
-        public static native void orderWindow(long window, int ordered, long relativeTo);
-        public static native void orderOut(long window);
+        static native void orderFront(long window);
+        static native void orderFrontRegardless(long window);
+        static native void orderWindow(long window, int ordered, long relativeTo);
+        static native void orderOut(long window);
 
-        public static native void addChildWindow(long parent, long child, int ordered);
-        public static native void removeChildWindow(long parent, long child);
+        static native void addChildWindow(long parent, long child, int ordered);
+        static native void removeChildWindow(long parent, long child);
 
-        public static native void setFrame(long window, int x, int y, int w, int h, boolean display);
+        static native void setAlphaValue(long window, float alpha);
+        static native void setOpaque(long window, boolean opaque);
+        static native void setBackgroundColor(long window, long color);
 
-        public static native void setAlphaValue(long window, float alpha);
-        public static native void setOpaque(long window, boolean opaque);
-        public static native void setBackgroundColor(long window, long color);
+        static native void miniaturize(long window);
+        static native void deminiaturize(long window);
+        static native boolean isZoomed(long window);
+        static native void zoom(long window);
 
-        public static native void miniaturize(long window);
-        public static native void deminiaturize(long window);
-        public static native boolean isZoomed(long window);
-        public static native void zoom(long window);
-
-        public static native void makeFirstResponder(long window, long responder);
+        static native void makeFirstResponder(long window, long responder);
     }
 
-    public static final class NSView {
-        public static native void addSubview(long view, long subview);
-        public static native void removeFromSuperview(long view);
+    static final class NSView {
+        static native void addSubview(long view, long subview);
+        static native void removeFromSuperview(long view);
 
-        public static native void setFrame(long view, int x, int y, int w, int h);
-        public static native Rectangle2D frame(long view);
-        public static native long window(long view);
+        static native void setFrame(long view, int x, int y, int w, int h);
+        static native long window(long view);
 
-        public static native void setHidden(long view, boolean hidden);
+        static native void setHidden(long view, boolean hidden);
 
-        public static native void setToolTip(long view, String msg);
+        static native void setToolTip(long view, String msg);
     }
 
-    public static final class NSObject {
-        public static native void release(long object);
-    }
-
-    public static final class NSColor {
-        public static native long clearColor();
+    static final class NSColor {
+        static native long clearColor();
     }
 }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,20 +33,25 @@
 import java.awt.event.InvocationEvent;
 import java.awt.event.KeyEvent;
 import java.awt.im.InputMethodHighlight;
+import java.awt.im.spi.InputMethodDescriptor;
 import java.awt.peer.*;
 import java.lang.reflect.*;
+import java.net.URL;
 import java.security.*;
 import java.util.*;
 import java.util.concurrent.Callable;
+import java.net.MalformedURLException;
 
 import sun.awt.*;
+import sun.awt.datatransfer.DataTransferer;
 import sun.lwawt.*;
 import sun.lwawt.LWWindowPeer.PeerType;
 import sun.security.action.GetBooleanAction;
+import sun.awt.image.MultiResolutionImage;
 
 import sun.util.CoreResourceBundleControl;
 
-class NamedCursor extends Cursor {
+final class NamedCursor extends Cursor {
     NamedCursor(String name) {
         super(name);
     }
@@ -72,6 +77,7 @@
 
         ResourceBundle platformResources = java.security.AccessController.doPrivileged(
                 new java.security.PrivilegedAction<ResourceBundle>() {
+            @Override
             public ResourceBundle run() {
                 ResourceBundle platformResources = null;
                 try {
@@ -109,8 +115,6 @@
     private static final boolean inAWT;
 
     public LWCToolkit() {
-        SunToolkit.setDataTransfererClassName("sun.lwawt.macosx.CDataTransferer");
-
         areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
         //set system property if not yet assigned
         System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
@@ -131,18 +135,20 @@
 
     private native void loadNativeColors(final int[] systemColors, final int[] appleColors);
 
+    @Override
     protected void loadSystemColors(final int[] systemColors) {
         if (systemColors == null) return;
         loadNativeColors(systemColors, appleColors);
     }
 
     private static class AppleSpecificColor extends Color {
-        int index;
-        public AppleSpecificColor(int index) {
+        private final int index;
+        AppleSpecificColor(int index) {
             super(appleColors[index]);
             this.index = index;
         }
 
+        @Override
         public int getRGB() {
             return appleColors[index];
         }
@@ -150,31 +156,19 @@
 
     /**
      * Returns Apple specific colors that we may expose going forward.
-     *
      */
     public static Color getAppleColor(int color) {
         return new AppleSpecificColor(color);
     }
 
+    // This is only called from native code.
     static void systemColorsChanged() {
-        // This is only called from native code.
-        EventQueue.invokeLater(new Runnable() {
-            public void run() {
-                AccessController.doPrivileged (new PrivilegedAction<Object>() {
-                    public Object run() {
-                        try {
-                            final Method updateColorsMethod = SystemColor.class.getDeclaredMethod("updateSystemColors", new Class[0]);
-                            updateColorsMethod.setAccessible(true);
-                            updateColorsMethod.invoke(null, new Object[0]);
-                        } catch (final Throwable e) {
-                            e.printStackTrace();
-                            // swallow this if something goes horribly wrong
-                        }
-                        return null;
-                    }
-                });
-            }
-           });
+        EventQueue.invokeLater(() -> {
+            AccessController.doPrivileged ((PrivilegedAction<Object>) () -> {
+                AWTAccessor.getSystemColorAccessor().updateSystemColors();
+                return null;
+            });
+        });
     }
 
     public static LWCToolkit getLWCToolkit() {
@@ -190,13 +184,44 @@
         } else if (peerType == PeerType.LW_FRAME) {
             return new CPlatformLWWindow();
         } else {
-            assert (peerType == PeerType.SIMPLEWINDOW || peerType == PeerType.DIALOG || peerType == PeerType.FRAME);
+            assert (peerType == PeerType.SIMPLEWINDOW
+                    || peerType == PeerType.DIALOG
+                    || peerType == PeerType.FRAME);
             return new CPlatformWindow();
         }
     }
 
+    LWWindowPeer createEmbeddedFrame(CEmbeddedFrame target) {
+        PlatformComponent platformComponent = createPlatformComponent();
+        PlatformWindow platformWindow = createPlatformWindow(PeerType.EMBEDDED_FRAME);
+        return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.EMBEDDED_FRAME);
+    }
+
+    LWWindowPeer createEmbeddedFrame(CViewEmbeddedFrame target) {
+        PlatformComponent platformComponent = createPlatformComponent();
+        PlatformWindow platformWindow = createPlatformWindow(PeerType.VIEW_EMBEDDED_FRAME);
+        return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.VIEW_EMBEDDED_FRAME);
+    }
+
+    private CPrinterDialogPeer createCPrinterDialog(CPrinterDialog target) {
+        PlatformComponent platformComponent = createPlatformComponent();
+        PlatformWindow platformWindow = createPlatformWindow(PeerType.DIALOG);
+        CPrinterDialogPeer peer = new CPrinterDialogPeer(target, platformComponent, platformWindow);
+        targetCreatedPeer(target, peer);
+        return peer;
+    }
+
     @Override
-    protected SecurityWarningWindow createSecurityWarning(Window ownerWindow, LWWindowPeer ownerPeer) {
+    public DialogPeer createDialog(Dialog target) {
+        if (target instanceof CPrinterDialog) {
+            return createCPrinterDialog((CPrinterDialog)target);
+        }
+        return super.createDialog(target);
+    }
+
+    @Override
+    protected SecurityWarningWindow createSecurityWarning(Window ownerWindow,
+                                                          LWWindowPeer ownerPeer) {
         return new CWarningWindow(ownerWindow, ownerPeer);
     }
 
@@ -248,13 +273,11 @@
         PopupMenuPeer peer = new CPopupMenu(target);
         targetCreatedPeer(target, peer);
         return peer;
-
     }
 
     @Override
     public SystemTrayPeer createSystemTray(SystemTray target) {
-        SystemTrayPeer peer = new CSystemTray();
-        return peer;
+        return new CSystemTray();
     }
 
     @Override
@@ -265,56 +288,63 @@
     }
 
     @Override
+    protected DesktopPeer createDesktopPeer(Desktop target) {
+        return new CDesktopPeer();
+    }
+
+    @Override
     public LWCursorManager getCursorManager() {
         return CCursorManager.getInstance();
     }
 
     @Override
-    public Cursor createCustomCursor(final Image cursor, final Point hotSpot, final String name) throws IndexOutOfBoundsException, HeadlessException {
+    public Cursor createCustomCursor(final Image cursor, final Point hotSpot,
+                                     final String name)
+            throws IndexOutOfBoundsException, HeadlessException {
         return new CCustomCursor(cursor, hotSpot, name);
     }
 
     @Override
-    public Dimension getBestCursorSize(final int preferredWidth, final int preferredHeight) throws HeadlessException {
+    public Dimension getBestCursorSize(final int preferredWidth,
+                                       final int preferredHeight)
+            throws HeadlessException {
         return CCustomCursor.getBestCursorSize(preferredWidth, preferredHeight);
     }
 
     @Override
     protected void platformCleanup() {
         // TODO Auto-generated method stub
-
     }
 
     @Override
     protected void platformInit() {
         // TODO Auto-generated method stub
-
     }
 
     @Override
     protected void platformRunMessage() {
         // TODO Auto-generated method stub
-
     }
 
     @Override
     protected void platformShutdown() {
         // TODO Auto-generated method stub
-
     }
 
     class OSXPlatformFont extends sun.awt.PlatformFont
     {
-        public OSXPlatformFont(String name, int style)
+        OSXPlatformFont(String name, int style)
         {
             super(name, style);
         }
+        @Override
         protected char getMissingGlyphCharacter()
         {
             // Follow up for real implementation
             return (char)0xfff8; // see http://developer.apple.com/fonts/LastResortFont/
         }
     }
+    @Override
     public FontPeer getFontPeer(String name, int style) {
         return new OSXPlatformFont(name, style);
     }
@@ -334,7 +364,7 @@
     @Override
     protected void initializeDesktopProperties() {
         super.initializeDesktopProperties();
-        Map <Object, Object> fontHints = new HashMap<Object, Object>();
+        Map <Object, Object> fontHints = new HashMap<>();
         fontHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
         fontHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
         desktopProperties.put(SunToolkit.DESKTOPFONTHINTS, fontHints);
@@ -355,14 +385,8 @@
         desktopProperties.put("DnD.Cursor.CopyNoDrop", new NamedCursor("DnD.Cursor.CopyNoDrop"));
         desktopProperties.put("DnD.Cursor.MoveNoDrop", new NamedCursor("DnD.Cursor.MoveNoDrop"));
         desktopProperties.put("DnD.Cursor.LinkNoDrop", new NamedCursor("DnD.Cursor.LinkNoDrop"));
-
     }
 
-
-/*
- * The method returns true if some events were processed during that timeout.
- * @see sun.awt.SunToolkit#syncNativeQueue(long)
- */
     @Override
     protected boolean syncNativeQueue(long timeout) {
         return nativeSyncQueue(timeout);
@@ -386,7 +410,6 @@
     @Override
     public void sync() {
         // TODO Auto-generated method stub
-
     }
 
     @Override
@@ -406,6 +429,7 @@
      * as Num Lock on PC keyboards is called Clear, doesn't lock
      * anything and is used for entirely different purpose.
      */
+    @Override
     public boolean getLockingKeyState(int keyCode) throws UnsupportedOperationException {
         switch (keyCode) {
             case KeyEvent.VK_NUM_LOCK:
@@ -425,10 +449,12 @@
     //Set to true by default.
     private static boolean areExtraMouseButtonsEnabled = true;
 
+    @Override
     public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
         return areExtraMouseButtonsEnabled;
     }
 
+    @Override
     public int getNumberOfButtons(){
         return BUTTONS;
     }
@@ -439,6 +465,11 @@
     }
 
     @Override
+    public DataTransferer getDataTransferer() {
+        return CDataTransferer.getInstanceImpl();
+    }
+
+    @Override
     public boolean isAlwaysOnTopSupported() {
         return true;
     }
@@ -482,6 +513,7 @@
      * @see       java.awt.MenuShortcut
      * @since     JDK1.1
      */
+    @Override
     public int getMenuShortcutKeyMask() {
         return Event.META_MASK;
     }
@@ -489,13 +521,34 @@
     @Override
     public Image getImage(final String filename) {
         final Image nsImage = checkForNSImage(filename);
-        if (nsImage != null) return nsImage;
+        if (nsImage != null) {
+            return nsImage;
+        }
 
-        return super.getImage(filename);
+        if (imageCached(filename)) {
+            return super.getImage(filename);
+        }
+
+        String fileneame2x = getScaledImageName(filename);
+        return (imageExists(fileneame2x))
+                ? getImageWithResolutionVariant(filename, fileneame2x)
+                : super.getImage(filename);
     }
 
-    static final String nsImagePrefix = "NSImage://";
-    protected Image checkForNSImage(final String imageName) {
+    @Override
+    public Image getImage(URL url) {
+
+        if (imageCached(url)) {
+            return super.getImage(url);
+        }
+
+        URL url2x = getScaledImageURL(url);
+        return (imageExists(url2x))
+                ? getImageWithResolutionVariant(url, url2x) : super.getImage(url);
+    }
+
+    private static final String nsImagePrefix = "NSImage://";
+    private Image checkForNSImage(final String imageName) {
         if (imageName == null) return null;
         if (!imageName.startsWith(nsImagePrefix)) return null;
         return CImage.getCreator().createImageFromName(imageName.substring(nsImagePrefix.length()));
@@ -514,8 +567,9 @@
         synchronized(ret) { return ret[0]; }
     }
 
-    public static <T> T invokeAndWait(final Callable<T> callable, Component component) throws Exception {
-        final CallableWrapper<T> wrapper = new CallableWrapper<T>(callable);
+    public static <T> T invokeAndWait(final Callable<T> callable,
+                                      Component component) throws Exception {
+        final CallableWrapper<T> wrapper = new CallableWrapper<>(callable);
         invokeAndWait(wrapper, component);
         return wrapper.getResult();
     }
@@ -525,10 +579,11 @@
         T object;
         Exception e;
 
-        public CallableWrapper(final Callable<T> callable) {
+        CallableWrapper(final Callable<T> callable) {
             this.callable = callable;
         }
 
+        @Override
         public void run() {
             try {
                 object = callable.call();
@@ -543,12 +598,16 @@
         }
     }
 
-    // Kicks an event over to the appropriate eventqueue and waits for it to finish
-    // To avoid deadlocking, we manually run the NSRunLoop while waiting
-    // Any selector invoked using ThreadUtilities performOnMainThread will be processed in doAWTRunLoop
-    // The InvocationEvent will call LWCToolkit.stopAWTRunLoop() when finished, which will stop our manual runloop
-    // Does not dispatch native events while in the loop
-    public static void invokeAndWait(Runnable runnable, Component component) throws InvocationTargetException {
+    /**
+     * Kicks an event over to the appropriate eventqueue and waits for it to
+     * finish To avoid deadlocking, we manually run the NSRunLoop while waiting
+     * Any selector invoked using ThreadUtilities performOnMainThread will be
+     * processed in doAWTRunLoop The InvocationEvent will call
+     * LWCToolkit.stopAWTRunLoop() when finished, which will stop our manual
+     * runloop Does not dispatch native events while in the loop
+     */
+    public static void invokeAndWait(Runnable runnable, Component component)
+            throws InvocationTargetException {
         final long mediator = createAWTRunLoopMediator();
 
         InvocationEvent invocationEvent =
@@ -583,7 +642,8 @@
         }
     }
 
-    public static void invokeLater(Runnable event, Component component) throws InvocationTargetException {
+    public static void invokeLater(Runnable event, Component component)
+            throws InvocationTargetException {
         final InvocationEvent invocationEvent =
                 new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(), event);
 
@@ -612,16 +672,18 @@
         return getSystemEventQueueImpl();
     }
 
-
 // DnD support
 
-    public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
-        DragSourceContextPeer dscp = CDragSourceContextPeer.createDragSourceContextPeer(dge);
-
-        return dscp;
+    @Override
+    public DragSourceContextPeer createDragSourceContextPeer(
+            DragGestureEvent dge) throws InvalidDnDOperationException {
+        return CDragSourceContextPeer.createDragSourceContextPeer(dge);
     }
 
-    public <T extends DragGestureRecognizer> T createDragGestureRecognizer(Class<T> abstractRecognizerClass, DragSource ds, Component c, int srcActions, DragGestureListener dgl) {
+    @Override
+    public <T extends DragGestureRecognizer> T createDragGestureRecognizer(
+            Class<T> abstractRecognizerClass, DragSource ds, Component c,
+            int srcActions, DragGestureListener dgl) {
         DragGestureRecognizer dgr = null;
 
         // Create a new mouse drag gesture recognizer if we have a class match:
@@ -635,6 +697,7 @@
     /**
      * Returns the default keyboard locale of the underlying operating system
      */
+    @Override
     public Locale getDefaultKeyboardLocale() {
         Locale locale = CInputMethod.getNativeLocale();
 
@@ -645,7 +708,8 @@
         return locale;
     }
 
-    public java.awt.im.spi.InputMethodDescriptor getInputMethodAdapterDescriptor() {
+    @Override
+    public InputMethodDescriptor getInputMethodAdapterDescriptor() {
         if (sInputMethodDescriptor == null)
             sInputMethodDescriptor = new CInputMethodDescriptor();
 
@@ -661,12 +725,14 @@
      * @return style attribute map, or null
      * @since 1.3
      */
+    @Override
     public Map mapInputMethodHighlight(InputMethodHighlight highlight) {
         return CInputMethod.mapInputMethodHighlight(highlight);
     }
 
     /**
-     * Returns key modifiers used by Swing to set up a focus accelerator key stroke.
+     * Returns key modifiers used by Swing to set up a focus accelerator key
+     * stroke.
      */
     @Override
     public int getFocusAcceleratorKeyMask() {
@@ -674,8 +740,8 @@
     }
 
     /**
-     * Tests whether specified key modifiers mask can be used to enter a printable
-     * character.
+     * Tests whether specified key modifiers mask can be used to enter a
+     * printable character.
      */
     @Override
     public boolean isPrintableCharacterModifiersMask(int mods) {
@@ -696,19 +762,18 @@
      * Returns the value of "sun.awt.disableCALayers" property. Default
      * value is {@code false}.
      */
-    public synchronized static boolean getSunAwtDisableCALayers() {
+    public static synchronized boolean getSunAwtDisableCALayers() {
         if (sunAwtDisableCALayers == null) {
             sunAwtDisableCALayers = AccessController.doPrivileged(
                 new GetBooleanAction("sun.awt.disableCALayers"));
         }
-        return sunAwtDisableCALayers.booleanValue();
+        return sunAwtDisableCALayers;
     }
 
-
     /*
      * Returns true if the application (one of its windows) owns keyboard focus.
      */
-    public native boolean isApplicationActive();
+    native boolean isApplicationActive();
 
     /************************
      * Native methods section
@@ -729,7 +794,7 @@
     static void doAWTRunLoop(long mediator, boolean processEvents) {
         doAWTRunLoopImpl(mediator, processEvents, inAWT);
     }
-    static private native void doAWTRunLoopImpl(long mediator, boolean processEvents, boolean inAWT);
+    private static native void doAWTRunLoopImpl(long mediator, boolean processEvents, boolean inAWT);
     static native void stopAWTRunLoop(long mediator);
 
     private native boolean nativeSyncQueue(long timeout);
@@ -773,6 +838,7 @@
         return true;
     }
 
+    @Override
     public boolean isSwingBackbufferTranslucencySupported() {
         return true;
     }
@@ -781,4 +847,36 @@
     public boolean enableInputMethodsForTextComponent() {
         return true;
     }
+
+    private static URL getScaledImageURL(URL url) {
+        try {
+            String scaledImagePath = getScaledImageName(url.getPath());
+            return scaledImagePath == null ? null : new URL(url.getProtocol(),
+                    url.getHost(), url.getPort(), scaledImagePath);
+        } catch (MalformedURLException e) {
+            return null;
+        }
+    }
+
+    private static String getScaledImageName(String path) {
+        if (!isValidPath(path)) {
+            return null;
+        }
+
+        int slash = path.lastIndexOf('/');
+        String name = (slash < 0) ? path : path.substring(slash + 1);
+
+        if (name.contains("@2x")) {
+            return null;
+        }
+
+        int dot = name.lastIndexOf('.');
+        String name2x = (dot < 0) ? name + "@2x"
+                : name.substring(0, dot) + "@2x" + name.substring(dot);
+        return (slash < 0) ? name2x : path.substring(0, slash + 1) + name2x;
+    }
+
+    private static boolean isValidPath(String path) {
+        return !path.isEmpty() && !path.endsWith("/") && !path.endsWith(".");
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/NSEvent.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.lwawt.macosx;
+
+import java.awt.event.*;
+
+/**
+ * A class representing Cocoa NSEvent class with the fields only necessary for
+ * JDK functionality.
+ */
+final class NSEvent {
+    private int type;
+    private int modifierFlags;
+
+    // Mouse event information
+    private int clickCount;
+    private int buttonNumber;
+    private int x;
+    private int y;
+    private double scrollDeltaY;
+    private double scrollDeltaX;
+    private int absX;
+    private int absY;
+
+    // Key event information
+    private short keyCode;
+    private String charactersIgnoringModifiers;
+
+    // Called from native
+    NSEvent(int type, int modifierFlags, short keyCode, String charactersIgnoringModifiers) {
+        this.type = type;
+        this.modifierFlags = modifierFlags;
+        this.keyCode = keyCode;
+        this.charactersIgnoringModifiers = charactersIgnoringModifiers;
+    }
+
+    // Called from native
+    NSEvent(int type, int modifierFlags, int clickCount, int buttonNumber,
+                   int x, int y, int absX, int absY,
+                   double scrollDeltaY, double scrollDeltaX) {
+        this.type = type;
+        this.modifierFlags = modifierFlags;
+        this.clickCount = clickCount;
+        this.buttonNumber = buttonNumber;
+        this.x = x;
+        this.y = y;
+        this.absX = absX;
+        this.absY = absY;
+        this.scrollDeltaY = scrollDeltaY;
+        this.scrollDeltaX = scrollDeltaX;
+    }
+
+    int getType() {
+        return type;
+    }
+
+    int getModifierFlags() {
+        return modifierFlags;
+    }
+
+    int getClickCount() {
+        return clickCount;
+    }
+
+    int getButtonNumber() {
+        return buttonNumber;
+    }
+
+    int getX() {
+        return x;
+    }
+
+    int getY() {
+        return y;
+    }
+
+    double getScrollDeltaY() {
+        return scrollDeltaY;
+    }
+
+    double getScrollDeltaX() {
+        return scrollDeltaX;
+    }
+
+    int getAbsX() {
+        return absX;
+    }
+
+    int getAbsY() {
+        return absY;
+    }
+
+    short getKeyCode() {
+        return keyCode;
+    }
+
+    String getCharactersIgnoringModifiers() {
+        return charactersIgnoringModifiers;
+    }
+
+    @Override
+    public String toString() {
+        return "NSEvent[" + getType() + " ," + getModifierFlags() + " ,"
+                + getClickCount() + " ," + getButtonNumber() + " ," + getX() + " ,"
+                + getY() + " ," + getAbsX() + " ," + getAbsY()+ " ," + getKeyCode() + " ,"
+                + getCharactersIgnoringModifiers() + "]";
+    }
+
+    /*
+     * Converts an NSEvent button number to a MouseEvent constant.
+     */
+    static int nsToJavaButton(int buttonNumber) {
+        int jbuttonNumber = buttonNumber + 1;
+        switch (buttonNumber) {
+            case CocoaConstants.kCGMouseButtonLeft:
+                jbuttonNumber = MouseEvent.BUTTON1;
+                break;
+            case CocoaConstants.kCGMouseButtonRight:
+                jbuttonNumber = MouseEvent.BUTTON3;
+                break;
+            case CocoaConstants.kCGMouseButtonCenter:
+                jbuttonNumber = MouseEvent.BUTTON2;
+                break;
+        }
+        return jbuttonNumber;
+    }
+
+    /*
+     * Converts NPCocoaEvent types to AWT event types.
+     */
+    static int npToJavaEventType(int npEventType) {
+        int jeventType = 0;
+        switch (npEventType) {
+            case CocoaConstants.NPCocoaEventMouseDown:
+                jeventType = MouseEvent.MOUSE_PRESSED;
+                break;
+            case CocoaConstants.NPCocoaEventMouseUp:
+                jeventType = MouseEvent.MOUSE_RELEASED;
+                break;
+            case CocoaConstants.NPCocoaEventMouseMoved:
+                jeventType = MouseEvent.MOUSE_MOVED;
+                break;
+            case CocoaConstants.NPCocoaEventMouseEntered:
+                jeventType = MouseEvent.MOUSE_ENTERED;
+                break;
+            case CocoaConstants.NPCocoaEventMouseExited:
+                jeventType = MouseEvent.MOUSE_EXITED;
+                break;
+            case CocoaConstants.NPCocoaEventMouseDragged:
+                jeventType = MouseEvent.MOUSE_DRAGGED;
+                break;
+            case CocoaConstants.NPCocoaEventKeyDown:
+                jeventType = KeyEvent.KEY_PRESSED;
+                break;
+            case CocoaConstants.NPCocoaEventKeyUp:
+                jeventType = KeyEvent.KEY_RELEASED;
+                break;
+        }
+        return jeventType;
+    }
+
+    /*
+     * Converts NSEvent types to AWT event types.
+     */
+    static int nsToJavaEventType(int nsEventType) {
+        int jeventType = 0;
+        switch (nsEventType) {
+            case CocoaConstants.NSLeftMouseDown:
+            case CocoaConstants.NSRightMouseDown:
+            case CocoaConstants.NSOtherMouseDown:
+                jeventType = MouseEvent.MOUSE_PRESSED;
+                break;
+            case CocoaConstants.NSLeftMouseUp:
+            case CocoaConstants.NSRightMouseUp:
+            case CocoaConstants.NSOtherMouseUp:
+                jeventType = MouseEvent.MOUSE_RELEASED;
+                break;
+            case CocoaConstants.NSMouseMoved:
+                jeventType = MouseEvent.MOUSE_MOVED;
+                break;
+            case CocoaConstants.NSLeftMouseDragged:
+            case CocoaConstants.NSRightMouseDragged:
+            case CocoaConstants.NSOtherMouseDragged:
+                jeventType = MouseEvent.MOUSE_DRAGGED;
+                break;
+            case CocoaConstants.NSMouseEntered:
+                jeventType = MouseEvent.MOUSE_ENTERED;
+                break;
+            case CocoaConstants.NSMouseExited:
+                jeventType = MouseEvent.MOUSE_EXITED;
+                break;
+            case CocoaConstants.NSScrollWheel:
+                jeventType = MouseEvent.MOUSE_WHEEL;
+                break;
+            case CocoaConstants.NSKeyDown:
+                jeventType = KeyEvent.KEY_PRESSED;
+                break;
+            case CocoaConstants.NSKeyUp:
+                jeventType = KeyEvent.KEY_RELEASED;
+                break;
+        }
+        return jeventType;
+    }
+
+    /*
+     * Converts NSEvent mouse modifiers to AWT mouse modifiers.
+     */
+    static native int nsToJavaMouseModifiers(int buttonNumber,
+                                                    int modifierFlags);
+
+    /*
+     * Converts NSEvent key modifiers to AWT key modifiers.
+     */
+    static native int nsToJavaKeyModifiers(int modifierFlags);
+
+    /*
+     * Converts NSEvent key info to AWT key info.
+     */
+    static native boolean nsToJavaKeyInfo(int[] in, int[] out);
+
+    /*
+     * Converts NSEvent key modifiers to AWT key info.
+     */
+    static native void nsKeyModifiersToJavaKeyInfo(int[] in, int[] out);
+
+    /*
+     * There is a small number of NS characters that need to be converted
+     * into other characters before we pass them to AWT.
+     */
+    static native char nsToJavaChar(char nsChar, int modifierFlags);
+
+    static boolean isPopupTrigger(int jmodifiers) {
+        final boolean isRightButtonDown = ((jmodifiers & InputEvent.BUTTON3_DOWN_MASK) != 0);
+        final boolean isLeftButtonDown = ((jmodifiers & InputEvent.BUTTON1_DOWN_MASK) != 0);
+        final boolean isControlDown = ((jmodifiers & InputEvent.CTRL_DOWN_MASK) != 0);
+        return isRightButtonDown || (isControlDown && isLeftButtonDown);
+    }
+}
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/event/NSEvent.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,260 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.lwawt.macosx.event;
-
-import sun.lwawt.macosx.CocoaConstants;
-import java.awt.event.*;
-
-/**
- * A class representing Cocoa NSEvent class with the fields only necessary for
- * JDK functionality.
- */
-public final class NSEvent {
-    private int type;
-    private int modifierFlags;
-
-    // Mouse event information
-    private int clickCount;
-    private int buttonNumber;
-    private int x;
-    private int y;
-    private double scrollDeltaY;
-    private double scrollDeltaX;
-    private int absX;
-    private int absY;
-
-    // Key event information
-    private short keyCode;
-    private String charactersIgnoringModifiers;
-
-    public NSEvent(int type, int modifierFlags, short keyCode, String charactersIgnoringModifiers) {
-        this.type = type;
-        this.modifierFlags = modifierFlags;
-        this.keyCode = keyCode;
-        this.charactersIgnoringModifiers = charactersIgnoringModifiers;
-    }
-
-    public NSEvent(int type, int modifierFlags, int clickCount, int buttonNumber,
-                   int x, int y, int absX, int absY,
-                   double scrollDeltaY, double scrollDeltaX) {
-        this.type = type;
-        this.modifierFlags = modifierFlags;
-        this.clickCount = clickCount;
-        this.buttonNumber = buttonNumber;
-        this.x = x;
-        this.y = y;
-        this.absX = absX;
-        this.absY = absY;
-        this.scrollDeltaY = scrollDeltaY;
-        this.scrollDeltaX = scrollDeltaX;
-    }
-
-    public int getType() {
-        return type;
-    }
-
-    public int getModifierFlags() {
-        return modifierFlags;
-    }
-
-    public int getClickCount() {
-        return clickCount;
-    }
-
-    public int getButtonNumber() {
-        return buttonNumber;
-    }
-
-    public int getX() {
-        return x;
-    }
-
-    public int getY() {
-        return y;
-    }
-
-    public double getScrollDeltaY() {
-        return scrollDeltaY;
-    }
-
-    public double getScrollDeltaX() {
-        return scrollDeltaX;
-    }
-
-    public int getAbsX() {
-        return absX;
-    }
-
-    public int getAbsY() {
-        return absY;
-    }
-
-    public short getKeyCode() {
-        return keyCode;
-    }
-
-    public String getCharactersIgnoringModifiers() {
-        return charactersIgnoringModifiers;
-    }
-
-    @Override
-    public String toString() {
-        return "NSEvent[" + getType() + " ," + getModifierFlags() + " ,"
-                + getClickCount() + " ," + getButtonNumber() + " ," + getX() + " ,"
-                + getY() + " ," + getAbsX() + " ," + getAbsY()+ " ," + getKeyCode() + " ,"
-                + getCharactersIgnoringModifiers() + "]";
-    }
-
-    /*
-     * Converts an NSEvent button number to a MouseEvent constant.
-     */
-    public static int nsToJavaButton(int buttonNumber) {
-        int jbuttonNumber = buttonNumber + 1;
-        switch (buttonNumber) {
-            case CocoaConstants.kCGMouseButtonLeft:
-                jbuttonNumber = MouseEvent.BUTTON1;
-                break;
-            case CocoaConstants.kCGMouseButtonRight:
-                jbuttonNumber = MouseEvent.BUTTON3;
-                break;
-            case CocoaConstants.kCGMouseButtonCenter:
-                jbuttonNumber = MouseEvent.BUTTON2;
-                break;
-        }
-        return jbuttonNumber;
-    }
-
-    /*
-     * Converts NPCocoaEvent types to AWT event types.
-     */
-    public static int npToJavaEventType(int npEventType) {
-        int jeventType = 0;
-        switch (npEventType) {
-            case CocoaConstants.NPCocoaEventMouseDown:
-                jeventType = MouseEvent.MOUSE_PRESSED;
-                break;
-            case CocoaConstants.NPCocoaEventMouseUp:
-                jeventType = MouseEvent.MOUSE_RELEASED;
-                break;
-            case CocoaConstants.NPCocoaEventMouseMoved:
-                jeventType = MouseEvent.MOUSE_MOVED;
-                break;
-            case CocoaConstants.NPCocoaEventMouseEntered:
-                jeventType = MouseEvent.MOUSE_ENTERED;
-                break;
-            case CocoaConstants.NPCocoaEventMouseExited:
-                jeventType = MouseEvent.MOUSE_EXITED;
-                break;
-            case CocoaConstants.NPCocoaEventMouseDragged:
-                jeventType = MouseEvent.MOUSE_DRAGGED;
-                break;
-            case CocoaConstants.NPCocoaEventKeyDown:
-                jeventType = KeyEvent.KEY_PRESSED;
-                break;
-            case CocoaConstants.NPCocoaEventKeyUp:
-                jeventType = KeyEvent.KEY_RELEASED;
-                break;
-        }
-        return jeventType;
-    }
-
-    /*
-     * Converts NSEvent types to AWT event types.
-     */
-    public static int nsToJavaEventType(int nsEventType) {
-        int jeventType = 0;
-        switch (nsEventType) {
-            case CocoaConstants.NSLeftMouseDown:
-            case CocoaConstants.NSRightMouseDown:
-            case CocoaConstants.NSOtherMouseDown:
-                jeventType = MouseEvent.MOUSE_PRESSED;
-                break;
-            case CocoaConstants.NSLeftMouseUp:
-            case CocoaConstants.NSRightMouseUp:
-            case CocoaConstants.NSOtherMouseUp:
-                jeventType = MouseEvent.MOUSE_RELEASED;
-                break;
-            case CocoaConstants.NSMouseMoved:
-                jeventType = MouseEvent.MOUSE_MOVED;
-                break;
-            case CocoaConstants.NSLeftMouseDragged:
-            case CocoaConstants.NSRightMouseDragged:
-            case CocoaConstants.NSOtherMouseDragged:
-                jeventType = MouseEvent.MOUSE_DRAGGED;
-                break;
-            case CocoaConstants.NSMouseEntered:
-                jeventType = MouseEvent.MOUSE_ENTERED;
-                break;
-            case CocoaConstants.NSMouseExited:
-                jeventType = MouseEvent.MOUSE_EXITED;
-                break;
-            case CocoaConstants.NSScrollWheel:
-                jeventType = MouseEvent.MOUSE_WHEEL;
-                break;
-            case CocoaConstants.NSKeyDown:
-                jeventType = KeyEvent.KEY_PRESSED;
-                break;
-            case CocoaConstants.NSKeyUp:
-                jeventType = KeyEvent.KEY_RELEASED;
-                break;
-        }
-        return jeventType;
-    }
-
-    /*
-     * Converts NSEvent mouse modifiers to AWT mouse modifiers.
-     */
-    public static native int nsToJavaMouseModifiers(int buttonNumber,
-                                                    int modifierFlags);
-
-    /*
-     * Converts NSEvent key modifiers to AWT key modifiers.
-     */
-    public static native int nsToJavaKeyModifiers(int modifierFlags);
-
-    /*
-     * Converts NSEvent key info to AWT key info.
-     */
-    public static native boolean nsToJavaKeyInfo(int[] in, int[] out);
-
-    /*
-     * Converts NSEvent key modifiers to AWT key info.
-     */
-    public static native void nsKeyModifiersToJavaKeyInfo(int[] in, int[] out);
-
-    /*
-     * There is a small number of NS characters that need to be converted
-     * into other characters before we pass them to AWT.
-     */
-    public static native char nsToJavaChar(char nsChar, int modifierFlags);
-
-    public static boolean isPopupTrigger(int jmodifiers) {
-        final boolean isRightButtonDown = ((jmodifiers & InputEvent.BUTTON3_DOWN_MASK) != 0);
-        final boolean isLeftButtonDown = ((jmodifiers & InputEvent.BUTTON1_DOWN_MASK) != 0);
-        final boolean isControlDown = ((jmodifiers & InputEvent.CTRL_DOWN_MASK) != 0);
-        return isRightButtonDown || (isControlDown && isLeftButtonDown);
-    }
-}
--- a/jdk/src/macosx/lib/flavormap.properties	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/lib/flavormap.properties	Tue Apr 01 15:37:15 2014 +0200
@@ -79,3 +79,5 @@
 TIFF=image/x-java-image;class=java.awt.Image
 RICH_TEXT=text/rtf
 HTML=text/html;charset=utf-8;eoln="\r\n";terminators=1
+URL=application/x-java-url;class=java.net.URL
+URL=text/uri-list;eoln="\r\n";terminators=1
--- a/jdk/src/macosx/native/com/apple/laf/AquaFileView.m	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/native/com/apple/laf/AquaFileView.m	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,9 @@
  * questions.
  */
 
+
+#include <jni_util.h>
+
 #import "com_apple_laf_AquaFileView.h"
 
 #import <sys/param.h> // for MAXPATHLEN
@@ -98,6 +101,7 @@
 JNF_COCOA_ENTER(env);
 
     jbyte *byteArray = (*env)->GetByteArrayElements(env, absolutePath, NULL);
+    CHECK_NULL_RETURN(byteArray, returnValue);
     jsize length = (*env)->GetArrayLength(env, absolutePath);
 
     // Can't assume that byteArray is NULL terminated and FSPathMakeRef doesn't
@@ -138,6 +142,7 @@
 JNF_COCOA_ENTER(env);
 
     jbyte *byteArray = (*env)->GetByteArrayElements(env, absolutePath, NULL);
+    CHECK_NULL_RETURN(byteArray, returnValue);
     jsize length = (*env)->GetArrayLength(env, absolutePath);
 
     // Can't assume that byteArray is NULL terminated and FSPathMakeRef doesn't
@@ -153,7 +158,9 @@
     Boolean isDirectory = (isDir == JNI_TRUE ? true : false);
     FSRef ref;
 
-    OSErr theErr = FSPathMakeRefWithOptions((const UInt8 *)&arrayCopy, kFSPathMakeRefDoNotFollowLeafSymlink, &ref, &isDirectory);
+    OSErr theErr = FSPathMakeRefWithOptions((const UInt8 *)&arrayCopy,
+                                            kFSPathMakeRefDoNotFollowLeafSymlink,
+                                            &ref, &isDirectory);
     if (theErr == noErr) {
         CFStringRef displayName = NULL;
 
@@ -190,6 +197,7 @@
     size_t maxPathLen = sizeof(pathCString) - 1;
 
     jbyte *byteArray = (*env)->GetByteArrayElements(env, pathToAlias, NULL);
+    CHECK_NULL_RETURN(byteArray, returnValue);
     jsize length = (*env)->GetArrayLength(env, pathToAlias);
 
     if (length > maxPathLen) {
@@ -205,7 +213,8 @@
     OSErr theErr = FSPathMakeRef(pathCString, &fileRef, &isDirectory);
 
     Boolean ignored;
-    theErr = FSResolveAliasFileWithMountFlags(&fileRef, false, &ignored, &ignored, kResolveAliasFileNoUI);
+    theErr = FSResolveAliasFileWithMountFlags(&fileRef, false, &ignored,
+                                              &ignored, kResolveAliasFileNoUI);
     if (theErr == noErr) {
         UInt8 resolvedPath[MAXPATHLEN];
         theErr = FSRefMakePath(&fileRef, resolvedPath, MAXPATHLEN);
--- a/jdk/src/macosx/native/sun/awt/AWTEvent.m	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/native/sun/awt/AWTEvent.m	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -633,12 +633,12 @@
 }
 
 /*
- * Class:     sun_lwawt_macosx_event_NSEvent
+ * Class:     sun_lwawt_macosx_NSEvent
  * Method:    nsToJavaMouseModifiers
  * Signature: (II)I
  */
 JNIEXPORT jint JNICALL
-Java_sun_lwawt_macosx_event_NSEvent_nsToJavaMouseModifiers
+Java_sun_lwawt_macosx_NSEvent_nsToJavaMouseModifiers
 (JNIEnv *env, jclass cls, jint buttonNumber, jint modifierFlags)
 {
     jint jmodifiers = 0;
@@ -653,12 +653,12 @@
 }
 
 /*
- * Class:     sun_lwawt_macosx_event_NSEvent
+ * Class:     sun_lwawt_macosx_NSEvent
  * Method:    nsToJavaKeyModifiers
  * Signature: (I)I
  */
 JNIEXPORT jint JNICALL
-Java_sun_lwawt_macosx_event_NSEvent_nsToJavaKeyModifiers
+Java_sun_lwawt_macosx_NSEvent_nsToJavaKeyModifiers
 (JNIEnv *env, jclass cls, jint modifierFlags)
 {
     jint jmodifiers = 0;
@@ -673,12 +673,12 @@
 }
 
 /*
- * Class:     sun_lwawt_macosx_event_NSEvent
+ * Class:     sun_lwawt_macosx_NSEvent
  * Method:    nsToJavaKeyInfo
  * Signature: ([I[I)Z
  */
 JNIEXPORT jboolean JNICALL
-Java_sun_lwawt_macosx_event_NSEvent_nsToJavaKeyInfo
+Java_sun_lwawt_macosx_NSEvent_nsToJavaKeyInfo
 (JNIEnv *env, jclass cls, jintArray inData, jintArray outData)
 {
     BOOL postsTyped = NO;
@@ -715,12 +715,12 @@
 }
 
 /*
- * Class:     sun_lwawt_macosx_event_NSEvent
+ * Class:     sun_lwawt_macosx_NSEvent
  * Method:    nsKeyModifiersToJavaKeyInfo
  * Signature: ([I[I)V
  */
 JNIEXPORT void JNICALL
-Java_sun_lwawt_macosx_event_NSEvent_nsKeyModifiersToJavaKeyInfo
+Java_sun_lwawt_macosx_NSEvent_nsKeyModifiersToJavaKeyInfo
 (JNIEnv *env, jclass cls, jintArray inData, jintArray outData)
 {
 JNF_COCOA_ENTER(env);
@@ -753,12 +753,12 @@
 }
 
 /*
- * Class:     sun_lwawt_macosx_event_NSEvent
+ * Class:     sun_lwawt_macosx_NSEvent
  * Method:    nsToJavaChar
  * Signature: (CI)C
  */
 JNIEXPORT jint JNICALL
-Java_sun_lwawt_macosx_event_NSEvent_nsToJavaChar
+Java_sun_lwawt_macosx_NSEvent_nsToJavaChar
 (JNIEnv *env, jclass cls, jchar nsChar, jint modifierFlags)
 {
     jchar javaChar = 0;
--- a/jdk/src/macosx/native/sun/awt/AWTView.h	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/native/sun/awt/AWTView.h	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
 #import "CDragSource.h"
 #import "CDropTarget.h"
 
-@interface AWTView : NSView<NSTextInputClient> {
+@interface AWTView : NSView<NSTextInputClient, CDragSourceHolder, CDropTargetHolder> {
 @private
     jobject m_cPlatformView;
 
@@ -61,14 +61,8 @@
 
 - (id) initWithRect:(NSRect) rect platformView:(jobject)cPlatformView windowLayer:(CALayer*)windowLayer;
 - (void) deliverJavaMouseEvent: (NSEvent *) event;
-- (void) resetTrackingArea;
-- (void) deliverJavaKeyEventHelper: (NSEvent *) event;
 - (jobject) awtComponent:(JNIEnv *)env;
 
-- (void) setDragSource:(CDragSource *)source;
-- (void) setDropTarget:(CDropTarget *)target;
-
-
 // Input method-related events
 - (void)setInputMethod:(jobject)inputMethod;
 - (void)abandonInput;
--- a/jdk/src/macosx/native/sun/awt/AWTView.m	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/native/sun/awt/AWTView.m	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,10 @@
 @interface AWTView()
 @property (retain) CDropTarget *_dropTarget;
 @property (retain) CDragSource *_dragSource;
+
+-(void) deliverResize: (NSRect) rect;
+-(void) resetTrackingArea;
+-(void) deliverJavaKeyEventHelper: (NSEvent*) event;
 @end
 
 // Uncomment this line to see fprintfs of each InputMethod API being called on this View
@@ -363,7 +367,7 @@
     // TODO: need consitent way for doing that both with global as well as with local coordinates.
     // The reason to do it here is one more native method for getting screen dimension otherwise.
 
-    NSRect screenRect = [[NSScreen mainScreen] frame];
+    NSRect screenRect = [[[NSScreen screens] objectAtIndex:0] frame];
     absP.y = screenRect.size.height - absP.y;
     jint clickCount;
 
@@ -376,7 +380,7 @@
         clickCount = [event clickCount];
     }
 
-    static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/event/NSEvent");
+    static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
     static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IIIIIIIIDD)V");
     jobject jEvent = JNFNewObject(env, jctor_NSEvent,
                                   [event type],
@@ -393,7 +397,7 @@
     }
 
     static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
-    static JNF_MEMBER_CACHE(jm_deliverMouseEvent, jc_PlatformView, "deliverMouseEvent", "(Lsun/lwawt/macosx/event/NSEvent;)V");
+    static JNF_MEMBER_CACHE(jm_deliverMouseEvent, jc_PlatformView, "deliverMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
     JNFCallVoidMethod(env, m_cPlatformView, jm_deliverMouseEvent, jEvent);
 }
 
@@ -441,7 +445,7 @@
         characters = JNFNSToJavaString(env, [event characters]);
     }
 
-    static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/event/NSEvent");
+    static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
     static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IISLjava/lang/String;)V");
     jobject jevent = JNFNewObject(env, jctor_NSEvent,
                                   [event type],
@@ -451,7 +455,7 @@
 
     static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
     static JNF_MEMBER_CACHE(jm_deliverKeyEvent, jc_PlatformView,
-                            "deliverKeyEvent", "(Lsun/lwawt/macosx/event/NSEvent;)V");
+                            "deliverKeyEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
     JNFCallVoidMethod(env, m_cPlatformView, jm_deliverKeyEvent, jevent);
 
     if (characters != NULL) {
--- a/jdk/src/macosx/native/sun/awt/CDataTransferer.m	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/native/sun/awt/CDataTransferer.m	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 
 #import <AppKit/AppKit.h>
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
+#import "jni_util.h"
 
 #include "ThreadUtilities.h"
 
@@ -172,7 +173,9 @@
         NSData *tiffImage = [imageRep TIFFRepresentation];
         jsize tiffSize = (jsize)[tiffImage length]; // #warning 64-bit: -length returns NSUInteger, but NewByteArray takes jsize
         returnValue = (*env)->NewByteArray(env, tiffSize);
+        CHECK_NULL_RETURN(returnValue, nil);
         jbyte *tiffData = (jbyte *)(*env)->GetPrimitiveArrayCritical(env, returnValue, 0);
+        CHECK_NULL_RETURN(tiffData, nil);
         [tiffImage getBytes:tiffData];
         (*env)->ReleasePrimitiveArrayCritical(env, returnValue, tiffData, 0); // Do not use JNI_COMMIT, as that will not free the buffer copy when +ProtectJavaHeap is on.
         [imageRep release];
@@ -184,12 +187,13 @@
 
 static jobject getImageForByteStream(JNIEnv *env, jbyteArray sourceData)
 {
-    if (sourceData == NULL) return NULL;
+    CHECK_NULL_RETURN(sourceData, NULL);
 
     jsize sourceSize = (*env)->GetArrayLength(env, sourceData);
     if (sourceSize == 0) return NULL;
 
     jbyte *sourceBytes = (*env)->GetPrimitiveArrayCritical(env, sourceData, NULL);
+    CHECK_NULL_RETURN(sourceBytes, NULL);
     NSData *rawData = [NSData dataWithBytes:sourceBytes length:sourceSize];
 
     NSImage *newImage = [[NSImage alloc] initWithData:rawData];
@@ -197,8 +201,7 @@
     [newImage release];
 
     (*env)->ReleasePrimitiveArrayCritical(env, sourceData, sourceBytes, JNI_ABORT);
-
-    if (newImage == nil) return NULL;
+    CHECK_NULL_RETURN(newImage, NULL);
 
     // The ownership of the NSImage is passed to the new CImage jobject. No need to release it.
     static JNF_CLASS_CACHE(jc_CImage, "sun/lwawt/macosx/CImage");
@@ -231,7 +234,8 @@
     if (filenameCount == 0) return nil;
 
     // Get the java.lang.String class object:
-    jclass stringClazz = (*env)->FindClass(env, "java/lang/String"); // can't be null
+    jclass stringClazz = (*env)->FindClass(env, "java/lang/String");
+    CHECK_NULL_RETURN(stringClazz, nil);
     jobject jfilenameArray = (*env)->NewObjectArray(env, filenameCount, stringClazz, NULL); // AWT_THREADING Safe (known object)
     if ((*env)->ExceptionOccurred(env)) {
         (*env)->ExceptionDescribe(env);
--- a/jdk/src/macosx/native/sun/awt/CDragSource.h	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/native/sun/awt/CDragSource.h	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,9 +29,15 @@
 #import <Cocoa/Cocoa.h>
 #include <jni.h>
 
+@class CDragSource;
+
+@protocol CDragSourceHolder
+- (void) setDragSource:(CDragSource *)source;
+@end
+
 @interface CDragSource : NSObject {
 @private
-    NSView*        fView;
+    NSView<CDragSourceHolder>* fView;
     jobject            fComponent;
     jobject            fDragSourceContextPeer;
 
@@ -53,8 +59,6 @@
     jint                     fDragMouseModifiers;
 }
 
-+ (CDragSource *) currentDragSource;
-
 // Common methods:
 - (id)        init:(jobject)jDragSourceContextPeer
          component:(jobject)jComponent
@@ -66,7 +70,7 @@
          modifiers:(jint)extModifiers
         clickCount:(jint)clickCount
          timeStamp:(jlong)timeStamp
-         dragImage:(jobject)jDragImage
+         dragImage:(jlong)nsDragImagePtr
   dragImageOffsetX:(jint)jDragImageOffsetX
   dragImageOffsetY:(jint)jDragImageOffsetY
      sourceActions:(jint)jSourceActions
@@ -84,13 +88,6 @@
 - (void)draggedImage:(NSImage *)image movedTo:(NSPoint)screenPoint;
 - (BOOL)ignoreModifierKeysWhileDragging;
 
-// Updates from the destination to the source
-- (void) postDragEnter;
-- (void) postDragExit;
-
-// Utility
-- (NSPoint) mapNSScreenPointToJavaWithOffset:(NSPoint) point;
-
 @end
 
 #endif // CDragSource_h
--- a/jdk/src/macosx/native/sun/awt/CDragSource.m	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/native/sun/awt/CDragSource.m	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -75,15 +75,18 @@
 static NSDragOperation    sDragOperation;
 static NSPoint            sDraggingLocation;
 
-static CDragSource*        sCurrentDragSource;
 static BOOL                sNeedsEnter;
 
+@interface CDragSource ()
+// Updates from the destination to the source
+- (void) postDragEnter;
+- (void) postDragExit;
+// Utility
+- (NSPoint) mapNSScreenPointToJavaWithOffset:(NSPoint) point;
+@end
+
 @implementation CDragSource
 
-+ (CDragSource *) currentDragSource {
-    return sCurrentDragSource;
-}
-
 - (id)        init:(jobject)jDragSourceContextPeer
          component:(jobject)jComponent
            control:(id)control
@@ -94,7 +97,7 @@
          modifiers:(jint)extModifiers
         clickCount:(jint)clickCount
          timeStamp:(jlong)timeStamp
-         dragImage:(jobject)jDragImage
+         dragImage:(jlong)nsDragImagePtr
   dragImageOffsetX:(jint)jDragImageOffsetX
   dragImageOffsetY:(jint)jDragImageOffsetY
      sourceActions:(jint)jSourceActions
@@ -109,26 +112,21 @@
 
     // Construct the object if we have a valid model for it:
     if (control != nil) {
-        JNIEnv *env = [ThreadUtilities getJNIEnv];
-        fComponent = JNFNewGlobalRef(env, jComponent);
-        fDragSourceContextPeer = JNFNewGlobalRef(env, jDragSourceContextPeer);
+        fComponent = jComponent;
+        fDragSourceContextPeer = jDragSourceContextPeer;
+        fTransferable = jTransferable;
+        fTriggerEvent = jTrigger;
 
-        fTransferable = JNFNewGlobalRef(env, jTransferable);
-        fTriggerEvent = JNFNewGlobalRef(env, jTrigger);
-
-        if (jDragImage) {
-            JNF_MEMBER_CACHE(nsImagePtr, CImageClass, "ptr", "J");
-            jlong imgPtr = JNFGetLongField(env, jDragImage, nsImagePtr);
-            fDragImage = (NSImage*) jlong_to_ptr(imgPtr); // Double-casting prevents compiler 'd$|//
-
+        if (nsDragImagePtr) {
+            fDragImage = (NSImage*) jlong_to_ptr(nsDragImagePtr);
             [fDragImage retain];
         }
 
         fDragImageOffset = NSMakePoint(jDragImageOffsetX, jDragImageOffsetY);
 
         fSourceActions = jSourceActions;
-        fFormats = JNFNewGlobalRef(env, jFormats);
-        fFormatMap = JNFNewGlobalRef(env, jFormatMap);
+        fFormats = jFormats;
+        fFormatMap = jFormatMap;
 
         fTriggerEventTimeStamp = timeStamp;
         fDragPos = NSMakePoint(dragPosX, dragPosY);
@@ -515,8 +513,6 @@
     fDragKeyModifiers = [DnDUtilities extractJavaExtKeyModifiersFromJavaExtModifiers:fModifiers];
     fDragMouseModifiers = [DnDUtilities extractJavaExtMouseModifiersFromJavaExtModifiers:fModifiers];
 
-    // Set the current DragSource
-    sCurrentDragSource = self;
     sNeedsEnter = YES;
 
     @try {
@@ -566,8 +562,6 @@
                 JNF_MEMBER_CACHE(resetHoveringMethod, CDragSourceContextPeerClass, "resetHovering", "()V");
         JNFCallVoidMethod(env, fDragSourceContextPeer, resetHoveringMethod); // Hust reset static variable
     } @finally {
-        // Clear the current DragSource
-        sCurrentDragSource = nil;
         sNeedsEnter = NO;
     }
 
--- a/jdk/src/macosx/native/sun/awt/CDragSourceContextPeer.m	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/native/sun/awt/CDragSourceContextPeer.m	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,30 +40,39 @@
 JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CDragSourceContextPeer_createNativeDragSource
   (JNIEnv *env, jobject jthis, jobject jcomponent, jlong jnativepeer, jobject jtransferable,
    jobject jtrigger, jint jdragposx, jint jdragposy, jint jextmodifiers, jint jclickcount, jlong jtimestamp,
-   jobject jnsdragimage, jint jdragimageoffsetx, jint jdragimageoffsety,
+   jlong nsdragimageptr, jint jdragimageoffsetx, jint jdragimageoffsety,
    jint jsourceactions, jlongArray jformats, jobject jformatmap)
 {
     id controlObj = (id) jlong_to_ptr(jnativepeer);
     __block CDragSource* dragSource = nil;
 
 JNF_COCOA_ENTER(env);
+
+    // Global references are disposed when the DragSource is removed
+    jobject gComponent = JNFNewGlobalRef(env, jcomponent);
+    jobject gDragSourceContextPeer = JNFNewGlobalRef(env, jthis);
+    jobject gTransferable = JNFNewGlobalRef(env, jtransferable);
+    jobject gTriggerEvent = JNFNewGlobalRef(env, jtrigger);
+    jlongArray gFormats = JNFNewGlobalRef(env, jformats);
+    jobject gFormatMap = JNFNewGlobalRef(env, jformatmap);
+
     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
-        dragSource = [[CDragSource alloc] init:jthis
-                                     component:jcomponent
+        dragSource = [[CDragSource alloc] init:gDragSourceContextPeer
+                                     component:gComponent
                                        control:controlObj
-                                  transferable:jtransferable
-                                  triggerEvent:jtrigger
+                                  transferable:gTransferable
+                                  triggerEvent:gTriggerEvent
                                       dragPosX:jdragposx
                                       dragPosY:jdragposy
                                      modifiers:jextmodifiers
                                     clickCount:jclickcount
                                      timeStamp:jtimestamp
-                                     dragImage:jnsdragimage
+                                     dragImage:nsdragimageptr
                               dragImageOffsetX:jdragimageoffsetx
                               dragImageOffsetY:jdragimageoffsety
                                  sourceActions:jsourceactions
-                                       formats:jformats
-                                     formatMap:jformatmap];
+                                       formats:gFormats
+                                     formatMap:gFormatMap];
     }];
 JNF_COCOA_EXIT(env);
 
--- a/jdk/src/macosx/native/sun/awt/CDropTarget.h	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/native/sun/awt/CDropTarget.h	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,9 +31,15 @@
 
 @class ControlModel;
 
+@class CDropTarget;
+
+@protocol CDropTargetHolder
+- (void) setDropTarget:(CDropTarget *)target;
+@end
+
 @interface CDropTarget : NSObject {
 @private
-    NSView*        fView;
+    NSView<CDropTargetHolder>* fView;
     jobject            fComponent;
     jobject            fDropTarget;
     jobject            fDropTargetContextPeer;
--- a/jdk/src/macosx/native/sun/awt/CImage.m	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/native/sun/awt/CImage.m	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -143,21 +143,23 @@
     NSMutableArray * reps = [NSMutableArray arrayWithCapacity: num];
 
     jint * ws = (*env)->GetIntArrayElements(env, widths, NULL);
-    jint * hs = (*env)->GetIntArrayElements(env, heights, NULL);
-
-    jsize i;
-    for (i = 0; i < num; i++) {
-        jintArray buffer = (*env)->GetObjectArrayElement(env, buffers, i);
+    if (ws != NULL) {
+        jint * hs = (*env)->GetIntArrayElements(env, heights, NULL);
+        if (hs != NULL) {
+            jsize i;
+            for (i = 0; i < num; i++) {
+                jintArray buffer = (*env)->GetObjectArrayElement(env, buffers, i);
 
-        NSBitmapImageRep* imageRep = CImage_CreateImageRep(env, buffer, ws[i], hs[i]);
-        if (imageRep) {
-            [reps addObject: imageRep];
+                NSBitmapImageRep* imageRep = CImage_CreateImageRep(env, buffer, ws[i], hs[i]);
+                if (imageRep) {
+                    [reps addObject: imageRep];
+                }
+            }
+
+            (*env)->ReleaseIntArrayElements(env, heights, hs, JNI_ABORT);
         }
+        (*env)->ReleaseIntArrayElements(env, widths, ws, JNI_ABORT);
     }
-
-    (*env)->ReleaseIntArrayElements(env, heights, hs, JNI_ABORT);
-    (*env)->ReleaseIntArrayElements(env, widths, ws, JNI_ABORT);
-
     if ([reps count]) {
         NSImage *nsImage = [[NSImage alloc] initWithSize:NSMakeSize(0, 0)];
         [nsImage addRepresentations: reps];
@@ -320,3 +322,26 @@
 
 JNF_COCOA_EXIT(env);
 }
+
+/*
+ * Class:     sun_lwawt_macosx_CImage
+ * Method:    nativeResizeNSImageRepresentations
+ * Signature: (JDD)V
+ */
+JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CImage_nativeResizeNSImageRepresentations
+(JNIEnv *env, jclass clazz, jlong image, jdouble w, jdouble h)
+{
+    if (!image) return;
+    NSImage *i = (NSImage *)jlong_to_ptr(image);
+    
+JNF_COCOA_ENTER(env);
+    
+    NSImageRep *imageRep = nil;
+    NSArray *imageRepresentations = [i representations];
+    NSEnumerator *imageEnumerator = [imageRepresentations objectEnumerator];
+    while ((imageRep = [imageEnumerator nextObject]) != nil) {
+        [imageRep setSize:NSMakeSize(w, h)];
+    }
+    
+JNF_COCOA_EXIT(env);
+}
--- a/jdk/src/macosx/native/sun/awt/CRobot.m	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/native/sun/awt/CRobot.m	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,9 @@
  * questions.
  */
 
+
+#import "jni_util.h"
+
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
 #import <ApplicationServices/ApplicationServices.h>
 
@@ -187,9 +190,8 @@
     // volatile, otherwise it warns that it might be clobbered by 'longjmp'
     volatile CGPoint point;
 
-    // Translate the device relative point into a valid global CGPoint.
-    point.x = mouseLastX + globalDeviceBounds.origin.x;
-    point.y = mouseLastY + globalDeviceBounds.origin.y;
+    point.x = mouseLastX;
+    point.y = mouseLastY;
 
     __block CGMouseButton button = kCGMouseButtonLeft;
     __block CGEventType type = kCGEventMouseMoved;
@@ -343,6 +345,7 @@
 
     // get a pointer to the Java int array
     void *jPixelData = (*env)->GetPrimitiveArrayCritical(env, pixels, 0);
+    CHECK_NULL(jPixelData);
 
     // create a graphics context around the Java int array
     CGColorSpaceRef picColorSpace = CGColorSpaceCreateWithName(
--- a/jdk/src/macosx/native/sun/awt/CTrayIcon.m	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/native/sun/awt/CTrayIcon.m	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -135,7 +135,7 @@
 
     clickCount = [event clickCount];
 
-    static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/event/NSEvent");
+    static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
     static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IIIIIIIIDD)V");
     jobject jEvent = JNFNewObject(env, jctor_NSEvent,
                                   [event type],
@@ -152,7 +152,7 @@
     }
 
     static JNF_CLASS_CACHE(jc_TrayIcon, "sun/lwawt/macosx/CTrayIcon");
-    static JNF_MEMBER_CACHE(jm_handleMouseEvent, jc_TrayIcon, "handleMouseEvent", "(Lsun/lwawt/macosx/event/NSEvent;)V");
+    static JNF_MEMBER_CACHE(jm_handleMouseEvent, jc_TrayIcon, "handleMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
     JNFCallVoidMethod(env, peer, jm_handleMouseEvent, jEvent);
 }
 
--- a/jdk/src/macosx/native/sun/awt/CWrapper.h	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
--- a/jdk/src/macosx/native/sun/awt/CWrapper.m	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/native/sun/awt/CWrapper.m	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,38 +23,11 @@
  * questions.
  */
 
-#import "CWrapper.h"
-
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
-
-#import "AWTWindow.h"
-#import "LWCToolkit.h"
-#import "GeomUtilities.h"
 #import "ThreadUtilities.h"
-
 #import "sun_lwawt_macosx_CWrapper_NSWindow.h"
 
 /*
- * Class:     sun_lwawt_macosx_CWrapper$NSObject
- * Method:    release
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL
-Java_sun_lwawt_macosx_CWrapper_00024NSObject_release
-(JNIEnv *env, jclass cls, jlong objectPtr)
-{
-JNF_COCOA_ENTER(env);
-
-    id obj = (id)jlong_to_ptr(objectPtr);
-    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
-        CFRelease(obj);
-    }];
-
-JNF_COCOA_EXIT(env);
-}
-
-
-/*
  * Class:     sun_lwawt_macosx_CWrapper$NSWindow
  * Method:    makeKeyAndOrderFront
  * Signature: (J)V
@@ -249,6 +222,7 @@
     dispatch_once(&pred, ^{
         LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_NSNormalWindowLevel] = NSNormalWindowLevel;
         LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_NSFloatingWindowLevel] = NSFloatingWindowLevel;
+        LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_NSPopUpMenuWindowLevel] = NSPopUpMenuWindowLevel;
     });
 }
 
@@ -308,8 +282,8 @@
 {
 JNF_COCOA_ENTER(env);
 
-    AWTWindow *parent = (AWTWindow *)jlong_to_ptr(parentPtr);
-    AWTWindow *child = (AWTWindow *)jlong_to_ptr(childPtr);
+    NSWindow *parent = (NSWindow *)jlong_to_ptr(parentPtr);
+    NSWindow *child = (NSWindow *)jlong_to_ptr(childPtr);
     [ThreadUtilities performOnMainThread:@selector(removeChildWindow:)
                                       on:parent
                               withObject:child
@@ -320,26 +294,6 @@
 
 /*
  * Class:     sun_lwawt_macosx_CWrapper$NSWindow
- * Method:    setFrame
- * Signature: (JIIIIZ)V
- */
-JNIEXPORT void JNICALL
-Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setFrame
-(JNIEnv *env, jclass cls, jlong windowPtr, jint x, jint y, jint w, jint h, jboolean display)
-{
-JNF_COCOA_ENTER(env);
-
-    AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr);
-    NSRect frame = NSMakeRect(x, y, w, h);
-    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
-        [window setFrame:frame display:display];
-    }];
-
-JNF_COCOA_EXIT(env);
-}
-
-/*
- * Class:     sun_lwawt_macosx_CWrapper$NSWindow
  * Method:    setAlphaValue
  * Signature: (JF)V
  */
@@ -349,7 +303,7 @@
 {
 JNF_COCOA_ENTER(env);
 
-    AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr);
+    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
     [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
         [window setAlphaValue:(CGFloat)alpha];
     }];
@@ -368,7 +322,7 @@
 {
 JNF_COCOA_ENTER(env);
 
-    AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr);
+    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
     [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
         [window setOpaque:(BOOL)opaque];
     }];
@@ -387,7 +341,7 @@
 {
 JNF_COCOA_ENTER(env);
 
-    AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr);
+    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
     NSColor *color = (NSColor *)jlong_to_ptr(colorPtr);
     [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
         [window setBackgroundColor:color];
@@ -397,6 +351,7 @@
 }
 
 /*
+ * Class:     sun_lwawt_macosx_CWrapper$NSWindow
  * Method:    miniaturize
  * Signature: (J)V
  */
@@ -560,33 +515,6 @@
 
 /*
  * Class:     sun_lwawt_macosx_CWrapper$NSView
- * Method:    frame
- * Signature: (J)Ljava/awt/Rectangle;
- */
-JNIEXPORT jobject JNICALL
-Java_sun_lwawt_macosx_CWrapper_00024NSView_frame
-(JNIEnv *env, jclass cls, jlong viewPtr)
-{
-    jobject jRect = NULL;
-
-JNF_COCOA_ENTER(env);
-
-    __block NSRect rect = NSZeroRect;
-
-    NSView *view = (NSView *)jlong_to_ptr(viewPtr);
-    [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
-        rect = [view frame];
-    }];
-
-    jRect = NSToJavaRect(env, rect);
-
-JNF_COCOA_EXIT(env);
-
-    return jRect;
-}
-
-/*
- * Class:     sun_lwawt_macosx_CWrapper$NSView
  * Method:    window
  * Signature: (J)J
  */
--- a/jdk/src/macosx/native/sun/awt/LWCToolkit.m	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/native/sun/awt/LWCToolkit.m	Tue Apr 01 15:37:15 2014 +0200
@@ -200,13 +200,17 @@
     gNumberOfButtons = sun_lwawt_macosx_LWCToolkit_BUTTONS;
 
     jclass inputEventClazz = (*env)->FindClass(env, "java/awt/event/InputEvent");
+    CHECK_NULL(inputEventClazz);
     jmethodID getButtonDownMasksID = (*env)->GetStaticMethodID(env, inputEventClazz, "getButtonDownMasks", "()[I");
+    CHECK_NULL(getButtonDownMasksID);
     jintArray obj = (jintArray)(*env)->CallStaticObjectMethod(env, inputEventClazz, getButtonDownMasksID);
     jint * tmp = (*env)->GetIntArrayElements(env, obj, JNI_FALSE);
+    CHECK_NULL(tmp);
 
     gButtonDownMasks = (jint*)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(jint), gNumberOfButtons);
     if (gButtonDownMasks == NULL) {
         gNumberOfButtons = 0;
+        (*env)->ReleaseIntArrayElements(env, obj, tmp, JNI_ABORT);
         JNU_ThrowOutOfMemoryError(env, NULL);
         return;
     }
@@ -240,7 +244,7 @@
     return ((ia & 0xFF) << 24) | ((ir & 0xFF) << 16) | ((ig & 0xFF) << 8) | ((ib & 0xFF) << 0);
 }
 
-void doLoadNativeColors(JNIEnv *env, jintArray jColors, BOOL useAppleColors) {
+BOOL doLoadNativeColors(JNIEnv *env, jintArray jColors, BOOL useAppleColors) {
     jint len = (*env)->GetArrayLength(env, jColors);
 
     UInt32 colorsArray[len];
@@ -254,8 +258,12 @@
     }];
 
     jint *_colors = (*env)->GetPrimitiveArrayCritical(env, jColors, 0);
+    if (_colors == NULL) {
+        return NO;
+    }
     memcpy(_colors, colors, len * sizeof(UInt32));
     (*env)->ReleasePrimitiveArrayCritical(env, jColors, _colors, 0);
+    return YES;
 }
 
 /**
@@ -267,8 +275,9 @@
 (JNIEnv *env, jobject peer, jintArray jSystemColors, jintArray jAppleColors)
 {
 JNF_COCOA_ENTER(env);
-    doLoadNativeColors(env, jSystemColors, NO);
-    doLoadNativeColors(env, jAppleColors, YES);
+    if (doLoadNativeColors(env, jSystemColors, NO)) {
+        doLoadNativeColors(env, jAppleColors, YES);
+    }
 JNF_COCOA_EXIT(env);
 }
 
--- a/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m	Tue Apr 01 15:37:15 2014 +0200
@@ -142,10 +142,9 @@
     splash->screenFormat.byteOrder = 1 ?  BYTE_ORDER_LSBFIRST : BYTE_ORDER_MSBFIRST;
     splash->screenFormat.depthBytes = 4;
 
-    dispatch_async(dispatch_get_main_queue(), ^(void) {
-            NSApplication * app = [NSApplicationAWT sharedApplication];
-            [NSApplicationAWT runAWTLoopWithApp: app];
-    });
+    [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^() {
+        [NSApplicationAWT runAWTLoopWithApp:[NSApplicationAWT sharedApplication]];
+    }];
 }
 
 void
--- a/jdk/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -433,18 +433,18 @@
 }
 
 JNIEXPORT jint JNICALL
-Java_sun_java2d_opengl_CGLGraphicsConfig_getMaxTextureSize
+Java_sun_java2d_opengl_CGLGraphicsConfig_nativeGetMaxTextureSize
     (JNIEnv *env, jclass cglgc)
 {
-    J2dTraceLn(J2D_TRACE_INFO, "CGLGraphicsConfig_getMaxTextureSize");
+    J2dTraceLn(J2D_TRACE_INFO, "CGLGraphicsConfig_nativeGetMaxTextureSize");
 
     __block int max = 0;
 
-    [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+    [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
         [sharedContext makeCurrentContext];
         j2d_glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max);
+        [NSOpenGLContext clearCurrentContext];
     }];
 
     return (jint)max;
 }
-
--- a/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java	Tue Apr 01 15:37:15 2014 +0200
@@ -680,7 +680,7 @@
         gotHeader = true;
     }
 
-    public Iterator getImageTypes(int imageIndex)
+    public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
       throws IOException {
         checkIndex(imageIndex);
         try {
@@ -688,7 +688,7 @@
         } catch (IllegalArgumentException e) {
             throw new IIOException(I18N.getString("BMPImageReader6"), e);
         }
-        ArrayList list = new ArrayList(1);
+        ArrayList<ImageTypeSpecifier> list = new ArrayList<>(1);
         list.add(new ImageTypeSpecifier(originalColorModel,
                                         originalSampleModel));
         return list.iterator();
@@ -912,6 +912,7 @@
                 throw new
                     IIOException(I18N.getString("BMPImageReader1"));
             }
+            break;
 
         case VERSION_4_8_BIT:
             switch((int)compression) {
--- a/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReaderSpi.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReaderSpi.java	Tue Apr 01 15:37:15 2014 +0200
@@ -51,7 +51,7 @@
               entensions,
               mimeType,
               "com.sun.imageio.plugins.bmp.BMPImageReader",
-              new Class[] { ImageInputStream.class },
+              new Class<?>[] { ImageInputStream.class },
               writerSpiNames,
               false,
               null, null, null, null,
--- a/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1325,10 +1325,11 @@
                                ImageWriteParam bmpParam) throws IOException {
         String format =
             compressionType == BI_JPEG ? "jpeg" : "png";
-        Iterator iterator = ImageIO.getImageWritersByFormatName(format);
+        Iterator<ImageWriter> iterator =
+               ImageIO.getImageWritersByFormatName(format);
         ImageWriter writer = null;
         if (iterator.hasNext())
-            writer = (ImageWriter)iterator.next();
+            writer = iterator.next();
         if (writer != null) {
             if (embedded_stream == null) {
                 throw new RuntimeException("No stream for writing embedded image!");
--- a/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriterSpi.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriterSpi.java	Tue Apr 01 15:37:15 2014 +0200
@@ -56,7 +56,7 @@
               entensions,
               mimeType,
               "com.sun.imageio.plugins.bmp.BMPImageWriter",
-              new Class[] { ImageOutputStream.class },
+              new Class<?>[] { ImageOutputStream.class },
               readerSpiNames,
               false,
               null, null, null, null,
--- a/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPMetadata.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPMetadata.java	Tue Apr 01 15:37:15 2014 +0200
@@ -91,10 +91,6 @@
     public int green;
     public int blue;
 
-    // Fields from CommentExtension
-    // List of byte[]
-    public List comments = null; // new ArrayList();
-
     public BMPMetadata() {
         super(true,
               nativeMetadataFormatName,
--- a/jdk/src/share/classes/com/sun/imageio/plugins/common/StandardMetadataFormat.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/common/StandardMetadataFormat.java	Tue Apr 01 15:37:15 2014 +0200
@@ -42,7 +42,7 @@
 
     public StandardMetadataFormat() {
         super(standardMetadataFormatName, CHILD_POLICY_SOME);
-        List values;
+        List<String> values;
 
         // root -> Chroma
         addElement("Chroma", standardMetadataFormatName,
@@ -52,7 +52,7 @@
         addElement("ColorSpaceType", "Chroma",
                    CHILD_POLICY_EMPTY);
 
-        values = new ArrayList();
+        values = new ArrayList<>();
         values.add("XYZ");
         values.add("Lab");
         values.add("Luv");
@@ -164,7 +164,7 @@
         // root -> Data -> PlanarConfiguration
         addElement("PlanarConfiguration", "Data", CHILD_POLICY_EMPTY);
 
-        values = new ArrayList();
+        values = new ArrayList<>();
         values.add("PixelInterleaved");
         values.add("PlaneInterleaved");
         values.add("LineInterleaved");
@@ -178,7 +178,7 @@
         // root -> Data -> SampleFormat
         addElement("SampleFormat", "Data", CHILD_POLICY_EMPTY);
 
-        values = new ArrayList();
+        values = new ArrayList<>();
         values.add("SignedIntegral");
         values.add("UnsignedIntegral");
         values.add("Real");
@@ -225,7 +225,7 @@
         addElement("ImageOrientation", "Dimension",
                    CHILD_POLICY_EMPTY);
 
-        values = new ArrayList();
+        values = new ArrayList<>();
         values.add("Normal");
         values.add("Rotate90");
         values.add("Rotate180");
@@ -306,7 +306,7 @@
         // root -> Document -> SubimageInterpretation
         addElement("SubimageInterpretation", "Document",
                    CHILD_POLICY_EMPTY);
-        values = new ArrayList();
+        values = new ArrayList<>();
         values.add("Standalone");
         values.add("SinglePage");
         values.add("FullResolution");
@@ -418,7 +418,7 @@
                      false,
                      null);
 
-        values = new ArrayList();
+        values = new ArrayList<>();
         values.add("none");
         values.add("lzw");
         values.add("zip");
@@ -437,7 +437,7 @@
         // root -> Transparency -> Alpha
         addElement("Alpha", "Transparency", CHILD_POLICY_EMPTY);
 
-        values = new ArrayList();
+        values = new ArrayList<>();
         values.add("none");
         values.add("premultiplied");
         values.add("nonpremultiplied");
--- a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageMetadata.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageMetadata.java	Tue Apr 01 15:37:15 2014 +0200
@@ -84,17 +84,17 @@
 
     // Fields from ApplicationExtension
     // List of byte[]
-    public List applicationIDs = null; // new ArrayList();
+    public List<byte[]> applicationIDs = null;
 
     // List of byte[]
-    public List authenticationCodes = null; // new ArrayList();
+    public List<byte[]> authenticationCodes = null;
 
     // List of byte[]
-    public List applicationData = null; // new ArrayList();
+    public List<byte[]> applicationData = null;
 
     // Fields from CommentExtension
     // List of byte[]
-    public List comments = null; // new ArrayList();
+    public List<byte[]> comments = null;
 
     protected GIFImageMetadata(boolean standardMetadataFormatSupported,
                                String nativeMetadataFormatName,
@@ -225,13 +225,13 @@
             for (int i = 0; i < numAppExtensions; i++) {
                 IIOMetadataNode appExtNode =
                     new IIOMetadataNode("ApplicationExtension");
-                byte[] applicationID = (byte[])applicationIDs.get(i);
+                byte[] applicationID = applicationIDs.get(i);
                 appExtNode.setAttribute("applicationID",
                                         toISO8859(applicationID));
-                byte[] authenticationCode = (byte[])authenticationCodes.get(i);
+                byte[] authenticationCode = authenticationCodes.get(i);
                 appExtNode.setAttribute("authenticationCode",
                                         toISO8859(authenticationCode));
-                byte[] appData = (byte[])applicationData.get(i);
+                byte[] appData = applicationData.get(i);
                 appExtNode.setUserObject(appData.clone());
                 node.appendChild(appExtNode);
             }
@@ -246,7 +246,7 @@
             for (int i = 0; i < numComments; i++) {
                 IIOMetadataNode commentNode =
                     new IIOMetadataNode("CommentExtension");
-                byte[] comment = (byte[])comments.get(i);
+                byte[] comment = comments.get(i);
                 commentNode.setAttribute("value", toISO8859(comment));
                 node.appendChild(commentNode);
             }
@@ -374,7 +374,7 @@
         if (comments == null) {
             return null;
         }
-        Iterator commentIter = comments.iterator();
+        Iterator<byte[]> commentIter = comments.iterator();
         if (!commentIter.hasNext()) {
             return null;
         }
@@ -383,7 +383,7 @@
         IIOMetadataNode node = null; // scratch node
 
         while (commentIter.hasNext()) {
-            byte[] comment = (byte[])commentIter.next();
+            byte[] comment = commentIter.next();
             String s = null;
             try {
                 s = new String(comment, "ISO-8859-1");
--- a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java	Tue Apr 01 15:37:15 2014 +0200
@@ -72,7 +72,7 @@
     // A List of Longs indicating the stream positions of the
     // start of the metadata for each image.  Entries are added
     // as needed.
-    List imageStartPosition = new ArrayList();
+    List<Long> imageStartPosition = new ArrayList<>();
 
     // Length of metadata for image at 'currIndex', valid only if
     // imageMetadata != null.
@@ -227,7 +227,8 @@
         return new ImageTypeSpecifier(colorModel, sampleModel);
     }
 
-    public Iterator getImageTypes(int imageIndex) throws IIOException {
+    public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
+            throws IIOException {
         checkIndex(imageIndex);
 
         int index = locateImage(imageIndex);
@@ -236,7 +237,7 @@
         }
         readMetadata();
 
-        List l = new ArrayList(1);
+        List<ImageTypeSpecifier> l = new ArrayList<>(1);
 
         byte[] colorTable;
         if (imageMetadata.localColorTable != null) {
@@ -605,7 +606,7 @@
             int index = Math.min(imageIndex, imageStartPosition.size() - 1);
 
             // Seek to that position
-            Long l = (Long)imageStartPosition.get(index);
+            Long l = imageStartPosition.get(index);
             stream.seek(l.longValue());
 
             // Skip images until at desired index or last image found
@@ -731,7 +732,7 @@
                     } else if (label == 0xfe) { // Comment extension
                         byte[] comment = concatenateBlocks();
                         if (imageMetadata.comments == null) {
-                            imageMetadata.comments = new ArrayList();
+                            imageMetadata.comments = new ArrayList<>();
                         }
                         imageMetadata.comments.add(comment);
                     } else if (label == 0xff) { // Application extension
@@ -762,10 +763,10 @@
 
                         // Init lists if necessary
                         if (imageMetadata.applicationIDs == null) {
-                            imageMetadata.applicationIDs = new ArrayList();
+                            imageMetadata.applicationIDs = new ArrayList<>();
                             imageMetadata.authenticationCodes =
-                                new ArrayList();
-                            imageMetadata.applicationData = new ArrayList();
+                                new ArrayList<>();
+                            imageMetadata.applicationData = new ArrayList<>();
                         }
                         imageMetadata.applicationIDs.add(applicationID);
                         imageMetadata.authenticationCodes.add(authCode);
@@ -868,7 +869,7 @@
         }
 
         // Initialize the destination image
-        Iterator imageTypes = getImageTypes(imageIndex);
+        Iterator<ImageTypeSpecifier> imageTypes = getImageTypes(imageIndex);
         this.theImage = getDestination(param,
                                        imageTypes,
                                        imageMetadata.imageWidth,
@@ -1031,7 +1032,7 @@
         streamMetadata = null;
         currIndex = -1;
         imageMetadata = null;
-        imageStartPosition = new ArrayList();
+        imageStartPosition = new ArrayList<>();
         numImages = -1;
 
         // No need to reinitialize 'block'
--- a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReaderSpi.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReaderSpi.java	Tue Apr 01 15:37:15 2014 +0200
@@ -60,7 +60,7 @@
               suffixes,
               MIMETypes,
               readerClassName,
-              new Class[] { ImageInputStream.class },
+              new Class<?>[] { ImageInputStream.class },
               writerSpiNames,
               true,
               GIFStreamMetadata.nativeMetadataFormatName,
--- a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageWriter.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageWriter.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1204,9 +1204,9 @@
     private void writeApplicationExtension(GIFWritableImageMetadata im)
       throws IOException {
         if (im.applicationIDs != null) {
-            Iterator iterIDs = im.applicationIDs.iterator();
-            Iterator iterCodes = im.authenticationCodes.iterator();
-            Iterator iterData = im.applicationData.iterator();
+            Iterator<byte[]> iterIDs = im.applicationIDs.iterator();
+            Iterator<byte[]> iterCodes = im.authenticationCodes.iterator();
+            Iterator<byte[]> iterData = im.applicationData.iterator();
 
             while (iterIDs.hasNext()) {
                 try {
@@ -1214,10 +1214,10 @@
                     stream.write(0xff);
 
                     stream.write(11);
-                    stream.write((byte[])iterIDs.next(), 0, 8);
-                    stream.write((byte[])iterCodes.next(), 0, 3);
+                    stream.write(iterIDs.next(), 0, 8);
+                    stream.write(iterCodes.next(), 0, 3);
 
-                    writeBlocks((byte[])iterData.next());
+                    writeBlocks(iterData.next());
 
                     stream.write(0x00);
                 } catch (IOException e) {
@@ -1231,11 +1231,11 @@
       throws IOException {
         if (im.comments != null) {
             try {
-                Iterator iter = im.comments.iterator();
+                Iterator<byte[]> iter = im.comments.iterator();
                 while (iter.hasNext()) {
                     stream.write(0x21);
                     stream.write(0xfe);
-                    writeBlocks((byte[])iter.next());
+                    writeBlocks(iter.next());
                     stream.write(0x00);
                 }
             } catch (IOException e) {
--- a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageWriterSpi.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageWriterSpi.java	Tue Apr 01 15:37:15 2014 +0200
@@ -60,7 +60,7 @@
               suffixes,
               MIMETypes,
               writerClassName,
-              new Class[] { ImageOutputStream.class },
+              new Class<?>[] { ImageOutputStream.class },
               readerSpiNames,
               true,
               GIFWritableStreamMetadata.NATIVE_FORMAT_NAME,
--- a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFWritableImageMetadata.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFWritableImageMetadata.java	Tue Apr 01 15:37:15 2014 +0200
@@ -258,14 +258,14 @@
                 }
 
                 if (applicationIDs == null) {
-                    applicationIDs = new ArrayList();
-                    authenticationCodes = new ArrayList();
-                    applicationData = new ArrayList();
+                    applicationIDs = new ArrayList<>();
+                    authenticationCodes = new ArrayList<>();
+                    applicationData = new ArrayList<>();
                 }
 
                 applicationIDs.add(fromISO8859(applicationIDString));
                 authenticationCodes.add(fromISO8859(authenticationCodeString));
-                applicationData.add(applicationExtensionData);
+                applicationData.add((byte[]) applicationExtensionData);
             } else if (name.equals("CommentExtensions")) {
                 Node commentExtension = node.getFirstChild();
                 if (commentExtension != null) {
@@ -276,7 +276,7 @@
                         }
 
                         if (comments == null) {
-                            comments = new ArrayList();
+                            comments = new ArrayList<>();
                         }
 
                         String comment =
@@ -367,7 +367,7 @@
                         String value = getAttribute(childNode, "value");
                         byte[] comment = fromISO8859(value);
                         if (comments == null) {
-                            comments = new ArrayList();
+                            comments = new ArrayList<>();
                         }
                         comments.add(comment);
                     }
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/DHTMarkerSegment.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/DHTMarkerSegment.java	Tue Apr 01 15:37:15 2014 +0200
@@ -43,7 +43,7 @@
  * A DHT (Define Huffman Table) marker segment.
  */
 class DHTMarkerSegment extends MarkerSegment {
-    List tables = new ArrayList();
+    List<Htable> tables = new ArrayList<>();
 
     DHTMarkerSegment(boolean needFour) {
         super(JPEG.DHT);
@@ -93,11 +93,11 @@
 
     protected Object clone() {
         DHTMarkerSegment newGuy = (DHTMarkerSegment) super.clone();
-        newGuy.tables = new ArrayList(tables.size());
-        Iterator iter = tables.iterator();
+        newGuy.tables = new ArrayList<>(tables.size());
+        Iterator<Htable> iter = tables.iterator();
         while (iter.hasNext()) {
-            Htable table = (Htable) iter.next();
-            newGuy.tables.add(table.clone());
+            Htable table = iter.next();
+            newGuy.tables.add((Htable) table.clone());
         }
         return newGuy;
     }
@@ -105,7 +105,7 @@
     IIOMetadataNode getNativeNode() {
         IIOMetadataNode node = new IIOMetadataNode("dht");
         for (int i= 0; i<tables.size(); i++) {
-            Htable table = (Htable) tables.get(i);
+            Htable table = tables.get(i);
             node.appendChild(table.getNativeNode());
         }
         return node;
@@ -124,7 +124,7 @@
         System.out.println("Num tables: "
                            + Integer.toString(tables.size()));
         for (int i= 0; i<tables.size(); i++) {
-            Htable table = (Htable) tables.get(i);
+            Htable table = tables.get(i);
             table.print();
         }
         System.out.println();
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/DQTMarkerSegment.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/DQTMarkerSegment.java	Tue Apr 01 15:37:15 2014 +0200
@@ -44,7 +44,7 @@
  * A DQT (Define Quantization Table) marker segment.
  */
 class DQTMarkerSegment extends MarkerSegment {
-    List tables = new ArrayList();  // Could be 1 to 4
+    List<Qtable> tables = new ArrayList<>();  // Could be 1 to 4
 
     DQTMarkerSegment(float quality, boolean needTwo) {
         super(JPEG.DQT);
@@ -86,11 +86,11 @@
 
     protected Object clone() {
         DQTMarkerSegment newGuy = (DQTMarkerSegment) super.clone();
-        newGuy.tables = new ArrayList(tables.size());
-        Iterator iter = tables.iterator();
+        newGuy.tables = new ArrayList<>(tables.size());
+        Iterator<Qtable> iter = tables.iterator();
         while (iter.hasNext()) {
-            Qtable table = (Qtable) iter.next();
-            newGuy.tables.add(table.clone());
+            Qtable table = iter.next();
+            newGuy.tables.add((Qtable) table.clone());
         }
         return newGuy;
     }
@@ -98,7 +98,7 @@
     IIOMetadataNode getNativeNode() {
         IIOMetadataNode node = new IIOMetadataNode("dqt");
         for (int i= 0; i<tables.size(); i++) {
-            Qtable table = (Qtable) tables.get(i);
+            Qtable table = tables.get(i);
             node.appendChild(table.getNativeNode());
         }
         return node;
@@ -117,7 +117,7 @@
         System.out.println("Num tables: "
                            + Integer.toString(tables.size()));
         for (int i= 0; i<tables.size(); i++) {
-            Qtable table = (Qtable) tables.get(i);
+            Qtable table = tables.get(i);
             table.print();
         }
         System.out.println();
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java	Tue Apr 01 15:37:15 2014 +0200
@@ -76,7 +76,7 @@
     int thumbWidth;
     int thumbHeight;
     JFIFThumbRGB thumb = null;  // If present
-    ArrayList extSegments = new ArrayList();
+    ArrayList<JFIFExtensionMarkerSegment> extSegments = new ArrayList<>();
     ICCMarkerSegment iccSegment = null; // optional ICC
     private static final int THUMB_JPEG = 0x10;
     private static final int THUMB_PALETTE = 0x11;
@@ -157,11 +157,11 @@
     protected Object clone() {
         JFIFMarkerSegment newGuy = (JFIFMarkerSegment) super.clone();
         if (!extSegments.isEmpty()) { // Clone the list with a deep copy
-            newGuy.extSegments = new ArrayList();
-            for (Iterator iter = extSegments.iterator(); iter.hasNext();) {
-                JFIFExtensionMarkerSegment jfxx =
-                    (JFIFExtensionMarkerSegment) iter.next();
-                newGuy.extSegments.add(jfxx.clone());
+            newGuy.extSegments = new ArrayList<>();
+            for (Iterator<JFIFExtensionMarkerSegment> iter =
+                    extSegments.iterator(); iter.hasNext();) {
+                JFIFExtensionMarkerSegment jfxx = iter.next();
+                newGuy.extSegments.add((JFIFExtensionMarkerSegment) jfxx.clone());
             }
         }
         if (iccSegment != null) {
@@ -230,9 +230,9 @@
         if (!extSegments.isEmpty()) {
             IIOMetadataNode JFXXnode = new IIOMetadataNode("JFXX");
             node.appendChild(JFXXnode);
-            for (Iterator iter = extSegments.iterator(); iter.hasNext();) {
-                JFIFExtensionMarkerSegment seg =
-                    (JFIFExtensionMarkerSegment) iter.next();
+            for (Iterator<JFIFExtensionMarkerSegment> iter =
+                    extSegments.iterator(); iter.hasNext();) {
+                JFIFExtensionMarkerSegment seg = iter.next();
                 JFXXnode.appendChild(seg.getNativeNode());
             }
         }
@@ -312,8 +312,7 @@
             }
             index--;
         }
-        JFIFExtensionMarkerSegment jfxx =
-            (JFIFExtensionMarkerSegment) extSegments.get(index);
+        JFIFExtensionMarkerSegment jfxx = extSegments.get(index);
         return jfxx.thumb.getWidth();
     }
 
@@ -324,8 +323,7 @@
             }
             index--;
         }
-        JFIFExtensionMarkerSegment jfxx =
-            (JFIFExtensionMarkerSegment) extSegments.get(index);
+        JFIFExtensionMarkerSegment jfxx = extSegments.get(index);
         return jfxx.thumb.getHeight();
     }
 
@@ -340,8 +338,7 @@
             if (thumb != null) {
                 index--;
             }
-            JFIFExtensionMarkerSegment jfxx =
-                (JFIFExtensionMarkerSegment) extSegments.get(index);
+            JFIFExtensionMarkerSegment jfxx = extSegments.get(index);
             ret = jfxx.thumb.getThumbnail(iis, reader);
         }
         reader.thumbnailComplete();
@@ -436,13 +433,13 @@
      * default encoding is used for the extra thumbnails.
      */
     void writeWithThumbs(ImageOutputStream ios,
-                         List thumbnails,
+                         List<? extends BufferedImage> thumbnails,
                          JPEGImageWriter writer) throws IOException {
         if (thumbnails != null) {
             JFIFExtensionMarkerSegment jfxx = null;
             if (thumbnails.size() == 1) {
                 if (!extSegments.isEmpty()) {
-                    jfxx = (JFIFExtensionMarkerSegment) extSegments.get(0);
+                    jfxx = extSegments.get(0);
                 }
                 writeThumb(ios,
                            (BufferedImage) thumbnails.get(0),
@@ -456,7 +453,7 @@
                 for (int i = 0; i < thumbnails.size(); i++) {
                     jfxx = null;
                     if (i < extSegments.size()) {
-                        jfxx = (JFIFExtensionMarkerSegment) extSegments.get(i);
+                        jfxx = extSegments.get(i);
                     }
                     writeThumb(ios,
                                (BufferedImage) thumbnails.get(i),
@@ -605,7 +602,7 @@
      * marker segments as necessary.
      */
     static void writeDefaultJFIF(ImageOutputStream ios,
-                                 List thumbnails,
+                                 List<? extends BufferedImage> thumbnails,
                                  ICC_Profile iccProfile,
                                  JPEGImageWriter writer)
         throws IOException {
@@ -637,9 +634,9 @@
         System.out.print("Thumbnail Height: ");
         System.out.println(thumbHeight);
         if (!extSegments.isEmpty()) {
-            for (Iterator iter = extSegments.iterator(); iter.hasNext();) {
-                JFIFExtensionMarkerSegment extSegment =
-                    (JFIFExtensionMarkerSegment) iter.next();
+            for (Iterator<JFIFExtensionMarkerSegment> iter =
+                    extSegments.iterator(); iter.hasNext();) {
+                JFIFExtensionMarkerSegment extSegment = iter.next();
                 extSegment.print();
             }
         }
@@ -1373,7 +1370,7 @@
      * combining chunks as necessary.
      */
     class ICCMarkerSegment extends MarkerSegment {
-        ArrayList chunks = null;
+        ArrayList<byte[]> chunks = null;
         byte [] profile = null; // The complete profile when it's fully read
                          // May remain null when writing
         private static final int ID_SIZE = 12;
@@ -1428,7 +1425,7 @@
                 // two chunk numbering bytes
                 length -= 2;
                 buffer.readData(profileData);
-                chunks = new ArrayList();
+                chunks = new ArrayList<>();
                 chunks.add(profileData);
                 chunksRead = 1;
                 inICC = true;
@@ -1518,7 +1515,7 @@
                 for (int i = 1; i <= numChunks; i++) {
                     boolean foundIt = false;
                     for (int chunk = 0; chunk < chunks.size(); chunk++) {
-                        byte [] chunkData = (byte []) chunks.get(chunk);
+                        byte [] chunkData = chunks.get(chunk);
                         if (chunkData[0] == i) { // Right one
                             System.arraycopy(chunkData, 2,
                                              profile, index,
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageMetadataFormat.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageMetadataFormat.java	Tue Apr 01 15:37:15 2014 +0200
@@ -82,7 +82,7 @@
                      "2",
                      "0", "255",
                      true, true);
-        List resUnits = new ArrayList();
+        List<String> resUnits = new ArrayList<>();
         resUnits.add("0");
         resUnits.add("1");
         resUnits.add("2");
@@ -125,7 +125,7 @@
         addElement("JFIFthumbPalette", "app0JFXX", CHILD_POLICY_EMPTY);
         addElement("JFIFthumbRGB", "app0JFXX", CHILD_POLICY_EMPTY);
 
-        List codes = new ArrayList();
+        List<String> codes = new ArrayList<>();
         codes.add("16"); // Hex 10
         codes.add("17"); // Hex 11
         codes.add("19"); // Hex 13
@@ -192,7 +192,7 @@
                      "0", "65535",
                      true, true);
 
-        List transforms = new ArrayList();
+        List<String> transforms = new ArrayList<>();
         transforms.add("0");
         transforms.add("1");
         transforms.add("2");
@@ -205,7 +205,7 @@
 
         addElement("componentSpec", "sof", CHILD_POLICY_EMPTY);
 
-        List procs = new ArrayList();
+        List<String> procs = new ArrayList<>();
         procs.add("0");
         procs.add("1");
         procs.add("2");
@@ -234,7 +234,7 @@
                      null,
                      "0", "65535",
                      true, true);
-        List comps = new ArrayList();
+        List<String> comps = new ArrayList<>();
         comps.add("1");
         comps.add("2");
         comps.add("3");
@@ -267,7 +267,7 @@
                      null,
                      "1", "255",
                      true, true);
-        List tabids = new ArrayList();
+        List<String> tabids = new ArrayList<>();
         tabids.add("0");
         tabids.add("1");
         tabids.add("2");
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -78,7 +78,7 @@
      * List of stream positions for images, reinitialized every time
      * a new input source is set.
      */
-    private List imagePositions = null;
+    private List<Long> imagePositions = null;
 
     /**
      * The number of images in the stream, or 0.
@@ -223,9 +223,9 @@
     private DisposerRecord disposerRecord;
 
     /** Sets up static C structures. */
-    private static native void initReaderIDs(Class iisClass,
-                                             Class qTableClass,
-                                             Class huffClass);
+    private static native void initReaderIDs(Class<?> iisClass,
+                                             Class<?> qTableClass,
+                                             Class<?> huffClass);
 
     public JPEGImageReader(ImageReaderSpi originator) {
         super(originator);
@@ -375,7 +375,7 @@
             currentImage = 0;
         }
         if (seekForwardOnly) {
-            Long pos = (Long) imagePositions.get(imagePositions.size()-1);
+            Long pos = imagePositions.get(imagePositions.size()-1);
             iis.flushBefore(pos.longValue());
         }
         tablesOnlyChecked = true;
@@ -392,6 +392,7 @@
         }
     }
 
+    @SuppressWarnings("fallthrough")
     private int getNumImagesOnThread(boolean allowSearch)
       throws IOException {
         if (numImages != 0) {
@@ -481,12 +482,12 @@
             checkTablesOnly();
         }
         if (imageIndex < imagePositions.size()) {
-            iis.seek(((Long)(imagePositions.get(imageIndex))).longValue());
+            iis.seek(imagePositions.get(imageIndex).longValue());
         } else {
             // read to start of image, saving positions
             // First seek to the last position we already have, and skip the
             // entire image
-            Long pos = (Long) imagePositions.get(imagePositions.size()-1);
+            Long pos = imagePositions.get(imagePositions.size()-1);
             iis.seek(pos.longValue());
             skipImage();
             // Now add all intervening positions, skipping images
@@ -766,7 +767,7 @@
         }
     }
 
-    public Iterator getImageTypes(int imageIndex)
+    public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
         throws IOException {
         setThreadLock();
         try {
@@ -776,7 +777,7 @@
         }
     }
 
-    private Iterator getImageTypesOnThread(int imageIndex)
+    private Iterator<ImageTypeSpecifier> getImageTypesOnThread(int imageIndex)
         throws IOException {
         if (currentImage != imageIndex) {
             cbLock.check();
@@ -1063,7 +1064,7 @@
 
         if (!wantRaster){
             // Can we read this image?
-            Iterator imageTypes = getImageTypes(imageIndex);
+            Iterator<ImageTypeSpecifier> imageTypes = getImageTypes(imageIndex);
             if (imageTypes.hasNext() == false) {
                 throw new IIOException("Unsupported Image Type");
             }
@@ -1187,8 +1188,8 @@
         // and set knownPassCount
         if (imageIndex == imageMetadataIndex) { // We have metadata
             knownPassCount = 0;
-            for (Iterator iter = imageMetadata.markerSequence.iterator();
-                 iter.hasNext();) {
+            for (Iterator<MarkerSegment> iter =
+                    imageMetadata.markerSequence.iterator(); iter.hasNext();) {
                 if (iter.next() instanceof SOSMarkerSegment) {
                     knownPassCount++;
                 }
@@ -1565,7 +1566,7 @@
 
         // reset local Java structures
         numImages = 0;
-        imagePositions = new ArrayList();
+        imagePositions = new ArrayList<>();
         currentImage = -1;
         image = null;
         raster = null;
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReaderSpi.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReaderSpi.java	Tue Apr 01 15:37:15 2014 +0200
@@ -46,7 +46,7 @@
               JPEG.suffixes,
               JPEG.MIMETypes,
               "com.sun.imageio.plugins.jpeg.JPEGImageReader",
-              new Class[] { ImageInputStream.class },
+              new Class<?>[] { ImageInputStream.class },
               writerSpiNames,
               true,
               JPEG.nativeStreamMetadataFormatName,
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java	Tue Apr 01 15:37:15 2014 +0200
@@ -107,7 +107,7 @@
     /**
      * If there are thumbnails to be written, this is the list.
      */
-    private List thumbnails = null;
+    private List<? extends BufferedImage> thumbnails = null;
 
     /**
      * If metadata should include an icc profile, store it here.
@@ -1394,14 +1394,14 @@
      */
     private int [] collectScans(JPEGMetadata metadata,
                                 SOFMarkerSegment sof) {
-        List segments = new ArrayList();
+        List<SOSMarkerSegment> segments = new ArrayList<>();
         int SCAN_SIZE = 9;
         int MAX_COMPS_PER_SCAN = 4;
-        for (Iterator iter = metadata.markerSequence.iterator();
+        for (Iterator<MarkerSegment> iter = metadata.markerSequence.iterator();
              iter.hasNext();) {
-            MarkerSegment seg = (MarkerSegment) iter.next();
+            MarkerSegment seg = iter.next();
             if (seg instanceof SOSMarkerSegment) {
-                segments.add(seg);
+                segments.add((SOSMarkerSegment) seg);
             }
         }
         int [] retval = null;
@@ -1411,7 +1411,7 @@
             retval = new int [numScans*SCAN_SIZE];
             int index = 0;
             for (int i = 0; i < numScans; i++) {
-                SOSMarkerSegment sos = (SOSMarkerSegment) segments.get(i);
+                SOSMarkerSegment sos = segments.get(i);
                 retval[index++] = sos.componentSpecs.length; // num comps
                 for (int j = 0; j < MAX_COMPS_PER_SCAN; j++) {
                     if (j < sos.componentSpecs.length) {
@@ -1441,10 +1441,10 @@
      */
     private JPEGQTable [] collectQTablesFromMetadata
         (JPEGMetadata metadata) {
-        ArrayList tables = new ArrayList();
-        Iterator iter = metadata.markerSequence.iterator();
+        ArrayList<DQTMarkerSegment.Qtable> tables = new ArrayList<>();
+        Iterator<MarkerSegment> iter = metadata.markerSequence.iterator();
         while (iter.hasNext()) {
-            MarkerSegment seg = (MarkerSegment) iter.next();
+            MarkerSegment seg = iter.next();
             if (seg instanceof DQTMarkerSegment) {
                 DQTMarkerSegment dqt =
                     (DQTMarkerSegment) seg;
@@ -1456,7 +1456,7 @@
             retval = new JPEGQTable[tables.size()];
             for (int i = 0; i < retval.length; i++) {
                 retval[i] =
-                    new JPEGQTable(((DQTMarkerSegment.Qtable)tables.get(i)).data);
+                    new JPEGQTable(tables.get(i).data);
             }
         }
         return retval;
@@ -1471,16 +1471,14 @@
      */
     private JPEGHuffmanTable[] collectHTablesFromMetadata
         (JPEGMetadata metadata, boolean wantDC) throws IIOException {
-        ArrayList tables = new ArrayList();
-        Iterator iter = metadata.markerSequence.iterator();
+        ArrayList<DHTMarkerSegment.Htable> tables = new ArrayList<>();
+        Iterator<MarkerSegment> iter = metadata.markerSequence.iterator();
         while (iter.hasNext()) {
-            MarkerSegment seg = (MarkerSegment) iter.next();
+            MarkerSegment seg = iter.next();
             if (seg instanceof DHTMarkerSegment) {
-                DHTMarkerSegment dht =
-                    (DHTMarkerSegment) seg;
+                DHTMarkerSegment dht = (DHTMarkerSegment) seg;
                 for (int i = 0; i < dht.tables.size(); i++) {
-                    DHTMarkerSegment.Htable htable =
-                        (DHTMarkerSegment.Htable) dht.tables.get(i);
+                    DHTMarkerSegment.Htable htable = dht.tables.get(i);
                     if (htable.tableClass == (wantDC ? 0 : 1)) {
                         tables.add(htable);
                     }
@@ -1553,6 +1551,7 @@
                         retval = JPEG.JCS_YCC;
                     }
                 }
+                break;
             case ColorSpace.TYPE_CMYK:
                 retval = JPEG.JCS_CMYK;
                 break;
@@ -1592,6 +1591,7 @@
                         retval = JPEG.JCS_YCC;
                     }
                 }
+                break;
             case ColorSpace.TYPE_CMYK:
                 retval = JPEG.JCS_CMYK;
                 break;
@@ -1638,6 +1638,7 @@
                         retval = JPEG.JCS_YCC;
                     }
                 }
+                break;
             case ColorSpace.TYPE_CMYK:
                 retval = JPEG.JCS_YCCK;
                 break;
@@ -1662,8 +1663,8 @@
     ////////////// Native methods and callbacks
 
     /** Sets up static native structures. */
-    private static native void initWriterIDs(Class qTableClass,
-                                             Class huffClass);
+    private static native void initWriterIDs(Class<?> qTableClass,
+                                             Class<?> huffClass);
 
     /** Sets up per-writer native structure and returns a pointer to it. */
     private native long initJPEGImageWriter();
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriterSpi.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriterSpi.java	Tue Apr 01 15:37:15 2014 +0200
@@ -50,7 +50,7 @@
               JPEG.suffixes,
               JPEG.MIMETypes,
               "com.sun.imageio.plugins.jpeg.JPEGImageWriter",
-              new Class[] { ImageOutputStream.class },
+              new Class<?>[] { ImageOutputStream.class },
               readerSpiNames,
               true,
               JPEG.nativeStreamMetadataFormatName,
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java	Tue Apr 01 15:37:15 2014 +0200
@@ -52,6 +52,7 @@
 import java.awt.color.ICC_Profile;
 import java.awt.color.ICC_ColorSpace;
 import java.awt.color.ColorSpace;
+import java.awt.image.BufferedImage;
 import java.awt.image.ColorModel;
 import java.awt.Point;
 
@@ -69,7 +70,7 @@
      * <code>markerSequence</code> is modified.  This is used by reset
      * to restore the original state.
      */
-    private List resetSequence = null;
+    private List<MarkerSegment> resetSequence = null;
 
     /**
      * Set to <code>true</code> when reading a thumbnail stored as
@@ -100,7 +101,7 @@
      * list is package visible so that the writer can access it.
      * @see #MarkerSegment
      */
-    List markerSequence = new ArrayList();
+    List<MarkerSegment> markerSequence = new ArrayList<>();
 
     /**
      * Indicates whether this object represents stream or image
@@ -645,9 +646,9 @@
      * with the given tag, or null if none is found.
      */
     MarkerSegment findMarkerSegment(int tag) {
-        Iterator iter = markerSequence.iterator();
+        Iterator<MarkerSegment> iter = markerSequence.iterator();
         while (iter.hasNext()) {
-            MarkerSegment seg = (MarkerSegment)iter.next();
+            MarkerSegment seg = iter.next();
             if (seg.tag == tag) {
                 return seg;
             }
@@ -659,19 +660,20 @@
      * Returns the first or last MarkerSegment object in the list
      * of the given class, or null if none is found.
      */
-    MarkerSegment findMarkerSegment(Class cls, boolean first) {
+    MarkerSegment findMarkerSegment(Class<? extends MarkerSegment> cls, boolean first) {
         if (first) {
-            Iterator iter = markerSequence.iterator();
+            Iterator<MarkerSegment> iter = markerSequence.iterator();
             while (iter.hasNext()) {
-                MarkerSegment seg = (MarkerSegment)iter.next();
+                MarkerSegment seg = iter.next();
                 if (cls.isInstance(seg)) {
                     return seg;
                 }
             }
         } else {
-            ListIterator iter = markerSequence.listIterator(markerSequence.size());
+            ListIterator<MarkerSegment> iter =
+                markerSequence.listIterator(markerSequence.size());
             while (iter.hasPrevious()) {
-                MarkerSegment seg = (MarkerSegment)iter.previous();
+                MarkerSegment seg = iter.previous();
                 if (cls.isInstance(seg)) {
                     return seg;
                 }
@@ -684,19 +686,21 @@
      * Returns the index of the first or last MarkerSegment in the list
      * of the given class, or -1 if none is found.
      */
-    private int findMarkerSegmentPosition(Class cls, boolean first) {
+    private int findMarkerSegmentPosition(Class<? extends MarkerSegment> cls,
+                                          boolean first) {
         if (first) {
-            ListIterator iter = markerSequence.listIterator();
+            ListIterator<MarkerSegment> iter = markerSequence.listIterator();
             for (int i = 0; iter.hasNext(); i++) {
-                MarkerSegment seg = (MarkerSegment)iter.next();
+                MarkerSegment seg = iter.next();
                 if (cls.isInstance(seg)) {
                     return i;
                 }
             }
         } else {
-            ListIterator iter = markerSequence.listIterator(markerSequence.size());
+            ListIterator<MarkerSegment> iter =
+                    markerSequence.listIterator(markerSequence.size());
             for (int i = markerSequence.size()-1; iter.hasPrevious(); i--) {
-                MarkerSegment seg = (MarkerSegment)iter.previous();
+                MarkerSegment seg = iter.previous();
                 if (cls.isInstance(seg)) {
                     return i;
                 }
@@ -706,9 +710,10 @@
     }
 
     private int findLastUnknownMarkerSegmentPosition() {
-        ListIterator iter = markerSequence.listIterator(markerSequence.size());
+        ListIterator<MarkerSegment> iter =
+            markerSequence.listIterator(markerSequence.size());
         for (int i = markerSequence.size()-1; iter.hasPrevious(); i--) {
-            MarkerSegment seg = (MarkerSegment)iter.previous();
+            MarkerSegment seg = iter.previous();
             if (seg.unknown == true) {
                 return i;
             }
@@ -733,15 +738,15 @@
     /**
      * Returns a deep copy of the current marker sequence.
      */
-    private List cloneSequence() {
+    private List<MarkerSegment> cloneSequence() {
         if (markerSequence == null) {
             return null;
         }
-        List retval = new ArrayList(markerSequence.size());
-        Iterator iter = markerSequence.iterator();
+        List<MarkerSegment> retval = new ArrayList<>(markerSequence.size());
+        Iterator<MarkerSegment> iter = markerSequence.iterator();
         while(iter.hasNext()) {
-            MarkerSegment seg = (MarkerSegment)iter.next();
-            retval.add(seg.clone());
+            MarkerSegment seg = iter.next();
+            retval.add((MarkerSegment) seg.clone());
         }
 
         return retval;
@@ -774,7 +779,7 @@
     IIOMetadataNode getNativeTree() {
         IIOMetadataNode root;
         IIOMetadataNode top;
-        Iterator iter = markerSequence.iterator();
+        Iterator<MarkerSegment> iter = markerSequence.iterator();
         if (isStream) {
             root = new IIOMetadataNode(JPEG.nativeStreamMetadataFormatName);
             top = root;
@@ -797,7 +802,7 @@
             top = sequence;
         }
         while(iter.hasNext()) {
-            MarkerSegment seg = (MarkerSegment) iter.next();
+            MarkerSegment seg = iter.next();
             top.appendChild(seg.getNativeNode());
         }
         return root;
@@ -961,9 +966,9 @@
 
         // NumProgressiveScans - count sos segments
         int sosCount = 0;
-        Iterator iter = markerSequence.iterator();
+        Iterator<MarkerSegment> iter = markerSequence.iterator();
         while (iter.hasNext()) {
-            MarkerSegment ms = (MarkerSegment) iter.next();
+            MarkerSegment ms = iter.next();
             if (ms.tag == JPEG.SOS) {
                 sosCount++;
             }
@@ -1028,9 +1033,9 @@
         // Add a text entry for each COM Marker Segment
         if (findMarkerSegment(JPEG.COM) != null) {
             text = new IIOMetadataNode("Text");
-            Iterator iter = markerSequence.iterator();
+            Iterator<MarkerSegment> iter = markerSequence.iterator();
             while (iter.hasNext()) {
-                MarkerSegment seg = (MarkerSegment) iter.next();
+                MarkerSegment seg = iter.next();
                 if (seg.tag == JPEG.COM) {
                     COMMarkerSegment com = (COMMarkerSegment) seg;
                     IIOMetadataNode entry = new IIOMetadataNode("TextEntry");
@@ -1068,7 +1073,7 @@
         if (root == null) {
             throw new IllegalArgumentException("null root!");
         }
-        List copy = null;
+        List<MarkerSegment> copy = null;
         if (resetSequence == null) {
             resetSequence = cloneSequence();  // Deep copy
             copy = resetSequence;  // Avoid cloning twice
@@ -1181,12 +1186,12 @@
      */
     private void mergeDQTNode(Node node) throws IIOInvalidTreeException {
         // First collect any existing DQT nodes into a local list
-        ArrayList oldDQTs = new ArrayList();
-        Iterator iter = markerSequence.iterator();
+        ArrayList<DQTMarkerSegment> oldDQTs = new ArrayList<>();
+        Iterator<MarkerSegment> iter = markerSequence.iterator();
         while (iter.hasNext()) {
-            MarkerSegment seg = (MarkerSegment) iter.next();
+            MarkerSegment seg = iter.next();
             if (seg instanceof DQTMarkerSegment) {
-                oldDQTs.add(seg);
+                oldDQTs.add((DQTMarkerSegment) seg);
             }
         }
         if (!oldDQTs.isEmpty()) {
@@ -1201,10 +1206,9 @@
                 DQTMarkerSegment dqt = null;
                 int tableIndex = -1;
                 for (int j = 0; j < oldDQTs.size(); j++) {
-                    DQTMarkerSegment testDQT = (DQTMarkerSegment) oldDQTs.get(j);
+                    DQTMarkerSegment testDQT = oldDQTs.get(j);
                     for (int k = 0; k < testDQT.tables.size(); k++) {
-                        DQTMarkerSegment.Qtable testTable =
-                            (DQTMarkerSegment.Qtable) testDQT.tables.get(k);
+                        DQTMarkerSegment.Qtable testTable = testDQT.tables.get(k);
                         if (childID == testTable.tableID) {
                             dqt = testDQT;
                             tableIndex = k;
@@ -1216,7 +1220,7 @@
                 if (dqt != null) {
                     dqt.tables.set(tableIndex, dqt.getQtableFromNode(child));
                 } else {
-                    dqt = (DQTMarkerSegment) oldDQTs.get(oldDQTs.size()-1);
+                    dqt = oldDQTs.get(oldDQTs.size()-1);
                     dqt.tables.add(dqt.getQtableFromNode(child));
                 }
             }
@@ -1257,12 +1261,12 @@
      */
     private void mergeDHTNode(Node node) throws IIOInvalidTreeException {
         // First collect any existing DQT nodes into a local list
-        ArrayList oldDHTs = new ArrayList();
-        Iterator iter = markerSequence.iterator();
+        ArrayList<DHTMarkerSegment> oldDHTs = new ArrayList<>();
+        Iterator<MarkerSegment> iter = markerSequence.iterator();
         while (iter.hasNext()) {
-            MarkerSegment seg = (MarkerSegment) iter.next();
+            MarkerSegment seg = iter.next();
             if (seg instanceof DHTMarkerSegment) {
-                oldDHTs.add(seg);
+                oldDHTs.add((DHTMarkerSegment) seg);
             }
         }
         if (!oldDHTs.isEmpty()) {
@@ -1283,10 +1287,9 @@
                 DHTMarkerSegment dht = null;
                 int tableIndex = -1;
                 for (int j = 0; j < oldDHTs.size(); j++) {
-                    DHTMarkerSegment testDHT = (DHTMarkerSegment) oldDHTs.get(j);
+                    DHTMarkerSegment testDHT = oldDHTs.get(j);
                     for (int k = 0; k < testDHT.tables.size(); k++) {
-                        DHTMarkerSegment.Htable testTable =
-                            (DHTMarkerSegment.Htable) testDHT.tables.get(k);
+                        DHTMarkerSegment.Htable testTable = testDHT.tables.get(k);
                         if ((childID == testTable.tableID) &&
                             (childClass == testTable.tableClass)) {
                             dht = testDHT;
@@ -1299,7 +1302,7 @@
                 if (dht != null) {
                     dht.tables.set(tableIndex, dht.getHtableFromNode(child));
                 } else {
-                    dht = (DHTMarkerSegment) oldDHTs.get(oldDHTs.size()-1);
+                    dht = oldDHTs.get(oldDHTs.size()-1);
                     dht.tables.add(dht.getHtableFromNode(child));
                 }
             }
@@ -1735,8 +1738,9 @@
                 }
                 if (idsDiffer) {
                     // update the ids in each SOS marker segment
-                    for (Iterator iter = markerSequence.iterator(); iter.hasNext();) {
-                        MarkerSegment seg = (MarkerSegment) iter.next();
+                    for (Iterator<MarkerSegment> iter = markerSequence.iterator();
+                            iter.hasNext();) {
+                        MarkerSegment seg = iter.next();
                         if (seg instanceof SOSMarkerSegment) {
                             SOSMarkerSegment target = (SOSMarkerSegment) seg;
                             for (int i = 0; i < target.componentSpecs.length; i++) {
@@ -1788,11 +1792,12 @@
         }
 
         if (updateQtables) {
-            List tableSegments = new ArrayList();
-            for (Iterator iter = markerSequence.iterator(); iter.hasNext();) {
-                MarkerSegment seg = (MarkerSegment) iter.next();
+            List<DQTMarkerSegment> tableSegments = new ArrayList<>();
+            for (Iterator<MarkerSegment> iter = markerSequence.iterator();
+                    iter.hasNext();) {
+                MarkerSegment seg = iter.next();
                 if (seg instanceof DQTMarkerSegment) {
-                    tableSegments.add(seg);
+                    tableSegments.add((DQTMarkerSegment) seg);
                 }
             }
             // If there are no tables, don't add them, as the metadata encodes an
@@ -1806,12 +1811,12 @@
 
                 // Find the table with selector 1.
                 boolean found = false;
-                for (Iterator iter = tableSegments.iterator(); iter.hasNext();) {
-                    DQTMarkerSegment testdqt = (DQTMarkerSegment) iter.next();
-                    for (Iterator tabiter = testdqt.tables.iterator();
-                         tabiter.hasNext();) {
-                        DQTMarkerSegment.Qtable tab =
-                            (DQTMarkerSegment.Qtable) tabiter.next();
+                for (Iterator<DQTMarkerSegment> iter = tableSegments.iterator();
+                        iter.hasNext();) {
+                    DQTMarkerSegment testdqt = iter.next();
+                    for (Iterator<DQTMarkerSegment.Qtable> tabiter =
+                            testdqt.tables.iterator(); tabiter.hasNext();) {
+                        DQTMarkerSegment.Qtable tab = tabiter.next();
                         if (tab.tableID == 1) {
                             found = true;
                         }
@@ -1820,12 +1825,12 @@
                 if (!found) {
                     //    find the table with selector 0.  There should be one.
                     DQTMarkerSegment.Qtable table0 = null;
-                    for (Iterator iter = tableSegments.iterator(); iter.hasNext();) {
-                        DQTMarkerSegment testdqt = (DQTMarkerSegment) iter.next();
-                        for (Iterator tabiter = testdqt.tables.iterator();
-                             tabiter.hasNext();) {
-                            DQTMarkerSegment.Qtable tab =
-                                (DQTMarkerSegment.Qtable) tabiter.next();
+                    for (Iterator<DQTMarkerSegment> iter =
+                            tableSegments.iterator(); iter.hasNext();) {
+                        DQTMarkerSegment testdqt = iter.next();
+                        for (Iterator<DQTMarkerSegment.Qtable> tabiter =
+                                testdqt.tables.iterator(); tabiter.hasNext();) {
+                            DQTMarkerSegment.Qtable tab = tabiter.next();
                             if (tab.tableID == 0) {
                                 table0 = tab;
                             }
@@ -1835,19 +1840,19 @@
                     // Assuming that the table with id 0 is a luminance table,
                     // compute a new chrominance table of the same quality and
                     // add it to the last DQT segment
-                    DQTMarkerSegment dqt =
-                        (DQTMarkerSegment) tableSegments.get(tableSegments.size()-1);
+                    DQTMarkerSegment dqt = tableSegments.get(tableSegments.size()-1);
                     dqt.tables.add(dqt.getChromaForLuma(table0));
                 }
             }
         }
 
         if (updateHtables) {
-            List tableSegments = new ArrayList();
-            for (Iterator iter = markerSequence.iterator(); iter.hasNext();) {
-                MarkerSegment seg = (MarkerSegment) iter.next();
+            List<DHTMarkerSegment> tableSegments = new ArrayList<>();
+            for (Iterator<MarkerSegment> iter = markerSequence.iterator();
+                    iter.hasNext();) {
+                MarkerSegment seg = iter.next();
                 if (seg instanceof DHTMarkerSegment) {
-                    tableSegments.add(seg);
+                    tableSegments.add((DHTMarkerSegment) seg);
                 }
             }
             // If there are no tables, don't add them, as the metadata encodes an
@@ -1860,12 +1865,12 @@
 
                 // find a table with selector 1. AC/DC is irrelevant
                 boolean found = false;
-                for (Iterator iter = tableSegments.iterator(); iter.hasNext();) {
-                    DHTMarkerSegment testdht = (DHTMarkerSegment) iter.next();
-                    for (Iterator tabiter = testdht.tables.iterator();
-                         tabiter.hasNext();) {
-                        DHTMarkerSegment.Htable tab =
-                            (DHTMarkerSegment.Htable) tabiter.next();
+                for (Iterator<DHTMarkerSegment> iter = tableSegments.iterator();
+                        iter.hasNext();) {
+                    DHTMarkerSegment testdht = iter.next();
+                    for (Iterator<DHTMarkerSegment.Htable> tabiter =
+                            testdht.tables.iterator(); tabiter.hasNext();) {
+                        DHTMarkerSegment.Htable tab = tabiter.next();
                         if (tab.tableID == 1) {
                             found = true;
                         }
@@ -1875,7 +1880,7 @@
                     // Create new standard dc and ac chrominance tables and add them
                     // to the last DHT segment
                     DHTMarkerSegment lastDHT =
-                        (DHTMarkerSegment) tableSegments.get(tableSegments.size()-1);
+                        tableSegments.get(tableSegments.size()-1);
                     lastDHT.addHtable(JPEGHuffmanTable.StdDCLuminance, true, 1);
                     lastDHT.addHtable(JPEGHuffmanTable.StdACLuminance, true, 1);
                 }
@@ -2181,7 +2186,7 @@
         if (resetSequence == null) {
             resetSequence = markerSequence;
         }
-        markerSequence = new ArrayList();
+        markerSequence = new ArrayList<>();
 
         // Build a whole new marker sequence from the tree
 
@@ -2310,10 +2315,10 @@
      * segments, including 0 if there are no SOS marker segments.
      */
     private int countScanBands() {
-        List ids = new ArrayList();
-        Iterator iter = markerSequence.iterator();
+        List<Integer> ids = new ArrayList<>();
+        Iterator<MarkerSegment> iter = markerSequence.iterator();
         while(iter.hasNext()) {
-            MarkerSegment seg = (MarkerSegment)iter.next();
+            MarkerSegment seg = iter.next();
             if (seg instanceof SOSMarkerSegment) {
                 SOSMarkerSegment sos = (SOSMarkerSegment) seg;
                 SOSMarkerSegment.ScanComponentSpec [] specs = sos.componentSpecs;
@@ -2334,7 +2339,7 @@
     void writeToStream(ImageOutputStream ios,
                        boolean ignoreJFIF,
                        boolean forceJFIF,
-                       List thumbnails,
+                       List<? extends BufferedImage> thumbnails,
                        ICC_Profile iccProfile,
                        boolean ignoreAdobe,
                        int newAdobeTransform,
@@ -2360,9 +2365,9 @@
             }
         }
         // Iterate over each MarkerSegment
-        Iterator iter = markerSequence.iterator();
+        Iterator<MarkerSegment> iter = markerSequence.iterator();
         while(iter.hasNext()) {
-            MarkerSegment seg = (MarkerSegment)iter.next();
+            MarkerSegment seg = iter.next();
             if (seg instanceof JFIFMarkerSegment) {
                 if (ignoreJFIF == false) {
                     JFIFMarkerSegment jfif = (JFIFMarkerSegment) seg;
@@ -2409,7 +2414,7 @@
 
     public void print() {
         for (int i = 0; i < markerSequence.size(); i++) {
-            MarkerSegment seg = (MarkerSegment) markerSequence.get(i);
+            MarkerSegment seg = markerSequence.get(i);
             seg.print();
         }
     }
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadataFormat.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadataFormat.java	Tue Apr 01 15:37:15 2014 +0200
@@ -56,7 +56,7 @@
                      DATATYPE_INTEGER,
                      false,
                      "0");
-        List tabids = new ArrayList();
+        List<String> tabids = new ArrayList<>();
         tabids.add("0");
         tabids.add("1");
         tabids.add("2");
@@ -74,7 +74,7 @@
 
         addElement("dht", parentName, 1, 4);
         addElement("dhtable", "dht", CHILD_POLICY_EMPTY);
-        List classes = new ArrayList();
+        List<String> classes = new ArrayList<>();
         classes.add("0");
         classes.add("1");
         addAttribute("dhtable",
--- a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReaderSpi.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReaderSpi.java	Tue Apr 01 15:37:15 2014 +0200
@@ -60,7 +60,7 @@
               suffixes,
               MIMETypes,
               readerClassName,
-              new Class[] { ImageInputStream.class },
+              new Class<?>[] { ImageInputStream.class },
               writerSpiNames,
               false,
               null, null,
--- a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java	Tue Apr 01 15:37:15 2014 +0200
@@ -656,16 +656,16 @@
     }
 
     private void write_tEXt() throws IOException {
-        Iterator keywordIter = metadata.tEXt_keyword.iterator();
-        Iterator textIter = metadata.tEXt_text.iterator();
+        Iterator<String> keywordIter = metadata.tEXt_keyword.iterator();
+        Iterator<String> textIter = metadata.tEXt_text.iterator();
 
         while (keywordIter.hasNext()) {
             ChunkStream cs = new ChunkStream(PNGImageReader.tEXt_TYPE, stream);
-            String keyword = (String)keywordIter.next();
+            String keyword = keywordIter.next();
             cs.writeBytes(keyword);
             cs.writeByte(0);
 
-            String text = (String)textIter.next();
+            String text = textIter.next();
             cs.writeBytes(text);
             cs.finish();
         }
@@ -717,33 +717,33 @@
     }
 
     private void write_zTXt() throws IOException {
-        Iterator keywordIter = metadata.zTXt_keyword.iterator();
-        Iterator methodIter = metadata.zTXt_compressionMethod.iterator();
-        Iterator textIter = metadata.zTXt_text.iterator();
+        Iterator<String> keywordIter = metadata.zTXt_keyword.iterator();
+        Iterator<Integer> methodIter = metadata.zTXt_compressionMethod.iterator();
+        Iterator<String> textIter = metadata.zTXt_text.iterator();
 
         while (keywordIter.hasNext()) {
             ChunkStream cs = new ChunkStream(PNGImageReader.zTXt_TYPE, stream);
-            String keyword = (String)keywordIter.next();
+            String keyword = keywordIter.next();
             cs.writeBytes(keyword);
             cs.writeByte(0);
 
-            int compressionMethod = ((Integer)methodIter.next()).intValue();
+            int compressionMethod = (methodIter.next()).intValue();
             cs.writeByte(compressionMethod);
 
-            String text = (String)textIter.next();
+            String text = textIter.next();
             cs.write(deflate(text.getBytes("ISO-8859-1")));
             cs.finish();
         }
     }
 
     private void writeUnknownChunks() throws IOException {
-        Iterator typeIter = metadata.unknownChunkType.iterator();
-        Iterator dataIter = metadata.unknownChunkData.iterator();
+        Iterator<String> typeIter = metadata.unknownChunkType.iterator();
+        Iterator<byte[]> dataIter = metadata.unknownChunkData.iterator();
 
         while (typeIter.hasNext() && dataIter.hasNext()) {
-            String type = (String)typeIter.next();
+            String type = typeIter.next();
             ChunkStream cs = new ChunkStream(chunkType(type), stream);
-            byte[] data = (byte[])dataIter.next();
+            byte[] data = dataIter.next();
             cs.write(data);
             cs.finish();
         }
--- a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriterSpi.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriterSpi.java	Tue Apr 01 15:37:15 2014 +0200
@@ -62,7 +62,7 @@
                 suffixes,
                 MIMETypes,
                 writerClassName,
-                new Class[] { ImageOutputStream.class },
+                new Class<?>[] { ImageOutputStream.class },
                 readerSpiNames,
                 false,
                 null, null,
--- a/jdk/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReader.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReader.java	Tue Apr 01 15:37:15 2014 +0200
@@ -152,14 +152,14 @@
         gotHeader = true;
     }
 
-    public Iterator getImageTypes(int imageIndex)
+    public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
         throws IOException {
         checkIndex(imageIndex);
         readHeader();
 
         BufferedImage bi =
             new BufferedImage(1, 1, BufferedImage.TYPE_BYTE_BINARY);
-        ArrayList list = new ArrayList(1);
+        ArrayList<ImageTypeSpecifier> list = new ArrayList<>(1);
         list.add(new ImageTypeSpecifier(bi));
         return list.iterator();
     }
--- a/jdk/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReaderSpi.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReaderSpi.java	Tue Apr 01 15:37:15 2014 +0200
@@ -55,7 +55,7 @@
               entensions,
               mimeType,
               "com.sun.imageio.plugins.wbmp.WBMPImageReader",
-              new Class[] { ImageInputStream.class },
+              new Class<?>[] { ImageInputStream.class },
               writerSpiNames,
               true,
               null, null, null, null,
--- a/jdk/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageWriterSpi.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageWriterSpi.java	Tue Apr 01 15:37:15 2014 +0200
@@ -55,7 +55,7 @@
               entensions,
               mimeType,
               "com.sun.imageio.plugins.wbmp.WBMPImageWriter",
-              new Class[] { ImageOutputStream.class },
+              new Class<?>[] { ImageOutputStream.class },
               readerSpiNames,
               true,
               null, null, null, null,
--- a/jdk/src/share/classes/com/sun/imageio/spi/FileImageInputStreamSpi.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/spi/FileImageInputStreamSpi.java	Tue Apr 01 15:37:15 2014 +0200
@@ -37,7 +37,7 @@
 
     private static final String version = "1.0";
 
-    private static final Class inputClass = File.class;
+    private static final Class<?> inputClass = File.class;
 
     public FileImageInputStreamSpi() {
         super(vendorName, version, inputClass);
--- a/jdk/src/share/classes/com/sun/imageio/spi/FileImageOutputStreamSpi.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/spi/FileImageOutputStreamSpi.java	Tue Apr 01 15:37:15 2014 +0200
@@ -37,7 +37,7 @@
 
     private static final String version = "1.0";
 
-    private static final Class outputClass = File.class;
+    private static final Class<?> outputClass = File.class;
 
     public FileImageOutputStreamSpi() {
         super(vendorName, version, outputClass);
--- a/jdk/src/share/classes/com/sun/imageio/spi/InputStreamImageInputStreamSpi.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/spi/InputStreamImageInputStreamSpi.java	Tue Apr 01 15:37:15 2014 +0200
@@ -40,7 +40,7 @@
 
     private static final String version = "1.0";
 
-    private static final Class inputClass = InputStream.class;
+    private static final Class<?> inputClass = InputStream.class;
 
     public InputStreamImageInputStreamSpi() {
         super(vendorName, version, inputClass);
--- a/jdk/src/share/classes/com/sun/imageio/spi/OutputStreamImageOutputStreamSpi.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/spi/OutputStreamImageOutputStreamSpi.java	Tue Apr 01 15:37:15 2014 +0200
@@ -40,7 +40,7 @@
 
     private static final String version = "1.0";
 
-    private static final Class outputClass = OutputStream.class;
+    private static final Class<?> outputClass = OutputStream.class;
 
     public OutputStreamImageOutputStreamSpi() {
         super(vendorName, version, outputClass);
--- a/jdk/src/share/classes/com/sun/imageio/spi/RAFImageInputStreamSpi.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/spi/RAFImageInputStreamSpi.java	Tue Apr 01 15:37:15 2014 +0200
@@ -38,7 +38,7 @@
 
     private static final String version = "1.0";
 
-    private static final Class inputClass = RandomAccessFile.class;
+    private static final Class<?> inputClass = RandomAccessFile.class;
 
     public RAFImageInputStreamSpi() {
         super(vendorName, version, inputClass);
--- a/jdk/src/share/classes/com/sun/imageio/spi/RAFImageOutputStreamSpi.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/spi/RAFImageOutputStreamSpi.java	Tue Apr 01 15:37:15 2014 +0200
@@ -38,7 +38,7 @@
 
     private static final String version = "1.0";
 
-    private static final Class outputClass = RandomAccessFile.class;
+    private static final Class<?> outputClass = RandomAccessFile.class;
 
     public RAFImageOutputStreamSpi() {
         super(vendorName, version, outputClass);
--- a/jdk/src/share/classes/com/sun/imageio/stream/StreamCloser.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/stream/StreamCloser.java	Tue Apr 01 15:37:15 2014 +0200
@@ -82,7 +82,7 @@
                 };
 
                 java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction() {
+                    new java.security.PrivilegedAction<Object>() {
                         public Object run() {
                             /* The thread must be a member of a thread group
                              * which will not get GCed before VM exit.
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java	Tue Apr 01 15:37:15 2014 +0200
@@ -41,7 +41,6 @@
 import javax.swing.table.*;
 import javax.accessibility.*;
 
-import sun.swing.AbstractFilterComboBoxModel;
 import sun.swing.SwingUtilities2;
 
 import sun.swing.plaf.synth.*;
@@ -1329,9 +1328,71 @@
     /**
      * Data model for filter combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
-        protected JFileChooser getFileChooser() {
-            return GTKFileChooserUI.this.getFileChooser();
+    protected class FilterComboBoxModel extends AbstractListModel
+            implements ComboBoxModel, PropertyChangeListener {
+        protected FileFilter[] filters;
+
+        protected FilterComboBoxModel() {
+            super();
+            filters = getFileChooser().getChoosableFileFilters();
+        }
+
+        public void propertyChange(PropertyChangeEvent e) {
+            String prop = e.getPropertyName();
+            if (prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
+                filters = (FileFilter[]) e.getNewValue();
+                fireContentsChanged(this, -1, -1);
+            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public void setSelectedItem(Object filter) {
+            if (filter != null) {
+                getFileChooser().setFileFilter((FileFilter) filter);
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public Object getSelectedItem() {
+            // Ensure that the current filter is in the list.
+            // NOTE: we shouldnt' have to do this, since JFileChooser adds
+            // the filter to the choosable filters list when the filter
+            // is set. Lets be paranoid just in case someone overrides
+            // setFileFilter in JFileChooser.
+            FileFilter currentFilter = getFileChooser().getFileFilter();
+            boolean found = false;
+            if (currentFilter != null) {
+                for (FileFilter filter : filters) {
+                    if (filter == currentFilter) {
+                        found = true;
+                    }
+                }
+                if (found == false) {
+                    getFileChooser().addChoosableFileFilter(currentFilter);
+                }
+            }
+            return getFileChooser().getFileFilter();
+        }
+
+        public int getSize() {
+            if (filters != null) {
+                return filters.length;
+            } else {
+                return 0;
+            }
+        }
+
+        public Object getElementAt(int index) {
+            if (index > getSize() - 1) {
+                // This shouldn't happen. Try to recover gracefully.
+                return getFileChooser().getFileFilter();
+            }
+            if (filters != null) {
+                return filters[index];
+            } else {
+                return null;
+            }
         }
     }
 }
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java	Tue Apr 01 15:37:15 2014 +0200
@@ -38,7 +38,6 @@
 import java.io.IOException;
 import java.util.*;
 import sun.awt.shell.ShellFolder;
-import sun.swing.AbstractFilterComboBoxModel;
 import sun.swing.SwingUtilities2;
 
 /**
@@ -778,9 +777,70 @@
     /**
      * Data model for a type-face selection combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
-        protected JFileChooser getFileChooser() {
-            return MotifFileChooserUI.this.getFileChooser();
+    protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
+            PropertyChangeListener {
+        protected FileFilter[] filters;
+        protected FilterComboBoxModel() {
+            super();
+            filters = getFileChooser().getChoosableFileFilters();
+        }
+
+        public void propertyChange(PropertyChangeEvent e) {
+            String prop = e.getPropertyName();
+            if(prop.equals(JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY)) {
+                filters = (FileFilter[]) e.getNewValue();
+                fireContentsChanged(this, -1, -1);
+            } else if (prop.equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY)) {
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public void setSelectedItem(Object filter) {
+            if(filter != null) {
+                getFileChooser().setFileFilter((FileFilter) filter);
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public Object getSelectedItem() {
+            // Ensure that the current filter is in the list.
+            // NOTE: we shouldnt' have to do this, since JFileChooser adds
+            // the filter to the choosable filters list when the filter
+            // is set. Lets be paranoid just in case someone overrides
+            // setFileFilter in JFileChooser.
+            FileFilter currentFilter = getFileChooser().getFileFilter();
+            boolean found = false;
+            if(currentFilter != null) {
+                for (FileFilter filter : filters) {
+                    if (filter == currentFilter) {
+                        found = true;
+                    }
+                }
+                if (!found) {
+                    getFileChooser().addChoosableFileFilter(currentFilter);
+                }
+            }
+            return getFileChooser().getFileFilter();
+        }
+
+        public int getSize() {
+            if(filters != null) {
+                return filters.length;
+            } else {
+                return 0;
+            }
+        }
+
+        public FileFilter getElementAt(int index) {
+            if(index > getSize() - 1) {
+                // This shouldn't happen. Try to recover gracefully.
+                return getFileChooser().getFileFilter();
+            }
+            if(filters != null) {
+                return filters[index];
+            } else {
+                return null;
+            }
         }
     }
 
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1193,9 +1193,70 @@
     /**
      * Data model for a type-face selection combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
-        protected JFileChooser getFileChooser() {
-            return WindowsFileChooserUI.this.getFileChooser();
+    protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
+            PropertyChangeListener {
+        protected FileFilter[] filters;
+        protected FilterComboBoxModel() {
+            super();
+            filters = getFileChooser().getChoosableFileFilters();
+        }
+
+        public void propertyChange(PropertyChangeEvent e) {
+            String prop = e.getPropertyName();
+            if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
+                filters = (FileFilter[]) e.getNewValue();
+                fireContentsChanged(this, -1, -1);
+            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public void setSelectedItem(Object filter) {
+            if(filter != null) {
+                getFileChooser().setFileFilter((FileFilter) filter);
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public Object getSelectedItem() {
+            // Ensure that the current filter is in the list.
+            // NOTE: we shouldnt' have to do this, since JFileChooser adds
+            // the filter to the choosable filters list when the filter
+            // is set. Lets be paranoid just in case someone overrides
+            // setFileFilter in JFileChooser.
+            FileFilter currentFilter = getFileChooser().getFileFilter();
+            boolean found = false;
+            if(currentFilter != null) {
+                for (FileFilter filter : filters) {
+                    if (filter == currentFilter) {
+                        found = true;
+                    }
+                }
+                if(found == false) {
+                    getFileChooser().addChoosableFileFilter(currentFilter);
+                }
+            }
+            return getFileChooser().getFileFilter();
+        }
+
+        public int getSize() {
+            if(filters != null) {
+                return filters.length;
+            } else {
+                return 0;
+            }
+        }
+
+        public FileFilter getElementAt(int index) {
+            if(index > getSize() - 1) {
+                // This shouldn't happen. Try to recover gracefully.
+                return getFileChooser().getFileFilter();
+            }
+            if(filters != null) {
+                return filters[index];
+            } else {
+                return null;
+            }
         }
     }
 
--- a/jdk/src/share/classes/com/sun/tracing/ProviderFactory.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/com/sun/tracing/ProviderFactory.java	Tue Apr 01 15:37:15 2014 +0200
@@ -5,9 +5,9 @@
 import java.io.PrintStream;
 import java.lang.reflect.Field;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
-import sun.security.action.GetPropertyAction;
 
 import sun.tracing.NullProviderFactory;
 import sun.tracing.PrintStreamProviderFactory;
@@ -56,7 +56,7 @@
 
         // Try to instantiate a DTraceProviderFactory
         String prop = AccessController.doPrivileged(
-            new GetPropertyAction("com.sun.tracing.dtrace"));
+            (PrivilegedAction<String>) () -> System.getProperty("com.sun.tracing.dtrace"));
 
         if ( (prop == null || !prop.equals("disable")) &&
              DTraceProviderFactory.isSupported() ) {
@@ -65,7 +65,7 @@
 
         // Try to instantiate an output stream factory
         prop = AccessController.doPrivileged(
-            new GetPropertyAction("sun.tracing.stream"));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.tracing.stream"));
         if (prop != null) {
             for (String spec : prop.split(",")) {
                 PrintStream ps = getPrintStreamFromSpec(spec);
--- a/jdk/src/share/classes/java/awt/Component.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/awt/Component.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -26,10 +26,10 @@
 
 import java.io.PrintStream;
 import java.io.PrintWriter;
+import java.util.Objects;
 import java.util.Vector;
 import java.util.Locale;
 import java.util.EventListener;
-import java.util.Iterator;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
@@ -50,8 +50,6 @@
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
 import java.beans.Transient;
-import java.awt.event.InputMethodListener;
-import java.awt.event.InputMethodEvent;
 import java.awt.im.InputContext;
 import java.awt.im.InputMethodRequests;
 import java.awt.dnd.DropTarget;
@@ -976,6 +974,17 @@
             public void revalidateSynchronously(Component comp) {
                 comp.revalidateSynchronously();
             }
+
+            @Override
+            public void createBufferStrategy(Component comp, int numBuffers,
+                    BufferCapabilities caps) throws AWTException {
+                comp.createBufferStrategy(numBuffers, caps);
+            }
+
+            @Override
+            public BufferStrategy getBufferStrategy(Component comp) {
+                return comp.getBufferStrategy();
+            }
         });
     }
 
@@ -8120,18 +8129,12 @@
      * @since     JDK1.0
      */
     protected String paramString() {
-        String thisName = getName();
-        String str = (thisName != null? thisName : "") + "," + x + "," + y + "," + width + "x" + height;
-        if (!isValid()) {
-            str += ",invalid";
-        }
-        if (!visible) {
-            str += ",hidden";
-        }
-        if (!enabled) {
-            str += ",disabled";
-        }
-        return str;
+        final String thisName = Objects.toString(getName(), "");
+        final String invalid = isValid() ? "" : ",invalid";
+        final String hidden = visible ? "" : ",hidden";
+        final String disabled = enabled ? "" : ",disabled";
+        return thisName + ',' + x + ',' + y + ',' + width + 'x' + height
+                + invalid + hidden + disabled;
     }
 
     /**
@@ -8140,7 +8143,7 @@
      * @since     JDK1.0
      */
     public String toString() {
-        return getClass().getName() + "[" + paramString() + "]";
+        return getClass().getName() + '[' + paramString() + ']';
     }
 
     /**
--- a/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java	Tue Apr 01 15:37:15 2014 +0200
@@ -287,7 +287,7 @@
         synchronized (this) {
             KeyEvent ke = enqueuedKeyEvents.isEmpty() ? null : enqueuedKeyEvents.getFirst();
             if (ke != null && time >= ke.getWhen()) {
-                TypeAheadMarker marker = typeAheadMarkers.getFirst();
+                TypeAheadMarker marker = typeAheadMarkers.isEmpty() ? null : typeAheadMarkers.getFirst();
                 if (marker != null) {
                     Window toplevel = marker.untilFocused.getContainingWindow();
                     // Check that the component awaiting focus belongs to
--- a/jdk/src/share/classes/java/awt/EventQueue.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/awt/EventQueue.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1093,6 +1093,13 @@
                 dispatchThread = null;
             }
             AWTAutoShutdown.getInstance().notifyThreadFree(edt);
+            /*
+             * Event was posted after EDT events pumping had stopped, so start
+             * another EDT to handle this event
+             */
+            if (peekEvent() != null) {
+                initDispatchThread();
+            }
         } finally {
             pushPopLock.unlock();
         }
--- a/jdk/src/share/classes/java/awt/Label.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/awt/Label.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -272,13 +272,13 @@
      * @return     the parameter string of this label
      */
     protected String paramString() {
-        String str = ",align=";
+        String align = "";
         switch (alignment) {
-          case LEFT:   str += "left"; break;
-          case CENTER: str += "center"; break;
-          case RIGHT:  str += "right"; break;
+            case LEFT:   align = "left"; break;
+            case CENTER: align = "center"; break;
+            case RIGHT:  align = "right"; break;
         }
-        return super.paramString() + str + ",text=" + text;
+        return super.paramString() + ",align=" + align + ",text=" + text;
     }
 
     /**
--- a/jdk/src/share/classes/java/awt/MediaTracker.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/awt/MediaTracker.java	Tue Apr 01 15:37:15 2014 +0200
@@ -28,6 +28,7 @@
 import java.awt.Component;
 import java.awt.Image;
 import java.awt.image.ImageObserver;
+import sun.awt.image.MultiResolutionToolkitImage;
 
 /**
  * The <code>MediaTracker</code> class is a utility class to track
@@ -222,10 +223,17 @@
      * @param     h    the height at which the image is rendered
      */
     public synchronized void addImage(Image image, int id, int w, int h) {
+        addImageImpl(image, id, w, h);
+        Image rvImage = getResolutionVariant(image);
+        if (rvImage != null) {
+            addImageImpl(rvImage, id, 2 * w, 2 * h);
+        }
+    }
+
+    private void addImageImpl(Image image, int id, int w, int h) {
         head = MediaEntry.insert(head,
                                  new ImageMediaEntry(this, image, id, w, h));
     }
-
     /**
      * Flag indicating that media is currently being loaded.
      * @see         java.awt.MediaTracker#statusAll
@@ -719,6 +727,15 @@
      * @since   JDK1.1
      */
     public synchronized void removeImage(Image image) {
+        removeImageImpl(image);
+        Image rvImage = getResolutionVariant(image);
+        if (rvImage != null) {
+            removeImageImpl(rvImage);
+        }
+        notifyAll();    // Notify in case remaining images are "done".
+    }
+
+    private void removeImageImpl(Image image) {
         MediaEntry cur = head;
         MediaEntry prev = null;
         while (cur != null) {
@@ -735,7 +752,6 @@
             }
             cur = next;
         }
-        notifyAll();    // Notify in case remaining images are "done".
     }
 
     /**
@@ -750,6 +766,15 @@
      * @since      JDK1.1
      */
     public synchronized void removeImage(Image image, int id) {
+        removeImageImpl(image, id);
+        Image rvImage = getResolutionVariant(image);
+        if (rvImage != null) {
+            removeImageImpl(rvImage, id);
+        }
+        notifyAll();    // Notify in case remaining images are "done".
+    }
+
+    private void removeImageImpl(Image image, int id) {
         MediaEntry cur = head;
         MediaEntry prev = null;
         while (cur != null) {
@@ -766,7 +791,6 @@
             }
             cur = next;
         }
-        notifyAll();    // Notify in case remaining images are "done".
     }
 
     /**
@@ -783,6 +807,16 @@
      */
     public synchronized void removeImage(Image image, int id,
                                          int width, int height) {
+        removeImageImpl(image, id, width, height);
+        Image rvImage = getResolutionVariant(image);
+        if (rvImage != null) {
+            removeImageImpl(rvImage, id, 2 * width, 2 * height);
+
+        }
+        notifyAll();    // Notify in case remaining images are "done".
+    }
+
+    private void removeImageImpl(Image image, int id, int width, int height) {
         MediaEntry cur = head;
         MediaEntry prev = null;
         while (cur != null) {
@@ -801,12 +835,18 @@
             }
             cur = next;
         }
-        notifyAll();    // Notify in case remaining images are "done".
     }
 
     synchronized void setDone() {
         notifyAll();
     }
+
+    private static Image getResolutionVariant(Image image) {
+        if (image instanceof MultiResolutionToolkitImage) {
+            return ((MultiResolutionToolkitImage) image).getResolutionVariant();
+        }
+        return null;
+    }
 }
 
 abstract class MediaEntry {
--- a/jdk/src/share/classes/java/awt/Robot.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/awt/Robot.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2009, 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
@@ -72,9 +72,6 @@
     private int autoDelay = 0;
     private static int LEGAL_BUTTON_MASK = 0;
 
-    // location of robot's GC, used in mouseMove(), getPixelColor() and captureScreenImage()
-    private Point gdLoc;
-
     private DirectColorModel screenCapCM = null;
 
     /**
@@ -132,7 +129,6 @@
 
     private void init(GraphicsDevice screen) throws AWTException {
         checkRobotAllowed();
-        gdLoc = screen.getDefaultConfiguration().getBounds().getLocation();
         Toolkit toolkit = Toolkit.getDefaultToolkit();
         if (toolkit instanceof ComponentFactory) {
             peer = ((ComponentFactory)toolkit).createRobot(this, screen);
@@ -200,7 +196,7 @@
      * @param y         Y position
      */
     public synchronized void mouseMove(int x, int y) {
-        peer.mouseMove(gdLoc.x + x, gdLoc.y + y);
+        peer.mouseMove(x, y);
         afterEvent();
     }
 
@@ -395,7 +391,7 @@
      * @return  Color of the pixel
      */
     public synchronized Color getPixelColor(int x, int y) {
-        Color color = new Color(peer.getRGBPixel(gdLoc.x + x, gdLoc.y + y));
+        Color color = new Color(peer.getRGBPixel(x, y));
         return color;
     }
 
@@ -412,10 +408,7 @@
     public synchronized BufferedImage createScreenCapture(Rectangle screenRect) {
         checkScreenCaptureAllowed();
 
-        // according to the spec, screenRect is relative to robot's GD
-        Rectangle translatedRect = new Rectangle(screenRect);
-        translatedRect.translate(gdLoc.x, gdLoc.y);
-        checkValidRect(translatedRect);
+        checkValidRect(screenRect);
 
         BufferedImage image;
         DataBufferInt buffer;
@@ -441,14 +434,14 @@
         int pixels[];
         int[] bandmasks = new int[3];
 
-        pixels = peer.getRGBPixels(translatedRect);
+        pixels = peer.getRGBPixels(screenRect);
         buffer = new DataBufferInt(pixels, pixels.length);
 
         bandmasks[0] = screenCapCM.getRedMask();
         bandmasks[1] = screenCapCM.getGreenMask();
         bandmasks[2] = screenCapCM.getBlueMask();
 
-        raster = Raster.createPackedRaster(buffer, translatedRect.width, translatedRect.height, translatedRect.width, bandmasks, null);
+        raster = Raster.createPackedRaster(buffer, screenRect.width, screenRect.height, screenRect.width, bandmasks, null);
         SunWritableRaster.makeTrackable(buffer);
 
         image = new BufferedImage(screenCapCM, raster, false, null);
--- a/jdk/src/share/classes/java/awt/SystemColor.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/awt/SystemColor.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -24,6 +24,8 @@
  */
 package java.awt;
 
+import sun.awt.AWTAccessor;
+
 import java.io.ObjectStreamException;
 
 import java.lang.annotation.Native;
@@ -459,7 +461,8 @@
     };
 
     static {
-      updateSystemColors();
+        AWTAccessor.setSystemColorAccessor(SystemColor::updateSystemColors);
+        updateSystemColors();
     }
 
     /**
--- a/jdk/src/share/classes/java/awt/Toolkit.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/awt/Toolkit.java	Tue Apr 01 15:37:15 2014 +0200
@@ -26,10 +26,6 @@
 package java.awt;
 
 import java.beans.PropertyChangeEvent;
-import java.util.MissingResourceException;
-import java.util.Properties;
-import java.util.ResourceBundle;
-import java.util.StringTokenizer;
 import java.awt.event.*;
 import java.awt.peer.*;
 import java.awt.im.InputMethodHighlight;
@@ -855,50 +851,39 @@
      */
     public static synchronized Toolkit getDefaultToolkit() {
         if (toolkit == null) {
-            try {
-                // We disable the JIT during toolkit initialization.  This
-                // tends to touch lots of classes that aren't needed again
-                // later and therefore JITing is counter-productiive.
-                java.lang.Compiler.disable();
-
-                java.security.AccessController.doPrivileged(
-                        new java.security.PrivilegedAction<Void>() {
-                    public Void run() {
-                        String nm = null;
-                        Class<?> cls = null;
-                        try {
-                            nm = System.getProperty("awt.toolkit");
+            java.security.AccessController.doPrivileged(
+                    new java.security.PrivilegedAction<Void>() {
+                public Void run() {
+                    Class<?> cls = null;
+                    String nm = System.getProperty("awt.toolkit");
+                    try {
+                        cls = Class.forName(nm);
+                    } catch (ClassNotFoundException e) {
+                        ClassLoader cl = ClassLoader.getSystemClassLoader();
+                        if (cl != null) {
                             try {
-                                cls = Class.forName(nm);
-                            } catch (ClassNotFoundException e) {
-                                ClassLoader cl = ClassLoader.getSystemClassLoader();
-                                if (cl != null) {
-                                    try {
-                                        cls = cl.loadClass(nm);
-                                    } catch (ClassNotFoundException ee) {
-                                        throw new AWTError("Toolkit not found: " + nm);
-                                    }
-                                }
+                                cls = cl.loadClass(nm);
+                            } catch (final ClassNotFoundException ignored) {
+                                throw new AWTError("Toolkit not found: " + nm);
                             }
-                            if (cls != null) {
-                                toolkit = (Toolkit)cls.newInstance();
-                                if (GraphicsEnvironment.isHeadless()) {
-                                    toolkit = new HeadlessToolkit(toolkit);
-                                }
+                        }
+                    }
+                    try {
+                        if (cls != null) {
+                            toolkit = (Toolkit)cls.newInstance();
+                            if (GraphicsEnvironment.isHeadless()) {
+                                toolkit = new HeadlessToolkit(toolkit);
                             }
-                        } catch (InstantiationException e) {
-                            throw new AWTError("Could not instantiate Toolkit: " + nm);
-                        } catch (IllegalAccessException e) {
-                            throw new AWTError("Could not access Toolkit: " + nm);
                         }
-                        return null;
+                    } catch (final InstantiationException ignored) {
+                        throw new AWTError("Could not instantiate Toolkit: " + nm);
+                    } catch (final IllegalAccessException ignored) {
+                        throw new AWTError("Could not access Toolkit: " + nm);
                     }
-                });
-                loadAssistiveTechnologies();
-            } finally {
-                // Make sure to always re-enable the JIT.
-                java.lang.Compiler.enable();
-            }
+                    return null;
+                }
+            });
+            loadAssistiveTechnologies();
         }
         return toolkit;
     }
--- a/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java	Tue Apr 01 15:37:15 2014 +0200
@@ -570,7 +570,7 @@
         if (DataTransferer.isFlavorCharsetTextType(this) &&
             (isRepresentationClassInputStream() ||
              isRepresentationClassByteBuffer() ||
-             DataTransferer.byteArrayClass.equals(representationClass)))
+             byte[].class.equals(representationClass)))
         {
             params += ";charset=" + DataTransferer.getTextCharset(this);
         }
@@ -743,7 +743,7 @@
     private static Comparator<DataFlavor> textFlavorComparator;
 
     static class TextFlavorComparator
-        extends DataTransferer.DataFlavorComparator {
+            extends DataTransferer.DataFlavorComparator {
 
         /**
          * Compares two <code>DataFlavor</code> objects. Returns a negative
@@ -754,8 +754,8 @@
          * <code>DataFlavor</code>s are ordered according to the rules outlined
          * for <code>selectBestTextFlavor</code>.
          *
-         * @param obj1 the first <code>DataFlavor</code> to be compared
-         * @param obj2 the second <code>DataFlavor</code> to be compared
+         * @param flavor1 the first <code>DataFlavor</code> to be compared
+         * @param flavor2 the second <code>DataFlavor</code> to be compared
          * @return a negative integer, zero, or a positive integer as the first
          *         argument is worse, equal to, or better than the second
          * @throws ClassCastException if either of the arguments is not an
@@ -765,13 +765,10 @@
          *
          * @see #selectBestTextFlavor
          */
-        public int compare(Object obj1, Object obj2) {
-            DataFlavor flavor1 = (DataFlavor)obj1;
-            DataFlavor flavor2 = (DataFlavor)obj2;
-
+        public int compare(DataFlavor flavor1, DataFlavor flavor2) {
             if (flavor1.isFlavorTextType()) {
                 if (flavor2.isFlavorTextType()) {
-                    return super.compare(obj1, obj2);
+                    return super.compare(flavor1, flavor2);
                 } else {
                     return 1;
                 }
@@ -1014,7 +1011,7 @@
                     !(isRepresentationClassReader() ||
                         String.class.equals(representationClass) ||
                         isRepresentationClassCharBuffer() ||
-                        DataTransferer.charArrayClass.equals(representationClass)))
+                        char[].class.equals(representationClass)))
                 {
                     String thisCharset =
                         DataTransferer.canonicalName(getParameter("charset"));
@@ -1099,8 +1096,7 @@
                 !(isRepresentationClassReader() ||
                   String.class.equals(representationClass) ||
                   isRepresentationClassCharBuffer() ||
-                  DataTransferer.charArrayClass.equals
-                  (representationClass)))
+                  char[].class.equals(representationClass)))
             {
                 String charset =
                     DataTransferer.canonicalName(getParameter("charset"));
--- a/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java	Tue Apr 01 15:37:15 2014 +0200
@@ -544,7 +544,7 @@
             DataTransferer transferer = DataTransferer.getInstance();
             if (transferer != null) {
                 List<DataFlavor> platformFlavors =
-                    transferer.getPlatformMappingsForNative(nat);
+                        transferer.getPlatformMappingsForNative(nat);
                 if (!platformFlavors.isEmpty()) {
                     if (flavors != null) {
                         platformFlavors.removeAll(new HashSet<>(flavors));
--- a/jdk/src/share/classes/java/awt/dnd/DragGestureEvent.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/awt/dnd/DragGestureEvent.java	Tue Apr 01 15:37:15 2014 +0200
@@ -36,6 +36,7 @@
 
 import java.awt.datatransfer.Transferable;
 
+import java.io.InvalidObjectException;
 import java.util.EventObject;
 
 import java.util.Collections;
@@ -329,22 +330,50 @@
     {
         ObjectInputStream.GetField f = s.readFields();
 
-        dragSource = (DragSource)f.get("dragSource", null);
-        component = (Component)f.get("component", null);
-        origin = (Point)f.get("origin", null);
-        action = f.get("action", 0);
+        DragSource newDragSource = (DragSource)f.get("dragSource", null);
+        if (newDragSource == null) {
+            throw new InvalidObjectException("null DragSource");
+        }
+        dragSource = newDragSource;
+
+        Component newComponent = (Component)f.get("component", null);
+        if (newComponent == null) {
+            throw new InvalidObjectException("null component");
+        }
+        component = newComponent;
+
+        Point newOrigin = (Point)f.get("origin", null);
+        if (newOrigin == null) {
+            throw new InvalidObjectException("null origin");
+        }
+        origin = newOrigin;
+
+        int newAction = f.get("action", 0);
+        if (newAction != DnDConstants.ACTION_COPY &&
+                newAction != DnDConstants.ACTION_MOVE &&
+                newAction != DnDConstants.ACTION_LINK) {
+            throw new InvalidObjectException("bad action");
+        }
+        action = newAction;
+
         // Pre-1.4 support. 'events' was previously non-transient
+        List newEvents;
         try {
-            events = (List)f.get("events", null);
+            newEvents = (List)f.get("events", null);
         } catch (IllegalArgumentException e) {
             // 1.4-compatible byte stream. 'events' was written explicitly
-            events = (List)s.readObject();
+            newEvents = (List)s.readObject();
         }
 
         // Implementation assumes 'events' is never null.
-        if (events == null) {
-            events = Collections.EMPTY_LIST;
+        if (newEvents != null && newEvents.isEmpty()) {
+            // Constructor treats empty events list as invalid value
+            // Throw exception if serialized list is empty
+            throw new InvalidObjectException("empty list of events");
+        } else if (newEvents == null) {
+            newEvents = Collections.emptyList();
         }
+        events = newEvents;
     }
 
     /*
--- a/jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -29,6 +29,8 @@
 import java.awt.Component;
 import java.awt.Point;
 
+import java.io.InvalidObjectException;
+import java.util.Collections;
 import java.util.TooManyListenersException;
 import java.util.ArrayList;
 
@@ -411,10 +413,21 @@
      *
      * @since 1.4
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream s)
         throws ClassNotFoundException, IOException
     {
-        s.defaultReadObject();
+        ObjectInputStream.GetField f = s.readFields();
+
+        DragSource newDragSource = (DragSource)f.get("dragSource", null);
+        if (newDragSource == null) {
+            throw new InvalidObjectException("null DragSource");
+        }
+        dragSource = newDragSource;
+
+        component = (Component)f.get("component", null);
+        sourceActions = f.get("sourceActions", 0) & (DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK);
+        events = (ArrayList<InputEvent>)f.get("events", new ArrayList<>(1));
 
         dragGestureListener = (DragGestureListener)s.readObject();
     }
--- a/jdk/src/share/classes/java/awt/dnd/DragSourceContext.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/awt/dnd/DragSourceContext.java	Tue Apr 01 15:37:15 2014 +0200
@@ -37,6 +37,7 @@
 import java.awt.dnd.peer.DragSourceContextPeer;
 
 import java.io.IOException;
+import java.io.InvalidObjectException;
 import java.io.ObjectOutputStream;
 import java.io.ObjectInputStream;
 import java.io.Serializable;
@@ -562,7 +563,36 @@
     private void readObject(ObjectInputStream s)
         throws ClassNotFoundException, IOException
     {
-        s.defaultReadObject();
+        ObjectInputStream.GetField f = s.readFields();
+
+        DragGestureEvent newTrigger = (DragGestureEvent)f.get("trigger", null);
+        if (newTrigger == null) {
+            throw new InvalidObjectException("Null trigger");
+        }
+        if (newTrigger.getDragSource() == null) {
+            throw new InvalidObjectException("Null DragSource");
+        }
+        if (newTrigger.getComponent() == null) {
+            throw new InvalidObjectException("Null trigger component");
+        }
+
+        int DGRActions = newTrigger.getSourceAsDragGestureRecognizer().getSourceActions()
+                & (DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK);
+        if (DGRActions == DnDConstants.ACTION_NONE) {
+            throw new InvalidObjectException("Invalid source actions");
+        }
+        int triggerActions = newTrigger.getDragAction();
+        if (triggerActions != DnDConstants.ACTION_COPY &&
+                triggerActions != DnDConstants.ACTION_MOVE &&
+                triggerActions != DnDConstants.ACTION_LINK) {
+            throw new InvalidObjectException("No drag action");
+        }
+        trigger = newTrigger;
+
+        cursor = (Cursor)f.get("cursor", null);
+        useCustomCursor = f.get("useCustomCursor", false);
+        sourceActions = f.get("sourceActions", 0)
+                & (DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK);
 
         transferable = (Transferable)s.readObject();
         listener = (DragSourceListener)s.readObject();
@@ -630,5 +660,5 @@
      *
      * @serial
      */
-    private final int sourceActions;
+    private int sourceActions;
 }
--- a/jdk/src/share/classes/java/awt/event/InputEvent.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/awt/event/InputEvent.java	Tue Apr 01 15:37:15 2014 +0200
@@ -298,6 +298,10 @@
                 public int[] getButtonDownMasks() {
                     return InputEvent.getButtonDownMasks();
                 }
+
+                public boolean canAccessSystemClipboard(InputEvent event) {
+                    return event.canAccessSystemClipboard;
+                }
             });
     }
 
--- a/jdk/src/share/classes/java/beans/Introspector.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/beans/Introspector.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -729,27 +729,53 @@
             if (igpd != null && ispd != null) {
                 // Complete indexed properties set
                 // Merge any classic property descriptors
-                if (gpd != null) {
-                    PropertyDescriptor tpd = mergePropertyDescriptor(igpd, gpd);
-                    if (tpd instanceof IndexedPropertyDescriptor) {
-                        igpd = (IndexedPropertyDescriptor)tpd;
+                if ((gpd == spd) || (gpd == null)) {
+                    pd = spd;
+                } else if (spd == null) {
+                    pd = gpd;
+                } else if (spd instanceof IndexedPropertyDescriptor) {
+                    pd = mergePropertyWithIndexedProperty(gpd, (IndexedPropertyDescriptor) spd);
+                } else if (gpd instanceof IndexedPropertyDescriptor) {
+                    pd = mergePropertyWithIndexedProperty(spd, (IndexedPropertyDescriptor) gpd);
+                } else {
+                    pd = mergePropertyDescriptor(gpd, spd);
+                }
+                if (igpd == ispd) {
+                    ipd = igpd;
+                } else {
+                    ipd = mergePropertyDescriptor(igpd, ispd);
+                }
+                if (pd == null) {
+                    pd = ipd;
+                } else {
+                    Class<?> propType = pd.getPropertyType();
+                    Class<?> ipropType = ipd.getIndexedPropertyType();
+                    if (propType.isArray() && propType.getComponentType() == ipropType) {
+                        pd = pd.getClass0().isAssignableFrom(ipd.getClass0())
+                                ? new IndexedPropertyDescriptor(pd, ipd)
+                                : new IndexedPropertyDescriptor(ipd, pd);
+                    } else if (pd.getClass0().isAssignableFrom(ipd.getClass0())) {
+                        pd = pd.getClass0().isAssignableFrom(ipd.getClass0())
+                                ? new PropertyDescriptor(pd, ipd)
+                                : new PropertyDescriptor(ipd, pd);
+                    } else {
+                        pd = ipd;
                     }
                 }
-                if (spd != null) {
-                    PropertyDescriptor tpd = mergePropertyDescriptor(ispd, spd);
-                    if (tpd instanceof IndexedPropertyDescriptor) {
-                        ispd = (IndexedPropertyDescriptor)tpd;
-                    }
+            } else if (gpd != null && spd != null) {
+                if (igpd != null) {
+                    gpd = mergePropertyWithIndexedProperty(gpd, igpd);
                 }
-                if (igpd == ispd) {
-                    pd = igpd;
-                } else {
-                    pd = mergePropertyDescriptor(igpd, ispd);
+                if (ispd != null) {
+                    spd = mergePropertyWithIndexedProperty(spd, ispd);
                 }
-            } else if (gpd != null && spd != null) {
                 // Complete simple properties set
                 if (gpd == spd) {
                     pd = gpd;
+                } else if (spd instanceof IndexedPropertyDescriptor) {
+                    pd = mergePropertyWithIndexedProperty(gpd, (IndexedPropertyDescriptor) spd);
+                } else if (gpd instanceof IndexedPropertyDescriptor) {
+                    pd = mergePropertyWithIndexedProperty(spd, (IndexedPropertyDescriptor) gpd);
                 } else {
                     pd = mergePropertyDescriptor(gpd, spd);
                 }
@@ -809,6 +835,16 @@
         return current == null ? candidate == null : current.isAssignableFrom(candidate);
     }
 
+    private PropertyDescriptor mergePropertyWithIndexedProperty(PropertyDescriptor pd, IndexedPropertyDescriptor ipd) {
+        Class<?> type = pd.getPropertyType();
+        if (type.isArray() && (type.getComponentType() == ipd.getIndexedPropertyType())) {
+            return pd.getClass0().isAssignableFrom(ipd.getClass0())
+                    ? new IndexedPropertyDescriptor(pd, ipd)
+                    : new IndexedPropertyDescriptor(ipd, pd);
+        }
+        return pd;
+    }
+
     /**
      * Adds the property descriptor to the indexedproperty descriptor only if the
      * types are the same.
@@ -828,6 +864,12 @@
             } else {
                 result = new IndexedPropertyDescriptor(ipd, pd);
             }
+        } else if ((ipd.getReadMethod() == null) && (ipd.getWriteMethod() == null)) {
+            if (pd.getClass0().isAssignableFrom(ipd.getClass0())) {
+                result = new PropertyDescriptor(pd, ipd);
+            } else {
+                result = new PropertyDescriptor(ipd, pd);
+            }
         } else {
             // Cannot merge the pd because of type mismatch
             // Return the most specific pd
@@ -879,7 +921,7 @@
     }
 
     // Handle regular ipd merge
-    private PropertyDescriptor mergePropertyDescriptor(IndexedPropertyDescriptor ipd1,
+    private IndexedPropertyDescriptor mergePropertyDescriptor(IndexedPropertyDescriptor ipd1,
                                                        IndexedPropertyDescriptor ipd2) {
         if (ipd1.getClass0().isAssignableFrom(ipd2.getClass0())) {
             return new IndexedPropertyDescriptor(ipd1, ipd2);
--- a/jdk/src/share/classes/java/io/SequenceInputStream.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/io/SequenceInputStream.java	Tue Apr 01 15:37:15 2014 +0200
@@ -135,7 +135,7 @@
      * @since   JDK1.1
      */
     public int available() throws IOException {
-        if(in == null) {
+        if (in == null) {
             return 0; // no way to signal EOF from available()
         }
         return in.available();
@@ -160,15 +160,14 @@
      * @exception  IOException  if an I/O error occurs.
      */
     public int read() throws IOException {
-        if (in == null) {
-            return -1;
+        while (in != null) {
+            int c = in.read();
+            if (c != -1) {
+                return c;
+            }
+            nextStream();
         }
-        int c = in.read();
-        if (c == -1) {
-            nextStream();
-            return read();
-        }
-        return c;
+        return -1;
     }
 
     /**
@@ -204,13 +203,14 @@
         } else if (len == 0) {
             return 0;
         }
-
-        int n = in.read(b, off, len);
-        if (n <= 0) {
+        do {
+            int n = in.read(b, off, len);
+            if (n > 0) {
+                return n;
+            }
             nextStream();
-            return read(b, off, len);
-        }
-        return n;
+        } while (in != null);
+        return -1;
     }
 
     /**
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java	Tue Apr 01 15:37:15 2014 +0200
@@ -736,16 +736,17 @@
     @LambdaForm.Hidden
     static Object guardWithCatch(MethodHandle target, Class<? extends Throwable> exType, MethodHandle catcher,
                                  Object... av) throws Throwable {
+        // Use asFixedArity() to avoid unnecessary boxing of last argument for VarargsCollector case.
         try {
-            return target.invokeWithArguments(av);
+            return target.asFixedArity().invokeWithArguments(av);
         } catch (Throwable t) {
             if (!exType.isInstance(t)) throw t;
-            Object[] args = prepend(t, av);
-            return catcher.invokeWithArguments(args);
+            return catcher.asFixedArity().invokeWithArguments(prepend(t, av));
         }
     }
 
     /** Prepend an element {@code elem} to an {@code array}. */
+    @LambdaForm.Hidden
     private static Object[] prepend(Object elem, Object[] array) {
         Object[] newArray = new Object[array.length+1];
         newArray[0] = elem;
--- a/jdk/src/share/classes/java/math/BigInteger.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/math/BigInteger.java	Tue Apr 01 15:37:15 2014 +0200
@@ -126,8 +126,6 @@
      * 1 for positive.  Note that the BigInteger zero <i>must</i> have
      * a signum of 0.  This is necessary to ensures that there is exactly one
      * representation for each BigInteger value.
-     *
-     * @serial
      */
     final int signum;
 
@@ -142,55 +140,43 @@
      */
     final int[] mag;
 
-    // These "redundant fields" are initialized with recognizable nonsense
-    // values, and cached the first time they are needed (or never, if they
-    // aren't needed).
-
-     /**
-     * One plus the bitCount of this BigInteger. Zeros means unitialized.
-     *
-     * @serial
-     * @see #bitCount
-     * @deprecated Deprecated since logical value is offset from stored
-     * value and correction factor is applied in accessor method.
-     */
-    @Deprecated
-    private int bitCount;
+    // The following fields are stable variables. A stable variable's value
+    // changes at most once from the default zero value to a non-zero stable
+    // value. A stable value is calculated lazily on demand.
 
     /**
-     * One plus the bitLength of this BigInteger. Zeros means unitialized.
+     * One plus the bitCount of this BigInteger. This is a stable variable.
+     *
+     * @see #bitCount
+     */
+    private int bitCountPlusOne;
+
+    /**
+     * One plus the bitLength of this BigInteger. This is a stable variable.
      * (either value is acceptable).
      *
-     * @serial
      * @see #bitLength()
-     * @deprecated Deprecated since logical value is offset from stored
-     * value and correction factor is applied in accessor method.
      */
-    @Deprecated
-    private int bitLength;
+    private int bitLengthPlusOne;
 
     /**
-     * Two plus the lowest set bit of this BigInteger, as returned by
-     * getLowestSetBit().
+     * Two plus the lowest set bit of this BigInteger. This is a stable variable.
      *
-     * @serial
      * @see #getLowestSetBit
-     * @deprecated Deprecated since logical value is offset from stored
-     * value and correction factor is applied in accessor method.
      */
-    @Deprecated
-    private int lowestSetBit;
+    private int lowestSetBitPlusTwo;
 
     /**
      * Two plus the index of the lowest-order int in the magnitude of this
-     * BigInteger that contains a nonzero int, or -2 (either value is acceptable).
-     * The least significant int has int-number 0, the next int in order of
+     * BigInteger that contains a nonzero int. This is a stable variable. The
+     * least significant int has int-number 0, the next int in order of
      * increasing significance has int-number 1, and so forth.
-     * @deprecated Deprecated since logical value is offset from stored
-     * value and correction factor is applied in accessor method.
+     *
+     * <p>Note: never used for a BigInteger with a magnitude of zero.
+     *
+     * @see #firstNonzeroIntNum()
      */
-    @Deprecated
-    private int firstNonzeroIntNum;
+    private int firstNonzeroIntNumPlusTwo;
 
     /**
      * This mask is used to obtain the value of an int as if it were unsigned.
@@ -3240,7 +3226,7 @@
      * @return index of the rightmost one bit in this BigInteger.
      */
     public int getLowestSetBit() {
-        @SuppressWarnings("deprecation") int lsb = lowestSetBit - 2;
+        int lsb = lowestSetBitPlusTwo - 2;
         if (lsb == -2) {  // lowestSetBit not initialized yet
             lsb = 0;
             if (signum == 0) {
@@ -3252,7 +3238,7 @@
                     ;
                 lsb += (i << 5) + Integer.numberOfTrailingZeros(b);
             }
-            lowestSetBit = lsb + 2;
+            lowestSetBitPlusTwo = lsb + 2;
         }
         return lsb;
     }
@@ -3271,7 +3257,7 @@
      *         representation of this BigInteger, <i>excluding</i> a sign bit.
      */
     public int bitLength() {
-        @SuppressWarnings("deprecation") int n = bitLength - 1;
+        int n = bitLengthPlusOne - 1;
         if (n == -1) { // bitLength not initialized yet
             int[] m = mag;
             int len = m.length;
@@ -3291,7 +3277,7 @@
                      n = magBitLength;
                  }
             }
-            bitLength = n + 1;
+            bitLengthPlusOne = n + 1;
         }
         return n;
     }
@@ -3305,7 +3291,7 @@
      *         of this BigInteger that differ from its sign bit.
      */
     public int bitCount() {
-        @SuppressWarnings("deprecation") int bc = bitCount - 1;
+        int bc = bitCountPlusOne - 1;
         if (bc == -1) {  // bitCount not initialized yet
             bc = 0;      // offset by one to initialize
             // Count the bits in the magnitude
@@ -3319,7 +3305,7 @@
                 magTrailingZeroCount += Integer.numberOfTrailingZeros(mag[j]);
                 bc += magTrailingZeroCount - 1;
             }
-            bitCount = bc + 1;
+            bitCountPlusOne = bc + 1;
         }
         return bc;
     }
@@ -3622,16 +3608,16 @@
      */
     private static void toString(BigInteger u, StringBuilder sb, int radix,
                                  int digits) {
-        /* If we're smaller than a certain threshold, use the smallToString
-           method, padding with leading zeroes when necessary. */
+        // If we're smaller than a certain threshold, use the smallToString
+        // method, padding with leading zeroes when necessary.
         if (u.mag.length <= SCHOENHAGE_BASE_CONVERSION_THRESHOLD) {
             String s = u.smallToString(radix);
 
             // Pad with internal zeros if necessary.
             // Don't pad if we're at the beginning of the string.
             if ((s.length() < digits) && (sb.length() > 0)) {
-                for (int i=s.length(); i < digits; i++) { // May be a faster way to
-                    sb.append('0');                    // do this?
+                for (int i=s.length(); i < digits; i++) {
+                    sb.append('0');
                 }
             }
 
@@ -4185,22 +4171,23 @@
     }
 
     /**
-     * Returns the index of the int that contains the first nonzero int in the
-     * little-endian binary representation of the magnitude (int 0 is the
-     * least significant). If the magnitude is zero, return value is undefined.
-     */
+    * Returns the index of the int that contains the first nonzero int in the
+    * little-endian binary representation of the magnitude (int 0 is the
+    * least significant). If the magnitude is zero, return value is undefined.
+    *
+    * <p>Note: never used for a BigInteger with a magnitude of zero.
+    * @see #getInt.
+    */
     private int firstNonzeroIntNum() {
-        int fn = firstNonzeroIntNum - 2;
+        int fn = firstNonzeroIntNumPlusTwo - 2;
         if (fn == -2) { // firstNonzeroIntNum not initialized yet
-            fn = 0;
-
             // Search for the first nonzero int
             int i;
             int mlen = mag.length;
             for (i = mlen - 1; i >= 0 && mag[i] == 0; i--)
                 ;
             fn = mlen - i - 1;
-            firstNonzeroIntNum = fn + 2; // offset by two to initialize
+            firstNonzeroIntNumPlusTwo = fn + 2; // offset by two to initialize
         }
         return fn;
     }
@@ -4212,16 +4199,17 @@
      * Serializable fields for BigInteger.
      *
      * @serialField signum  int
-     *              signum of this BigInteger.
-     * @serialField magnitude int[]
-     *              magnitude array of this BigInteger.
+     *              signum of this BigInteger
+     * @serialField magnitude byte[]
+     *              magnitude array of this BigInteger
      * @serialField bitCount  int
-     *              number of bits in this BigInteger
+     *              appears in the serialized form for backward compatibility
      * @serialField bitLength int
-     *              the number of bits in the minimal two's-complement
-     *              representation of this BigInteger
+     *              appears in the serialized form for backward compatibility
+     * @serialField firstNonzeroByteNum int
+     *              appears in the serialized form for backward compatibility
      * @serialField lowestSetBit int
-     *              lowest set bit in the twos complement representation
+     *              appears in the serialized form for backward compatibility
      */
     private static final ObjectStreamField[] serialPersistentFields = {
         new ObjectStreamField("signum", Integer.TYPE),
@@ -4238,22 +4226,14 @@
      * for historical reasons, but it is converted to an array of ints
      * and the byte array is discarded.
      * Note:
-     * The current convention is to initialize the cache fields, bitCount,
-     * bitLength and lowestSetBit, to 0 rather than some other marker value.
-     * Therefore, no explicit action to set these fields needs to be taken in
-     * readObject because those fields already have a 0 value be default since
-     * defaultReadObject is not being used.
+     * The current convention is to initialize the cache fields, bitCountPlusOne,
+     * bitLengthPlusOne and lowestSetBitPlusTwo, to 0 rather than some other
+     * marker value. Therefore, no explicit action to set these fields needs to
+     * be taken in readObject because those fields already have a 0 value by
+     * default since defaultReadObject is not being used.
      */
     private void readObject(java.io.ObjectInputStream s)
         throws java.io.IOException, ClassNotFoundException {
-        /*
-         * In order to maintain compatibility with previous serialized forms,
-         * the magnitude of a BigInteger is serialized as an array of bytes.
-         * The magnitude field is used as a temporary store for the byte array
-         * that is deserialized. The cached computation fields should be
-         * transient but are serialized for compatibility reasons.
-         */
-
         // prepare to read the alternate persistent fields
         ObjectInputStream.GetField fields = s.readFields();
 
@@ -4317,12 +4297,14 @@
     }
 
     /**
-     * Save the {@code BigInteger} instance to a stream.
-     * The magnitude of a BigInteger is serialized as a byte array for
-     * historical reasons.
-     *
-     * @serialData two necessary fields are written as well as obsolete
-     *             fields for compatibility with older versions.
+     * Save the {@code BigInteger} instance to a stream.  The magnitude of a
+     * {@code BigInteger} is serialized as a byte array for historical reasons.
+     * To maintain compatibility with older implementations, the integers
+     * -1, -1, -2, and -2 are written as the values of the obsolete fields
+     * {@code bitCount}, {@code bitLength}, {@code lowestSetBit}, and
+     * {@code firstNonzeroByteNum}, respectively.  These values are compatible
+     * with older implementations, but will be ignored by current
+     * implementations.
      */
     private void writeObject(ObjectOutputStream s) throws IOException {
         // set the values of the Serializable fields
@@ -4338,7 +4320,7 @@
 
         // save them
         s.writeFields();
-}
+    }
 
     /**
      * Returns the mag array as an array of bytes.
--- a/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java	Tue Apr 01 15:37:15 2014 +0200
@@ -36,7 +36,7 @@
 import java.rmi.server.RMIClassLoader;
 import java.rmi.server.UnicastRemoteObject;
 import java.security.AccessController;
-import sun.security.action.GetIntegerAction;
+import java.security.PrivilegedAction;
 
 /**
  * An <code>ActivationGroup</code> is responsible for creating new
@@ -446,9 +446,8 @@
     {
         if (currSystem == null) {
             try {
-                int port = AccessController.doPrivileged(
-                    new GetIntegerAction("java.rmi.activation.port",
-                                         ActivationSystem.SYSTEM_PORT));
+                int port = AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
+                    Integer.getInteger("java.rmi.activation.port", ActivationSystem.SYSTEM_PORT));
                 currSystem = (ActivationSystem)
                     Naming.lookup("//:" + port +
                                   "/java.rmi.activation.ActivationSystem");
--- a/jdk/src/share/classes/java/rmi/server/ObjID.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/rmi/server/ObjID.java	Tue Apr 01 15:37:15 2014 +0200
@@ -31,9 +31,9 @@
 import java.io.ObjectOutput;
 import java.io.Serializable;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.security.SecureRandom;
 import java.util.concurrent.atomic.AtomicLong;
-import sun.security.action.GetPropertyAction;
 
 /**
  * An <code>ObjID</code> is used to identify a remote object exported
@@ -242,7 +242,7 @@
 
     private static boolean useRandomIDs() {
         String value = AccessController.doPrivileged(
-            new GetPropertyAction("java.rmi.server.randomIDs"));
+            (PrivilegedAction<String>) () -> System.getProperty("java.rmi.server.randomIDs"));
         return value == null ? true : Boolean.parseBoolean(value);
     }
 }
--- a/jdk/src/share/classes/java/util/Arrays.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/util/Arrays.java	Tue Apr 01 15:37:15 2014 +0200
@@ -28,6 +28,7 @@
 import java.lang.reflect.Array;
 import java.util.concurrent.ForkJoinPool;
 import java.util.function.BinaryOperator;
+import java.util.function.Consumer;
 import java.util.function.DoubleBinaryOperator;
 import java.util.function.IntBinaryOperator;
 import java.util.function.IntFunction;
@@ -35,6 +36,7 @@
 import java.util.function.IntToLongFunction;
 import java.util.function.IntUnaryOperator;
 import java.util.function.LongBinaryOperator;
+import java.util.function.UnaryOperator;
 import java.util.stream.DoubleStream;
 import java.util.stream.IntStream;
 import java.util.stream.LongStream;
@@ -3848,12 +3850,13 @@
 
         @Override
         public int indexOf(Object o) {
-            if (o==null) {
-                for (int i=0; i<a.length; i++)
-                    if (a[i]==null)
+            E[] a = this.a;
+            if (o == null) {
+                for (int i = 0; i < a.length; i++)
+                    if (a[i] == null)
                         return i;
             } else {
-                for (int i=0; i<a.length; i++)
+                for (int i = 0; i < a.length; i++)
                     if (o.equals(a[i]))
                         return i;
             }
@@ -3869,6 +3872,28 @@
         public Spliterator<E> spliterator() {
             return Spliterators.spliterator(a, Spliterator.ORDERED);
         }
+
+        @Override
+        public void forEach(Consumer<? super E> action) {
+            Objects.requireNonNull(action);
+            for (E e : a) {
+                action.accept(e);
+            }
+        }
+
+        @Override
+        public void replaceAll(UnaryOperator<E> operator) {
+            Objects.requireNonNull(operator);
+            E[] a = this.a;
+            for (int i = 0; i < a.length; i++) {
+                a[i] = operator.apply(a[i]);
+            }
+        }
+
+        @Override
+        public void sort(Comparator<? super E> c) {
+            Arrays.sort(a, c);
+        }
     }
 
     /**
--- a/jdk/src/share/classes/java/util/logging/LogManager.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/java/util/logging/LogManager.java	Tue Apr 01 15:37:15 2014 +0200
@@ -570,7 +570,7 @@
         // the context requires default loggers, will be added to the context
         // logger's tree.
         final Logger getGlobalLogger() {
-            @SuppressWarnings("deprecated") // avoids initialization cycles.
+            @SuppressWarnings("deprecation") // avoids initialization cycles.
             final Logger global = Logger.global;
             return global;
         }
@@ -642,7 +642,7 @@
             // method be called for anything else than Logger.global
             // or owner.rootLogger.
             if (!requiresDefaultLoggers() || logger == null
-                    || logger != Logger.global && logger != LogManager.this.rootLogger) {
+                    || logger != getGlobalLogger() && logger != LogManager.this.rootLogger ) {
 
                 // the case where we have a non null logger which is neither
                 // Logger.global nor manager.rootLogger indicates a serious
--- a/jdk/src/share/classes/javax/imageio/ImageIO.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/imageio/ImageIO.java	Tue Apr 01 15:37:15 2014 +0200
@@ -339,7 +339,7 @@
             throw new IllegalArgumentException("input == null!");
         }
 
-        Iterator iter;
+        Iterator<ImageInputStreamSpi> iter;
         // Ensure category is present
         try {
             iter = theRegistry.getServiceProviders(ImageInputStreamSpi.class,
@@ -351,7 +351,7 @@
         boolean usecache = getUseCache() && hasCachePermission();
 
         while (iter.hasNext()) {
-            ImageInputStreamSpi spi = (ImageInputStreamSpi)iter.next();
+            ImageInputStreamSpi spi = iter.next();
             if (spi.getInputClass().isInstance(input)) {
                 try {
                     return spi.createInputStreamInstance(input,
@@ -401,7 +401,7 @@
             throw new IllegalArgumentException("output == null!");
         }
 
-        Iterator iter;
+        Iterator<ImageOutputStreamSpi> iter;
         // Ensure category is present
         try {
             iter = theRegistry.getServiceProviders(ImageOutputStreamSpi.class,
@@ -413,7 +413,7 @@
         boolean usecache = getUseCache() && hasCachePermission();
 
         while (iter.hasNext()) {
-            ImageOutputStreamSpi spi = (ImageOutputStreamSpi)iter.next();
+            ImageOutputStreamSpi spi = iter.next();
             if (spi.getOutputClass().isInstance(output)) {
                 try {
                     return spi.createOutputStreamInstance(output,
@@ -512,9 +512,9 @@
 
     static class ImageReaderIterator implements Iterator<ImageReader> {
         // Contains ImageReaderSpis
-        public Iterator iter;
+        private Iterator<ImageReaderSpi> iter;
 
-        public ImageReaderIterator(Iterator iter) {
+        public ImageReaderIterator(Iterator<ImageReaderSpi> iter) {
             this.iter = iter;
         }
 
@@ -525,7 +525,7 @@
         public ImageReader next() {
             ImageReaderSpi spi = null;
             try {
-                spi = (ImageReaderSpi)iter.next();
+                spi = iter.next();
                 return spi.createReaderInstance();
             } catch (IOException e) {
                 // Deregister the spi in this case, but only as
@@ -640,7 +640,7 @@
         if (input == null) {
             throw new IllegalArgumentException("input == null!");
         }
-        Iterator iter;
+        Iterator<ImageReaderSpi> iter;
         // Ensure category is present
         try {
             iter = theRegistry.getServiceProviders(ImageReaderSpi.class,
@@ -702,7 +702,7 @@
         if (formatName == null) {
             throw new IllegalArgumentException("formatName == null!");
         }
-        Iterator iter;
+        Iterator<ImageReaderSpi> iter;
         // Ensure category is present
         try {
             iter = theRegistry.getServiceProviders(ImageReaderSpi.class,
@@ -738,7 +738,7 @@
             throw new IllegalArgumentException("fileSuffix == null!");
         }
         // Ensure category is present
-        Iterator iter;
+        Iterator<ImageReaderSpi> iter;
         try {
             iter = theRegistry.getServiceProviders(ImageReaderSpi.class,
                                    new ContainsFilter(readerFileSuffixesMethod,
@@ -773,7 +773,7 @@
             throw new IllegalArgumentException("MIMEType == null!");
         }
         // Ensure category is present
-        Iterator iter;
+        Iterator<ImageReaderSpi> iter;
         try {
             iter = theRegistry.getServiceProviders(ImageReaderSpi.class,
                                       new ContainsFilter(readerMIMETypesMethod,
@@ -826,9 +826,9 @@
 
     static class ImageWriterIterator implements Iterator<ImageWriter> {
         // Contains ImageWriterSpis
-        public Iterator iter;
+        private Iterator<ImageWriterSpi> iter;
 
-        public ImageWriterIterator(Iterator iter) {
+        public ImageWriterIterator(Iterator<ImageWriterSpi> iter) {
             this.iter = iter;
         }
 
@@ -839,7 +839,7 @@
         public ImageWriter next() {
             ImageWriterSpi spi = null;
             try {
-                spi = (ImageWriterSpi)iter.next();
+                spi = iter.next();
                 return spi.createWriterInstance();
             } catch (IOException e) {
                 // Deregister the spi in this case, but only as a writerSpi
@@ -885,7 +885,7 @@
         if (formatName == null) {
             throw new IllegalArgumentException("formatName == null!");
         }
-        Iterator iter;
+        Iterator<ImageWriterSpi> iter;
         // Ensure category is present
         try {
             iter = theRegistry.getServiceProviders(ImageWriterSpi.class,
@@ -919,7 +919,7 @@
         if (fileSuffix == null) {
             throw new IllegalArgumentException("fileSuffix == null!");
         }
-        Iterator iter;
+        Iterator<ImageWriterSpi> iter;
         // Ensure category is present
         try {
             iter = theRegistry.getServiceProviders(ImageWriterSpi.class,
@@ -953,7 +953,7 @@
         if (MIMEType == null) {
             throw new IllegalArgumentException("MIMEType == null!");
         }
-        Iterator iter;
+        Iterator<ImageWriterSpi> iter;
         // Ensure category is present
         try {
             iter = theRegistry.getServiceProviders(ImageWriterSpi.class,
@@ -1002,7 +1002,7 @@
 
         ImageReaderSpi readerSpi = reader.getOriginatingProvider();
         if (readerSpi == null) {
-            Iterator readerSpiIter;
+            Iterator<ImageReaderSpi> readerSpiIter;
             // Ensure category is present
             try {
                 readerSpiIter =
@@ -1013,7 +1013,7 @@
             }
 
             while (readerSpiIter.hasNext()) {
-                ImageReaderSpi temp = (ImageReaderSpi) readerSpiIter.next();
+                ImageReaderSpi temp = readerSpiIter.next();
                 if (temp.isOwnReader(reader)) {
                     readerSpi = temp;
                     break;
@@ -1029,7 +1029,7 @@
             return null;
         }
 
-        Class writerSpiClass = null;
+        Class<?> writerSpiClass = null;
         try {
             writerSpiClass = Class.forName(writerNames[0], true,
                                            ClassLoader.getSystemClassLoader());
@@ -1082,7 +1082,7 @@
 
         ImageWriterSpi writerSpi = writer.getOriginatingProvider();
         if (writerSpi == null) {
-            Iterator writerSpiIter;
+            Iterator<ImageWriterSpi> writerSpiIter;
             // Ensure category is present
             try {
                 writerSpiIter =
@@ -1093,7 +1093,7 @@
             }
 
             while (writerSpiIter.hasNext()) {
-                ImageWriterSpi temp = (ImageWriterSpi) writerSpiIter.next();
+                ImageWriterSpi temp = writerSpiIter.next();
                 if (temp.isOwnWriter(writer)) {
                     writerSpi = temp;
                     break;
@@ -1109,7 +1109,7 @@
             return null;
         }
 
-        Class readerSpiClass = null;
+        Class<?> readerSpiClass = null;
         try {
             readerSpiClass = Class.forName(readerNames[0], true,
                                            ClassLoader.getSystemClassLoader());
@@ -1160,7 +1160,7 @@
             throw new IllegalArgumentException("formatName == null!");
         }
 
-        Iterator iter;
+        Iterator<ImageWriterSpi> iter;
         // Ensure category is present
         try {
             iter = theRegistry.getServiceProviders(ImageWriterSpi.class,
@@ -1178,9 +1178,9 @@
         implements Iterator<ImageTranscoder>
     {
         // Contains ImageTranscoderSpis
-        public Iterator iter;
+        public Iterator<ImageTranscoderSpi> iter;
 
-        public ImageTranscoderIterator(Iterator iter) {
+        public ImageTranscoderIterator(Iterator<ImageTranscoderSpi> iter) {
             this.iter = iter;
         }
 
@@ -1190,7 +1190,7 @@
 
         public ImageTranscoder next() {
             ImageTranscoderSpi spi = null;
-            spi = (ImageTranscoderSpi)iter.next();
+            spi = iter.next();
             return spi.createTranscoderInstance();
         }
 
@@ -1249,7 +1249,7 @@
         ServiceRegistry.Filter filter =
             new TranscoderFilter(readerSpi, writerSpi);
 
-        Iterator iter;
+        Iterator<ImageTranscoderSpi> iter;
         // Ensure category is present
         try {
             iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class,
@@ -1435,12 +1435,12 @@
             throw new IllegalArgumentException("stream == null!");
         }
 
-        Iterator iter = getImageReaders(stream);
+        Iterator<ImageReader> iter = getImageReaders(stream);
         if (!iter.hasNext()) {
             return null;
         }
 
-        ImageReader reader = (ImageReader)iter.next();
+        ImageReader reader = iter.next();
         ImageReadParam param = reader.getDefaultReadParam();
         reader.setInput(stream, true, true);
         BufferedImage bi;
--- a/jdk/src/share/classes/javax/imageio/ImageReader.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/imageio/ImageReader.java	Tue Apr 01 15:37:15 2014 +0200
@@ -291,7 +291,7 @@
         if (input != null) {
             boolean found = false;
             if (originatingProvider != null) {
-                Class[] classes = originatingProvider.getInputTypes();
+                Class<?>[] classes = originatingProvider.getInputTypes();
                 for (int i = 0; i < classes.length; i++) {
                     if (classes[i].isInstance(input)) {
                         found = true;
@@ -793,7 +793,7 @@
     }
 
     private IIOMetadata getMetadata(String formatName,
-                                    Set nodeNames,
+                                    Set<String> nodeNames,
                                     boolean wantStream,
                                     int imageIndex) throws IOException {
         if (formatName == null) {
@@ -1065,10 +1065,10 @@
 
         BufferedImage im = read(imageIndex, param);
 
-        ArrayList thumbnails = null;
+        ArrayList<BufferedImage> thumbnails = null;
         int numThumbnails = getNumThumbnails(imageIndex);
         if (numThumbnails > 0) {
-            thumbnails = new ArrayList();
+            thumbnails = new ArrayList<>();
             for (int j = 0; j < numThumbnails; j++) {
                 thumbnails.add(readThumbnail(imageIndex, j));
             }
@@ -1156,7 +1156,7 @@
         readAll(Iterator<? extends ImageReadParam> params)
         throws IOException
     {
-        List output = new ArrayList();
+        List<IIOImage> output = new ArrayList<>();
 
         int imageIndex = getMinIndex();
 
@@ -1187,10 +1187,10 @@
                 break;
             }
 
-            ArrayList thumbnails = null;
+            ArrayList<BufferedImage> thumbnails = null;
             int numThumbnails = getNumThumbnails(imageIndex);
             if (numThumbnails > 0) {
-                thumbnails = new ArrayList();
+                thumbnails = new ArrayList<>();
                 for (int j = 0; j < numThumbnails; j++) {
                     thumbnails.add(readThumbnail(imageIndex, j));
                 }
@@ -1797,9 +1797,9 @@
 
     // Add an element to a list, creating a new list if the
     // existing list is null, and return the list.
-    static List addToList(List l, Object elt) {
+    static <T> List<T> addToList(List<T> l, T elt) {
         if (l == null) {
-            l = new ArrayList();
+            l = new ArrayList<>();
         }
         l.add(elt);
         return l;
@@ -1808,7 +1808,7 @@
 
     // Remove an element from a list, discarding the list if the
     // resulting list is empty, and return the list or null.
-    static List removeFromList(List l, Object elt) {
+    static <T> List<T> removeFromList(List<T> l, T elt) {
         if (l == null) {
             return l;
         }
@@ -2461,10 +2461,10 @@
              * If that throws MissingResourceException, then try the
              * system class loader.
              */
-            ClassLoader loader = (ClassLoader)
+            ClassLoader loader =
                 java.security.AccessController.doPrivileged(
-                   new java.security.PrivilegedAction() {
-                      public Object run() {
+                   new java.security.PrivilegedAction<ClassLoader>() {
+                      public ClassLoader run() {
                         return Thread.currentThread().getContextClassLoader();
                       }
                 });
--- a/jdk/src/share/classes/javax/imageio/ImageTypeSpecifier.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/imageio/ImageTypeSpecifier.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1075,7 +1075,7 @@
                                             new Point(0, 0));
             return new BufferedImage(colorModel, raster,
                                      colorModel.isAlphaPremultiplied(),
-                                     new Hashtable());
+                                     new Hashtable<>());
         } catch (NegativeArraySizeException e) {
             // Exception most likely thrown from a DataBuffer constructor
             throw new IllegalArgumentException
--- a/jdk/src/share/classes/javax/imageio/ImageWriter.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/imageio/ImageWriter.java	Tue Apr 01 15:37:15 2014 +0200
@@ -205,7 +205,7 @@
         if (output != null) {
             ImageWriterSpi provider = getOriginatingProvider();
             if (provider != null) {
-                Class[] classes = provider.getOutputTypes();
+                Class<?>[] classes = provider.getOutputTypes();
                 boolean found = false;
                 for (int i = 0; i < classes.length; i++) {
                     if (classes[i].isInstance(output)) {
@@ -1964,10 +1964,10 @@
              * If that throws MissingResourceException, then try the
              * system class loader.
              */
-            ClassLoader loader = (ClassLoader)
+            ClassLoader loader =
                 java.security.AccessController.doPrivileged(
-                   new java.security.PrivilegedAction() {
-                      public Object run() {
+                   new java.security.PrivilegedAction<ClassLoader>() {
+                      public ClassLoader run() {
                         return Thread.currentThread().getContextClassLoader();
                       }
                 });
--- a/jdk/src/share/classes/javax/imageio/metadata/IIOMetadata.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/imageio/metadata/IIOMetadata.java	Tue Apr 01 15:37:15 2014 +0200
@@ -395,15 +395,15 @@
             throw new IllegalArgumentException("Unsupported format name");
         }
         try {
-            Class cls = null;
+            Class<?> cls = null;
             final Object o = this;
 
             // firstly we try to use classloader used for loading
             // the IIOMetadata implemantation for this plugin.
-            ClassLoader loader = (ClassLoader)
+            ClassLoader loader =
                 java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction() {
-                            public Object run() {
+                    new java.security.PrivilegedAction<ClassLoader>() {
+                            public ClassLoader run() {
                                 return o.getClass().getClassLoader();
                             }
                         });
@@ -415,10 +415,10 @@
                 // we failed to load IIOMetadataFormat class by
                 // using IIOMetadata classloader.Next try is to
                 // use thread context classloader.
-                loader = (ClassLoader)
+                loader =
                     java.security.AccessController.doPrivileged(
-                        new java.security.PrivilegedAction() {
-                                public Object run() {
+                        new java.security.PrivilegedAction<ClassLoader>() {
+                                public ClassLoader run() {
                                     return Thread.currentThread().getContextClassLoader();
                                 }
                         });
--- a/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataFormatImpl.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataFormatImpl.java	Tue Apr 01 15:37:15 2014 +0200
@@ -90,7 +90,7 @@
     private String rootName;
 
     // Element name (String) -> Element
-    private HashMap elementMap = new HashMap();
+    private HashMap<String, Element> elementMap = new HashMap<>();
 
     class Element {
         String elementName;
@@ -100,17 +100,17 @@
         int maxChildren = 0;
 
         // Child names (Strings)
-        List childList = new ArrayList();
+        List<String> childList = new ArrayList<>();
 
         // Parent names (Strings)
-        List parentList = new ArrayList();
+        List<String> parentList = new ArrayList<>();
 
         // List of attribute names in the order they were added
-        List attrList = new ArrayList();
+        List<String> attrList = new ArrayList<>();
         // Attr name (String) -> Attribute
-        Map attrMap = new HashMap();
+        Map<String, Attribute> attrMap = new HashMap<>();
 
-        ObjectValue objectValue;
+        ObjectValue<?> objectValue;
     }
 
     class Attribute {
@@ -122,7 +122,7 @@
         String defaultValue = null;
 
         // enumeration
-        List enumeratedValues;
+        List<String> enumeratedValues;
 
         // range
         String minValue;
@@ -133,17 +133,18 @@
         int listMaxLength;
     }
 
-    class ObjectValue {
+    class ObjectValue<T> {
         int valueType = VALUE_NONE;
-        Class classType = null;
-        Object defaultValue = null;
+        // ? extends T So that ObjectValue<Object> can take Class<?>
+        Class<? extends T> classType = null;
+        T defaultValue = null;
 
         // Meaningful only if valueType == VALUE_ENUMERATION
-        List enumeratedValues = null;
+        List<? extends T> enumeratedValues = null;
 
         // Meaningful only if valueType == VALUE_RANGE
-        Comparable minValue = null;
-        Comparable maxValue = null;
+        Comparable<? super T> minValue = null;
+        Comparable<? super T> maxValue = null;
 
         // Meaningful only if valueType == VALUE_LIST
         int arrayMinLength = 0;
@@ -272,7 +273,7 @@
         if (mustAppear && (elementName == null)) {
             throw new IllegalArgumentException("element name is null!");
         }
-        Element element = (Element)elementMap.get(elementName);
+        Element element = elementMap.get(elementName);
         if (mustAppear && (element == null)) {
             throw new IllegalArgumentException("No such element: " +
                                                elementName);
@@ -287,7 +288,7 @@
     // Utility method for locating an attribute
     private Attribute getAttribute(String elementName, String attrName) {
         Element element = getElement(elementName);
-        Attribute attr = (Attribute)element.attrMap.get(attrName);
+        Attribute attr = element.attrMap.get(attrName);
         if (attr == null) {
             throw new IllegalArgumentException("No such attribute \"" +
                                                attrName + "\"!");
@@ -408,9 +409,9 @@
     protected void removeElement(String elementName) {
         Element element = getElement(elementName, false);
         if (element != null) {
-            Iterator iter = element.parentList.iterator();
+            Iterator<String> iter = element.parentList.iterator();
             while (iter.hasNext()) {
-                String parentName = (String)iter.next();
+                String parentName = iter.next();
                 Element parent = getElement(parentName, false);
                 if (parent != null) {
                     parent.childList.remove(elementName);
@@ -514,7 +515,7 @@
         if (enumeratedValues.size() == 0) {
             throw new IllegalArgumentException("enumeratedValues is empty!");
         }
-        Iterator iter = enumeratedValues.iterator();
+        Iterator<String> iter = enumeratedValues.iterator();
         while (iter.hasNext()) {
             Object o = iter.next();
             if (o == null) {
@@ -681,7 +682,7 @@
                                        String attrName,
                                        boolean hasDefaultValue,
                                        boolean defaultValue) {
-        List values = new ArrayList();
+        List<String> values = new ArrayList<>();
         values.add("TRUE");
         values.add("FALSE");
 
@@ -740,7 +741,7 @@
                                       T defaultValue)
     {
         Element element = getElement(elementName);
-        ObjectValue obj = new ObjectValue();
+        ObjectValue<T> obj = new ObjectValue<>();
         obj.valueType = VALUE_ARBITRARY;
         obj.classType = classType;
         obj.defaultValue = defaultValue;
@@ -793,7 +794,7 @@
         if (enumeratedValues.size() == 0) {
             throw new IllegalArgumentException("enumeratedValues is empty!");
         }
-        Iterator iter = enumeratedValues.iterator();
+        Iterator<? extends T> iter = enumeratedValues.iterator();
         while (iter.hasNext()) {
             Object o = iter.next();
             if (o == null) {
@@ -804,7 +805,7 @@
             }
         }
 
-        ObjectValue obj = new ObjectValue();
+        ObjectValue<T> obj = new ObjectValue<>();
         obj.valueType = VALUE_ENUMERATION;
         obj.classType = classType;
         obj.defaultValue = defaultValue;
@@ -854,7 +855,7 @@
                        boolean maxInclusive)
     {
         Element element = getElement(elementName);
-        ObjectValue obj = new ObjectValue();
+        ObjectValue<T> obj = new ObjectValue<>();
         obj.valueType = VALUE_RANGE;
         if (minInclusive) {
             obj.valueType |= VALUE_RANGE_MIN_INCLUSIVE_MASK;
@@ -895,7 +896,7 @@
                                   int arrayMinLength,
                                   int arrayMaxLength) {
         Element element = getElement(elementName);
-        ObjectValue obj = new ObjectValue();
+        ObjectValue<Object> obj = new ObjectValue<>();
         obj.valueType = VALUE_LIST;
         obj.classType = classType;
         obj.arrayMinLength = arrayMinLength;
@@ -962,10 +963,10 @@
          * If that throws MissingResourceException, then try the
          * system class loader.
          */
-        ClassLoader loader = (ClassLoader)
+        ClassLoader loader =
             java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedAction() {
-                   public Object run() {
+                new java.security.PrivilegedAction<ClassLoader>() {
+                   public ClassLoader run() {
                        return Thread.currentThread().getContextClassLoader();
                    }
             });
@@ -1037,17 +1038,17 @@
         if (element.childPolicy == CHILD_POLICY_EMPTY) {
             return null;
         }
-        return (String[])element.childList.toArray(new String[0]);
+        return element.childList.toArray(new String[0]);
     }
 
     // Attributes
 
     public String[] getAttributeNames(String elementName) {
         Element element = getElement(elementName);
-        List names = element.attrList;
+        List<String> names = element.attrList;
 
         String[] result = new String[names.size()];
-        return (String[])names.toArray(result);
+        return names.toArray(result);
     }
 
     public int getAttributeValueType(String elementName, String attrName) {
@@ -1079,10 +1080,9 @@
                 ("Attribute not an enumeration!");
         }
 
-        List values = attr.enumeratedValues;
-        Iterator iter = values.iterator();
+        List<String> values = attr.enumeratedValues;
         String[] result = new String[values.size()];
-        return (String[])values.toArray(result);
+        return values.toArray(result);
     }
 
     public String getAttributeMinValue(String elementName, String attrName) {
@@ -1170,7 +1170,7 @@
         if (attrName == null) {
             throw new IllegalArgumentException("attrName == null!");
         }
-        Attribute attr = (Attribute)element.attrMap.get(attrName);
+        Attribute attr = element.attrMap.get(attrName);
         if (attr == null) {
             throw new IllegalArgumentException("No such attribute!");
         }
@@ -1179,9 +1179,9 @@
         return getResource(key, locale);
     }
 
-    private ObjectValue getObjectValue(String elementName) {
+    private ObjectValue<?> getObjectValue(String elementName) {
         Element element = getElement(elementName);
-        ObjectValue objv = element.objectValue;
+        ObjectValue<?> objv = element.objectValue;
         if (objv == null) {
             throw new IllegalArgumentException("No object within element " +
                                                elementName + "!");
@@ -1191,7 +1191,7 @@
 
     public int getObjectValueType(String elementName) {
         Element element = getElement(elementName);
-        ObjectValue objv = element.objectValue;
+        ObjectValue<?> objv = element.objectValue;
         if (objv == null) {
             return VALUE_NONE;
         }
@@ -1199,27 +1199,27 @@
     }
 
     public Class<?> getObjectClass(String elementName) {
-        ObjectValue objv = getObjectValue(elementName);
+        ObjectValue<?> objv = getObjectValue(elementName);
         return objv.classType;
     }
 
     public Object getObjectDefaultValue(String elementName) {
-        ObjectValue objv = getObjectValue(elementName);
+        ObjectValue<?> objv = getObjectValue(elementName);
         return objv.defaultValue;
     }
 
     public Object[] getObjectEnumerations(String elementName) {
-        ObjectValue objv = getObjectValue(elementName);
+        ObjectValue<?> objv = getObjectValue(elementName);
         if (objv.valueType != VALUE_ENUMERATION) {
             throw new IllegalArgumentException("Not an enumeration!");
         }
-        List vlist = objv.enumeratedValues;
+        List<?> vlist = objv.enumeratedValues;
         Object[] values = new Object[vlist.size()];
         return vlist.toArray(values);
     }
 
     public Comparable<?> getObjectMinValue(String elementName) {
-        ObjectValue objv = getObjectValue(elementName);
+        ObjectValue<?> objv = getObjectValue(elementName);
         if ((objv.valueType & VALUE_RANGE) != VALUE_RANGE) {
             throw new IllegalArgumentException("Not a range!");
         }
@@ -1227,7 +1227,7 @@
     }
 
     public Comparable<?> getObjectMaxValue(String elementName) {
-        ObjectValue objv = getObjectValue(elementName);
+        ObjectValue<?> objv = getObjectValue(elementName);
         if ((objv.valueType & VALUE_RANGE) != VALUE_RANGE) {
             throw new IllegalArgumentException("Not a range!");
         }
@@ -1235,7 +1235,7 @@
     }
 
     public int getObjectArrayMinLength(String elementName) {
-        ObjectValue objv = getObjectValue(elementName);
+        ObjectValue<?> objv = getObjectValue(elementName);
         if (objv.valueType != VALUE_LIST) {
             throw new IllegalArgumentException("Not a list!");
         }
@@ -1243,7 +1243,7 @@
     }
 
     public int getObjectArrayMaxLength(String elementName) {
-        ObjectValue objv = getObjectValue(elementName);
+        ObjectValue<?> objv = getObjectValue(elementName);
         if (objv.valueType != VALUE_LIST) {
             throw new IllegalArgumentException("Not a list!");
         }
--- a/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataNode.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataNode.java	Tue Apr 01 15:37:15 2014 +0200
@@ -50,9 +50,9 @@
 
 class IIONamedNodeMap implements NamedNodeMap {
 
-    List nodes;
+    List<? extends Node> nodes;
 
-    public IIONamedNodeMap(List nodes) {
+    public IIONamedNodeMap(List<? extends Node> nodes) {
         this.nodes = nodes;
     }
 
@@ -61,9 +61,9 @@
     }
 
     public Node getNamedItem(String name) {
-        Iterator iter = nodes.iterator();
+        Iterator<? extends Node> iter = nodes.iterator();
         while (iter.hasNext()) {
-            Node node = (Node)iter.next();
+            Node node = iter.next();
             if (name.equals(node.getNodeName())) {
                 return node;
             }
@@ -73,7 +73,7 @@
     }
 
     public Node item(int index) {
-        Node node = (Node)nodes.get(index);
+        Node node = nodes.get(index);
         return node;
     }
 
@@ -111,9 +111,9 @@
 
 class IIONodeList implements NodeList {
 
-    List nodes;
+    List<? extends Node> nodes;
 
-    public IIONodeList(List nodes) {
+    public IIONodeList(List<? extends Node> nodes) {
         this.nodes = nodes;
     }
 
@@ -125,7 +125,7 @@
         if (index < 0 || index > nodes.size()) {
             return null;
         }
-        return (Node)nodes.get(index);
+        return nodes.get(index);
     }
 }
 
@@ -285,7 +285,7 @@
      * A <code>List</code> of <code>IIOAttr</code> nodes representing
      * attributes.
      */
-    private List attributes = new ArrayList();
+    private List<IIOAttr> attributes = new ArrayList<>();
 
     /**
      * Constructs an empty <code>IIOMetadataNode</code>.
@@ -789,7 +789,7 @@
     private void removeAttribute(String name, boolean checkPresent) {
         int numAttributes = attributes.size();
         for (int i = 0; i < numAttributes; i++) {
-            IIOAttr attr = (IIOAttr)attributes.get(i);
+            IIOAttr attr = attributes.get(i);
             if (name.equals(attr.getName())) {
                 attr.setOwnerElement(null);
                 attributes.remove(i);
@@ -873,12 +873,12 @@
     }
 
     public NodeList getElementsByTagName(String name) {
-        List l = new ArrayList();
+        List<Node> l = new ArrayList<>();
         getElementsByTagName(name, l);
         return new IIONodeList(l);
     }
 
-    private void getElementsByTagName(String name, List l) {
+    private void getElementsByTagName(String name, List<Node> l) {
         if (nodeName.equals(name)) {
             l.add(this);
         }
--- a/jdk/src/share/classes/javax/imageio/spi/DigraphNode.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/imageio/spi/DigraphNode.java	Tue Apr 01 15:37:15 2014 +0200
@@ -39,17 +39,17 @@
  * the current node) may be queried.
  *
  */
-class DigraphNode implements Cloneable, Serializable {
+class DigraphNode<E> implements Cloneable, Serializable {
     private static final long serialVersionUID = 5308261378582246841L;
 
     /** The data associated with this node. */
-    protected Object data;
+    protected E data;
 
     /**
      * A <code>Set</code> of neighboring nodes pointed to by this
      * node.
      */
-    protected Set outNodes = new HashSet();
+    protected Set<DigraphNode<E>> outNodes = new HashSet<>();
 
     /** The in-degree of the node. */
     protected int inDegree = 0;
@@ -58,14 +58,14 @@
      * A <code>Set</code> of neighboring nodes that point to this
      * node.
      */
-    private Set inNodes = new HashSet();
+    private Set<DigraphNode<E>> inNodes = new HashSet<>();
 
-    public DigraphNode(Object data) {
+    public DigraphNode(E data) {
         this.data = data;
     }
 
     /** Returns the <code>Object</code> referenced by this node. */
-    public Object getData() {
+    public E getData() {
         return data;
     }
 
@@ -73,7 +73,7 @@
      * Returns an <code>Iterator</code> containing the nodes pointed
      * to by this node.
      */
-    public Iterator getOutNodes() {
+    public Iterator<DigraphNode<E>> getOutNodes() {
         return outNodes.iterator();
     }
 
@@ -86,7 +86,7 @@
      * @return <code>true</code> if the node was not previously the
      * target of an edge.
      */
-    public boolean addEdge(DigraphNode node) {
+    public boolean addEdge(DigraphNode<E> node) {
         if (outNodes.contains(node)) {
             return false;
         }
@@ -105,7 +105,7 @@
      *
      * @return <code>true</code> if the node is the target of an edge.
      */
-    public boolean hasEdge(DigraphNode node) {
+    public boolean hasEdge(DigraphNode<E> node) {
         return outNodes.contains(node);
     }
 
@@ -116,7 +116,7 @@
      * @return <code>true</code> if the node was previously the target
      * of an edge.
      */
-    public boolean removeEdge(DigraphNode node) {
+    public boolean removeEdge(DigraphNode<E> node) {
         if (!outNodes.contains(node)) {
             return false;
         }
@@ -132,15 +132,17 @@
      * appropriately.
      */
     public void dispose() {
-        Object[] inNodesArray = inNodes.toArray();
+        @SuppressWarnings("unchecked")
+        DigraphNode<E>[] inNodesArray = (DigraphNode<E>[])inNodes.toArray();
         for(int i=0; i<inNodesArray.length; i++) {
-            DigraphNode node = (DigraphNode) inNodesArray[i];
+            DigraphNode<E> node = inNodesArray[i];
             node.removeEdge(this);
         }
 
-        Object[] outNodesArray = outNodes.toArray();
+        @SuppressWarnings("unchecked")
+        DigraphNode<E>[] outNodesArray = (DigraphNode<E>[])outNodes.toArray();
         for(int i=0; i<outNodesArray.length; i++) {
-            DigraphNode node = (DigraphNode) outNodesArray[i];
+            DigraphNode<E> node = outNodesArray[i];
             removeEdge(node);
         }
     }
--- a/jdk/src/share/classes/javax/imageio/spi/IIORegistry.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/imageio/spi/IIORegistry.java	Tue Apr 01 15:37:15 2014 +0200
@@ -115,7 +115,7 @@
      * A <code>Vector</code> containing the valid IIO registry
      * categories (superinterfaces) to be used in the constructor.
      */
-    private static final Vector initialCategories = new Vector(5);
+    private static final Vector<Class<?>> initialCategories = new Vector<>(5);
 
     static {
         initialCategories.add(ImageReaderSpi.class);
@@ -198,9 +198,10 @@
 
         ClassLoader loader = Thread.currentThread().getContextClassLoader();
 
-        Iterator categories = getCategories();
+        Iterator<Class<?>> categories = getCategories();
         while (categories.hasNext()) {
-            Class<IIOServiceProvider> c = (Class)categories.next();
+            @SuppressWarnings("unchecked")
+            Class<IIOServiceProvider> c = (Class<IIOServiceProvider>)categories.next();
             Iterator<IIOServiceProvider> riter =
                     ServiceLoader.load(c, loader).iterator();
             while (riter.hasNext()) {
@@ -234,12 +235,13 @@
           file read capability is restricted (like the
           applet context case).
          */
-        PrivilegedAction doRegistration =
-            new PrivilegedAction() {
+        PrivilegedAction<Object> doRegistration =
+            new PrivilegedAction<Object>() {
                 public Object run() {
-                    Iterator categories = getCategories();
+                    Iterator<Class<?>> categories = getCategories();
                     while (categories.hasNext()) {
-                        Class<IIOServiceProvider> c = (Class)categories.next();
+                        @SuppressWarnings("unchecked")
+                        Class<IIOServiceProvider> c = (Class<IIOServiceProvider>)categories.next();
                         for (IIOServiceProvider p : ServiceLoader.loadInstalled(c)) {
                             registerServiceProvider(p);
                         }
--- a/jdk/src/share/classes/javax/imageio/spi/ImageReaderSpi.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/imageio/spi/ImageReaderSpi.java	Tue Apr 01 15:37:15 2014 +0200
@@ -81,14 +81,14 @@
      * the equivalent array <code>{ ImageInputStream.class }</code>.
      */
     @Deprecated
-    public static final Class[] STANDARD_INPUT_TYPE =
+    public static final Class<?>[] STANDARD_INPUT_TYPE =
         { ImageInputStream.class };
 
     /**
      * An array of <code>Class</code> objects to be returned from
      * <code>getInputTypes</code>, initially <code>null</code>.
      */
-    protected Class[] inputTypes = null;
+    protected Class<?>[] inputTypes = null;
 
     /**
      * An array of strings to be returned from
@@ -101,7 +101,7 @@
      * The <code>Class</code> of the reader, initially
      * <code>null</code>.
      */
-    private Class readerClass = null;
+    private Class<?> readerClass = null;
 
     /**
      * Constructs a blank <code>ImageReaderSpi</code>.  It is up to
@@ -197,7 +197,7 @@
                           String[] suffixes,
                           String[] MIMETypes,
                           String readerClassName,
-                          Class[] inputTypes,
+                          Class<?>[] inputTypes,
                           String[] writerSpiNames,
                           boolean supportsStandardStreamMetadataFormat,
                           String nativeStreamMetadataFormatName,
@@ -252,9 +252,9 @@
      * returned.
      *
      * @return a non-<code>null</code> array of
-     * <code>Class</code>objects of length at least 1.
+     * <code>Class</code> objects of length at least 1.
      */
-    public Class[] getInputTypes() {
+    public Class<?>[] getInputTypes() {
         return inputTypes.clone();
     }
 
--- a/jdk/src/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java	Tue Apr 01 15:37:15 2014 +0200
@@ -587,7 +587,7 @@
             throw new IllegalArgumentException("Unsupported format name");
         }
         try {
-            Class cls = Class.forName(formatClassName, true,
+            Class<?> cls = Class.forName(formatClassName, true,
                                       ClassLoader.getSystemClassLoader());
             Method meth = cls.getMethod("getInstance");
             return (IIOMetadataFormat) meth.invoke(null);
--- a/jdk/src/share/classes/javax/imageio/spi/ImageWriterSpi.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/imageio/spi/ImageWriterSpi.java	Tue Apr 01 15:37:15 2014 +0200
@@ -83,14 +83,14 @@
      * the equivalent array <code>{ ImageOutputStream.class }</code>.
      */
     @Deprecated
-    public static final Class[] STANDARD_OUTPUT_TYPE =
+    public static final Class<?>[] STANDARD_OUTPUT_TYPE =
         { ImageOutputStream.class };
 
     /**
      * An array of <code>Class</code> objects to be returned from
      * <code>getOutputTypes</code>, initially <code>null</code>.
      */
-    protected Class[] outputTypes = null;
+    protected Class<?>[] outputTypes = null;
 
     /**
      * An array of strings to be returned from
@@ -103,7 +103,7 @@
      * The <code>Class</code> of the writer, initially
      * <code>null</code>.
      */
-    private Class writerClass = null;
+    private Class<?> writerClass = null;
 
     /**
      * Constructs a blank <code>ImageWriterSpi</code>.  It is up to
@@ -198,7 +198,7 @@
                           String[] suffixes,
                           String[] MIMETypes,
                           String writerClassName,
-                          Class[] outputTypes,
+                          Class<?>[] outputTypes,
                           String[] readerSpiNames,
                           boolean supportsStandardStreamMetadataFormat,
                           String nativeStreamMetadataFormatName,
@@ -265,9 +265,9 @@
      * returned.
      *
      * @return a non-<code>null</code> array of
-     * <code>Class</code>objects of length at least 1.
+     * <code>Class</code> objects of length at least 1.
      */
-    public Class[] getOutputTypes() {
+    public Class<?>[] getOutputTypes() {
         return outputTypes.clone();
     }
 
--- a/jdk/src/share/classes/javax/imageio/spi/PartiallyOrderedSet.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/imageio/spi/PartiallyOrderedSet.java	Tue Apr 01 15:37:15 2014 +0200
@@ -51,17 +51,17 @@
  * supplied by a trusted vendor over those supplied by another.
  *
  */
-class PartiallyOrderedSet extends AbstractSet {
+class PartiallyOrderedSet<E> extends AbstractSet<E> {
 
     // The topological sort (roughly) follows the algorithm described in
     // Horowitz and Sahni, _Fundamentals of Data Structures_ (1976),
     // p. 315.
 
     // Maps Objects to DigraphNodes that contain them
-    private Map poNodes = new HashMap();
+    private Map<E, DigraphNode<E>> poNodes = new HashMap<>();
 
     // The set of Objects
-    private Set nodes = poNodes.keySet();
+    private Set<E> nodes = poNodes.keySet();
 
     /**
      * Constructs a <code>PartiallyOrderedSet</code>.
@@ -81,20 +81,20 @@
      * collection, with an ordering that respects the orderings set
      * by the <code>setOrdering</code> method.
      */
-    public Iterator iterator() {
-        return new PartialOrderIterator(poNodes.values().iterator());
+    public Iterator<E> iterator() {
+        return new PartialOrderIterator<>(poNodes.values().iterator());
     }
 
     /**
      * Adds an <code>Object</code> to this
      * <code>PartiallyOrderedSet</code>.
      */
-    public boolean add(Object o) {
+    public boolean add(E o) {
         if (nodes.contains(o)) {
             return false;
         }
 
-        DigraphNode node = new DigraphNode(o);
+        DigraphNode<E> node = new DigraphNode<>(o);
         poNodes.put(o, node);
         return true;
     }
@@ -104,7 +104,7 @@
      * <code>PartiallyOrderedSet</code>.
      */
     public boolean remove(Object o) {
-        DigraphNode node = (DigraphNode)poNodes.get(o);
+        DigraphNode<E> node = poNodes.get(o);
         if (node == null) {
             return false;
         }
@@ -127,11 +127,9 @@
      * @return <code>true</code> if no prior ordering existed
      * between the nodes, <code>false</code>otherwise.
      */
-    public boolean setOrdering(Object first, Object second) {
-        DigraphNode firstPONode =
-            (DigraphNode)poNodes.get(first);
-        DigraphNode secondPONode =
-            (DigraphNode)poNodes.get(second);
+    public boolean setOrdering(E first, E second) {
+        DigraphNode<E> firstPONode = poNodes.get(first);
+        DigraphNode<E> secondPONode = poNodes.get(second);
 
         secondPONode.removeEdge(firstPONode);
         return firstPONode.addEdge(secondPONode);
@@ -142,11 +140,9 @@
      *
      * @return true if a prior prefence existed between the nodes.
      */
-    public boolean unsetOrdering(Object first, Object second) {
-        DigraphNode firstPONode =
-            (DigraphNode)poNodes.get(first);
-        DigraphNode secondPONode =
-            (DigraphNode)poNodes.get(second);
+    public boolean unsetOrdering(E first, E second) {
+        DigraphNode<E> firstPONode = poNodes.get(first);
+        DigraphNode<E> secondPONode = poNodes.get(second);
 
         return firstPONode.removeEdge(secondPONode) ||
             secondPONode.removeEdge(firstPONode);
@@ -156,25 +152,23 @@
      * Returns <code>true</code> if an ordering exists between two
      * nodes.
      */
-    public boolean hasOrdering(Object preferred, Object other) {
-        DigraphNode preferredPONode =
-            (DigraphNode)poNodes.get(preferred);
-        DigraphNode otherPONode =
-            (DigraphNode)poNodes.get(other);
+    public boolean hasOrdering(E preferred, E other) {
+        DigraphNode<E> preferredPONode = poNodes.get(preferred);
+        DigraphNode<E> otherPONode = poNodes.get(other);
 
         return preferredPONode.hasEdge(otherPONode);
     }
 }
 
-class PartialOrderIterator implements Iterator {
+class PartialOrderIterator<E> implements Iterator<E> {
 
-    LinkedList zeroList = new LinkedList();
-    Map inDegrees = new HashMap(); // DigraphNode -> Integer
+    LinkedList<DigraphNode<E>> zeroList = new LinkedList<>();
+    Map<DigraphNode<E>, Integer> inDegrees = new HashMap<>();
 
-    public PartialOrderIterator(Iterator iter) {
+    public PartialOrderIterator(Iterator<DigraphNode<E>> iter) {
         // Initialize scratch in-degree values, zero list
         while (iter.hasNext()) {
-            DigraphNode node = (DigraphNode)iter.next();
+            DigraphNode<E> node = iter.next();
             int inDegree = node.getInDegree();
             inDegrees.put(node, new Integer(inDegree));
 
@@ -189,14 +183,14 @@
         return !zeroList.isEmpty();
     }
 
-    public Object next() {
-        DigraphNode first = (DigraphNode)zeroList.removeFirst();
+    public E next() {
+        DigraphNode<E> first = zeroList.removeFirst();
 
         // For each out node of the output node, decrement its in-degree
-        Iterator outNodes = first.getOutNodes();
+        Iterator<DigraphNode<E>> outNodes = first.getOutNodes();
         while (outNodes.hasNext()) {
-            DigraphNode node = (DigraphNode)outNodes.next();
-            int inDegree = ((Integer)inDegrees.get(node)).intValue() - 1;
+            DigraphNode<E> node = outNodes.next();
+            int inDegree = inDegrees.get(node).intValue() - 1;
             inDegrees.put(node, new Integer(inDegree));
 
             // If the in-degree has fallen to 0, place the node on the list
--- a/jdk/src/share/classes/javax/imageio/spi/ServiceRegistry.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/imageio/spi/ServiceRegistry.java	Tue Apr 01 15:37:15 2014 +0200
@@ -99,7 +99,7 @@
 public class ServiceRegistry {
 
     // Class -> Registry
-    private Map categoryMap = new HashMap();
+    private Map<Class<?>, SubRegistry> categoryMap = new HashMap<>();
 
     /**
      * Constructs a <code>ServiceRegistry</code> instance with a
@@ -117,7 +117,7 @@
             throw new IllegalArgumentException("categories == null!");
         }
         while (categories.hasNext()) {
-            Class category = (Class)categories.next();
+            Class<?> category = categories.next();
             SubRegistry reg = new SubRegistry(this, category);
             categoryMap.put(category, reg);
         }
@@ -208,7 +208,7 @@
      * <code>Class</code>objects.
      */
     public Iterator<Class<?>> getCategories() {
-        Set keySet = categoryMap.keySet();
+        Set<Class<?>> keySet = categoryMap.keySet();
         return keySet.iterator();
     }
 
@@ -216,13 +216,13 @@
      * Returns an Iterator containing the subregistries to which the
      * provider belongs.
      */
-    private Iterator getSubRegistries(Object provider) {
-        List l = new ArrayList();
-        Iterator iter = categoryMap.keySet().iterator();
+    private Iterator<SubRegistry> getSubRegistries(Object provider) {
+        List<SubRegistry> l = new ArrayList<>();
+        Iterator<Class<?>> iter = categoryMap.keySet().iterator();
         while (iter.hasNext()) {
-            Class c = (Class)iter.next();
+            Class<?> c = iter.next();
             if (c.isAssignableFrom(provider.getClass())) {
-                l.add((SubRegistry)categoryMap.get(c));
+                l.add(categoryMap.get(c));
             }
         }
         return l.iterator();
@@ -259,7 +259,7 @@
         if (provider == null) {
             throw new IllegalArgumentException("provider == null!");
         }
-        SubRegistry reg = (SubRegistry)categoryMap.get(category);
+        SubRegistry reg = categoryMap.get(category);
         if (reg == null) {
             throw new IllegalArgumentException("category unknown!");
         }
@@ -292,9 +292,9 @@
         if (provider == null) {
             throw new IllegalArgumentException("provider == null!");
         }
-        Iterator regs = getSubRegistries(provider);
+        Iterator<SubRegistry> regs = getSubRegistries(provider);
         while (regs.hasNext()) {
-            SubRegistry reg = (SubRegistry)regs.next();
+            SubRegistry reg = regs.next();
             reg.registerServiceProvider(provider);
         }
     }
@@ -362,7 +362,7 @@
         if (provider == null) {
             throw new IllegalArgumentException("provider == null!");
         }
-        SubRegistry reg = (SubRegistry)categoryMap.get(category);
+        SubRegistry reg = categoryMap.get(category);
         if (reg == null) {
             throw new IllegalArgumentException("category unknown!");
         }
@@ -385,9 +385,9 @@
         if (provider == null) {
             throw new IllegalArgumentException("provider == null!");
         }
-        Iterator regs = getSubRegistries(provider);
+        Iterator<SubRegistry> regs = getSubRegistries(provider);
         while (regs.hasNext()) {
-            SubRegistry reg = (SubRegistry)regs.next();
+            SubRegistry reg = regs.next();
             reg.deregisterServiceProvider(provider);
         }
     }
@@ -408,9 +408,9 @@
         if (provider == null) {
             throw new IllegalArgumentException("provider == null!");
         }
-        Iterator regs = getSubRegistries(provider);
+        Iterator<SubRegistry> regs = getSubRegistries(provider);
         while (regs.hasNext()) {
-            SubRegistry reg = (SubRegistry)regs.next();
+            SubRegistry reg = regs.next();
             if (reg.contains(provider)) {
                 return true;
             }
@@ -442,11 +442,13 @@
      */
     public <T> Iterator<T> getServiceProviders(Class<T> category,
                                                boolean useOrdering) {
-        SubRegistry reg = (SubRegistry)categoryMap.get(category);
+        SubRegistry reg = categoryMap.get(category);
         if (reg == null) {
             throw new IllegalArgumentException("category unknown!");
         }
-        return reg.getServiceProviders(useOrdering);
+        @SuppressWarnings("unchecked")
+        Iterator<T> it = (Iterator<T>)reg.getServiceProviders(useOrdering);
+        return it;
     }
 
     /**
@@ -499,12 +501,12 @@
     public <T> Iterator<T> getServiceProviders(Class<T> category,
                                                Filter filter,
                                                boolean useOrdering) {
-        SubRegistry reg = (SubRegistry)categoryMap.get(category);
+        SubRegistry reg = categoryMap.get(category);
         if (reg == null) {
             throw new IllegalArgumentException("category unknown!");
         }
-        Iterator iter = getServiceProviders(category, useOrdering);
-        return new FilterIterator(iter, filter);
+        Iterator<T> iter = getServiceProviders(category, useOrdering);
+        return new FilterIterator<>(iter, filter);
     }
 
     /**
@@ -529,11 +531,11 @@
         if (providerClass == null) {
             throw new IllegalArgumentException("providerClass == null!");
         }
-        Iterator iter = categoryMap.keySet().iterator();
+        Iterator<Class<?>> iter = categoryMap.keySet().iterator();
         while (iter.hasNext()) {
-            Class c = (Class)iter.next();
+            Class<?> c = iter.next();
             if (c.isAssignableFrom(providerClass)) {
-                SubRegistry reg = (SubRegistry)categoryMap.get(c);
+                SubRegistry reg = categoryMap.get(c);
                 T provider = reg.getServiceProviderByClass(providerClass);
                 if (provider != null) {
                     return provider;
@@ -580,7 +582,7 @@
         if (firstProvider == secondProvider) {
             throw new IllegalArgumentException("providers are the same!");
         }
-        SubRegistry reg = (SubRegistry)categoryMap.get(category);
+        SubRegistry reg = categoryMap.get(category);
         if (reg == null) {
             throw new IllegalArgumentException("category unknown!");
         }
@@ -626,7 +628,7 @@
         if (firstProvider == secondProvider) {
             throw new IllegalArgumentException("providers are the same!");
         }
-        SubRegistry reg = (SubRegistry)categoryMap.get(category);
+        SubRegistry reg = categoryMap.get(category);
         if (reg == null) {
             throw new IllegalArgumentException("category unknown!");
         }
@@ -647,7 +649,7 @@
      * corresponding to <code>category</code>.
      */
     public void deregisterAll(Class<?> category) {
-        SubRegistry reg = (SubRegistry)categoryMap.get(category);
+        SubRegistry reg = categoryMap.get(category);
         if (reg == null) {
             throw new IllegalArgumentException("category unknown!");
         }
@@ -659,9 +661,9 @@
      * categories.
      */
     public void deregisterAll() {
-        Iterator iter = categoryMap.values().iterator();
+        Iterator<SubRegistry> iter = categoryMap.values().iterator();
         while (iter.hasNext()) {
-            SubRegistry reg = (SubRegistry)iter.next();
+            SubRegistry reg = iter.next();
             reg.clear();
         }
     }
@@ -690,15 +692,17 @@
 
     ServiceRegistry registry;
 
-    Class category;
+    Class<?> category;
 
     // Provider Objects organized by partial oridering
-    PartiallyOrderedSet poset = new PartiallyOrderedSet();
+    PartiallyOrderedSet<Object> poset = new PartiallyOrderedSet<>();
 
     // Class -> Provider Object of that class
-    Map<Class<?>,Object> map = new HashMap();
+    // No way to express heterogeneous map, we want
+    // Map<Class<T>, T>, where T is ?
+    Map<Class<?>, Object> map = new HashMap<>();
 
-    public SubRegistry(ServiceRegistry registry, Class category) {
+    public SubRegistry(ServiceRegistry registry, Class<?> category) {
         this.registry = registry;
         this.category = category;
     }
@@ -756,7 +760,7 @@
         return poset.unsetOrdering(firstProvider, secondProvider);
     }
 
-    public Iterator getServiceProviders(boolean useOrdering) {
+    public Iterator<Object> getServiceProviders(boolean useOrdering) {
         if (useOrdering) {
             return poset.iterator();
         } else {
@@ -764,12 +768,13 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     public <T> T getServiceProviderByClass(Class<T> providerClass) {
         return (T)map.get(providerClass);
     }
 
     public void clear() {
-        Iterator iter = map.values().iterator();
+        Iterator<Object> iter = map.values().iterator();
         while (iter.hasNext()) {
             Object provider = iter.next();
             iter.remove();
@@ -794,12 +799,12 @@
  */
 class FilterIterator<T> implements Iterator<T> {
 
-    private Iterator<T> iter;
+    private Iterator<? extends T> iter;
     private ServiceRegistry.Filter filter;
 
     private T next = null;
 
-    public FilterIterator(Iterator<T> iter,
+    public FilterIterator(Iterator<? extends T> iter,
                           ServiceRegistry.Filter filter) {
         this.iter = iter;
         this.filter = filter;
--- a/jdk/src/share/classes/javax/imageio/stream/ImageInputStreamImpl.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/imageio/stream/ImageInputStreamImpl.java	Tue Apr 01 15:37:15 2014 +0200
@@ -43,9 +43,9 @@
  */
 public abstract class ImageInputStreamImpl implements ImageInputStream {
 
-    private Stack markByteStack = new Stack();
+    private Stack<Long> markByteStack = new Stack<>();
 
-    private Stack markBitStack = new Stack();
+    private Stack<Integer> markBitStack = new Stack<>();
 
     private boolean isClosed = false;
 
@@ -798,14 +798,14 @@
             return;
         }
 
-        long pos = ((Long)markByteStack.pop()).longValue();
+        long pos = markByteStack.pop().longValue();
         if (pos < flushedPos) {
             throw new IIOException
                 ("Previous marked position has been discarded!");
         }
         seek(pos);
 
-        int offset = ((Integer)markBitStack.pop()).intValue();
+        int offset = markBitStack.pop().intValue();
         setBitOffset(offset);
     }
 
--- a/jdk/src/share/classes/javax/imageio/stream/MemoryCache.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/imageio/stream/MemoryCache.java	Tue Apr 01 15:37:15 2014 +0200
@@ -58,7 +58,7 @@
 
     private static final int BUFFER_LENGTH = 8192;
 
-    private ArrayList cache = new ArrayList();
+    private ArrayList<byte[]> cache = new ArrayList<>();
 
     private long cacheStart = 0L;
 
@@ -74,7 +74,7 @@
             // contiguous data...
             throw new IOException("Cache addressing limit exceeded!");
         }
-        return (byte[])cache.get((int)blockOffset);
+        return cache.get((int)blockOffset);
     }
 
     /**
--- a/jdk/src/share/classes/javax/smartcardio/TerminalFactory.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/smartcardio/TerminalFactory.java	Tue Apr 01 15:37:15 2014 +0200
@@ -32,8 +32,6 @@
 import sun.security.jca.*;
 import sun.security.jca.GetInstance.*;
 
-import sun.security.action.GetPropertyAction;
-
 /**
  * A factory for CardTerminal objects.
  *
@@ -99,8 +97,8 @@
 
     static {
         // lookup up the user specified type, default to PC/SC
-        String type = AccessController.doPrivileged
-                            (new GetPropertyAction(PROP_NAME, "PC/SC")).trim();
+        String type = AccessController.doPrivileged(
+             (PrivilegedAction<String>) () -> System.getProperty(PROP_NAME, "PC/SC")).trim();
         TerminalFactory factory = null;
         try {
             factory = TerminalFactory.getInstance(type, null);
--- a/jdk/src/share/classes/javax/swing/BufferStrategyPaintManager.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/BufferStrategyPaintManager.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,9 @@
 import java.util.*;
 
 import com.sun.java.swing.SwingUtilities3;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import sun.awt.AWTAccessor;
 
 import sun.awt.SubRegionShowable;
 import sun.java2d.SunGraphics2D;
@@ -69,12 +72,6 @@
     // if we get a blit strategy.
     //
 
-    //
-    // Methods used to create BufferStrategy for Applets.
-    //
-    private static Method COMPONENT_CREATE_BUFFER_STRATEGY_METHOD;
-    private static Method COMPONENT_GET_BUFFER_STRATEGY_METHOD;
-
     private static final PlatformLogger LOGGER = PlatformLogger.getLogger(
                            "javax.swing.BufferStrategyPaintManager");
 
@@ -143,44 +140,6 @@
      */
     private boolean disposeBufferOnEnd;
 
-    private static Method getGetBufferStrategyMethod() {
-        if (COMPONENT_GET_BUFFER_STRATEGY_METHOD == null) {
-            getMethods();
-        }
-        return COMPONENT_GET_BUFFER_STRATEGY_METHOD;
-    }
-
-    private static Method getCreateBufferStrategyMethod() {
-        if (COMPONENT_CREATE_BUFFER_STRATEGY_METHOD == null) {
-            getMethods();
-        }
-        return COMPONENT_CREATE_BUFFER_STRATEGY_METHOD;
-    }
-
-    private static void getMethods() {
-        java.security.AccessController.doPrivileged(
-                            new java.security.PrivilegedAction<Object>() {
-            public Object run() {
-                try {
-                    COMPONENT_CREATE_BUFFER_STRATEGY_METHOD = Component.class.
-                              getDeclaredMethod("createBufferStrategy",
-                                                new Class[] { int.class,
-                                                BufferCapabilities.class });
-                    COMPONENT_CREATE_BUFFER_STRATEGY_METHOD.
-                                            setAccessible(true);
-                    COMPONENT_GET_BUFFER_STRATEGY_METHOD = Component.class.
-                              getDeclaredMethod("getBufferStrategy");
-                    COMPONENT_GET_BUFFER_STRATEGY_METHOD.setAccessible(true);
-                } catch (SecurityException e) {
-                    assert false;
-                } catch (NoSuchMethodException nsme) {
-                    assert false;
-                }
-                return null;
-            }
-        });
-    }
-
     BufferStrategyPaintManager() {
         bufferInfos = new ArrayList<BufferInfo>(1);
     }
@@ -766,16 +725,7 @@
                     componentBS = ((Window)root).getBufferStrategy();
                 }
                 else {
-                    try {
-                        componentBS = (BufferStrategy)
-                                 getGetBufferStrategyMethod().invoke(root);
-                    } catch (InvocationTargetException ite) {
-                        assert false;
-                    } catch (IllegalArgumentException iae) {
-                        assert false;
-                    } catch (IllegalAccessException iae2) {
-                        assert false;
-                    }
+                    componentBS = AWTAccessor.getComponentAccessor().getBufferStrategy(root);
                 }
                 if (componentBS != ourBS) {
                     // Component has a different BS, dispose ours.
@@ -839,19 +789,16 @@
             BufferStrategy bs = null;
             if (SunToolkit.isInstanceOf(root, "java.applet.Applet")) {
                 try {
-                    getCreateBufferStrategyMethod().invoke(root, 2, caps);
-                    bs = (BufferStrategy)getGetBufferStrategyMethod().
-                                            invoke(root);
-                } catch (InvocationTargetException ite) {
+                    AWTAccessor.ComponentAccessor componentAccessor
+                            = AWTAccessor.getComponentAccessor();
+                    componentAccessor.createBufferStrategy(root, 2, caps);
+                    bs = componentAccessor.getBufferStrategy(root);
+                } catch (AWTException e) {
                     // Type is not supported
                     if (LOGGER.isLoggable(PlatformLogger.Level.FINER)) {
                         LOGGER.finer("createBufferStratety failed",
-                                     ite);
+                                     e);
                     }
-                } catch (IllegalArgumentException iae) {
-                    assert false;
-                } catch (IllegalAccessException iae2) {
-                    assert false;
                 }
             }
             else {
--- a/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java	Tue Apr 01 15:37:15 2014 +0200
@@ -677,6 +677,11 @@
 
           f.setBounds(currentBounds);
 
+          if (!floaterCollision) {
+              Rectangle r = currentBounds;
+              currentManager.notifyRepaintPerformed(parent, r.x, r.y, r.width, r.height);
+          }
+
           if(floaterCollision) {
               // since we couldn't blit we just redraw as fast as possible
               // the isDragging mucking is to avoid activating emergency
@@ -706,6 +711,8 @@
           // Fix the damage
           for (int i = 0; i < dirtyRects.length; i++) {
               parent.paintImmediately(dirtyRects[i]);
+              Rectangle r = dirtyRects[i];
+              currentManager.notifyRepaintPerformed(parent, r.x, r.y, r.width, r.height);
           }
 
           // new areas of blit were exposed
@@ -716,9 +723,10 @@
                   dirtyRects[i].x += newX - previousBounds.x;
                   dirtyRects[i].y += newY - previousBounds.y;
                   ((JInternalFrame)f).isDragging = false;
-
                   parent.paintImmediately(dirtyRects[i]);
                   ((JInternalFrame)f).isDragging = true;
+                  Rectangle r = dirtyRects[i];
+                  currentManager.notifyRepaintPerformed(parent, r.x, r.y, r.width, r.height);
               }
 
           }
--- a/jdk/src/share/classes/javax/swing/JSpinner.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/JSpinner.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1221,6 +1221,7 @@
             JFormattedTextField ftf = getTextField();
             ftf.setEditable(true);
             ftf.setFormatterFactory(factory);
+            // Change the text orientation for the NumberEditor
             ftf.setHorizontalAlignment(JTextField.RIGHT);
 
             /* TBD - initializing the column width of the text field
@@ -1264,6 +1265,16 @@
         public SpinnerNumberModel getModel() {
             return (SpinnerNumberModel)(getSpinner().getModel());
         }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void setComponentOrientation(ComponentOrientation o) {
+            super.setComponentOrientation(o);
+            getTextField().setHorizontalAlignment(
+                    o.isLeftToRight() ? JTextField.RIGHT : JTextField.LEFT);
+        }
     }
 
 
--- a/jdk/src/share/classes/javax/swing/JTable.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/JTable.java	Tue Apr 01 15:37:15 2014 +0200
@@ -5308,12 +5308,12 @@
         return retValue;
     }
 
-    private void setLazyValue(Hashtable h, Class c, String s) {
-        h.put(c, new SwingLazyValue(s));
-    }
-
-    private void setLazyRenderer(Class c, String s) {
-        setLazyValue(defaultRenderersByColumnClass, c, s);
+    private void setLazyValue(Hashtable h, Class c, LazyClass lazyClass) {
+        h.put(c, new TableLazyValue(lazyClass));
+    }
+
+    private void setLazyRenderer(Class c, LazyClass lazyClass) {
+        setLazyValue(defaultRenderersByColumnClass, c, lazyClass);
     }
 
     /**
@@ -5326,24 +5326,24 @@
         defaultRenderersByColumnClass = new UIDefaults(8, 0.75f);
 
         // Objects
-        setLazyRenderer(Object.class, "javax.swing.table.DefaultTableCellRenderer$UIResource");
+        setLazyRenderer(Object.class, LazyClass.UIResource);
 
         // Numbers
-        setLazyRenderer(Number.class, "javax.swing.JTable$NumberRenderer");
+        setLazyRenderer(Number.class, LazyClass.NumberRenderer);
 
         // Doubles and Floats
-        setLazyRenderer(Float.class, "javax.swing.JTable$DoubleRenderer");
-        setLazyRenderer(Double.class, "javax.swing.JTable$DoubleRenderer");
+        setLazyRenderer(Float.class, LazyClass.DoubleRenderer);
+        setLazyRenderer(Double.class, LazyClass.DoubleRenderer);
 
         // Dates
-        setLazyRenderer(Date.class, "javax.swing.JTable$DateRenderer");
+        setLazyRenderer(Date.class, LazyClass.DateRenderer);
 
         // Icons and ImageIcons
-        setLazyRenderer(Icon.class, "javax.swing.JTable$IconRenderer");
-        setLazyRenderer(ImageIcon.class, "javax.swing.JTable$IconRenderer");
+        setLazyRenderer(Icon.class, LazyClass.IconRenderer);
+        setLazyRenderer(ImageIcon.class, LazyClass.IconRenderer);
 
         // Booleans
-        setLazyRenderer(Boolean.class, "javax.swing.JTable$BooleanRenderer");
+        setLazyRenderer(Boolean.class, LazyClass.BooleanRenderer);
     }
 
     /**
@@ -5421,8 +5421,8 @@
         }
     }
 
-    private void setLazyEditor(Class c, String s) {
-        setLazyValue(defaultEditorsByColumnClass, c, s);
+    private void setLazyEditor(Class c, LazyClass lazyClass) {
+        setLazyValue(defaultEditorsByColumnClass, c, lazyClass);
     }
 
     /**
@@ -5433,13 +5433,13 @@
         defaultEditorsByColumnClass = new UIDefaults(3, 0.75f);
 
         // Objects
-        setLazyEditor(Object.class, "javax.swing.JTable$GenericEditor");
+        setLazyEditor(Object.class, LazyClass.GenericEditor);
 
         // Numbers
-        setLazyEditor(Number.class, "javax.swing.JTable$NumberEditor");
+        setLazyEditor(Number.class, LazyClass.NumberEditor);
 
         // Booleans
-        setLazyEditor(Boolean.class, "javax.swing.JTable$BooleanEditor");
+        setLazyEditor(Boolean.class, LazyClass.BooleanEditor);
     }
 
     /**
@@ -6545,6 +6545,53 @@
         }
     }
 
+    private enum LazyClass {
+
+        UIResource,
+        NumberRenderer,
+        DoubleRenderer,
+        DateRenderer,
+        IconRenderer,
+        BooleanRenderer,
+        GenericEditor,
+        NumberEditor,
+        BooleanEditor,
+    }
+
+    private static class TableLazyValue implements UIDefaults.LazyValue {
+
+        private LazyClass type;
+
+        public TableLazyValue(LazyClass type) {
+            this.type = type;
+        }
+
+        @Override
+        public Object createValue(UIDefaults table) {
+            switch (type) {
+                case UIResource:
+                    return new DefaultTableCellRenderer.UIResource();
+                case NumberRenderer:
+                    return new NumberRenderer();
+                case DoubleRenderer:
+                    return new DoubleRenderer();
+                case DateRenderer:
+                    return new DateRenderer();
+                case IconRenderer:
+                    return new IconRenderer();
+                case BooleanRenderer:
+                    return new BooleanRenderer();
+                case GenericEditor:
+                    return new GenericEditor();
+                case NumberEditor:
+                    return new NumberEditor();
+                case BooleanEditor:
+                    return new BooleanEditor();
+                default:
+                    return null;
+            }
+        }
+    }
 
 /////////////////
 // Accessibility support
--- a/jdk/src/share/classes/javax/swing/JViewport.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/JViewport.java	Tue Apr 01 15:37:15 2014 +0200
@@ -25,8 +25,6 @@
 
 package javax.swing;
 
-import sun.swing.JLightweightFrame;
-
 import java.awt.*;
 import java.awt.event.*;
 import java.awt.peer.ComponentPeer;
@@ -37,10 +35,8 @@
 import javax.swing.border.*;
 import javax.accessibility.*;
 
-
 import java.io.Serializable;
 
-
 /**
  * The "viewport" or "porthole" through which you see the underlying
  * information. When you scroll, what moves is the viewport. It is like
@@ -364,18 +360,6 @@
         super.remove(child);
     }
 
-    @Override
-    public void addNotify() {
-        super.addNotify();
-        // JLightweightFrame does not support BLIT_SCROLL_MODE, so it should be replaced
-        Window rootWindow = SwingUtilities.getWindowAncestor(this);
-        if (rootWindow instanceof JLightweightFrame
-                && getScrollMode() == BLIT_SCROLL_MODE) {
-            setScrollMode(BACKINGSTORE_SCROLL_MODE);
-        }
-    }
-
-
     /**
      * Scrolls the view so that <code>Rectangle</code>
      * within the view becomes visible.
@@ -1109,13 +1093,15 @@
                         Graphics g = JComponent.safelyGetGraphics(this);
                         flushViewDirtyRegion(g, dirty);
                         view.setLocation(newX, newY);
-                        g.setClip(0,0,getWidth(), Math.min(getHeight(),
-                                                           jview.getHeight()));
+                        Rectangle r = new Rectangle(
+                            0, 0, getWidth(), Math.min(getHeight(), jview.getHeight()));
+                        g.setClip(r);
                         // Repaint the complete component if the blit succeeded
                         // and needsRepaintAfterBlit returns true.
                         repaintAll = (windowBlitPaint(g) &&
                                       needsRepaintAfterBlit());
                         g.dispose();
+                        rm.notifyRepaintPerformed(this, r.x, r.y, r.width, r.height);
                         rm.markCompletelyClean((JComponent)getParent());
                         rm.markCompletelyClean(this);
                         rm.markCompletelyClean(jview);
--- a/jdk/src/share/classes/javax/swing/MenuSelectionManager.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/MenuSelectionManager.java	Tue Apr 01 15:37:15 2014 +0200
@@ -30,6 +30,7 @@
 import javax.swing.event.*;
 
 import sun.awt.AppContext;
+import sun.swing.SwingUtilities2;
 
 /**
  * A MenuSelectionManager owns the selection in menu hierarchy.
@@ -60,6 +61,12 @@
             if (msm == null) {
                 msm = new MenuSelectionManager();
                 context.put(MENU_SELECTION_MANAGER_KEY, msm);
+
+                // installing additional listener if found in the AppContext
+                Object o = context.get(SwingUtilities2.MENU_SELECTION_MANAGER_LISTENER_KEY);
+                if (o != null && o instanceof ChangeListener) {
+                    msm.addChangeListener((ChangeListener) o);
+                }
             }
 
             return msm;
--- a/jdk/src/share/classes/javax/swing/RepaintManager.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/RepaintManager.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,8 @@
 import sun.security.action.GetPropertyAction;
 
 import com.sun.java.swing.SwingUtilities3;
+import sun.swing.SwingAccessor;
+import sun.swing.SwingUtilities2.RepaintListener;
 
 /**
  * This class manages repaint requests, allowing the number
@@ -184,6 +186,17 @@
 
 
     static {
+        SwingAccessor.setRepaintManagerAccessor(new SwingAccessor.RepaintManagerAccessor() {
+            @Override
+            public void addRepaintListener(RepaintManager rm, RepaintListener l) {
+                rm.addRepaintListener(l);
+            }
+            @Override
+            public void removeRepaintListener(RepaintManager rm, RepaintListener l) {
+                rm.removeRepaintListener(l);
+            }
+        });
+
         volatileImageBufferEnabled = "true".equals(AccessController.
                 doPrivileged(new GetPropertyAction(
                 "swing.volatileImageBufferEnabled", "true")));
@@ -1267,6 +1280,33 @@
         getPaintManager().copyArea(c, g, x, y, w, h, deltaX, deltaY, clip);
     }
 
+    private java.util.List<RepaintListener> repaintListeners = new ArrayList<>(1);
+
+    private void addRepaintListener(RepaintListener l) {
+        repaintListeners.add(l);
+    }
+
+    private void removeRepaintListener(RepaintListener l) {
+        repaintListeners.remove(l);
+    }
+
+    /**
+     * Notify the attached repaint listeners that an area of the {@code c} component
+     * has been immediately repainted, that is without scheduling a repaint runnable,
+     * due to performing a "blit" (via calling the {@code copyArea} method).
+     *
+     * @param c the component
+     * @param x the x coordinate of the area
+     * @param y the y coordinate of the area
+     * @param w the width of the area
+     * @param h the height of the area
+     */
+    void notifyRepaintPerformed(JComponent c, int x, int y, int w, int h) {
+        for (RepaintListener l : repaintListeners) {
+            l.repaintPerformed(c, x, y, w, h);
+        }
+    }
+
     /**
      * Invoked prior to any paint/copyArea method calls.  This will
      * be followed by an invocation of <code>endPaint</code>.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java	Tue Apr 01 15:37:15 2014 +0200
@@ -109,8 +109,7 @@
 
 
     static {
-        newline = java.security.AccessController.doPrivileged(
-                                new GetPropertyAction("line.separator"));
+        newline = System.lineSeparator();
         if (newline == null) {
             newline = "\n";
         }
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java	Tue Apr 01 15:37:15 2014 +0200
@@ -997,21 +997,32 @@
                              "model".equals(propertyName)) {
                         ui.updateEnabledState();
                     }
-                else if ("font".equals(propertyName)) {
-                    JComponent editor = spinner.getEditor();
-                    if (editor!=null && editor instanceof JSpinner.DefaultEditor) {
-                        JTextField tf =
-                            ((JSpinner.DefaultEditor)editor).getTextField();
-                        if (tf != null) {
-                            if (tf.getFont() instanceof UIResource) {
-                                tf.setFont(spinner.getFont());
+                    else if ("font".equals(propertyName)) {
+                        JComponent editor = spinner.getEditor();
+                        if (editor!=null && editor instanceof JSpinner.DefaultEditor) {
+                            JTextField tf =
+                                ((JSpinner.DefaultEditor)editor).getTextField();
+                            if (tf != null) {
+                                if (tf.getFont() instanceof UIResource) {
+                                    tf.setFont(spinner.getFont());
+                                }
                             }
                         }
                     }
-                }
-                else if (JComponent.TOOL_TIP_TEXT_KEY.equals(propertyName)) {
-                    updateToolTipTextForChildren(spinner);
-                }
+                    else if (JComponent.TOOL_TIP_TEXT_KEY.equals(propertyName)) {
+                        updateToolTipTextForChildren(spinner);
+                    } else if ("componentOrientation".equals(propertyName)) {
+                        ComponentOrientation o
+                                = (ComponentOrientation) e.getNewValue();
+                        if (o != (ComponentOrientation) e.getOldValue()) {
+                            JComponent editor = spinner.getEditor();
+                            if (editor != null) {
+                                editor.applyComponentOrientation(o);
+                            }
+                            spinner.revalidate();
+                            spinner.repaint();
+                        }
+                    }
                 }
             } else if (e.getSource() instanceof JComponent) {
                 JComponent c = (JComponent)e.getSource();
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1067,9 +1067,69 @@
     /**
      * Data model for a type-face selection combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
-        protected JFileChooser getFileChooser() {
-            return MetalFileChooserUI.this.getFileChooser();
+    protected class FilterComboBoxModel extends AbstractListModel<Object> implements ComboBoxModel<Object>, PropertyChangeListener {
+        protected FileFilter[] filters;
+        protected FilterComboBoxModel() {
+            super();
+            filters = getFileChooser().getChoosableFileFilters();
+        }
+
+        public void propertyChange(PropertyChangeEvent e) {
+            String prop = e.getPropertyName();
+            if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
+                filters = (FileFilter[]) e.getNewValue();
+                fireContentsChanged(this, -1, -1);
+            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public void setSelectedItem(Object filter) {
+            if(filter != null) {
+                getFileChooser().setFileFilter((FileFilter) filter);
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public Object getSelectedItem() {
+            // Ensure that the current filter is in the list.
+            // NOTE: we shouldnt' have to do this, since JFileChooser adds
+            // the filter to the choosable filters list when the filter
+            // is set. Lets be paranoid just in case someone overrides
+            // setFileFilter in JFileChooser.
+            FileFilter currentFilter = getFileChooser().getFileFilter();
+            boolean found = false;
+            if(currentFilter != null) {
+                for (FileFilter filter : filters) {
+                    if (filter == currentFilter) {
+                        found = true;
+                    }
+                }
+                if(found == false) {
+                    getFileChooser().addChoosableFileFilter(currentFilter);
+                }
+            }
+            return getFileChooser().getFileFilter();
+        }
+
+        public int getSize() {
+            if(filters != null) {
+                return filters.length;
+            } else {
+                return 0;
+            }
+        }
+
+        public Object getElementAt(int index) {
+            if(index > getSize() - 1) {
+                // This shouldn't happen. Try to recover gracefully.
+                return getFileChooser().getFileFilter();
+            }
+            if(filters != null) {
+                return filters[index];
+            } else {
+                return null;
+            }
         }
     }
 
--- a/jdk/src/share/classes/javax/swing/text/AbstractDocument.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/text/AbstractDocument.java	Tue Apr 01 15:37:15 2014 +0200
@@ -698,7 +698,6 @@
             return;
         }
         DocumentFilter filter = getDocumentFilter();
-        InsertStringResult insertStringResult = null;
 
         writeLock();
 
@@ -706,23 +705,21 @@
             if (filter != null) {
                 filter.insertString(getFilterBypass(), offs, str, a);
             } else {
-                insertStringResult = handleInsertString(offs, str, a);
+                handleInsertString(offs, str, a);
             }
         } finally {
             writeUnlock();
         }
-
-        processInsertStringResult(insertStringResult);
     }
 
     /**
      * Performs the actual work of inserting the text; it is assumed the
      * caller has obtained a write lock before invoking this.
      */
-    private InsertStringResult handleInsertString(int offs, String str, AttributeSet a)
+    private void handleInsertString(int offs, String str, AttributeSet a)
             throws BadLocationException {
         if ((str == null) || (str.length() == 0)) {
-            return null;
+            return;
         }
         UndoableEdit u = data.insertString(offs, str);
         DefaultDocumentEvent e =
@@ -749,29 +746,11 @@
         insertUpdate(e, a);
         // Mark the edit as done.
         e.end();
-
-        InsertStringResult result = new InsertStringResult();
-
-        result.documentEvent = e;
-
+        fireInsertUpdate(e);
         // only fire undo if Content implementation supports it
         // undo for the composed text is not supported for now
         if (u != null && (a == null || !a.isDefined(StyleConstants.ComposedTextAttribute))) {
-            result.undoableEditEvent = new UndoableEditEvent(this, e);
-        }
-
-        return result;
-    }
-
-    private void processInsertStringResult(InsertStringResult insertStringResult) {
-        if (insertStringResult == null) {
-            return;
-        }
-
-        fireInsertUpdate(insertStringResult.documentEvent);
-
-        if (insertStringResult.undoableEditEvent != null) {
-            fireUndoableEditUpdate(insertStringResult.undoableEditEvent);
+            fireUndoableEditUpdate(new UndoableEditEvent(this, e));
         }
     }
 
@@ -3129,23 +3108,13 @@
         public void insertString(int offset, String string,
                                  AttributeSet attr) throws
                                         BadLocationException {
-            InsertStringResult insertStringResult = handleInsertString(offset, string, attr);
-
-            processInsertStringResult(insertStringResult);
+            handleInsertString(offset, string, attr);
         }
 
         public void replace(int offset, int length, String text,
                             AttributeSet attrs) throws BadLocationException {
             handleRemove(offset, length);
-
-            InsertStringResult insertStringResult = handleInsertString(offset, text, attrs);
-
-            processInsertStringResult(insertStringResult);
+            handleInsertString(offset, text, attrs);
         }
     }
-
-    private static class InsertStringResult {
-        DefaultDocumentEvent documentEvent;
-        UndoableEditEvent undoableEditEvent;
-    }
 }
--- a/jdk/src/share/classes/javax/swing/text/AbstractWriter.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/text/AbstractWriter.java	Tue Apr 01 15:37:15 2014 +0200
@@ -141,10 +141,7 @@
             setLineSeparator((String)docNewline);
         }
         else {
-            String newline = null;
-            try {
-                newline = System.getProperty("line.separator");
-            } catch (SecurityException se) {}
+            String newline = System.lineSeparator();
             if (newline == null) {
                 // Should not get here, but if we do it means we could not
                 // find a newline string, use \n in this case.
--- a/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java	Tue Apr 01 15:37:15 2014 +0200
@@ -317,9 +317,7 @@
         int offs = pos;
         Object endOfLineProperty = doc.getProperty(EndOfLineStringProperty);
         if (endOfLineProperty == null) {
-            try {
-                endOfLineProperty = System.getProperty("line.separator");
-            } catch (SecurityException se) { }
+            endOfLineProperty = System.lineSeparator();
         }
         String endOfLine;
         if (endOfLineProperty instanceof String) {
--- a/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2089,6 +2089,13 @@
                         // null end tag.
                         endTag(false);
                         continue;
+                    } else if (textpos == 0) {
+                        if (!legalElementContext(dtd.pcdata)) {
+                            error("unexpected.pcdata");
+                        }
+                        if (last.breaksFlow()) {
+                            space = false;
+                        }
                     }
                     break;
 
--- a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/ByteVector.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/ByteVector.java	Tue Apr 01 15:37:15 2014 +0200
@@ -259,41 +259,68 @@
             if (c >= '\001' && c <= '\177') {
                 data[len++] = (byte) c;
             } else {
-                int byteLength = i;
-                for (int j = i; j < charLength; ++j) {
-                    c = s.charAt(j);
-                    if (c >= '\001' && c <= '\177') {
-                        byteLength++;
-                    } else if (c > '\u07FF') {
-                        byteLength += 3;
-                    } else {
-                        byteLength += 2;
-                    }
-                }
-                if (byteLength > 65535) {
-                    throw new IllegalArgumentException();
-                }
-                data[length] = (byte) (byteLength >>> 8);
-                data[length + 1] = (byte) byteLength;
-                if (length + 2 + byteLength > data.length) {
-                    length = len;
-                    enlarge(2 + byteLength);
-                    data = this.data;
-                }
-                for (int j = i; j < charLength; ++j) {
-                    c = s.charAt(j);
-                    if (c >= '\001' && c <= '\177') {
-                        data[len++] = (byte) c;
-                    } else if (c > '\u07FF') {
-                        data[len++] = (byte) (0xE0 | c >> 12 & 0xF);
-                        data[len++] = (byte) (0x80 | c >> 6 & 0x3F);
-                        data[len++] = (byte) (0x80 | c & 0x3F);
-                    } else {
-                        data[len++] = (byte) (0xC0 | c >> 6 & 0x1F);
-                        data[len++] = (byte) (0x80 | c & 0x3F);
-                    }
-                }
-                break;
+                length = len;
+                return encodeUTF8(s, i, 65535);
+            }
+        }
+        length = len;
+        return this;
+    }
+
+    /**
+     * Puts an UTF8 string into this byte vector. The byte vector is
+     * automatically enlarged if necessary. The string length is encoded in two
+     * bytes before the encoded characters, if there is space for that (i.e. if
+     * this.length - i - 2 >= 0).
+     *
+     * @param s
+     *            the String to encode.
+     * @param i
+     *            the index of the first character to encode. The previous
+     *            characters are supposed to have already been encoded, using
+     *            only one byte per character.
+     * @param maxByteLength
+     *            the maximum byte length of the encoded string, including the
+     *            already encoded characters.
+     * @return this byte vector.
+     */
+    ByteVector encodeUTF8(final String s, int i, int maxByteLength) {
+        int charLength = s.length();
+        int byteLength = i;
+        char c;
+        for (int j = i; j < charLength; ++j) {
+            c = s.charAt(j);
+            if (c >= '\001' && c <= '\177') {
+                byteLength++;
+            } else if (c > '\u07FF') {
+                byteLength += 3;
+            } else {
+                byteLength += 2;
+            }
+        }
+        if (byteLength > maxByteLength) {
+            throw new IllegalArgumentException();
+        }
+        int start = length - i - 2;
+        if (start >= 0) {
+          data[start] = (byte) (byteLength >>> 8);
+          data[start + 1] = (byte) byteLength;
+        }
+        if (length + byteLength - i > data.length) {
+            enlarge(byteLength - i);
+        }
+        int len = length;
+        for (int j = i; j < charLength; ++j) {
+            c = s.charAt(j);
+            if (c >= '\001' && c <= '\177') {
+                data[len++] = (byte) c;
+            } else if (c > '\u07FF') {
+                data[len++] = (byte) (0xE0 | c >> 12 & 0xF);
+                data[len++] = (byte) (0x80 | c >> 6 & 0x3F);
+                data[len++] = (byte) (0x80 | c & 0x3F);
+            } else {
+                data[len++] = (byte) (0xC0 | c >> 6 & 0x1F);
+                data[len++] = (byte) (0x80 | c & 0x3F);
             }
         }
         length = len;
--- a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/ClassWriter.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/ClassWriter.java	Tue Apr 01 15:37:15 2014 +0200
@@ -716,7 +716,8 @@
             sourceFile = newUTF8(file);
         }
         if (debug != null) {
-            sourceDebug = new ByteVector().putUTF8(debug);
+            sourceDebug = new ByteVector().encodeUTF8(debug, 0,
+                    Integer.MAX_VALUE);
         }
     }
 
@@ -857,7 +858,7 @@
         }
         if (sourceDebug != null) {
             ++attributeCount;
-            size += sourceDebug.length + 4;
+            size += sourceDebug.length + 6;
             newUTF8("SourceDebugExtension");
         }
         if (enclosingMethodOwner != 0) {
@@ -946,9 +947,9 @@
             out.putShort(newUTF8("SourceFile")).putInt(2).putShort(sourceFile);
         }
         if (sourceDebug != null) {
-            int len = sourceDebug.length - 2;
+            int len = sourceDebug.length;
             out.putShort(newUTF8("SourceDebugExtension")).putInt(len);
-            out.putByteArray(sourceDebug.data, 2, len);
+            out.putByteArray(sourceDebug.data, 0, len);
         }
         if (enclosingMethodOwner != 0) {
             out.putShort(newUTF8("EnclosingMethod")).putInt(4);
--- a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/Frame.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/Frame.java	Tue Apr 01 15:37:15 2014 +0200
@@ -99,8 +99,8 @@
      * stack types. VALUE depends on KIND. For LOCAL types, it is an index in
      * the input local variable types. For STACK types, it is a position
      * relatively to the top of input frame stack. For BASE types, it is either
-     * one of the constants defined in FrameVisitor, or for OBJECT and
-     * UNINITIALIZED types, a tag and an index in the type table.
+     * one of the constants defined below, or for OBJECT and UNINITIALIZED
+     * types, a tag and an index in the type table.
      *
      * Output frames can contain types of any kind and with a positive or
      * negative dimension (and even unassigned types, represented by 0 - which
@@ -537,7 +537,7 @@
     /**
      * The types that are initialized in the basic block. A constructor
      * invocation on an UNINITIALIZED or UNINITIALIZED_THIS type must replace
-     * <i>every occurrence</i> of this type in the local variables and in the
+     * <i>every occurence</i> of this type in the local variables and in the
      * operand stack. This cannot be done during the first phase of the
      * algorithm since, during this phase, the local variables and the operand
      * stack are not completely computed. It is therefore necessary to store the
@@ -1446,6 +1446,7 @@
                 // if t is the NULL type, merge(u,t)=u, so there is no change
                 return false;
             } else if ((t & (DIM | BASE_KIND)) == (u & (DIM | BASE_KIND))) {
+                // if t and u have the same dimension and same base kind
                 if ((u & BASE_KIND) == OBJECT) {
                     // if t is also a reference type, and if u and t have the
                     // same dimension merge(u,t) = dim(t) | common parent of the
@@ -1458,9 +1459,13 @@
                     v = OBJECT | cw.addType("java/lang/Object");
                 }
             } else if ((t & BASE_KIND) == OBJECT || (t & DIM) != 0) {
-                // if t is any other reference or array type,
-                // merge(u,t)=java/lang/Object
-                v = OBJECT | cw.addType("java/lang/Object");
+                // if t is any other reference or array type, the merged type
+                // is Object, or min(dim(u), dim(t)) | java/lang/Object is u
+                // and t have different array dimensions
+                int tdim = t & DIM;
+                int udim = u & DIM;
+                v = (udim != tdim ? Math.min(tdim, udim) : 0) | OBJECT
+                        | cw.addType("java/lang/Object");
             } else {
                 // if t is any other type, merge(u,t)=TOP
                 v = TOP;
--- a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/commons/AnalyzerAdapter.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/commons/AnalyzerAdapter.java	Tue Apr 01 15:37:15 2014 +0200
@@ -240,6 +240,7 @@
                 locals.add(types[i].getInternalName());
             }
         }
+        maxLocals = locals.size();
     }
 
     @Override
@@ -519,12 +520,12 @@
     // ------------------------------------------------------------------------
 
     private Object get(final int local) {
-        maxLocals = Math.max(maxLocals, local);
+        maxLocals = Math.max(maxLocals, local + 1);
         return local < locals.size() ? locals.get(local) : Opcodes.TOP;
     }
 
     private void set(final int local, final Object type) {
-        maxLocals = Math.max(maxLocals, local);
+        maxLocals = Math.max(maxLocals, local + 1);
         while (local >= locals.size()) {
             locals.add(Opcodes.TOP);
         }
--- a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/InsnList.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/InsnList.java	Tue Apr 01 15:37:15 2014 +0200
@@ -556,6 +556,8 @@
 
         AbstractInsnNode prev;
 
+        AbstractInsnNode remove;
+
         InsnListIterator(int index) {
             if (index == size()) {
                 next = null;
@@ -577,12 +579,22 @@
             AbstractInsnNode result = next;
             prev = result;
             next = result.next;
+            remove = result;
             return result;
         }
 
         public void remove() {
-            InsnList.this.remove(prev);
-            prev = prev.prev;
+            if (remove != null) {
+                if (remove == next) {
+                    next = next.next;
+                } else {
+                    prev = prev.prev;
+                }
+                InsnList.this.remove(remove);
+                remove = null;
+            } else {
+                throw new IllegalStateException();
+            }
         }
 
         public boolean hasPrevious() {
@@ -593,6 +605,7 @@
             AbstractInsnNode result = prev;
             next = result;
             prev = result.prev;
+            remove = result;
             return result;
         }
 
@@ -619,6 +632,7 @@
         public void add(Object o) {
             InsnList.this.insertBefore(next, (AbstractInsnNode) o);
             prev = (AbstractInsnNode) o;
+            remove = null;
         }
 
         public void set(Object o) {
--- a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Analyzer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Analyzer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -404,7 +404,7 @@
      *         instruction of the method. The size of the returned array is
      *         equal to the number of instructions (and labels) of the method. A
      *         given frame is <tt>null</tt> if the corresponding instruction
-     *         cannot be reached, or if an error occurred during the analysis of
+     *         cannot be reached, or if an error occured during the analysis of
      *         the method.
      */
     public Frame<V>[] getFrames() {
--- a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/AnalyzerException.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/AnalyzerException.java	Tue Apr 01 15:37:15 2014 +0200
@@ -66,7 +66,7 @@
  * @author Bing Ran
  * @author Eric Bruneton
  */
-@SuppressWarnings("serial") // JDK-implementation class
+@SuppressWarnings("serial") // implementation class
 public class AnalyzerException extends Exception {
 
     public final AbstractInsnNode node;
--- a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Interpreter.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Interpreter.java	Tue Apr 01 15:37:15 2014 +0200
@@ -111,7 +111,7 @@
      *            the bytecode instruction to be interpreted.
      * @return the result of the interpretation of the given instruction.
      * @throws AnalyzerException
-     *             if an error occurred during the interpretation.
+     *             if an error occured during the interpretation.
      */
     public abstract V newOperation(AbstractInsnNode insn)
             throws AnalyzerException;
@@ -130,7 +130,7 @@
      * @return the result of the interpretation of the given instruction. The
      *         returned value must be <tt>equal</tt> to the given value.
      * @throws AnalyzerException
-     *             if an error occurred during the interpretation.
+     *             if an error occured during the interpretation.
      */
     public abstract V copyOperation(AbstractInsnNode insn, V value)
             throws AnalyzerException;
@@ -151,7 +151,7 @@
      *            the argument of the instruction to be interpreted.
      * @return the result of the interpretation of the given instruction.
      * @throws AnalyzerException
-     *             if an error occurred during the interpretation.
+     *             if an error occured during the interpretation.
      */
     public abstract V unaryOperation(AbstractInsnNode insn, V value)
             throws AnalyzerException;
@@ -175,7 +175,7 @@
      *            the second argument of the instruction to be interpreted.
      * @return the result of the interpretation of the given instruction.
      * @throws AnalyzerException
-     *             if an error occurred during the interpretation.
+     *             if an error occured during the interpretation.
      */
     public abstract V binaryOperation(AbstractInsnNode insn, V value1, V value2)
             throws AnalyzerException;
@@ -196,7 +196,7 @@
      *            the third argument of the instruction to be interpreted.
      * @return the result of the interpretation of the given instruction.
      * @throws AnalyzerException
-     *             if an error occurred during the interpretation.
+     *             if an error occured during the interpretation.
      */
     public abstract V ternaryOperation(AbstractInsnNode insn, V value1,
             V value2, V value3) throws AnalyzerException;
@@ -214,7 +214,7 @@
      *            the arguments of the instruction to be interpreted.
      * @return the result of the interpretation of the given instruction.
      * @throws AnalyzerException
-     *             if an error occurred during the interpretation.
+     *             if an error occured during the interpretation.
      */
     public abstract V naryOperation(AbstractInsnNode insn,
             List<? extends V> values) throws AnalyzerException;
@@ -232,7 +232,7 @@
      * @param expected
      *            the expected return type of the analyzed method.
      * @throws AnalyzerException
-     *             if an error occurred during the interpretation.
+     *             if an error occured during the interpretation.
      */
     public abstract void returnOperation(AbstractInsnNode insn, V value,
             V expected) throws AnalyzerException;
--- a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/util/CheckAnnotationAdapter.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/util/CheckAnnotationAdapter.java	Tue Apr 01 15:37:15 2014 +0200
@@ -99,7 +99,7 @@
         }
         if (value instanceof Type) {
             int sort = ((Type) value).getSort();
-            if (sort != Type.OBJECT && sort != Type.ARRAY) {
+            if (sort == Type.METHOD) {
                 throw new IllegalArgumentException("Invalid annotation value");
             }
         }
--- a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/util/Textifier.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/util/Textifier.java	Tue Apr 01 15:37:15 2014 +0200
@@ -166,6 +166,11 @@
      */
     protected Map<Label, String> labelNames;
 
+    /**
+     * Class access flags
+     */
+    private int access;
+
     private int valueNumber = 0;
 
     /**
@@ -245,6 +250,7 @@
     public void visit(final int version, final int access, final String name,
             final String signature, final String superName,
             final String[] interfaces) {
+        this.access = access;
         int major = version & 0xFFFF;
         int minor = version >>> 16;
         buf.setLength(0);
@@ -447,6 +453,11 @@
         if ((access & Opcodes.ACC_BRIDGE) != 0) {
             buf.append("bridge ");
         }
+        if ((this.access & Opcodes.ACC_INTERFACE) != 0
+                && (access & Opcodes.ACC_ABSTRACT) == 0
+                && (access & Opcodes.ACC_STATIC) == 0) {
+            buf.append("default ");
+        }
 
         buf.append(name);
         appendDescriptor(METHOD_DESCRIPTOR, desc);
@@ -856,7 +867,6 @@
         appendDescriptor(INTERNAL_NAME, owner);
         buf.append('.').append(name).append(' ');
         appendDescriptor(METHOD_DESCRIPTOR, desc);
-        buf.append(' ').append(itf ? "itf" : "");
         buf.append('\n');
         text.add(buf.toString());
     }
@@ -869,26 +879,35 @@
         buf.append(name);
         appendDescriptor(METHOD_DESCRIPTOR, desc);
         buf.append(" [");
+        buf.append('\n');
+        buf.append(tab3);
         appendHandle(bsm);
+        buf.append('\n');
         buf.append(tab3).append("// arguments:");
         if (bsmArgs.length == 0) {
             buf.append(" none");
         } else {
-            buf.append('\n').append(tab3);
+            buf.append('\n');
             for (int i = 0; i < bsmArgs.length; i++) {
+                buf.append(tab3);
                 Object cst = bsmArgs[i];
                 if (cst instanceof String) {
                     Printer.appendString(buf, (String) cst);
                 } else if (cst instanceof Type) {
-                    buf.append(((Type) cst).getDescriptor()).append(".class");
+                    Type type = (Type) cst;
+                    if(type.getSort() == Type.METHOD){
+                        appendDescriptor(METHOD_DESCRIPTOR, type.getDescriptor());
+                    } else {
+                        buf.append(type.getDescriptor()).append(".class");
+                    }
                 } else if (cst instanceof Handle) {
                     appendHandle((Handle) cst);
                 } else {
                     buf.append(cst);
                 }
-                buf.append(", ");
+                buf.append(", \n");
             }
-            buf.setLength(buf.length() - 2);
+            buf.setLength(buf.length() - 3);
         }
         buf.append('\n');
         buf.append(tab2).append("]\n");
@@ -1234,10 +1253,10 @@
      *            a handle, non null.
      */
     protected void appendHandle(final Handle h) {
-        buf.append('\n').append(tab3);
         int tag = h.getTag();
         buf.append("// handle kind 0x").append(Integer.toHexString(tag))
                 .append(" : ");
+        boolean isMethodHandle = false;
         switch (tag) {
         case Opcodes.H_GETFIELD:
             buf.append("GETFIELD");
@@ -1253,18 +1272,23 @@
             break;
         case Opcodes.H_INVOKEINTERFACE:
             buf.append("INVOKEINTERFACE");
+            isMethodHandle = true;
             break;
         case Opcodes.H_INVOKESPECIAL:
             buf.append("INVOKESPECIAL");
+            isMethodHandle = true;
             break;
         case Opcodes.H_INVOKESTATIC:
             buf.append("INVOKESTATIC");
+            isMethodHandle = true;
             break;
         case Opcodes.H_INVOKEVIRTUAL:
             buf.append("INVOKEVIRTUAL");
+            isMethodHandle = true;
             break;
         case Opcodes.H_NEWINVOKESPECIAL:
             buf.append("NEWINVOKESPECIAL");
+            isMethodHandle = true;
             break;
         }
         buf.append('\n');
@@ -1272,9 +1296,13 @@
         appendDescriptor(INTERNAL_NAME, h.getOwner());
         buf.append('.');
         buf.append(h.getName());
-        buf.append('(');
+        if(!isMethodHandle){
+            buf.append('(');
+        }
         appendDescriptor(HANDLE_DESCRIPTOR, h.getDesc());
-        buf.append(')').append('\n');
+        if(!isMethodHandle){
+            buf.append(')');
+        }
     }
 
     /**
--- a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/version.txt	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/version.txt	Tue Apr 01 15:37:15 2014 +0200
@@ -1,12 +1,12 @@
 Path: .
-Working Copy Root Path: /hudson/jobs/objectweb-pull/workspace/ASM_5_0_BETA
-URL: svn://svn.forge.objectweb.org/svnroot/asm/trunk/asm
-Repository Root: svn://svn.forge.objectweb.org/svnroot/asm
+Working Copy Root Path: /hudson/jobs/objectweb-pull/workspace/asm-svn-2014-03-12
+URL: file:///svnroot/asm/trunk/asm
+Repository Root: file:///svnroot/asm
 Repository UUID: 271bd773-ee82-43a6-9b2b-1890ed8ce7f9
-Revision: 1700
+Revision: 1721
 Node Kind: directory
 Schedule: normal
 Last Changed Author: ebruneton
-Last Changed Rev: 1700
-Last Changed Date: 2013-10-29 20:22:52 +0100 (Tue, 29 Oct 2013)
+Last Changed Rev: 1721
+Last Changed Date: 2014-03-02 17:25:35 +0100 (Sun, 02 Mar 2014)
 
--- a/jdk/src/share/classes/sun/awt/AWTAccessor.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
 import java.awt.event.InvocationEvent;
 import java.awt.event.KeyEvent;
 import java.awt.geom.Point2D;
+import java.awt.image.BufferStrategy;
 import java.awt.peer.ComponentPeer;
 
 import java.lang.reflect.InvocationTargetException;
@@ -243,6 +244,16 @@
          */
         void revalidateSynchronously(Component comp);
 
+        /**
+         * Creates a new strategy for multi-buffering on this component.
+         */
+        void createBufferStrategy(Component comp, int numBuffers,
+                BufferCapabilities caps) throws AWTException;
+
+        /**
+         * returns the buffer strategy used by this component.
+         */
+        BufferStrategy getBufferStrategy(Component comp);
     }
 
     /*
@@ -375,6 +386,11 @@
          * Accessor for InputEvent.getButtonDownMasks()
          */
         int[] getButtonDownMasks();
+
+        /*
+         * Accessor for InputEvent.canAccessSystemClipboard field
+         */
+        boolean canAccessSystemClipboard(InputEvent event);
     }
 
     /*
@@ -729,6 +745,13 @@
     }
 
     /*
+     * An accessor object for the SystemColor class
+     */
+    public interface SystemColorAccessor {
+        void updateSystemColors();
+    }
+
+    /*
      * Accessor instances are initialized in the static initializers of
      * corresponding AWT classes by using setters defined below.
      */
@@ -757,6 +780,7 @@
     private static SequencedEventAccessor sequencedEventAccessor;
     private static ToolkitAccessor toolkitAccessor;
     private static InvocationEventAccessor invocationEventAccessor;
+    private static SystemColorAccessor systemColorAccessor;
 
     /*
      * Set an accessor object for the java.awt.Component class.
@@ -1182,4 +1206,22 @@
     public static InvocationEventAccessor getInvocationEventAccessor() {
         return invocationEventAccessor;
     }
+
+    /*
+     * Get the accessor object for the java.awt.SystemColor class.
+     */
+    public static SystemColorAccessor getSystemColorAccessor() {
+        if (systemColorAccessor == null) {
+            unsafe.ensureClassInitialized(SystemColor.class);
+        }
+
+        return systemColorAccessor;
+    }
+
+     /*
+     * Set the accessor object for the java.awt.SystemColor class.
+     */
+     public static void setSystemColorAccessor(SystemColorAccessor systemColorAccessor) {
+         AWTAccessor.systemColorAccessor = systemColorAccessor;
+     }
 }
--- a/jdk/src/share/classes/sun/awt/FontConfiguration.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/awt/FontConfiguration.java	Tue Apr 01 15:37:15 2014 +0200
@@ -867,7 +867,7 @@
         return descriptors;
     }
 
-    private FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
+    protected FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
         String fontName = fontNames[fontIndex];
         String styleName = styleNames[styleIndex];
 
--- a/jdk/src/share/classes/sun/awt/HToolkit.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/awt/HToolkit.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
 
 package sun.awt;
 
+import sun.awt.datatransfer.DataTransferer;
+
 import java.awt.*;
 import java.awt.dnd.*;
 import java.awt.dnd.peer.DragSourceContextPeer;
@@ -184,6 +186,11 @@
         return false;
     }
 
+    @Override
+    public DataTransferer getDataTransferer() {
+        return null;
+    }
+
     public GlobalCursorManager getGlobalCursorManager()
         throws HeadlessException {
         throw new HeadlessException();
--- a/jdk/src/share/classes/sun/awt/SunHints.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/awt/SunHints.java	Tue Apr 01 15:37:15 2014 +0200
@@ -172,7 +172,7 @@
         }
     }
 
-    private static final int NUM_KEYS = 9;
+    private static final int NUM_KEYS = 10;
     private static final int VALS_PER_KEY = 8;
 
     /**
@@ -253,6 +253,13 @@
     @Native public static final int INTVAL_STROKE_PURE = 2;
 
     /**
+     * Image scaling hint key and values
+     */
+    @Native public static final int INTKEY_RESOLUTION_VARIANT = 9;
+    @Native public static final int INTVAL_RESOLUTION_VARIANT_DEFAULT = 0;
+    @Native public static final int INTVAL_RESOLUTION_VARIANT_OFF = 1;
+    @Native public static final int INTVAL_RESOLUTION_VARIANT_ON = 2;
+    /**
      * LCD text contrast control hint key.
      * Value is "100" to make discontiguous with the others which
      * are all enumerative and are of a different class.
@@ -450,6 +457,24 @@
                            SunHints.INTVAL_STROKE_PURE,
                            "Pure stroke conversion for accurate paths");
 
+    /**
+     * Image resolution variant hint key and value objects
+     */
+    public static final Key KEY_RESOLUTION_VARIANT =
+        new SunHints.Key(SunHints.INTKEY_RESOLUTION_VARIANT,
+                         "Global image resolution variant key");
+    public static final Object VALUE_RESOLUTION_VARIANT_DEFAULT =
+        new SunHints.Value(KEY_RESOLUTION_VARIANT,
+                           SunHints.INTVAL_RESOLUTION_VARIANT_DEFAULT,
+                           "Choose image resolutions based on a default heuristic");
+    public static final Object VALUE_RESOLUTION_VARIANT_OFF =
+        new SunHints.Value(KEY_RESOLUTION_VARIANT,
+                           SunHints.INTVAL_RESOLUTION_VARIANT_OFF,
+                           "Use only the standard resolution of an image");
+    public static final Object VALUE_RESOLUTION_VARIANT_ON =
+        new SunHints.Value(KEY_RESOLUTION_VARIANT,
+                           SunHints.INTVAL_RESOLUTION_VARIANT_ON,
+                           "Always use resolution-specific variants of images");
 
     public static class LCDContrastKey extends Key {
 
--- a/jdk/src/share/classes/sun/awt/SunToolkit.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/awt/SunToolkit.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,9 @@
 import java.awt.TrayIcon;
 import java.awt.SystemTray;
 import java.awt.event.InputEvent;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
@@ -43,6 +46,7 @@
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 
+import sun.awt.datatransfer.DataTransferer;
 import sun.util.logging.PlatformLogger;
 import sun.misc.SoftCache;
 import sun.font.FontDesignMetrics;
@@ -199,6 +203,8 @@
 
     public abstract boolean isTraySupported();
 
+    public abstract DataTransferer getDataTransferer();
+
     @SuppressWarnings("deprecation")
     public abstract FontPeer getFontPeer(String name, int style);
 
@@ -714,6 +720,194 @@
     static final SoftCache imgCache = new SoftCache();
 
     static Image getImageFromHash(Toolkit tk, URL url) {
+        checkPermissions(url);
+        synchronized (imgCache) {
+            Image img = (Image)imgCache.get(url);
+            if (img == null) {
+                try {
+                    img = tk.createImage(new URLImageSource(url));
+                    imgCache.put(url, img);
+                } catch (Exception e) {
+                }
+            }
+            return img;
+        }
+    }
+
+    static Image getImageFromHash(Toolkit tk,
+                                               String filename) {
+        checkPermissions(filename);
+        synchronized (imgCache) {
+            Image img = (Image)imgCache.get(filename);
+            if (img == null) {
+                try {
+                    img = tk.createImage(new FileImageSource(filename));
+                    imgCache.put(filename, img);
+                } catch (Exception e) {
+                }
+            }
+            return img;
+        }
+    }
+
+    public Image getImage(String filename) {
+        return getImageFromHash(this, filename);
+    }
+
+    public Image getImage(URL url) {
+        return getImageFromHash(this, url);
+    }
+
+    protected Image getImageWithResolutionVariant(String fileName,
+            String resolutionVariantName) {
+        synchronized (imgCache) {
+            Image image = getImageFromHash(this, fileName);
+            if (image instanceof MultiResolutionImage) {
+                return image;
+            }
+            Image resolutionVariant = getImageFromHash(this, resolutionVariantName);
+            image = createImageWithResolutionVariant(image, resolutionVariant);
+            imgCache.put(fileName, image);
+            return image;
+        }
+    }
+
+    protected Image getImageWithResolutionVariant(URL url,
+            URL resolutionVariantURL) {
+        synchronized (imgCache) {
+            Image image = getImageFromHash(this, url);
+            if (image instanceof MultiResolutionImage) {
+                return image;
+            }
+            Image resolutionVariant = getImageFromHash(this, resolutionVariantURL);
+            image = createImageWithResolutionVariant(image, resolutionVariant);
+            imgCache.put(url, image);
+            return image;
+        }
+    }
+
+
+    public Image createImage(String filename) {
+        checkPermissions(filename);
+        return createImage(new FileImageSource(filename));
+    }
+
+    public Image createImage(URL url) {
+        checkPermissions(url);
+        return createImage(new URLImageSource(url));
+    }
+
+    public Image createImage(byte[] data, int offset, int length) {
+        return createImage(new ByteArrayImageSource(data, offset, length));
+    }
+
+    public Image createImage(ImageProducer producer) {
+        return new ToolkitImage(producer);
+    }
+
+    public static Image createImageWithResolutionVariant(Image image,
+            Image resolutionVariant) {
+        return new MultiResolutionToolkitImage(image, resolutionVariant);
+    }
+
+    public int checkImage(Image img, int w, int h, ImageObserver o) {
+        if (!(img instanceof ToolkitImage)) {
+            return ImageObserver.ALLBITS;
+        }
+
+        ToolkitImage tkimg = (ToolkitImage)img;
+        int repbits;
+        if (w == 0 || h == 0) {
+            repbits = ImageObserver.ALLBITS;
+        } else {
+            repbits = tkimg.getImageRep().check(o);
+        }
+        return (tkimg.check(o) | repbits) & checkResolutionVariant(img, w, h, o);
+    }
+
+    public boolean prepareImage(Image img, int w, int h, ImageObserver o) {
+        if (w == 0 || h == 0) {
+            return true;
+        }
+
+        // Must be a ToolkitImage
+        if (!(img instanceof ToolkitImage)) {
+            return true;
+        }
+
+        ToolkitImage tkimg = (ToolkitImage)img;
+        if (tkimg.hasError()) {
+            if (o != null) {
+                o.imageUpdate(img, ImageObserver.ERROR|ImageObserver.ABORT,
+                              -1, -1, -1, -1);
+            }
+            return false;
+        }
+        ImageRepresentation ir = tkimg.getImageRep();
+        return ir.prepare(o) & prepareResolutionVariant(img, w, h, o);
+    }
+
+    private int checkResolutionVariant(Image img, int w, int h, ImageObserver o) {
+        ToolkitImage rvImage = getResolutionVariant(img);
+        // Ignore the resolution variant in case of error
+        return (rvImage == null || rvImage.hasError()) ? 0xFFFF :
+                checkImage(rvImage, 2 * w, 2 * h, MultiResolutionToolkitImage.
+                                getResolutionVariantObserver(
+                                        img, o, w, h, 2 * w, 2 * h));
+    }
+
+    private boolean prepareResolutionVariant(Image img, int w, int h,
+            ImageObserver o) {
+
+        ToolkitImage rvImage = getResolutionVariant(img);
+        // Ignore the resolution variant in case of error
+        return rvImage == null || rvImage.hasError() || prepareImage(
+                rvImage, 2 * w, 2 * h,
+                MultiResolutionToolkitImage.getResolutionVariantObserver(
+                        img, o, w, h, 2 * w, 2 * h));
+    }
+
+    private static ToolkitImage getResolutionVariant(Image image) {
+        if (image instanceof MultiResolutionToolkitImage) {
+            Image resolutionVariant = ((MultiResolutionToolkitImage) image).
+                    getResolutionVariant();
+            if (resolutionVariant instanceof ToolkitImage) {
+                return (ToolkitImage) resolutionVariant;
+            }
+        }
+        return null;
+    }
+
+    protected static boolean imageCached(Object key) {
+        return imgCache.containsKey(key);
+    }
+
+    protected static boolean imageExists(String filename) {
+        checkPermissions(filename);
+        return filename != null && new File(filename).exists();
+    }
+
+    @SuppressWarnings("try")
+    protected static boolean imageExists(URL url) {
+        checkPermissions(url);
+        if (url != null) {
+            try (InputStream is = url.openStream()) {
+                return true;
+            }catch(IOException e){
+                return false;
+            }
+        }
+        return false;
+    }
+
+    private static void checkPermissions(String filename) {
+        SecurityManager security = System.getSecurityManager();
+        if (security != null) {
+            security.checkRead(filename);
+        }
+    }
+
+    private static void checkPermissions(URL url) {
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
             try {
@@ -741,128 +935,6 @@
                     sm.checkConnect(url.getHost(), url.getPort());
             }
         }
-        synchronized (imgCache) {
-            Image img = (Image)imgCache.get(url);
-            if (img == null) {
-                try {
-                    img = tk.createImage(new URLImageSource(url));
-                    imgCache.put(url, img);
-                } catch (Exception e) {
-                }
-            }
-            return img;
-        }
-    }
-
-    static Image getImageFromHash(Toolkit tk,
-                                               String filename) {
-        SecurityManager security = System.getSecurityManager();
-        if (security != null) {
-            security.checkRead(filename);
-        }
-        synchronized (imgCache) {
-            Image img = (Image)imgCache.get(filename);
-            if (img == null) {
-                try {
-                    img = tk.createImage(new FileImageSource(filename));
-                    imgCache.put(filename, img);
-                } catch (Exception e) {
-                }
-            }
-            return img;
-        }
-    }
-
-    public Image getImage(String filename) {
-        return getImageFromHash(this, filename);
-    }
-
-    public Image getImage(URL url) {
-        return getImageFromHash(this, url);
-    }
-
-    public Image createImage(String filename) {
-        SecurityManager security = System.getSecurityManager();
-        if (security != null) {
-            security.checkRead(filename);
-        }
-        return createImage(new FileImageSource(filename));
-    }
-
-    public Image createImage(URL url) {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            try {
-                java.security.Permission perm =
-                    url.openConnection().getPermission();
-                if (perm != null) {
-                    try {
-                        sm.checkPermission(perm);
-                    } catch (SecurityException se) {
-                        // fallback to checkRead/checkConnect for pre 1.2
-                        // security managers
-                        if ((perm instanceof java.io.FilePermission) &&
-                            perm.getActions().indexOf("read") != -1) {
-                            sm.checkRead(perm.getName());
-                        } else if ((perm instanceof
-                            java.net.SocketPermission) &&
-                            perm.getActions().indexOf("connect") != -1) {
-                            sm.checkConnect(url.getHost(), url.getPort());
-                        } else {
-                            throw se;
-                        }
-                    }
-                }
-            } catch (java.io.IOException ioe) {
-                    sm.checkConnect(url.getHost(), url.getPort());
-            }
-        }
-        return createImage(new URLImageSource(url));
-    }
-
-    public Image createImage(byte[] data, int offset, int length) {
-        return createImage(new ByteArrayImageSource(data, offset, length));
-    }
-
-    public Image createImage(ImageProducer producer) {
-        return new ToolkitImage(producer);
-    }
-
-    public int checkImage(Image img, int w, int h, ImageObserver o) {
-        if (!(img instanceof ToolkitImage)) {
-            return ImageObserver.ALLBITS;
-        }
-
-        ToolkitImage tkimg = (ToolkitImage)img;
-        int repbits;
-        if (w == 0 || h == 0) {
-            repbits = ImageObserver.ALLBITS;
-        } else {
-            repbits = tkimg.getImageRep().check(o);
-        }
-        return tkimg.check(o) | repbits;
-    }
-
-    public boolean prepareImage(Image img, int w, int h, ImageObserver o) {
-        if (w == 0 || h == 0) {
-            return true;
-        }
-
-        // Must be a ToolkitImage
-        if (!(img instanceof ToolkitImage)) {
-            return true;
-        }
-
-        ToolkitImage tkimg = (ToolkitImage)img;
-        if (tkimg.hasError()) {
-            if (o != null) {
-                o.imageUpdate(img, ImageObserver.ERROR|ImageObserver.ABORT,
-                              -1, -1, -1, -1);
-            }
-            return false;
-        }
-        ImageRepresentation ir = tkimg.getImageRep();
-        return ir.prepare(o);
     }
 
     /**
@@ -1120,19 +1192,6 @@
         return getStartupLocale();
     }
 
-    private static String dataTransfererClassName = null;
-
-    protected static void setDataTransfererClassName(String className) {
-        dataTransfererClassName = className;
-    }
-
-    public static String getDataTransfererClassName() {
-        if (dataTransfererClassName == null) {
-            Toolkit.getDefaultToolkit(); // transferer set during toolkit init
-        }
-        return dataTransfererClassName;
-    }
-
     // Support for window closing event notifications
     private transient WindowClosingListener windowClosingListener = null;
     /**
--- a/jdk/src/share/classes/sun/awt/datatransfer/ClipboardTransferable.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/awt/datatransfer/ClipboardTransferable.java	Tue Apr 01 15:37:15 2014 +0200
@@ -32,7 +32,6 @@
 import java.io.IOException;
 
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 
@@ -55,7 +54,7 @@
  * @since 1.4 (appeared in modified form as FullyRenderedTransferable in 1.3.1)
  */
 public class ClipboardTransferable implements Transferable {
-    private final HashMap flavorsToData = new HashMap();
+    private final Map<DataFlavor, Object> flavorsToData = new HashMap<>();
     private DataFlavor[] flavors = new DataFlavor[0];
 
     private final class DataFactory {
@@ -84,20 +83,13 @@
                 // Since the SystemFlavorMap will specify many DataFlavors
                 // which map to the same format, we should cache data as we
                 // read it.
-                HashMap cached_data = new HashMap(formats.length, 1.0f);
+                Map<Long, Object> cached_data = new HashMap<>(formats.length, 1.0f);
+                DataTransferer.getInstance()
+                        .getFlavorsForFormats(formats, SunClipboard.flavorMap)
+                        .entrySet()
+                        .forEach(entry -> fetchOneFlavor(clipboard, entry.getKey(), entry.getValue(), cached_data));
+                flavors = DataTransferer.setToSortedDataFlavorArray(flavorsToData.keySet());
 
-                Map flavorsForFormats = DataTransferer.getInstance().
-                    getFlavorsForFormats(formats, SunClipboard.flavorMap);
-                for (Iterator iter = flavorsForFormats.keySet().iterator();
-                     iter.hasNext(); )
-                {
-                    DataFlavor flavor = (DataFlavor)iter.next();
-                    Long lFormat = (Long)flavorsForFormats.get(flavor);
-
-                    fetchOneFlavor(clipboard, flavor, lFormat, cached_data);
-                }
-
-                flavors = DataTransferer.setToSortedDataFlavorArray(flavorsToData.keySet());
             }
         } finally {
             clipboard.closeClipboard();
@@ -105,13 +97,12 @@
     }
 
     private boolean fetchOneFlavor(SunClipboard clipboard, DataFlavor flavor,
-                                   Long lFormat, HashMap cached_data)
+                                   long format, Map<Long, Object> cached_data)
     {
         if (!flavorsToData.containsKey(flavor)) {
-            long format = lFormat.longValue();
             Object data = null;
 
-            if (!cached_data.containsKey(lFormat)) {
+            if (!cached_data.containsKey(format)) {
                 try {
                     data = clipboard.getClipboardData(format);
                 } catch (IOException e) {
@@ -122,9 +113,9 @@
 
                 // Cache this data, even if it's null, so we don't have to go
                 // to native code again for this format.
-                cached_data.put(lFormat, data);
+                cached_data.put(format, data);
             } else {
-                data = cached_data.get(lFormat);
+                data = cached_data.get(format);
             }
 
             // Casting IOException to byte array causes ClassCastException.
@@ -134,8 +125,7 @@
                 flavorsToData.put(flavor, data);
                 return false;
             } else if (data != null) {
-                flavorsToData.put(flavor, new DataFactory(format,
-                                                          (byte[])data));
+                flavorsToData.put(flavor, new DataFactory(format, (byte[])data));
                 return true;
             }
         }
@@ -143,14 +133,17 @@
         return false;
     }
 
+    @Override
     public DataFlavor[] getTransferDataFlavors() {
         return flavors.clone();
     }
 
+    @Override
     public boolean isDataFlavorSupported(DataFlavor flavor) {
         return flavorsToData.containsKey(flavor);
     }
 
+    @Override
     public Object getTransferData(DataFlavor flavor)
         throws UnsupportedFlavorException, IOException
     {
--- a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,10 +25,10 @@
 
 package sun.awt.datatransfer;
 
-import java.awt.AWTError;
 import java.awt.EventQueue;
+import java.awt.Graphics;
 import java.awt.Image;
-import java.awt.Graphics;
+import java.awt.Toolkit;
 
 import java.awt.datatransfer.DataFlavor;
 import java.awt.datatransfer.FlavorMap;
@@ -70,6 +70,7 @@
 import java.security.PrivilegedExceptionAction;
 import java.security.ProtectionDomain;
 
+import java.util.AbstractMap;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -112,6 +113,7 @@
 import sun.awt.image.ToolkitImage;
 
 import java.io.FilePermission;
+import java.util.stream.Stream;
 
 
 /**
@@ -136,27 +138,6 @@
  * @since 1.3.1
  */
 public abstract class DataTransferer {
-
-    /**
-     * Cached value of Class.forName("[C");
-     */
-    public static final Class charArrayClass;
-
-    /**
-     * Cached value of Class.forName("[B");
-     */
-    public static final Class byteArrayClass;
-
-    /**
-     * The <code>DataFlavor</code> representing plain text with Unicode
-     * encoding, where:
-     * <pre>
-     *     representationClass = java.lang.String
-     *     mimeType            = "text/plain; charset=Unicode"
-     * </pre>
-     */
-    public static final DataFlavor plainTextStringFlavor;
-
     /**
      * The <code>DataFlavor</code> representing a Java text encoding String
      * encoded in UTF-8, where
@@ -174,9 +155,9 @@
         private static final SortedSet<String> standardEncodings = load();
 
         private static SortedSet<String> load() {
-            final Comparator comparator =
+            final Comparator<String> comparator =
                     new CharsetComparator(IndexedComparator.SELECT_WORST);
-            final SortedSet<String> tempSet = new TreeSet<String>(comparator);
+            final SortedSet<String> tempSet = new TreeSet<>(comparator);
             tempSet.add("US-ASCII");
             tempSet.add("ISO-8859-1");
             tempSet.add("UTF-8");
@@ -194,7 +175,7 @@
      * listed in the DataFlavor.selectBestTextFlavor method comment. Additional
      * entries may be added during the life of the JRE for text/<other> types.
      */
-    private static final Map textMIMESubtypeCharsetSupport;
+    private static final Map<String, Boolean> textMIMESubtypeCharsetSupport;
 
     /**
      * Cache of the platform default encoding as specified in the
@@ -206,67 +187,43 @@
      * A collection of all natives listed in flavormap.properties with
      * a primary MIME type of "text".
      */
-    private static final Set textNatives =
-        Collections.synchronizedSet(new HashSet());
+    private static final Set<Long> textNatives =
+            Collections.synchronizedSet(new HashSet<>());
 
     /**
      * The native encodings/charsets for the Set of textNatives.
      */
-    private static final Map nativeCharsets =
-        Collections.synchronizedMap(new HashMap());
+    private static final Map<Long, String> nativeCharsets =
+            Collections.synchronizedMap(new HashMap<>());
 
     /**
      * The end-of-line markers for the Set of textNatives.
      */
-    private static final Map nativeEOLNs =
-        Collections.synchronizedMap(new HashMap());
+    private static final Map<Long, String> nativeEOLNs =
+            Collections.synchronizedMap(new HashMap<>());
 
     /**
      * The number of terminating NUL bytes for the Set of textNatives.
      */
-    private static final Map nativeTerminators =
-        Collections.synchronizedMap(new HashMap());
+    private static final Map<Long, Integer> nativeTerminators =
+            Collections.synchronizedMap(new HashMap<>());
 
     /**
      * The key used to store pending data conversion requests for an AppContext.
      */
     private static final String DATA_CONVERTER_KEY = "DATA_CONVERTER_KEY";
 
-    /**
-     * The singleton DataTransferer instance. It is created during MToolkit
-     * or WToolkit initialization.
-     */
-    private static DataTransferer transferer;
-
     private static final PlatformLogger dtLog = PlatformLogger.getLogger("sun.awt.datatransfer.DataTransfer");
 
     static {
-        Class tCharArrayClass = null, tByteArrayClass = null;
-        try {
-            tCharArrayClass = Class.forName("[C");
-            tByteArrayClass = Class.forName("[B");
-        } catch (ClassNotFoundException cannotHappen) {
-        }
-        charArrayClass = tCharArrayClass;
-        byteArrayClass = tByteArrayClass;
-
-        DataFlavor tPlainTextStringFlavor = null;
-        try {
-            tPlainTextStringFlavor = new DataFlavor
-                ("text/plain;charset=Unicode;class=java.lang.String");
-        } catch (ClassNotFoundException cannotHappen) {
-        }
-        plainTextStringFlavor = tPlainTextStringFlavor;
-
         DataFlavor tJavaTextEncodingFlavor = null;
         try {
-            tJavaTextEncodingFlavor = new DataFlavor
-                ("application/x-java-text-encoding;class=\"[B\"");
+            tJavaTextEncodingFlavor = new DataFlavor("application/x-java-text-encoding;class=\"[B\"");
         } catch (ClassNotFoundException cannotHappen) {
         }
         javaTextEncodingFlavor = tJavaTextEncodingFlavor;
 
-        Map tempMap = new HashMap(17);
+        Map<String, Boolean> tempMap = new HashMap<>(17);
         tempMap.put("sgml", Boolean.TRUE);
         tempMap.put("xml", Boolean.TRUE);
         tempMap.put("html", Boolean.TRUE);
@@ -290,63 +247,8 @@
      * that in a headless environment, there may be no DataTransferer instance;
      * instead, null will be returned.
      */
-    public static DataTransferer getInstance() {
-        synchronized (DataTransferer.class) {
-            if (transferer == null) {
-                final String name = SunToolkit.getDataTransfererClassName();
-                if (name != null) {
-                    PrivilegedAction<DataTransferer> action = new PrivilegedAction<DataTransferer>()
-                    {
-                      public DataTransferer run() {
-                          Class cls = null;
-                          Method method = null;
-                          DataTransferer ret = null;
-
-                          try {
-                              cls = Class.forName(name);
-                          } catch (ClassNotFoundException e) {
-                              ClassLoader cl = ClassLoader.
-                                  getSystemClassLoader();
-                              if (cl != null) {
-                                  try {
-                                      cls = cl.loadClass(name);
-                                  } catch (ClassNotFoundException ee) {
-                                      ee.printStackTrace();
-                                      throw new AWTError("DataTransferer not found: " + name);
-                                  }
-                              }
-                          }
-                          if (cls != null) {
-                              try {
-                                  method = cls.getDeclaredMethod("getInstanceImpl");
-                                  method.setAccessible(true);
-                              } catch (NoSuchMethodException e) {
-                                  e.printStackTrace();
-                                  throw new AWTError("Cannot instantiate DataTransferer: " + name);
-                              } catch (SecurityException e) {
-                                  e.printStackTrace();
-                                  throw new AWTError("Access is denied for DataTransferer: " + name);
-                              }
-                          }
-                          if (method != null) {
-                              try {
-                                  ret = (DataTransferer) method.invoke(null);
-                              } catch (InvocationTargetException e) {
-                                  e.printStackTrace();
-                                  throw new AWTError("Cannot instantiate DataTransferer: " + name);
-                              } catch (IllegalAccessException e) {
-                                  e.printStackTrace();
-                                  throw new AWTError("Cannot access DataTransferer: " + name);
-                              }
-                          }
-                          return ret;
-                      }
-                    };
-                    transferer = AccessController.doPrivileged(action);
-                }
-            }
-        }
-        return transferer;
+    public static synchronized DataTransferer getInstance() {
+        return ((SunToolkit) Toolkit.getDefaultToolkit()).getDataTransferer();
     }
 
     /**
@@ -409,29 +311,27 @@
             return false;
         }
 
-        Object support = textMIMESubtypeCharsetSupport.get(subType);
+        Boolean support = textMIMESubtypeCharsetSupport.get(subType);
 
         if (support != null) {
-            return (support == Boolean.TRUE);
+            return support;
         }
 
         boolean ret_val = (flavor.getParameter("charset") != null);
-        textMIMESubtypeCharsetSupport.put
-            (subType, (ret_val) ? Boolean.TRUE : Boolean.FALSE);
+        textMIMESubtypeCharsetSupport.put(subType, ret_val);
         return ret_val;
     }
     public static boolean doesSubtypeSupportCharset(String subType,
                                                     String charset)
     {
-        Object support = textMIMESubtypeCharsetSupport.get(subType);
+        Boolean support = textMIMESubtypeCharsetSupport.get(subType);
 
         if (support != null) {
-            return (support == Boolean.TRUE);
+            return support;
         }
 
         boolean ret_val = (charset != null);
-        textMIMESubtypeCharsetSupport.put
-            (subType, (ret_val) ? Boolean.TRUE : Boolean.FALSE);
+        textMIMESubtypeCharsetSupport.put(subType, ret_val);
         return ret_val;
     }
 
@@ -459,14 +359,14 @@
         if (flavor.isRepresentationClassReader() ||
             String.class.equals(rep_class) ||
             flavor.isRepresentationClassCharBuffer() ||
-            DataTransferer.charArrayClass.equals(rep_class))
+            char[].class.equals(rep_class))
         {
             return true;
         }
 
         if (!(flavor.isRepresentationClassInputStream() ||
               flavor.isRepresentationClassByteBuffer() ||
-              DataTransferer.byteArrayClass.equals(rep_class))) {
+              byte[].class.equals(rep_class))) {
             return false;
         }
 
@@ -490,15 +390,14 @@
 
         return (flavor.isRepresentationClassInputStream() ||
                 flavor.isRepresentationClassByteBuffer() ||
-                DataTransferer.byteArrayClass.
-                    equals(flavor.getRepresentationClass()));
+                byte[].class.equals(flavor.getRepresentationClass()));
     }
 
     /**
      * Determines whether this JRE can both encode and decode text in the
      * specified encoding.
      */
-    public static boolean isEncodingSupported(String encoding) {
+    private static boolean isEncodingSupported(String encoding) {
         if (encoding == null) {
             return false;
         }
@@ -536,37 +435,35 @@
         }
 
         return new FlavorTable() {
-                public Map getNativesForFlavors(DataFlavor[] flavors) {
-                    return map.getNativesForFlavors(flavors);
-                }
-                public Map getFlavorsForNatives(String[] natives) {
-                    return map.getFlavorsForNatives(natives);
+            @Override
+            public Map<DataFlavor, String> getNativesForFlavors(DataFlavor[] flavors) {
+                return map.getNativesForFlavors(flavors);
+            }
+            @Override
+            public Map<String, DataFlavor> getFlavorsForNatives(String[] natives) {
+                return map.getFlavorsForNatives(natives);
+            }
+            @Override
+            public List<String> getNativesForFlavor(DataFlavor flav) {
+                Map<DataFlavor, String> natives = getNativesForFlavors(new DataFlavor[]{flav});
+                String nat = natives.get(flav);
+                if (nat != null) {
+                    return Collections.singletonList(nat);
+                } else {
+                    return Collections.emptyList();
                 }
-                public List getNativesForFlavor(DataFlavor flav) {
-                    Map natives =
-                        getNativesForFlavors(new DataFlavor[] { flav } );
-                    String nat = (String)natives.get(flav);
-                    if (nat != null) {
-                        List list = new ArrayList(1);
-                        list.add(nat);
-                        return list;
-                    } else {
-                        return Collections.EMPTY_LIST;
-                    }
+            }
+            @Override
+            public List<DataFlavor> getFlavorsForNative(String nat) {
+                Map<String, DataFlavor> flavors = getFlavorsForNatives(new String[]{nat});
+                DataFlavor flavor = flavors.get(nat);
+                if (flavor != null) {
+                    return Collections.singletonList(flavor);
+                } else {
+                    return Collections.emptyList();
                 }
-                public List getFlavorsForNative(String nat) {
-                    Map flavors =
-                        getFlavorsForNatives(new String[] { nat } );
-                    DataFlavor flavor = (DataFlavor)flavors.get(nat);
-                    if (flavor != null) {
-                        List list = new ArrayList(1);
-                        list.add(flavor);
-                        return list;
-                    } else {
-                        return Collections.EMPTY_LIST;
-                    }
-                }
-            };
+            }
+        };
     }
 
     /**
@@ -588,13 +485,13 @@
 
         textNatives.add(format);
         nativeCharsets.put(format, (charset != null && charset.length() != 0)
-            ? charset : getDefaultTextCharset());
+                ? charset : getDefaultTextCharset());
         if (eoln != null && eoln.length() != 0 && !eoln.equals("\n")) {
             nativeEOLNs.put(format, eoln);
         }
         if (terminators != null && terminators.length() != 0) {
             Integer iTerminators = Integer.valueOf(terminators);
-            if (iTerminators.intValue() > 0) {
+            if (iTerminators > 0) {
                 nativeTerminators.put(format, iTerminators);
             }
         }
@@ -609,7 +506,7 @@
     }
 
     protected String getCharsetForTextFormat(Long lFormat) {
-        return (String)nativeCharsets.get(lFormat);
+        return nativeCharsets.get(lFormat);
     }
 
     /**
@@ -649,32 +546,18 @@
      * The map keys are sorted according to the native formats preference
      * order.
      */
-    public SortedMap<Long,DataFlavor> getFormatsForTransferable(
-                               Transferable contents, FlavorTable map)
+    public SortedMap<Long,DataFlavor> getFormatsForTransferable(Transferable contents,
+                                                                FlavorTable map)
     {
         DataFlavor[] flavors = contents.getTransferDataFlavors();
         if (flavors == null) {
-            return new TreeMap();
+            return Collections.emptySortedMap();
         }
         return getFormatsForFlavors(flavors, map);
     }
 
     /**
      * Returns a Map whose keys are all of the possible formats into which data
-     * in the specified DataFlavor can be translated. The value of each key
-     * is the DataFlavor in which a Transferable's data should be requested
-     * when converting to the format.
-     * <p>
-     * The map keys are sorted according to the native formats preference
-     * order.
-     */
-    public SortedMap getFormatsForFlavor(DataFlavor flavor, FlavorTable map) {
-        return getFormatsForFlavors(new DataFlavor[] { flavor },
-                                    map);
-    }
-
-    /**
-     * Returns a Map whose keys are all of the possible formats into which data
      * in the specified DataFlavors can be translated. The value of each key
      * is the DataFlavor in which the Transferable's data should be requested
      * when converting to the format.
@@ -687,18 +570,16 @@
      *            DataFlavors and data formats
      * @throws NullPointerException if flavors or map is <code>null</code>
      */
-    public SortedMap <Long, DataFlavor> getFormatsForFlavors(
-        DataFlavor[] flavors, FlavorTable map)
+    public SortedMap<Long, DataFlavor> getFormatsForFlavors(DataFlavor[] flavors,
+                                                            FlavorTable map)
     {
-        Map <Long,DataFlavor> formatMap =
-            new HashMap <> (flavors.length);
-        Map <Long,DataFlavor> textPlainMap =
-            new HashMap <> (flavors.length);
+        Map<Long,DataFlavor> formatMap = new HashMap<>(flavors.length);
+        Map<Long,DataFlavor> textPlainMap = new HashMap<>(flavors.length);
         // Maps formats to indices that will be used to sort the formats
         // according to the preference order.
         // Larger index value corresponds to the more preferable format.
-        Map indexMap = new HashMap(flavors.length);
-        Map textPlainIndexMap = new HashMap(flavors.length);
+        Map<Long, Integer> indexMap = new HashMap<>(flavors.length);
+        Map<Long, Integer> textPlainIndexMap = new HashMap<>(flavors.length);
 
         int currentIndex = 0;
 
@@ -718,14 +599,13 @@
                 flavor.isRepresentationClassInputStream() ||
                 flavor.isRepresentationClassRemote())
             {
-                List natives = map.getNativesForFlavor(flavor);
+                List<String> natives = map.getNativesForFlavor(flavor);
 
                 currentIndex += natives.size();
 
-                for (Iterator iter = natives.iterator(); iter.hasNext(); ) {
-                    Long lFormat =
-                        getFormatForNativeAsLong((String)iter.next());
-                    Integer index = Integer.valueOf(currentIndex--);
+                for (String aNative : natives) {
+                    Long lFormat = getFormatForNativeAsLong(aNative);
+                    Integer index = currentIndex--;
 
                     formatMap.put(lFormat, flavor);
                     indexMap.put(lFormat, index);
@@ -735,9 +615,8 @@
                     // for a single text/* flavor, we would prefer that
                     // text/plain native data come from a text/plain flavor.
                     if (("text".equals(flavor.getPrimaryType()) &&
-                         "plain".equals(flavor.getSubType())) ||
-                        flavor.equals(DataFlavor.stringFlavor))
-                    {
+                            "plain".equals(flavor.getSubType())) ||
+                            flavor.equals(DataFlavor.stringFlavor)) {
                         textPlainMap.put(lFormat, flavor);
                         textPlainIndexMap.put(lFormat, index);
                     }
@@ -751,9 +630,9 @@
         indexMap.putAll(textPlainIndexMap);
 
         // Sort the map keys according to the formats preference order.
-        Comparator comparator =
-            new IndexOrderComparator(indexMap, IndexedComparator.SELECT_WORST);
-        SortedMap sortedMap = new TreeMap(comparator);
+        Comparator<Long> comparator =
+                new IndexOrderComparator(indexMap, IndexedComparator.SELECT_WORST);
+        SortedMap<Long, DataFlavor> sortedMap = new TreeMap<>(comparator);
         sortedMap.putAll(formatMap);
 
         return sortedMap;
@@ -767,24 +646,6 @@
                                                    FlavorTable map) {
         return keysToLongArray(getFormatsForTransferable(contents, map));
     }
-    public long[] getFormatsForFlavorAsArray(DataFlavor flavor,
-                                             FlavorTable map) {
-        return keysToLongArray(getFormatsForFlavor(flavor, map));
-    }
-    public long[] getFormatsForFlavorsAsArray(DataFlavor[] flavors,
-                                              FlavorTable map) {
-        return keysToLongArray(getFormatsForFlavors(flavors, map));
-    }
-
-    /**
-     * Returns a Map whose keys are all of the possible DataFlavors into which
-     * data in the specified format can be translated. The value of each key
-     * is the format in which the Clipboard or dropped data should be requested
-     * when converting to the DataFlavor.
-     */
-    public Map getFlavorsForFormat(long format, FlavorTable map) {
-        return getFlavorsForFormats(new long[] { format }, map);
-    }
 
     /**
      * Returns a Map whose keys are all of the possible DataFlavors into which
@@ -792,10 +653,10 @@
      * is the format in which the Clipboard or dropped data should be requested
      * when converting to the DataFlavor.
      */
-    public Map getFlavorsForFormats(long[] formats, FlavorTable map) {
-        Map flavorMap = new HashMap(formats.length);
-        Set mappingSet = new HashSet(formats.length);
-        Set flavorSet = new HashSet(formats.length);
+    public Map<DataFlavor, Long> getFlavorsForFormats(long[] formats, FlavorTable map) {
+        Map<DataFlavor, Long> flavorMap = new HashMap<>(formats.length);
+        Set<AbstractMap.SimpleEntry<Long, DataFlavor>> mappingSet = new HashSet<>(formats.length);
+        Set<DataFlavor> flavorSet = new HashSet<>(formats.length);
 
         // First step: build flavorSet, mappingSet and initial flavorMap
         // flavorSet  - the set of all the DataFlavors into which
@@ -804,27 +665,22 @@
         //              into any DataFlavor;
         // flavorMap  - after this step, this map maps each of the DataFlavors
         //              from flavorSet to any of the specified formats.
-        for (int i = 0; i < formats.length; i++) {
-            long format = formats[i];
+        for (long format : formats) {
             String nat = getNativeForFormat(format);
-            List flavors = map.getFlavorsForNative(nat);
-
-            for (Iterator iter = flavors.iterator(); iter.hasNext(); ) {
-                DataFlavor flavor = (DataFlavor)iter.next();
-
+            List<DataFlavor> flavors = map.getFlavorsForNative(nat);
+            for (DataFlavor flavor : flavors) {
                 // Don't explicitly test for String, since it is just a special
                 // case of Serializable
                 if (flavor.isFlavorTextType() ||
-                    flavor.isFlavorJavaFileListType() ||
-                    DataFlavor.imageFlavor.equals(flavor) ||
-                    flavor.isRepresentationClassSerializable() ||
-                    flavor.isRepresentationClassInputStream() ||
-                    flavor.isRepresentationClassRemote())
-                {
-                    Long lFormat = Long.valueOf(format);
-                    Object mapping =
-                        DataTransferer.createMapping(lFormat, flavor);
-                    flavorMap.put(flavor, lFormat);
+                        flavor.isFlavorJavaFileListType() ||
+                        DataFlavor.imageFlavor.equals(flavor) ||
+                        flavor.isRepresentationClassSerializable() ||
+                        flavor.isRepresentationClassInputStream() ||
+                        flavor.isRepresentationClassRemote()) {
+
+                    AbstractMap.SimpleEntry<Long, DataFlavor> mapping =
+                            new AbstractMap.SimpleEntry<>(format, flavor);
+                    flavorMap.put(flavor, format);
                     mappingSet.add(mapping);
                     flavorSet.add(flavor);
                 }
@@ -844,19 +700,11 @@
         // a mappingSet of all format-to-flavor mappings for the specified formats
         // and check if the format-to-flavor mapping exists for the
         // (flavor,format) pair being added.
-        for (Iterator flavorIter = flavorSet.iterator();
-             flavorIter.hasNext(); ) {
-            DataFlavor flavor = (DataFlavor)flavorIter.next();
-
-            List natives = map.getNativesForFlavor(flavor);
-
-            for (Iterator nativeIter = natives.iterator();
-                 nativeIter.hasNext(); ) {
-                Long lFormat =
-                    getFormatForNativeAsLong((String)nativeIter.next());
-                Object mapping = DataTransferer.createMapping(lFormat, flavor);
-
-                if (mappingSet.contains(mapping)) {
+        for (DataFlavor flavor : flavorSet) {
+            List<String> natives = map.getNativesForFlavor(flavor);
+            for (String aNative : natives) {
+                Long lFormat = getFormatForNativeAsLong(aNative);
+                if (mappingSet.contains(new AbstractMap.SimpleEntry<>(lFormat, flavor))) {
                     flavorMap.put(flavor, lFormat);
                     break;
                 }
@@ -879,24 +727,19 @@
      * @throws NullPointerException if formats or map is <code>null</code>
      */
     public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
-        Set flavorSet = new HashSet(formats.length);
-
-        for (int i = 0; i < formats.length; i++) {
-            String nat = getNativeForFormat(formats[i]);
-            List flavors = map.getFlavorsForNative(nat);
-
-            for (Iterator iter = flavors.iterator(); iter.hasNext(); ) {
-                DataFlavor flavor = (DataFlavor)iter.next();
-
+        Set<DataFlavor> flavorSet = new HashSet<>(formats.length);
+
+        for (long format : formats) {
+            List<DataFlavor> flavors = map.getFlavorsForNative(getNativeForFormat(format));
+            for (DataFlavor flavor : flavors) {
                 // Don't explicitly test for String, since it is just a special
                 // case of Serializable
                 if (flavor.isFlavorTextType() ||
-                    flavor.isFlavorJavaFileListType() ||
-                    DataFlavor.imageFlavor.equals(flavor) ||
-                    flavor.isRepresentationClassSerializable() ||
-                    flavor.isRepresentationClassInputStream() ||
-                    flavor.isRepresentationClassRemote())
-                {
+                        flavor.isFlavorJavaFileListType() ||
+                        DataFlavor.imageFlavor.equals(flavor) ||
+                        flavor.isRepresentationClassSerializable() ||
+                        flavor.isRepresentationClassInputStream() ||
+                        flavor.isRepresentationClassRemote()) {
                     flavorSet.add(flavor);
                 }
             }
@@ -907,25 +750,6 @@
 
     /**
      * Returns an array of all DataFlavors for which
-     * 1) a mapping from the specified format exists in the specified map and
-     * 2) the data translation for this mapping can be performed by the data
-     * transfer subsystem.
-     * The array will be sorted according to a
-     * <code>DataFlavorComparator</code> created with the specified
-     * map as an argument.
-     *
-     * @param format the data format
-     * @param map the FlavorTable which contains mappings between
-     *            DataFlavors and data formats
-     * @throws NullPointerException if map is <code>null</code>
-     */
-    public DataFlavor[] getFlavorsForFormatAsArray(long format,
-                                                   FlavorTable map) {
-        return getFlavorsForFormatsAsArray(new long[] { format }, map);
-    }
-
-    /**
-     * Returns an array of all DataFlavors for which
      * 1) a mapping from at least one of the specified formats exists in the
      * specified map and
      * 2) the data translation for this mapping can be performed by the data
@@ -947,22 +771,6 @@
     }
 
     /**
-     * Returns an object that represents a mapping between the specified
-     * key and value. <tt>null</tt> values and the <tt>null</tt> keys are
-     * permitted. The internal representation of the mapping object is
-     * irrelevant. The only requrement is that the two mapping objects are equal
-     * if and only if their keys are equal and their values are equal.
-     * More formally, the two mapping objects are equal if and only if
-     * <tt>(value1 == null ? value2 == null : value1.equals(value2))
-     * && (key1 == null ? key2 == null : key1.equals(key2))</tt>.
-     */
-    private static Object createMapping(Object key, Object value) {
-        // NOTE: Should be updated to use AbstractMap.SimpleEntry as
-        // soon as it is made public.
-        return Arrays.asList(new Object[] { key, value });
-    }
-
-    /**
      * Looks-up or registers the String native with the native data transfer
      * system and returns a long format corresponding to that native.
      */
@@ -1013,17 +821,16 @@
     private byte[] translateTransferableString(String str,
                                                long format) throws IOException
     {
-        Long lFormat = Long.valueOf(format);
+        Long lFormat = format;
         String charset = getBestCharsetForTextFormat(lFormat, null);
         // Search and replace EOLN. Note that if EOLN is "\n", then we
         // never added an entry to nativeEOLNs anyway, so we'll skip this
         // code altogether.
         // windows: "abc\nde"->"abc\r\nde"
-        String eoln = (String)nativeEOLNs.get(lFormat);
+        String eoln = nativeEOLNs.get(lFormat);
         if (eoln != null) {
             int length = str.length();
-            StringBuffer buffer =
-                new StringBuffer(length * 2); // 2 is a heuristic
+            StringBuilder buffer = new StringBuilder(length * 2); // 2 is a heuristic
             for (int i = 0; i < length; i++) {
                 // Fix for 4914613 - skip native EOLN
                 if (str.startsWith(eoln, i)) {
@@ -1048,9 +855,9 @@
         // the we never added an entry to nativeTerminators anyway, so
         // we'll skip code altogether.
         // "abcde" -> "abcde\0"
-        Integer terminators = (Integer)nativeTerminators.get(lFormat);
+        Integer terminators = nativeTerminators.get(lFormat);
         if (terminators != null) {
-            int numTerminators = terminators.intValue();
+            int numTerminators = terminators;
             byte[] terminatedBytes =
                 new byte[bytes.length + numTerminators];
             System.arraycopy(bytes, 0, terminatedBytes, 0, bytes.length);
@@ -1073,7 +880,7 @@
             throws IOException
     {
 
-        Long lFormat = Long.valueOf(format);
+        Long lFormat = format;
         String charset = getBestCharsetForTextFormat(lFormat, localeTransferable);
 
         // Locate terminating NUL bytes. Note that if terminators is 0,
@@ -1086,11 +893,11 @@
         // multibyte coding like UTF-8, but helps understand the procedure.
         // "abcde\0" -> "abcde"
 
-        String eoln = (String)nativeEOLNs.get(lFormat);
-        Integer terminators = (Integer)nativeTerminators.get(lFormat);
+        String eoln = nativeEOLNs.get(lFormat);
+        Integer terminators = nativeTerminators.get(lFormat);
         int count;
         if (terminators != null) {
-            int numTerminators = terminators.intValue();
+            int numTerminators = terminators;
 search:
             for (count = 0; count < (bytes.length - numTerminators + 1); count += numTerminators) {
                 for (int i = count; i < count + numTerminators; i++) {
@@ -1123,7 +930,6 @@
 
             char[] buf = converted.toCharArray();
             char[] eoln_arr = eoln.toCharArray();
-            converted = null;
             int j = 0;
             boolean match;
 
@@ -1214,7 +1020,7 @@
                     ("cannot transfer non-text data as Reader");
             }
 
-            StringBuffer buf = new StringBuffer();
+            StringBuilder buf = new StringBuilder();
             try (Reader r = (Reader)obj) {
                 int c;
                 while ((c = r.read()) != -1) {
@@ -1243,7 +1049,7 @@
                 format);
 
         // Source data is a char array. Convert to a String and recur.
-        } else if (charArrayClass.equals(flavor.getRepresentationClass())) {
+        } else if (char[].class.equals(flavor.getRepresentationClass())) {
             if (!(isFlavorCharsetTextType(flavor) && isTextFormat(format))) {
                 throw new IOException
                     ("cannot transfer non-text data as char array");
@@ -1274,7 +1080,7 @@
         // Source data is a byte array. For arbitrary flavors, simply return
         // the array. For text flavors, decode back to a String and recur to
         // reencode according to the requested format.
-        } else if (byteArrayClass.equals(flavor.getRepresentationClass())) {
+        } else if (byte[].class.equals(flavor.getRepresentationClass())) {
             byte[] bytes = (byte[])obj;
 
             if (isFlavorCharsetTextType(flavor) && isTextFormat(format)) {
@@ -1342,7 +1148,7 @@
             final List list = (List)obj;
             final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents);
             final ArrayList<String> fileList = castToFiles(list, userProtectionDomain);
-            final ArrayList<String> uriList = new ArrayList<String>(fileList.size());
+            final ArrayList<String> uriList = new ArrayList<>(fileList.size());
             for (String fileObject : fileList) {
                 final URI uri = new File(fileObject).toURI();
                 // Some implementations are fussy about the number of slashes (file:///path/to/file is best)
@@ -1356,8 +1162,8 @@
             byte[] eoln = "\r\n".getBytes(targetCharset);
 
             try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
-                for (int i = 0; i < uriList.size(); i++) {
-                    byte[] bytes = uriList.get(i).getBytes(targetCharset);
+                for (String uri : uriList) {
+                    byte[] bytes = uri.getBytes(targetCharset);
                     bos.write(bytes, 0, bytes.length);
                     bos.write(eoln, 0, eoln.length);
                 }
@@ -1433,42 +1239,35 @@
             return str;
         }
 
-
-        String ret_val = "";
         final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents);
 
         try {
-            ret_val = (String) AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                    public Object run() {
-
-                        StringBuffer allowedFiles = new StringBuffer(str.length());
-                        String [] uriArray = str.split("(\\s)+");
-
-                        for (String fileName : uriArray)
+            return AccessController.doPrivileged((PrivilegedExceptionAction<String>) () -> {
+
+                StringBuilder allowedFiles = new StringBuilder(str.length());
+                String [] uriArray = str.split("(\\s)+");
+
+                for (String fileName : uriArray)
+                {
+                    File file = new File(fileName);
+                    if (file.exists() &&
+                        !(isFileInWebstartedCache(file) ||
+                        isForbiddenToRead(file, userProtectionDomain)))
+                    {
+                        if (0 != allowedFiles.length())
                         {
-                            File file = new File(fileName);
-                            if (file.exists() &&
-                                !(isFileInWebstartedCache(file) ||
-                                isForbiddenToRead(file, userProtectionDomain)))
-                            {
-
-                                if (0 != allowedFiles.length())
-                                {
-                                    allowedFiles.append("\\r\\n");
-                                }
-
-                                allowedFiles.append(fileName);
-                            }
+                            allowedFiles.append("\\r\\n");
                         }
 
-                        return allowedFiles.toString();
+                        allowedFiles.append(fileName);
                     }
-                });
+                }
+
+                return allowedFiles.toString();
+            });
         } catch (PrivilegedActionException pae) {
             throw new IOException(pae.getMessage(), pae);
         }
-
-        return ret_val;
     }
 
     private static ProtectionDomain getUserProtectionDomain(Transferable contents) {
@@ -1492,30 +1291,26 @@
     }
 
     private ArrayList<String> castToFiles(final List files,
-                                          final ProtectionDomain userProtectionDomain) throws IOException
-    {
-        final ArrayList<String> fileList = new ArrayList<String>();
+                                          final ProtectionDomain userProtectionDomain) throws IOException {
         try {
-            AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                public Object run() throws IOException {
-                    for (Object fileObject : files)
+            return AccessController.doPrivileged((PrivilegedExceptionAction<ArrayList<String>>) () -> {
+                ArrayList<String> fileList = new ArrayList<>();
+                for (Object fileObject : files)
+                {
+                    File file = castToFile(fileObject);
+                    if (file != null &&
+                        (null == System.getSecurityManager() ||
+                        !(isFileInWebstartedCache(file) ||
+                        isForbiddenToRead(file, userProtectionDomain))))
                     {
-                        File file = castToFile(fileObject);
-                        if (file != null &&
-                            (null == System.getSecurityManager() ||
-                            !(isFileInWebstartedCache(file) ||
-                            isForbiddenToRead(file, userProtectionDomain))))
-                        {
-                            fileList.add(file.getCanonicalPath());
-                        }
+                        fileList.add(file.getCanonicalPath());
                     }
-                    return null;
                 }
+                return fileList;
             });
         } catch (PrivilegedActionException pae) {
             throw new IOException(pae.getMessage());
         }
-        return fileList;
     }
 
     // It is important do not use user's successors
@@ -1539,8 +1334,7 @@
         "deployment.javapi.cachedir"
     };
 
-    private final static ArrayList <File> deploymentCacheDirectoryList =
-            new ArrayList<File>();
+    private final static ArrayList <File> deploymentCacheDirectoryList = new ArrayList<>();
 
     private static boolean isFileInWebstartedCache(File f) {
 
@@ -1598,6 +1392,30 @@
             // Turn the list of Files into a List and return
             theObject = Arrays.asList(files);
 
+            // Source data is a URI list. Convert to DataFlavor.javaFileListFlavor
+            // where possible.
+        } else if (isURIListFormat(format)
+                    && DataFlavor.javaFileListFlavor.equals(flavor)) {
+
+            try (ByteArrayInputStream str = new ByteArrayInputStream(bytes))  {
+
+                URI uris[] = dragQueryURIs(str, format, localeTransferable);
+                if (uris == null) {
+                    return null;
+                }
+                List<File> files = new ArrayList<>();
+                for (URI uri : uris) {
+                    try {
+                        files.add(new File(uri));
+                    } catch (IllegalArgumentException illegalArg) {
+                        // When converting from URIs to less generic files,
+                        // common practice (Wine, SWT) seems to be to
+                        // silently drop the URIs that aren't local files.
+                    }
+                }
+                theObject = files;
+            }
+
             // Target data is a String. Strip terminating NUL bytes. Decode bytes
             // into characters. Search-and-replace EOLN.
         } else if (String.class.equals(flavor.getRepresentationClass()) &&
@@ -1627,7 +1445,7 @@
 
             // Target data is a char array. Recur to obtain String and convert to
             // char array.
-        } else if (charArrayClass.equals(flavor.getRepresentationClass())) {
+        } else if (char[].class.equals(flavor.getRepresentationClass())) {
             if (!(isFlavorCharsetTextType(flavor) && isTextFormat(format))) {
                 throw new IOException
                           ("cannot transfer non-text data as char array");
@@ -1655,7 +1473,7 @@
             // the raw bytes. For text flavors, convert to a String to strip
             // terminators and search-and-replace EOLN, then reencode according to
             // the requested flavor.
-        } else if (byteArrayClass.equals(flavor.getRepresentationClass())) {
+        } else if (byte[].class.equals(flavor.getRepresentationClass())) {
             if (isFlavorCharsetTextType(flavor) && isTextFormat(format)) {
                 theObject = translateBytesToString(
                     bytes, format, localeTransferable
@@ -1728,7 +1546,7 @@
             if (uris == null) {
                 return null;
             }
-            ArrayList files = new ArrayList();
+            List<File> files = new ArrayList<>();
             for (URI uri : uris) {
                 try {
                     files.add(new File(uri));
@@ -1783,7 +1601,7 @@
 
             theObject = constructFlavoredObject(reader, flavor, Reader.class);
             // Target data is a byte array
-        } else if (byteArrayClass.equals(flavor.getRepresentationClass())) {
+        } else if (byte[].class.equals(flavor.getRepresentationClass())) {
             if(isFlavorCharsetTextType(flavor) && isTextFormat(format)) {
                 theObject = translateBytesToString(inputStreamToByteArray(str), format, localeTransferable)
                         .getBytes(DataTransferer.getTextCharset(flavor));
@@ -1853,47 +1671,34 @@
                                            Class clazz)
         throws IOException
     {
-        final Class dfrc = flavor.getRepresentationClass();
+        final Class<?> dfrc = flavor.getRepresentationClass();
 
         if (clazz.equals(dfrc)) {
             return arg; // simple case
         } else {
-            Constructor[] constructors = null;
+            Constructor[] constructors;
 
             try {
-                constructors = (Constructor[])
-                    AccessController.doPrivileged(new PrivilegedAction() {
-                            public Object run() {
-                                return dfrc.getConstructors();
-                            }
-                        });
+                constructors = AccessController.doPrivileged(
+                        (PrivilegedAction<Constructor[]>) dfrc::getConstructors);
             } catch (SecurityException se) {
                 throw new IOException(se.getMessage());
             }
 
-            Constructor constructor = null;
-
-            for (int j = 0; j < constructors.length; j++) {
-                if (!Modifier.isPublic(constructors[j].getModifiers())) {
-                    continue;
-                }
-
-                Class[] ptypes = constructors[j].getParameterTypes();
-
-                if (ptypes != null && ptypes.length == 1 &&
-                    clazz.equals(ptypes[0])) {
-                    constructor = constructors[j];
-                    break;
-                }
-            }
-
-            if (constructor == null) {
-                throw new IOException("can't find <init>(L"+ clazz +
-                                      ";)V for class: " + dfrc.getName());
-            }
+            Constructor constructor = Stream.of(constructors)
+                    .filter(c -> Modifier.isPublic(c.getModifiers()))
+                    .filter(c -> {
+                        Class[] ptypes = c.getParameterTypes();
+                        return ptypes != null
+                                && ptypes.length == 1
+                                && clazz.equals(ptypes[0]);
+                    })
+                    .findFirst()
+                    .orElseThrow(() ->
+                            new IOException("can't find <init>(L"+ clazz + ";)V for class: " + dfrc.getName()));
 
             try {
-                return constructor.newInstance(new Object[] { arg } );
+                return constructor.newInstance(arg);
             } catch (Exception e) {
                 throw new IOException(e.getMessage());
             }
@@ -1905,26 +1710,26 @@
      * can strip NUL terminators and perform EOLN search-and-replace.
      */
     public class ReencodingInputStream extends InputStream {
-        protected BufferedReader wrapped;
-        protected final char[] in = new char[2];
-        protected byte[] out;
-
-        protected CharsetEncoder encoder;
-        protected CharBuffer inBuf;
-        protected ByteBuffer outBuf;
-
-        protected char[] eoln;
-        protected int numTerminators;
-
-        protected boolean eos;
-        protected int index, limit;
+        BufferedReader wrapped;
+        final char[] in = new char[2];
+        byte[] out;
+
+        CharsetEncoder encoder;
+        CharBuffer inBuf;
+        ByteBuffer outBuf;
+
+        char[] eoln;
+        int numTerminators;
+
+        boolean eos;
+        int index, limit;
 
         public ReencodingInputStream(InputStream bytestream, long format,
                                      String targetEncoding,
                                      Transferable localeTransferable)
             throws IOException
         {
-            Long lFormat = Long.valueOf(format);
+            Long lFormat = format;
 
             String sourceEncoding = null;
             if (isLocaleDependentTextFormat(format) &&
@@ -1962,24 +1767,22 @@
                 out = new byte[(int)(encoder.maxBytesPerChar() * 2 + 0.5)];
                 inBuf = CharBuffer.wrap(in);
                 outBuf = ByteBuffer.wrap(out);
-            } catch (IllegalCharsetNameException e) {
-                throw new IOException(e.toString());
-            } catch (UnsupportedCharsetException e) {
-                throw new IOException(e.toString());
-            } catch (UnsupportedOperationException e) {
+            } catch (IllegalCharsetNameException
+                    | UnsupportedCharsetException
+                    | UnsupportedOperationException e) {
                 throw new IOException(e.toString());
             }
 
-            String sEoln = (String)nativeEOLNs.get(lFormat);
+            String sEoln = nativeEOLNs.get(lFormat);
             if (sEoln != null) {
                 eoln = sEoln.toCharArray();
             }
 
             // A hope and a prayer that this works generically. This will
             // definitely work on Win32.
-            Integer terminators = (Integer)nativeTerminators.get(lFormat);
+            Integer terminators = nativeTerminators.get(lFormat);
             if (terminators != null) {
-                numTerminators = terminators.intValue();
+                numTerminators = terminators;
             }
         }
 
@@ -2126,19 +1929,14 @@
         while (readerIterator.hasNext()) {
             ImageReader imageReader = (ImageReader)readerIterator.next();
             try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes)) {
-                ImageInputStream imageInputStream =
-                    ImageIO.createImageInputStream(bais);
-
-                try {
+                try (ImageInputStream imageInputStream = ImageIO.createImageInputStream(bais)) {
                     ImageReadParam param = imageReader.getDefaultReadParam();
                     imageReader.setInput(imageInputStream, true, true);
-                    BufferedImage bufferedImage =
-                        imageReader.read(imageReader.getMinIndex(), param);
+                    BufferedImage bufferedImage = imageReader.read(imageReader.getMinIndex(), param);
                     if (bufferedImage != null) {
                         return bufferedImage;
                     }
                 } finally {
-                    imageInputStream.close();
                     imageReader.dispose();
                 }
             } catch (IOException e) {
@@ -2227,7 +2025,7 @@
         }
     }
 
-    protected byte[] imageToStandardBytesImpl(RenderedImage renderedImage,
+    byte[] imageToStandardBytesImpl(RenderedImage renderedImage,
                                               String mimeType)
         throws IOException {
 
@@ -2248,14 +2046,10 @@
             }
 
             try {
-                ImageOutputStream imageOutputStream =
-                    ImageIO.createImageOutputStream(baos);
-                try {
+                try (ImageOutputStream imageOutputStream = ImageIO.createImageOutputStream(baos)) {
                     imageWriter.setOutput(imageOutputStream);
                     imageWriter.write(renderedImage);
                     imageOutputStream.flush();
-                } finally {
-                    imageOutputStream.close();
                 }
             } catch (IOException e) {
                 imageWriter.dispose();
@@ -2341,7 +2135,7 @@
          * that may contain client code.
          */
         if (isToolkitThread) try {
-            final Stack stack = new Stack();
+            final Stack<byte[]> stack = new Stack<>();
             final Runnable dataConverter = new Runnable() {
                 // Guard against multiple executions.
                 private boolean done = false;
@@ -2351,7 +2145,7 @@
                     }
                     byte[] data = null;
                     try {
-                        DataFlavor flavor = (DataFlavor)formatMap.get(Long.valueOf(format));
+                        DataFlavor flavor = (DataFlavor)formatMap.get(format);
                         if (flavor != null) {
                             data = translateTransferable(contents, flavor, format);
                         }
@@ -2388,12 +2182,11 @@
                 appContext.remove(DATA_CONVERTER_KEY);
             }
 
-            ret = (byte[])stack.pop();
+            ret = stack.pop();
         } finally {
             getToolkitThreadBlockedHandler().unlock();
         } else {
-            DataFlavor flavor = (DataFlavor)
-                formatMap.get(Long.valueOf(format));
+            DataFlavor flavor = (DataFlavor)formatMap.get(format);
             if (flavor != null) {
                 ret = translateTransferable(contents, flavor, format);
             }
@@ -2428,12 +2221,12 @@
      * The map keys are sorted according to the native formats preference
      * order.
      */
-    public static long[] keysToLongArray(SortedMap map) {
-        Set keySet = map.keySet();
+    public static long[] keysToLongArray(SortedMap<Long, ?> map) {
+        Set<Long> keySet = map.keySet();
         long[] retval = new long[keySet.size()];
         int i = 0;
-        for (Iterator iter = keySet.iterator(); iter.hasNext(); i++) {
-            retval[i] = ((Long)iter.next()).longValue();
+        for (Iterator<Long> iter = keySet.iterator(); iter.hasNext(); i++) {
+            retval[i] = iter.next();
         }
         return retval;
     }
@@ -2445,7 +2238,7 @@
     public static DataFlavor[] setToSortedDataFlavorArray(Set flavorsSet) {
         DataFlavor[] flavors = new DataFlavor[flavorsSet.size()];
         flavorsSet.toArray(flavors);
-        final Comparator comparator =
+        final Comparator<DataFlavor> comparator =
                 new DataFlavorComparator(IndexedComparator.SELECT_WORST);
         Arrays.sort(flavors, comparator);
         return flavors;
@@ -2474,8 +2267,8 @@
      * If there are no platform-specific mappings for this native, the method
      * returns an empty <code>List</code>.
      */
-    public List getPlatformMappingsForNative(String nat) {
-        return new ArrayList();
+    public List<DataFlavor> getPlatformMappingsForNative(String nat) {
+        return new ArrayList<>();
     }
 
     /**
@@ -2483,15 +2276,15 @@
      * If there are no platform-specific mappings for this flavor, the method
      * returns an empty <code>List</code>.
      */
-    public List getPlatformMappingsForFlavor(DataFlavor df) {
-        return new ArrayList();
+    public List<String> getPlatformMappingsForFlavor(DataFlavor df) {
+        return new ArrayList<>();
     }
 
     /**
      * A Comparator which includes a helper function for comparing two Objects
      * which are likely to be keys in the specified Map.
      */
-    public abstract static class IndexedComparator implements Comparator {
+    public abstract static class IndexedComparator<T> implements Comparator<T> {
 
         /**
          * The best Object (e.g., DataFlavor) will be the last in sequence.
@@ -2503,11 +2296,7 @@
          */
         public static final boolean SELECT_WORST = false;
 
-        protected final boolean order;
-
-        public IndexedComparator() {
-            this(SELECT_BEST);
-        }
+        final boolean order;
 
         public IndexedComparator(boolean order) {
             this.order = order;
@@ -2526,48 +2315,11 @@
          *             first object is mapped to a less, equal to, or greater
          *             index than the second.
          */
-        protected static int compareIndices(Map indexMap,
-                                            Object obj1, Object obj2,
-                                            Integer fallbackIndex) {
-            Integer index1 = (Integer)indexMap.get(obj1);
-            Integer index2 = (Integer)indexMap.get(obj2);
-
-            if (index1 == null) {
-                index1 = fallbackIndex;
-            }
-            if (index2 == null) {
-                index2 = fallbackIndex;
-            }
-
-            return index1.compareTo(index2);
-        }
-
-        /**
-         * Helper method to compare two objects by their Long indices in the
-         * given map. If the map doesn't contain an entry for either of the
-         * objects, the fallback index will be used for the object instead.
-         *
-         * @param indexMap the map which maps objects into Long indexes.
-         * @param obj1 the first object to be compared.
-         * @param obj2 the second object to be compared.
-         * @param fallbackIndex the Long to be used as a fallback index.
-         * @return a negative integer, zero, or a positive integer as the
-         *             first object is mapped to a less, equal to, or greater
-         *             index than the second.
-         */
-        protected static int compareLongs(Map indexMap,
-                                          Object obj1, Object obj2,
-                                          Long fallbackIndex) {
-            Long index1 = (Long)indexMap.get(obj1);
-            Long index2 = (Long)indexMap.get(obj2);
-
-            if (index1 == null) {
-                index1 = fallbackIndex;
-            }
-            if (index2 == null) {
-                index2 = fallbackIndex;
-            }
-
+        static <T> int compareIndices(Map<T, Integer> indexMap,
+                                      T obj1, T obj2,
+                                      Integer fallbackIndex) {
+            Integer index1 = indexMap.getOrDefault(obj1, fallbackIndex);
+            Integer index2 = indexMap.getOrDefault(obj2, fallbackIndex);
             return index1.compareTo(index2);
         }
     }
@@ -2579,45 +2331,37 @@
      * in alphabetical order, charsets are not automatically converted to their
      * canonical forms.
      */
-    public static class CharsetComparator extends IndexedComparator {
-        private static final Map charsets;
-        private static String defaultEncoding;
-
-        private static final Integer DEFAULT_CHARSET_INDEX = Integer.valueOf(2);
-        private static final Integer OTHER_CHARSET_INDEX = Integer.valueOf(1);
-        private static final Integer WORST_CHARSET_INDEX = Integer.valueOf(0);
-        private static final Integer UNSUPPORTED_CHARSET_INDEX =
-            Integer.valueOf(Integer.MIN_VALUE);
+    public static class CharsetComparator extends IndexedComparator<String> {
+        private static final Map<String, Integer> charsets;
+        private static final String defaultEncoding;
+
+        private static final Integer DEFAULT_CHARSET_INDEX = 2;
+        private static final Integer OTHER_CHARSET_INDEX = 1;
+        private static final Integer WORST_CHARSET_INDEX = 0;
+        private static final Integer UNSUPPORTED_CHARSET_INDEX = Integer.MIN_VALUE;
 
         private static final String UNSUPPORTED_CHARSET = "UNSUPPORTED";
 
         static {
-            HashMap charsetsMap = new HashMap(8, 1.0f);
+            Map<String, Integer> charsetsMap = new HashMap<>(8, 1.0f);
 
             // we prefer Unicode charsets
-            charsetsMap.put(canonicalName("UTF-16LE"), Integer.valueOf(4));
-            charsetsMap.put(canonicalName("UTF-16BE"), Integer.valueOf(5));
-            charsetsMap.put(canonicalName("UTF-8"), Integer.valueOf(6));
-            charsetsMap.put(canonicalName("UTF-16"), Integer.valueOf(7));
+            charsetsMap.put(canonicalName("UTF-16LE"), 4);
+            charsetsMap.put(canonicalName("UTF-16BE"), 5);
+            charsetsMap.put(canonicalName("UTF-8"), 6);
+            charsetsMap.put(canonicalName("UTF-16"), 7);
 
             // US-ASCII is the worst charset supported
             charsetsMap.put(canonicalName("US-ASCII"), WORST_CHARSET_INDEX);
 
-            String defEncoding = DataTransferer.canonicalName
-                (DataTransferer.getDefaultTextCharset());
-
-            if (charsetsMap.get(defaultEncoding) == null) {
-                charsetsMap.put(defaultEncoding, DEFAULT_CHARSET_INDEX);
-            }
+            defaultEncoding = DataTransferer.canonicalName(DataTransferer.getDefaultTextCharset());
+            charsetsMap.putIfAbsent(defaultEncoding, DEFAULT_CHARSET_INDEX);
+
             charsetsMap.put(UNSUPPORTED_CHARSET, UNSUPPORTED_CHARSET_INDEX);
 
             charsets = Collections.unmodifiableMap(charsetsMap);
         }
 
-        public CharsetComparator() {
-            this(SELECT_BEST);
-        }
-
         public CharsetComparator(boolean order) {
             super(order);
         }
@@ -2637,18 +2381,12 @@
          * @throws NullPointerException if either of the arguments is
          *         <code>null</code>.
          */
-        public int compare(Object obj1, Object obj2) {
-            String charset1 = null;
-            String charset2 = null;
+        public int compare(String obj1, String obj2) {
             if (order == SELECT_BEST) {
-                charset1 = (String)obj1;
-                charset2 = (String)obj2;
+                return compareCharsets(obj1, obj2);
             } else {
-                charset1 = (String)obj2;
-                charset2 = (String)obj1;
+                return compareCharsets(obj2, obj1);
             }
-
-            return compareCharsets(charset1, charset2);
         }
 
         /**
@@ -2674,7 +2412,7 @@
          *             first argument is worse, equal to, or better than the
          *             second.
          */
-        protected int compareCharsets(String charset1, String charset2) {
+        int compareCharsets(String charset1, String charset2) {
             charset1 = getEncoding(charset1);
             charset2 = getEncoding(charset2);
 
@@ -2704,7 +2442,7 @@
          * @param charset the charset.
          * @return an encoding for this charset.
          */
-        protected static String getEncoding(String charset) {
+        static String getEncoding(String charset) {
             if (charset == null) {
                 return null;
             } else if (!DataTransferer.isEncodingSupported(charset)) {
@@ -2732,131 +2470,108 @@
      * most descriptive one. For flavors which are otherwise equal, the
      * flavors' string representation are compared in the alphabetical order.
      */
-    public static class DataFlavorComparator extends IndexedComparator {
+    public static class DataFlavorComparator extends IndexedComparator<DataFlavor> {
 
         private final CharsetComparator charsetComparator;
 
-        private static final Map exactTypes;
-        private static final Map primaryTypes;
-        private static final Map nonTextRepresentations;
-        private static final Map textTypes;
-        private static final Map decodedTextRepresentations;
-        private static final Map encodedTextRepresentations;
-
-        private static final Integer UNKNOWN_OBJECT_LOSES =
-            Integer.valueOf(Integer.MIN_VALUE);
-        private static final Integer UNKNOWN_OBJECT_WINS =
-            Integer.valueOf(Integer.MAX_VALUE);
-
-        private static final Long UNKNOWN_OBJECT_LOSES_L =
-            Long.valueOf(Long.MIN_VALUE);
-        private static final Long UNKNOWN_OBJECT_WINS_L =
-            Long.valueOf(Long.MAX_VALUE);
+        private static final Map<String, Integer> exactTypes;
+        private static final Map<String, Integer> primaryTypes;
+        private static final Map<Class<?>, Integer> nonTextRepresentations;
+        private static final Map<String, Integer> textTypes;
+        private static final Map<Class<?>, Integer> decodedTextRepresentations;
+        private static final Map<Class<?>, Integer> encodedTextRepresentations;
+
+        private static final Integer UNKNOWN_OBJECT_LOSES = Integer.MIN_VALUE;
+        private static final Integer UNKNOWN_OBJECT_WINS = Integer.MAX_VALUE;
 
         static {
             {
-                HashMap exactTypesMap = new HashMap(4, 1.0f);
+                Map<String, Integer> exactTypesMap = new HashMap<>(4, 1.0f);
 
                 // application/x-java-* MIME types
-                exactTypesMap.put("application/x-java-file-list",
-                                  Integer.valueOf(0));
-                exactTypesMap.put("application/x-java-serialized-object",
-                                  Integer.valueOf(1));
-                exactTypesMap.put("application/x-java-jvm-local-objectref",
-                                  Integer.valueOf(2));
-                exactTypesMap.put("application/x-java-remote-object",
-                                  Integer.valueOf(3));
+                exactTypesMap.put("application/x-java-file-list", 0);
+                exactTypesMap.put("application/x-java-serialized-object", 1);
+                exactTypesMap.put("application/x-java-jvm-local-objectref", 2);
+                exactTypesMap.put("application/x-java-remote-object", 3);
 
                 exactTypes = Collections.unmodifiableMap(exactTypesMap);
             }
 
             {
-                HashMap primaryTypesMap = new HashMap(1, 1.0f);
-
-                primaryTypesMap.put("application", Integer.valueOf(0));
+                Map<String, Integer> primaryTypesMap = new HashMap<>(1, 1.0f);
+
+                primaryTypesMap.put("application", 0);
 
                 primaryTypes = Collections.unmodifiableMap(primaryTypesMap);
             }
 
             {
-                HashMap nonTextRepresentationsMap = new HashMap(3, 1.0f);
-
-                nonTextRepresentationsMap.put(java.io.InputStream.class,
-                                              Integer.valueOf(0));
-                nonTextRepresentationsMap.put(java.io.Serializable.class,
-                                              Integer.valueOf(1));
+                Map<Class<?>, Integer> nonTextRepresentationsMap = new HashMap<>(3, 1.0f);
+
+                nonTextRepresentationsMap.put(java.io.InputStream.class, 0);
+                nonTextRepresentationsMap.put(java.io.Serializable.class, 1);
 
                 Class<?> remoteClass = RMI.remoteClass();
                 if (remoteClass != null) {
-                    nonTextRepresentationsMap.put(remoteClass,
-                                                  Integer.valueOf(2));
+                    nonTextRepresentationsMap.put(remoteClass, 2);
                 }
 
-                nonTextRepresentations =
-                    Collections.unmodifiableMap(nonTextRepresentationsMap);
+                nonTextRepresentations = Collections.unmodifiableMap(nonTextRepresentationsMap);
             }
 
             {
-                HashMap textTypesMap = new HashMap(16, 1.0f);
+                Map<String, Integer> textTypesMap = new HashMap<>(16, 1.0f);
 
                 // plain text
-                textTypesMap.put("text/plain", Integer.valueOf(0));
+                textTypesMap.put("text/plain", 0);
 
                 // stringFlavor
-                textTypesMap.put("application/x-java-serialized-object",
-                                Integer.valueOf(1));
+                textTypesMap.put("application/x-java-serialized-object", 1);
 
                 // misc
-                textTypesMap.put("text/calendar", Integer.valueOf(2));
-                textTypesMap.put("text/css", Integer.valueOf(3));
-                textTypesMap.put("text/directory", Integer.valueOf(4));
-                textTypesMap.put("text/parityfec", Integer.valueOf(5));
-                textTypesMap.put("text/rfc822-headers", Integer.valueOf(6));
-                textTypesMap.put("text/t140", Integer.valueOf(7));
-                textTypesMap.put("text/tab-separated-values", Integer.valueOf(8));
-                textTypesMap.put("text/uri-list", Integer.valueOf(9));
+                textTypesMap.put("text/calendar", 2);
+                textTypesMap.put("text/css", 3);
+                textTypesMap.put("text/directory", 4);
+                textTypesMap.put("text/parityfec", 5);
+                textTypesMap.put("text/rfc822-headers", 6);
+                textTypesMap.put("text/t140", 7);
+                textTypesMap.put("text/tab-separated-values", 8);
+                textTypesMap.put("text/uri-list", 9);
 
                 // enriched
-                textTypesMap.put("text/richtext", Integer.valueOf(10));
-                textTypesMap.put("text/enriched", Integer.valueOf(11));
-                textTypesMap.put("text/rtf", Integer.valueOf(12));
+                textTypesMap.put("text/richtext", 10);
+                textTypesMap.put("text/enriched", 11);
+                textTypesMap.put("text/rtf", 12);
 
                 // markup
-                textTypesMap.put("text/html", Integer.valueOf(13));
-                textTypesMap.put("text/xml", Integer.valueOf(14));
-                textTypesMap.put("text/sgml", Integer.valueOf(15));
+                textTypesMap.put("text/html", 13);
+                textTypesMap.put("text/xml", 14);
+                textTypesMap.put("text/sgml", 15);
 
                 textTypes = Collections.unmodifiableMap(textTypesMap);
             }
 
             {
-                HashMap decodedTextRepresentationsMap = new HashMap(4, 1.0f);
-
-                decodedTextRepresentationsMap.put
-                    (DataTransferer.charArrayClass, Integer.valueOf(0));
-                decodedTextRepresentationsMap.put
-                    (java.nio.CharBuffer.class, Integer.valueOf(1));
-                decodedTextRepresentationsMap.put
-                    (java.lang.String.class, Integer.valueOf(2));
-                decodedTextRepresentationsMap.put
-                    (java.io.Reader.class, Integer.valueOf(3));
+                Map<Class<?>, Integer> decodedTextRepresentationsMap = new HashMap<>(4, 1.0f);
+
+                decodedTextRepresentationsMap.put(char[].class, 0);
+                decodedTextRepresentationsMap.put(CharBuffer.class, 1);
+                decodedTextRepresentationsMap.put(String.class, 2);
+                decodedTextRepresentationsMap.put(Reader.class, 3);
 
                 decodedTextRepresentations =
-                    Collections.unmodifiableMap(decodedTextRepresentationsMap);
+                        Collections.unmodifiableMap(decodedTextRepresentationsMap);
             }
 
             {
-                HashMap encodedTextRepresentationsMap = new HashMap(3, 1.0f);
-
-                encodedTextRepresentationsMap.put
-                    (DataTransferer.byteArrayClass, Integer.valueOf(0));
-                encodedTextRepresentationsMap.put
-                    (java.nio.ByteBuffer.class, Integer.valueOf(1));
-                encodedTextRepresentationsMap.put
-                    (java.io.InputStream.class, Integer.valueOf(2));
+                Map<Class<?>, Integer> encodedTextRepresentationsMap = new HashMap<>(3, 1.0f);
+
+                encodedTextRepresentationsMap.put(byte[].class, 0);
+                encodedTextRepresentationsMap.put(ByteBuffer.class, 1);
+                encodedTextRepresentationsMap.put(InputStream.class, 2);
 
                 encodedTextRepresentations =
-                    Collections.unmodifiableMap(encodedTextRepresentationsMap);
+                        Collections.unmodifiableMap(encodedTextRepresentationsMap);
             }
         }
 
@@ -2870,16 +2585,9 @@
             charsetComparator = new CharsetComparator(order);
         }
 
-        public int compare(Object obj1, Object obj2) {
-            DataFlavor flavor1 = null;
-            DataFlavor flavor2 = null;
-            if (order == SELECT_BEST) {
-                flavor1 = (DataFlavor)obj1;
-                flavor2 = (DataFlavor)obj2;
-            } else {
-                flavor1 = (DataFlavor)obj2;
-                flavor2 = (DataFlavor)obj1;
-            }
+        public int compare(DataFlavor obj1, DataFlavor obj2) {
+            DataFlavor flavor1 = order == SELECT_BEST ? obj1 : obj2;
+            DataFlavor flavor2 = order == SELECT_BEST ? obj2 : obj1;
 
             if (flavor1.equals(flavor2)) {
                 return 0;
@@ -2982,22 +2690,16 @@
      * reverse index-based order: an object A is greater than an object B if and
      * only if A is less than B with the direct index-based order.
      */
-    public static class IndexOrderComparator extends IndexedComparator {
-        private final Map indexMap;
-        private static final Integer FALLBACK_INDEX =
-            Integer.valueOf(Integer.MIN_VALUE);
-
-        public IndexOrderComparator(Map indexMap) {
-            super(SELECT_BEST);
-            this.indexMap = indexMap;
-        }
-
-        public IndexOrderComparator(Map indexMap, boolean order) {
+    public static class IndexOrderComparator extends IndexedComparator<Long> {
+        private final Map<Long, Integer> indexMap;
+        private static final Integer FALLBACK_INDEX = Integer.MIN_VALUE;
+
+        public IndexOrderComparator(Map<Long, Integer> indexMap, boolean order) {
             super(order);
             this.indexMap = indexMap;
         }
 
-        public int compare(Object obj1, Object obj2) {
+        public int compare(Long obj1, Long obj2) {
             if (order == SELECT_WORST) {
                 return -compareIndices(indexMap, obj1, obj2, FALLBACK_INDEX);
             } else {
@@ -3047,7 +2749,7 @@
          * Returns {@code true} if the given class is java.rmi.Remote.
          */
         static boolean isRemote(Class<?> c) {
-            return (remoteClass == null) ? null : remoteClass.isAssignableFrom(c);
+            return (remoteClass == null) ? false : remoteClass.isAssignableFrom(c);
         }
 
         /**
@@ -3064,9 +2766,7 @@
         static Object newMarshalledObject(Object obj) throws IOException {
             try {
                 return marshallCtor.newInstance(obj);
-            } catch (InstantiationException x) {
-                throw new AssertionError(x);
-            } catch (IllegalAccessException x) {
+            } catch (InstantiationException | IllegalAccessException x) {
                 throw new AssertionError(x);
             } catch (InvocationTargetException  x) {
                 Throwable cause = x.getCause();
--- a/jdk/src/share/classes/sun/awt/datatransfer/SunClipboard.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/awt/datatransfer/SunClipboard.java	Tue Apr 01 15:37:15 2014 +0200
@@ -217,7 +217,7 @@
             openClipboard(null);
 
             long[] formats = getClipboardFormats();
-            Long lFormat = (Long)DataTransferer.getInstance().
+            Long lFormat = DataTransferer.getInstance().
                     getFlavorsForFormats(formats, flavorMap).get(flavor);
 
             if (lFormat == null) {
--- a/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -627,14 +627,14 @@
         if (dropOperation == DnDConstants.ACTION_NONE)
             throw new IllegalArgumentException("invalid acceptDrop() action");
 
-        if (dropStatus != STATUS_WAIT) {
+        if (dropStatus == STATUS_WAIT || dropStatus == STATUS_ACCEPT) {
+            currentDA = currentA = mapOperation(dropOperation & currentSA);
+
+            dropStatus   = STATUS_ACCEPT;
+            dropComplete = false;
+        } else {
             throw new InvalidDnDOperationException("invalid acceptDrop()");
         }
-
-        currentDA = currentA = mapOperation(dropOperation & currentSA);
-
-        dropStatus   = STATUS_ACCEPT;
-        dropComplete = false;
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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.
+ */
+package sun.awt.image;
+
+import java.awt.Image;
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+import java.util.Arrays;
+import java.util.List;
+import java.util.function.Function;
+
+public class MultiResolutionBufferedImage extends BufferedImage
+        implements MultiResolutionImage {
+
+    Image[] resolutionVariants;
+    int baseIndex;
+
+    public MultiResolutionBufferedImage(int imageType, int baseIndex, Image... images) {
+        super(images[baseIndex].getWidth(null), images[baseIndex].getHeight(null),
+                imageType);
+        this.baseIndex = baseIndex;
+        this.resolutionVariants = images;
+        Graphics g = getGraphics();
+        g.drawImage(images[baseIndex], 0, 0, null);
+        g.dispose();
+        images[baseIndex] = this;
+    }
+
+    @Override
+    public Image getResolutionVariant(int width, int height) {
+        for (Image image : resolutionVariants) {
+            if (width <= image.getWidth(null) && height <= image.getHeight(null)) {
+                return image;
+            }
+        }
+        return this;
+    }
+
+    @Override
+    public List<Image> getResolutionVariants() {
+        return Arrays.asList(resolutionVariants);
+    }
+
+    public MultiResolutionBufferedImage map(Function<Image, Image> mapper) {
+        return new MultiResolutionBufferedImage(getType(), baseIndex,
+                Arrays.stream(resolutionVariants).map(mapper)
+                        .toArray(length -> new Image[length]));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/awt/image/MultiResolutionImage.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.awt.image;
+
+import java.awt.Image;
+import java.util.List;
+
+/**
+ * This interface is designed to provide a set of images at various resolutions.
+ *
+ * The <code>MultiResolutionImage</code> interface should be implemented by any
+ * class whose instances are intended to provide image resolution variants
+ * according to the given image width and height.
+ *
+ * For example,
+ * <pre>
+ * {@code
+ *  public class ScaledImage extends BufferedImage
+ *         implements MultiResolutionImage {
+ *
+ *    @Override
+ *    public Image getResolutionVariant(int width, int height) {
+ *      return ((width <= getWidth() && height <= getHeight()))
+ *             ? this : highResolutionImage;
+ *    }
+ *
+ *    @Override
+ *    public List<Image> getResolutionVariants() {
+ *        return Arrays.asList(this, highResolutionImage);
+ *    }
+ *  }
+ * }</pre>
+ *
+ * It is recommended to cache image variants for performance reasons.
+ *
+ * <b>WARNING</b>: This class is an implementation detail. This API may change
+ * between update release, and it may even be removed or be moved in some other
+ * package(s)/class(es).
+ */
+public interface MultiResolutionImage {
+
+    /**
+     * Provides an image with necessary resolution which best fits to the given
+     * image width and height.
+     *
+     * @param width the desired image resolution width.
+     * @param height the desired image resolution height.
+     * @return image resolution variant.
+     *
+     * @since JDK1.8
+     */
+    public Image getResolutionVariant(int width, int height);
+
+    /**
+     * Gets list of all resolution variants including the base image
+     *
+     * @return list of resolution variants.
+     * @since JDK1.8
+     */
+    public List<Image> getResolutionVariants();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/awt/image/MultiResolutionToolkitImage.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.awt.image;
+
+import java.awt.Image;
+import java.awt.image.ImageObserver;
+import java.util.Arrays;
+import java.util.List;
+import sun.misc.SoftCache;
+
+public class MultiResolutionToolkitImage extends ToolkitImage implements MultiResolutionImage {
+
+    Image resolutionVariant;
+
+    public MultiResolutionToolkitImage(Image lowResolutionImage, Image resolutionVariant) {
+        super(lowResolutionImage.getSource());
+        this.resolutionVariant = resolutionVariant;
+    }
+
+    @Override
+    public Image getResolutionVariant(int width, int height) {
+        return ((width <= getWidth() && height <= getHeight()))
+                ? this : resolutionVariant;
+    }
+
+    public Image getResolutionVariant() {
+        return resolutionVariant;
+    }
+
+    @Override
+    public List<Image> getResolutionVariants() {
+        return Arrays.<Image>asList(this, resolutionVariant);
+    }
+
+    private static final int BITS_INFO = ImageObserver.SOMEBITS
+            | ImageObserver.FRAMEBITS | ImageObserver.ALLBITS;
+
+    private static class ObserverCache {
+
+        static final SoftCache INSTANCE = new SoftCache();
+    }
+
+    public static ImageObserver getResolutionVariantObserver(
+            final Image image, final ImageObserver observer,
+            final int imgWidth, final int imgHeight,
+            final int rvWidth, final int rvHeight) {
+
+        if (observer == null) {
+            return null;
+        }
+
+        synchronized (ObserverCache.INSTANCE) {
+            ImageObserver o = (ImageObserver) ObserverCache.INSTANCE.get(image);
+
+            if (o == null) {
+
+                o = (Image resolutionVariant, int flags,
+                        int x, int y, int width, int height) -> {
+
+                            if ((flags & (ImageObserver.WIDTH | BITS_INFO)) != 0) {
+                                width = (width + 1) / 2;
+                            }
+
+                            if ((flags & (ImageObserver.HEIGHT | BITS_INFO)) != 0) {
+                                height = (height + 1) / 2;
+                            }
+
+                            if ((flags & BITS_INFO) != 0) {
+                                x /= 2;
+                                y /= 2;
+                            }
+
+                            return observer.imageUpdate(
+                                    image, flags, x, y, width, height);
+                        };
+
+                ObserverCache.INSTANCE.put(image, o);
+            }
+            return o;
+        }
+    }
+}
--- a/jdk/src/share/classes/sun/font/AttributeValues.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/AttributeValues.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -410,7 +410,7 @@
     }
 
     public Hashtable<Object, Object> toSerializableHashtable() {
-        Hashtable ht = new Hashtable();
+        Hashtable<Object, Object> ht = new Hashtable<>();
         int hashkey = defined;
         for (int m = defined, i = 0; m != 0; ++i) {
             EAttribute ea = EAttribute.atts[i];
@@ -798,7 +798,7 @@
                 hl = (InputMethodHighlight)((Annotation)imHighlight).getValue();
             }
 
-            Map imStyles = hl.getStyle();
+            Map<TextAttribute, ?> imStyles = hl.getStyle();
             if (imStyles == null) {
                 Toolkit tk = Toolkit.getDefaultToolkit();
                 imStyles = tk.mapInputMethodHighlight(hl);
@@ -812,6 +812,7 @@
         return this;
     }
 
+    @SuppressWarnings("unchecked")
     public static AffineTransform getBaselineTransform(Map<?, ?> map) {
         if (map != null) {
             AttributeValues av = null;
@@ -828,6 +829,7 @@
         return null;
     }
 
+    @SuppressWarnings("unchecked")
     public static AffineTransform getCharTransform(Map<?, ?> map) {
         if (map != null) {
             AttributeValues av = null;
--- a/jdk/src/share/classes/sun/font/CompositeFont.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/CompositeFont.java	Tue Apr 01 15:37:15 2014 +0200
@@ -447,8 +447,7 @@
     }
 
     public String toString() {
-        String ls = java.security.AccessController.doPrivileged(
-                new sun.security.action.GetPropertyAction("line.separator"));
+        String ls = System.lineSeparator();
         String componentsStr = "";
         for (int i=0; i<numSlots; i++) {
             componentsStr += "    Slot["+i+"]="+getSlotFont(i)+ls;
--- a/jdk/src/share/classes/sun/font/CreatedFontTracker.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/CreatedFontTracker.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -113,7 +113,7 @@
             if (t == null) {
                 // Add a shutdown hook to remove the temp file.
                 java.security.AccessController.doPrivileged(
-                   new java.security.PrivilegedAction() {
+                   new java.security.PrivilegedAction<Object>() {
                       public Object run() {
                           /* The thread must be a member of a thread group
                            * which will not get GCed before VM exit.
--- a/jdk/src/share/classes/sun/font/Decoration.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/Decoration.java	Tue Apr 01 15:37:15 2014 +0200
@@ -46,6 +46,7 @@
 import java.awt.geom.Line2D;
 import java.awt.geom.Rectangle2D;
 import java.awt.geom.GeneralPath;
+import java.text.AttributedCharacterIterator.Attribute;
 
 import static sun.font.AttributeValues.*;
 import static sun.font.EAttribute.*;
@@ -107,7 +108,7 @@
      * Return a Decoration appropriate for the the given Map.
      * @param attributes the Map used to determine the Decoration
      */
-    public static Decoration getDecoration(Map attributes) {
+    public static Decoration getDecoration(Map<? extends Attribute, ?> attributes) {
         if (attributes == null) {
             return PLAIN;
         }
--- a/jdk/src/share/classes/sun/font/FileFont.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/FileFont.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -159,7 +159,7 @@
         SunFontManager fm = SunFontManager.getInstance();
         fm.deRegisterBadFont(this);
 
-        for (Reference strikeRef : strikeCache.values()) {
+        for (Reference<FontStrike> strikeRef : strikeCache.values()) {
             if (strikeRef != null) {
                 /* NB we know these are all FileFontStrike instances
                  * because the cache is on this FileFont
@@ -261,7 +261,7 @@
 
         public void dispose() {
             java.security.AccessController.doPrivileged(
-                 new java.security.PrivilegedAction() {
+                 new java.security.PrivilegedAction<Object>() {
                       public Object run() {
                           if (fontFile != null) {
                               try {
--- a/jdk/src/share/classes/sun/font/Font2D.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/Font2D.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -91,8 +91,8 @@
      * the map will have fewer entries, and there's no need to try to
      * make the Font2D part of the key.
      */
-    protected ConcurrentHashMap<FontStrikeDesc, Reference>
-        strikeCache = new ConcurrentHashMap<FontStrikeDesc, Reference>();
+    protected ConcurrentHashMap<FontStrikeDesc, Reference<FontStrike>>
+        strikeCache = new ConcurrentHashMap<>();
 
     /* Store the last Strike in a Reference object.
      * Similarly to the strike that was stored on a C++ font object,
@@ -105,7 +105,7 @@
      * This pre-supposes that a FontStrike is a shareable object, which
      * it should.
      */
-    protected Reference lastFontStrike = new SoftReference(null);
+    protected Reference<FontStrike> lastFontStrike = new SoftReference<>(null);
 
     /*
      * POSSIBLE OPTIMISATION:
@@ -195,7 +195,7 @@
      * strike.
      */
     public FontStrike getStrike(Font font) {
-        FontStrike strike = (FontStrike)lastFontStrike.get();
+        FontStrike strike = lastFontStrike.get();
         if (strike != null) {
             return strike;
         } else {
@@ -307,17 +307,17 @@
          * collected, then we create a new strike, put it in the map and
          * set it to be the last strike.
          */
-        FontStrike strike = (FontStrike)lastFontStrike.get();
+        FontStrike strike = lastFontStrike.get();
         if (strike != null && desc.equals(strike.desc)) {
             //strike.lastlookupTime = System.currentTimeMillis();
             return strike;
         } else {
-            Reference strikeRef = strikeCache.get(desc);
+            Reference<FontStrike> strikeRef = strikeCache.get(desc);
             if (strikeRef != null) {
-                strike = (FontStrike)strikeRef.get();
+                strike = strikeRef.get();
                 if (strike != null) {
                     //strike.lastlookupTime = System.currentTimeMillis();
-                    lastFontStrike = new SoftReference(strike);
+                    lastFontStrike = new SoftReference<>(strike);
                     StrikeCache.refStrike(strike);
                     return strike;
                 }
@@ -360,14 +360,14 @@
             }
             strikeCache.put(desc, strikeRef);
             //strike.lastlookupTime = System.currentTimeMillis();
-            lastFontStrike = new SoftReference(strike);
+            lastFontStrike = new SoftReference<>(strike);
             StrikeCache.refStrike(strike);
             return strike;
         }
     }
 
     void removeFromCache(FontStrikeDesc desc) {
-        Reference ref = strikeCache.get(desc);
+        Reference<FontStrike> ref = strikeCache.get(desc);
         if (ref != null) {
             Object o = ref.get();
             if (o == null) {
--- a/jdk/src/share/classes/sun/font/FontDesignMetrics.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/FontDesignMetrics.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, 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
@@ -170,10 +170,10 @@
      * Also we put the references on a queue so that if they do get nulled
      * out we can clear the keys from the table.
      */
-    private static class KeyReference extends SoftReference
+    private static class KeyReference extends SoftReference<Object>
         implements DisposerRecord, Disposer.PollDisposable {
 
-        static ReferenceQueue queue = Disposer.getQueue();
+        static ReferenceQueue<Object> queue = Disposer.getQueue();
 
         Object key;
 
--- a/jdk/src/share/classes/sun/font/FontFamily.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/FontFamily.java	Tue Apr 01 15:37:15 2014 +0200
@@ -25,6 +25,7 @@
 
 package sun.font;
 
+import java.io.File;
 import java.awt.Font;
 import java.util.HashMap;
 import java.util.concurrent.ConcurrentHashMap;
@@ -105,8 +106,39 @@
         return familyRank;
     }
 
+    private boolean isFromSameSource(Font2D font) {
+        if (!(font instanceof FileFont)) {
+            return false;
+        }
+
+        FileFont existingFont = null;
+        if (plain instanceof FileFont) {
+            existingFont = (FileFont)plain;
+        } else if (bold instanceof FileFont) {
+            existingFont = (FileFont)bold;
+        } else if (italic instanceof FileFont) {
+             existingFont = (FileFont)italic;
+        } else if (bolditalic instanceof FileFont) {
+             existingFont = (FileFont)bolditalic;
+        }
+        // A family isn't created until there's a font.
+        // So if we didn't find a file font it means this
+        // isn't a file-based family.
+        if (existingFont == null) {
+            return false;
+        }
+        File existDir = (new File(existingFont.platName)).getParentFile();
+
+        FileFont newFont = (FileFont)font;
+        File newDir = (new File(newFont.platName)).getParentFile();
+        return java.util.Objects.equals(newDir, existDir);
+    }
+
     public void setFont(Font2D font, int style) {
-        if (font.getRank() > familyRank) {
+        /* Allow a lower-rank font only if its a file font
+         * from the exact same source as any previous font.
+         */
+        if ((font.getRank() > familyRank) && !isFromSameSource(font)) {
             if (FontUtilities.isLogging()) {
                 FontUtilities.getLogger()
                                   .warning("Rejecting adding " + font +
--- a/jdk/src/share/classes/sun/font/FontManagerFactory.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/FontManagerFactory.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,7 +71,7 @@
             return instance;
         }
 
-        AccessController.doPrivileged(new PrivilegedAction() {
+        AccessController.doPrivileged(new PrivilegedAction<Object>() {
 
             public Object run() {
                 try {
@@ -79,7 +79,7 @@
                             System.getProperty("sun.font.fontmanager",
                                                DEFAULT_CLASS);
                     ClassLoader cl = ClassLoader.getSystemClassLoader();
-                    Class fmClass = Class.forName(fmClassName, true, cl);
+                    Class<?> fmClass = Class.forName(fmClassName, true, cl);
                     instance = (FontManager) fmClass.newInstance();
                 } catch (ClassNotFoundException |
                          InstantiationException |
--- a/jdk/src/share/classes/sun/font/FontManagerNativeLibrary.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/FontManagerNativeLibrary.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 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
@@ -30,7 +30,7 @@
 public class FontManagerNativeLibrary {
     static {
         java.security.AccessController.doPrivileged(
-                                    new java.security.PrivilegedAction() {
+                                    new java.security.PrivilegedAction<Object>() {
             public Object run() {
                /* REMIND do we really have to load awt here? */
                System.loadLibrary("awt");
--- a/jdk/src/share/classes/sun/font/FontResolver.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/FontResolver.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, 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
@@ -33,6 +33,7 @@
 import java.awt.Font;
 import java.awt.GraphicsEnvironment;
 import java.awt.font.TextAttribute;
+import java.text.AttributedCharacterIterator;
 import java.util.ArrayList;
 import java.util.Map;
 import sun.text.CodePointIterator;
@@ -222,7 +223,8 @@
      *        is Font.PLAIN
      * @see #getFontIndex
      */
-    public Font getFont(int index, Map attributes) {
+    public Font getFont(int index,
+                        Map<? extends AttributedCharacterIterator.Attribute, ?> attributes) {
         Font font = defaultFont;
 
         if (index >= 2) {
--- a/jdk/src/share/classes/sun/font/FontScaler.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/FontScaler.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, 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
@@ -82,23 +82,24 @@
 public abstract class FontScaler implements DisposerRecord {
 
     private static FontScaler nullScaler = null;
-    private static Constructor<FontScaler> scalerConstructor = null;
+    private static Constructor<? extends FontScaler> scalerConstructor = null;
 
     //Find preferred font scaler
     //
     //NB: we can allow property based preferences
     //   (theoretically logic can be font type specific)
     static {
-        Class scalerClass = null;
-        Class arglst[] = new Class[] {Font2D.class, int.class,
+        Class<? extends FontScaler> scalerClass = null;
+        Class<?>[] arglst = new Class<?>[] {Font2D.class, int.class,
         boolean.class, int.class};
 
         try {
-            if (FontUtilities.isOpenJDK) {
-                scalerClass = Class.forName("sun.font.FreetypeFontScaler");
-            } else {
-                scalerClass = Class.forName("sun.font.T2KFontScaler");
-            }
+            @SuppressWarnings("unchecked")
+            Class<? extends FontScaler> tmp = (Class<? extends FontScaler>)
+                (FontUtilities.isOpenJDK ?
+                 Class.forName("sun.font.FreetypeFontScaler") :
+                 Class.forName("sun.font.T2KFontScaler"));
+            scalerClass = tmp;
         } catch (ClassNotFoundException e) {
                 scalerClass = NullFontScaler.class;
         }
--- a/jdk/src/share/classes/sun/font/FontUtilities.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/FontUtilities.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,7 +71,7 @@
     // This static initializer block figures out the OS constants.
     static {
 
-        AccessController.doPrivileged(new PrivilegedAction () {
+        AccessController.doPrivileged(new PrivilegedAction<Object>() {
             public Object run() {
                 String osName = System.getProperty("os.name", "unknownOS");
                 isSolaris = osName.startsWith("SunOS");
@@ -391,7 +391,7 @@
      */
     private static volatile
         SoftReference<ConcurrentHashMap<PhysicalFont, CompositeFont>>
-        compMapRef = new SoftReference(null);
+        compMapRef = new SoftReference<>(null);
 
     public static FontUIResource getCompositeFontUIResource(Font font) {
 
@@ -421,7 +421,7 @@
         ConcurrentHashMap<PhysicalFont, CompositeFont> compMap = compMapRef.get();
         if (compMap == null) { // Its been collected.
             compMap = new ConcurrentHashMap<PhysicalFont, CompositeFont>();
-            compMapRef = new SoftReference(compMap);
+            compMapRef = new SoftReference<>(compMap);
         }
         CompositeFont compFont = compMap.get(physicalFont);
         if (compFont == null) {
--- a/jdk/src/share/classes/sun/font/FreetypeFontScaler.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/FreetypeFontScaler.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -50,7 +50,7 @@
         initIDs(FreetypeFontScaler.class);
     }
 
-    private static native void initIDs(Class FFS);
+    private static native void initIDs(Class<?> FFS);
 
     private void invalidateScaler() throws FontScalerException {
         nativeScaler = 0;
@@ -69,7 +69,7 @@
                                         indexInCollection,
                                         supportsCJK,
                                         filesize);
-        this.font = new WeakReference(font);
+        this.font = new WeakReference<>(font);
     }
 
     synchronized StrikeMetrics getFontMetrics(long pScalerContext)
--- a/jdk/src/share/classes/sun/font/GlyphLayout.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/GlyphLayout.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -92,7 +92,7 @@
     private ScriptRun _scriptRuns;     // iterator over script runs
     private FontRunIterator _fontRuns; // iterator over physical fonts in a composite
     private int _ercount;
-    private ArrayList _erecords;
+    private ArrayList<EngineRecord> _erecords;
     private Point2D.Float _pt;
     private FontStrikeDesc _sd;
     private float[] _mat;
@@ -457,7 +457,7 @@
         //        _sd.init(dtx, gtx, font.getStyle(), frc.isAntiAliased(), frc.usesFractionalMetrics());
         _sd = txinfo.sd;
         for (;ix != stop; ix += dir) {
-            EngineRecord er = (EngineRecord)_erecords.get(ix);
+            EngineRecord er = _erecords.get(ix);
             for (;;) {
                 try {
                     er.layout();
@@ -505,7 +505,7 @@
         this._textRecord = new TextRecord();
         this._scriptRuns = new ScriptRun();
         this._fontRuns = new FontRunIterator();
-        this._erecords = new ArrayList(10);
+        this._erecords = new ArrayList<>(10);
         this._pt = new Point2D.Float();
         this._sd = new FontStrikeDesc();
         this._mat = new float[4];
@@ -523,7 +523,7 @@
             er = new EngineRecord();
             _erecords.add(er);
         } else {
-            er = (EngineRecord)_erecords.get(_ercount);
+            er = _erecords.get(_ercount);
         }
         er.init(start, limit, font, script, lang, gmask);
         ++_ercount;
--- a/jdk/src/share/classes/sun/font/StandardGlyphVector.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/StandardGlyphVector.java	Tue Apr 01 15:37:15 2014 +0200
@@ -153,7 +153,7 @@
     private AffineTransform invdtx; // inverse of dtx or null if dtx is identity
     private AffineTransform frctx; // font render context transform, wish we could just share it
     private Font2D font2D;         // basic strike-independent stuff
-    private SoftReference fsref;   // font strike reference for glyphs with no per-glyph transform
+    private SoftReference<GlyphStrike> fsref;   // font strike reference for glyphs with no per-glyph transform
 
     /////////////////////////////
     // Constructors and Factory methods
@@ -526,9 +526,9 @@
         }
 
         Shape[] lbcache;
-        if (lbcacheRef == null || (lbcache = (Shape[])lbcacheRef.get()) == null) {
+        if (lbcacheRef == null || (lbcache = lbcacheRef.get()) == null) {
             lbcache = new Shape[glyphs.length];
-            lbcacheRef = new SoftReference(lbcache);
+            lbcacheRef = new SoftReference<>(lbcache);
         }
 
         Shape result = lbcache[ix];
@@ -568,7 +568,7 @@
 
         return result;
     }
-    private SoftReference lbcacheRef;
+    private SoftReference<Shape[]> lbcacheRef;
 
     public Shape getGlyphVisualBounds(int ix) {
         if (ix < 0 || ix >= glyphs.length) {
@@ -576,9 +576,9 @@
         }
 
         Shape[] vbcache;
-        if (vbcacheRef == null || (vbcache = (Shape[])vbcacheRef.get()) == null) {
+        if (vbcacheRef == null || (vbcache = vbcacheRef.get()) == null) {
             vbcache = new Shape[glyphs.length];
-            vbcacheRef = new SoftReference(vbcache);
+            vbcacheRef = new SoftReference<>(vbcache);
         }
 
         Shape result = vbcache[ix];
@@ -589,7 +589,7 @@
 
         return result;
     }
-    private SoftReference vbcacheRef;
+    private SoftReference<Shape[]> vbcacheRef;
 
     public Rectangle getGlyphPixelBounds(int index, FontRenderContext renderFRC, float x, float y) {
       return getGlyphsPixelBounds(renderFRC, x, y, index, 1);
@@ -1230,14 +1230,14 @@
 
     private void clearCaches(int ix) {
         if (lbcacheRef != null) {
-            Shape[] lbcache = (Shape[])lbcacheRef.get();
+            Shape[] lbcache = lbcacheRef.get();
             if (lbcache != null) {
                 lbcache[ix] = null;
             }
         }
 
         if (vbcacheRef != null) {
-            Shape[] vbcache = (Shape[])vbcacheRef.get();
+            Shape[] vbcache = vbcacheRef.get();
             if (vbcache != null) {
                 vbcache[ix] = null;
             }
@@ -1357,11 +1357,11 @@
     private GlyphStrike getDefaultStrike() {
         GlyphStrike gs = null;
         if (fsref != null) {
-            gs = (GlyphStrike)fsref.get();
+            gs = fsref.get();
         }
         if (gs == null) {
             gs = GlyphStrike.create(this, dtx, null);
-            fsref = new SoftReference(gs);
+            fsref = new SoftReference<>(gs);
         }
         return gs;
     }
@@ -1379,7 +1379,7 @@
         StandardGlyphVector sgv;  // reference back to glyph vector - yuck
         int[] indices;            // index into unique strikes
         double[] transforms;      // six doubles per unique transform, because AT is a pain to manipulate
-        SoftReference strikesRef; // ref to unique strikes, one per transform
+        SoftReference<GlyphStrike[]> strikesRef; // ref to unique strikes, one per transform
         boolean haveAllStrikes;   // true if the strike array has been filled by getStrikes().
 
         // used when first setting a transform
@@ -1653,12 +1653,12 @@
         private GlyphStrike[] getStrikeArray() {
             GlyphStrike[] strikes = null;
             if (strikesRef != null) {
-                strikes = (GlyphStrike[])strikesRef.get();
+                strikes = strikesRef.get();
             }
             if (strikes == null) {
                 haveAllStrikes = false;
                 strikes = new GlyphStrike[transformCount() + 1];
-                strikesRef = new SoftReference(strikes);
+                strikesRef = new SoftReference<>(strikes);
             }
 
             return strikes;
--- a/jdk/src/share/classes/sun/font/StrikeCache.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/StrikeCache.java	Tue Apr 01 15:37:15 2014 +0200
@@ -65,7 +65,7 @@
 
     static final Unsafe unsafe = Unsafe.getUnsafe();
 
-    static ReferenceQueue refQueue = Disposer.getQueue();
+    static ReferenceQueue<Object> refQueue = Disposer.getQueue();
 
     static ArrayList<GlyphDisposedListener> disposeListeners = new ArrayList<GlyphDisposedListener>(1);
 
@@ -159,7 +159,7 @@
         }
 
         java.security.AccessController.doPrivileged(
-                                    new java.security.PrivilegedAction() {
+                                    new java.security.PrivilegedAction<Object>() {
             public Object run() {
 
                /* Allow a client to override the reference type used to
@@ -378,11 +378,11 @@
         }
     }
 
-    public static Reference getStrikeRef(FontStrike strike) {
+    public static Reference<FontStrike> getStrikeRef(FontStrike strike) {
         return getStrikeRef(strike, cacheRefTypeWeak);
     }
 
-    public static Reference getStrikeRef(FontStrike strike, boolean weak) {
+    public static Reference<FontStrike> getStrikeRef(FontStrike strike, boolean weak) {
         /* Some strikes may have no disposer as there's nothing
          * for them to free, as they allocated no native resource
          * eg, if they did not allocate resources because of a problem,
@@ -392,9 +392,9 @@
          */
         if (strike.disposer == null) {
             if (weak) {
-                return new WeakReference(strike);
+                return new WeakReference<>(strike);
             } else {
-                return new SoftReference(strike);
+                return new SoftReference<>(strike);
             }
         }
 
@@ -410,7 +410,7 @@
     }
 
     static class SoftDisposerRef
-        extends SoftReference implements DisposableStrike {
+        extends SoftReference<FontStrike> implements DisposableStrike {
 
         private FontStrikeDisposer disposer;
 
@@ -418,15 +418,16 @@
             return disposer;
         }
 
+        @SuppressWarnings("unchecked")
         SoftDisposerRef(FontStrike strike) {
             super(strike, StrikeCache.refQueue);
             disposer = strike.disposer;
-            Disposer.addReference(this, disposer);
+            Disposer.addReference((Reference<Object>)(Reference)this, disposer);
         }
     }
 
     static class WeakDisposerRef
-        extends WeakReference implements DisposableStrike {
+        extends WeakReference<FontStrike> implements DisposableStrike {
 
         private FontStrikeDisposer disposer;
 
@@ -434,10 +435,11 @@
             return disposer;
         }
 
+        @SuppressWarnings("unchecked")
         WeakDisposerRef(FontStrike strike) {
             super(strike, StrikeCache.refQueue);
             disposer = strike.disposer;
-            Disposer.addReference(this, disposer);
+            Disposer.addReference((Reference<Object>)(Reference)this, disposer);
         }
     }
 
--- a/jdk/src/share/classes/sun/font/SunFontManager.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/SunFontManager.java	Tue Apr 01 15:37:15 2014 +0200
@@ -197,9 +197,9 @@
     private static HashSet<String> missingFontFiles = null;
     private String defaultFontName;
     private String defaultFontFileName;
-    protected HashSet registeredFontFiles = new HashSet();
-
-    private ArrayList badFonts;
+    protected HashSet<String> registeredFontFiles = new HashSet<>();
+
+    private ArrayList<String> badFonts;
     /* fontPath is the location of all fonts on the system, excluding the
      * JRE's own font directory but including any path specified using the
      * sun.java2d.fontpath property. Together with that property,  it is
@@ -332,7 +332,7 @@
     static {
 
         java.security.AccessController.doPrivileged(
-                                    new java.security.PrivilegedAction() {
+                                    new java.security.PrivilegedAction<Object>() {
 
            public Object run() {
                FontManagerNativeLibrary.load();
@@ -373,7 +373,7 @@
 
         initJREFontMap();
         java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedAction() {
+                new java.security.PrivilegedAction<Object>() {
                     public Object run() {
                         File badFontFile =
                             new File(jreFontDirName + File.separator +
@@ -381,7 +381,7 @@
                         if (badFontFile.exists()) {
                             FileInputStream fis = null;
                             try {
-                                badFonts = new ArrayList();
+                                badFonts = new ArrayList<>();
                                 fis = new FileInputStream(badFontFile);
                                 InputStreamReader isr = new InputStreamReader(fis);
                                 BufferedReader br = new BufferedReader(isr);
@@ -762,7 +762,7 @@
             if (family == null) {
                 family = new FontFamily(familyName, false, rank);
                 family.setFont(f, f.style);
-            } else if (family.getRank() >= rank) {
+            } else {
                 family.setFont(f, f.style);
             }
             fullNameToFont.put(fontName.toLowerCase(Locale.ENGLISH), f);
@@ -853,7 +853,7 @@
                 if (family == null) {
                     family = new FontFamily(familyName, false, rank);
                     family.setFont(newFont, newFont.style);
-                } else if (family.getRank() >= rank) {
+                } else {
                     family.setFont(newFont, newFont.style);
                 }
                 return newFont;
@@ -1227,9 +1227,9 @@
                  * and I don't know how to recover from there being absolutely
                  * no fonts anywhere on the system.
                  */
-                Iterator i = physicalFonts.values().iterator();
+                Iterator<PhysicalFont> i = physicalFonts.values().iterator();
                 if (i.hasNext()) {
-                    defaultPhysicalFont = (PhysicalFont)i.next();
+                    defaultPhysicalFont = i.next();
                 } else {
                     throw new Error("Probable fatal error:No fonts found.");
                 }
@@ -1303,7 +1303,7 @@
         } else {
             filter = new TTorT1Filter();
         }
-        return (String[])AccessController.doPrivileged(new PrivilegedAction() {
+        return (String[])AccessController.doPrivileged(new PrivilegedAction<Object>() {
             public Object run() {
                 if (pathDirs.length == 1) {
                     File dir = new File(pathDirs[0]);
@@ -1419,6 +1419,7 @@
              * them "MS UI Gothic" has no JA name whereas the other two do.
              * So not every font in these files is unmapped or new.
              */
+            @SuppressWarnings("unchecked")
             HashMap<String,String> ffmapCopy =
                 (HashMap<String,String>)(fontToFileMap.clone());
             for (String key : fontToFamilyNameMap.keySet()) {
@@ -1470,7 +1471,7 @@
                     String name = unmappedFontNames.get(i);
                     String familyName = fontToFamilyNameMap.get(name);
                     if (familyName != null) {
-                        ArrayList family = familyToFontListMap.get(familyName);
+                        ArrayList<String> family = familyToFontListMap.get(familyName);
                         if (family != null) {
                             if (family.size() <= 1) {
                                 familyToFontListMap.remove(familyName);
@@ -1896,7 +1897,7 @@
      * to register those again, but we do want to register other registry
      * installed fonts.
      */
-    protected void registerOtherFontFiles(HashSet registeredFontFiles) {
+    protected void registerOtherFontFiles(HashSet<String> registeredFontFiles) {
         if (getFullNameToFileMap().size() == 0) {
             return;
         }
@@ -2080,6 +2081,7 @@
          * name.
          */
         if (_usingPerAppContextComposites) {
+            @SuppressWarnings("unchecked")
             ConcurrentHashMap<String, Font2D> altNameCache =
                 (ConcurrentHashMap<String, Font2D>)
                 AppContext.getAppContext().get(CompositeFont.class);
@@ -2304,10 +2306,15 @@
                 nameTable = createdByFullName;
             } else {
                 AppContext appContext = AppContext.getAppContext();
-                familyTable =
+                @SuppressWarnings("unchecked")
+                Hashtable<String,FontFamily> tmp1 =
                     (Hashtable<String,FontFamily>)appContext.get(regFamilyKey);
-                nameTable =
+                familyTable = tmp1;
+
+                @SuppressWarnings("unchecked")
+                Hashtable<String, Font2D> tmp2 =
                     (Hashtable<String,Font2D>)appContext.get(regFullNameKey);
+                nameTable = tmp2;
             }
 
             family = familyTable.get(lowerCaseName);
@@ -2467,7 +2474,7 @@
         } catch (FontFormatException e) {
             if (isCopy) {
                 java.security.AccessController.doPrivileged(
-                     new java.security.PrivilegedAction() {
+                     new java.security.PrivilegedAction<Object>() {
                           public Object run() {
                               if (_tracker != null) {
                                   _tracker.subBytes((int)fFile.length());
@@ -2492,7 +2499,7 @@
                     final Runnable fileCloserRunnable = new Runnable() {
                       public void run() {
                          java.security.AccessController.doPrivileged(
-                         new java.security.PrivilegedAction() {
+                         new java.security.PrivilegedAction<Object>() {
                          public Object run() {
 
                             for (int i=0;i<CHANNELPOOLSIZE;i++) {
@@ -2521,7 +2528,7 @@
                       }
                     };
                     java.security.AccessController.doPrivileged(
-                       new java.security.PrivilegedAction() {
+                       new java.security.PrivilegedAction<Object>() {
                           public Object run() {
                               /* The thread must be a member of a thread group
                                * which will not get GCed before VM exit.
@@ -2627,15 +2634,17 @@
         fullNameToFont.remove(oldFont.fullName.toLowerCase(Locale.ENGLISH));
         FontFamily.remove(oldFont);
         if (localeFullNamesToFont != null) {
-            Map.Entry[] mapEntries = localeFullNamesToFont.entrySet().
-                toArray(new Map.Entry[0]);
+            Map.Entry<?, ?>[] mapEntries = localeFullNamesToFont.entrySet().
+                toArray(new Map.Entry<?, ?>[0]);
             /* Should I be replacing these, or just I just remove
              * the names from the map?
              */
             for (int i=0; i<mapEntries.length;i++) {
                 if (mapEntries[i].getValue() == oldFont) {
                     try {
-                        mapEntries[i].setValue(newFont);
+                        @SuppressWarnings("unchecked")
+                        Map.Entry<String, PhysicalFont> tmp = (Map.Entry<String, PhysicalFont>)mapEntries[i];
+                        tmp.setValue(newFont);
                     } catch (Exception e) {
                         /* some maps don't support this operation.
                          * In this case just give up and remove the entry.
@@ -2864,7 +2873,7 @@
     private static boolean maybeMultiAppContext() {
         Boolean appletSM = (Boolean)
             java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedAction() {
+                new java.security.PrivilegedAction<Object>() {
                         public Object run() {
                             SecurityManager sm = System.getSecurityManager();
                             return new Boolean
@@ -3055,10 +3064,15 @@
             fontsAreRegistered = true;
         } else {
             AppContext appContext = AppContext.getAppContext();
-            familyTable =
+            @SuppressWarnings("unchecked")
+            Hashtable<String,FontFamily> tmp1 =
                 (Hashtable<String,FontFamily>)appContext.get(regFamilyKey);
-            fullNameTable =
+            familyTable = tmp1;
+            @SuppressWarnings("unchecked")
+            Hashtable<String,Font2D> tmp2 =
                 (Hashtable<String,Font2D>)appContext.get(regFullNameKey);
+            fullNameTable = tmp2;
+
             if (familyTable == null) {
                 familyTable = new Hashtable<String,FontFamily>();
                 fullNameTable = new Hashtable<String,Font2D>();
@@ -3114,8 +3128,10 @@
             familyTable = createdByFamilyName;
         } else if (fontsAreRegisteredPerAppContext) {
             AppContext appContext = AppContext.getAppContext();
-            familyTable =
+            @SuppressWarnings("unchecked")
+            Hashtable<String,FontFamily> tmp =
                 (Hashtable<String,FontFamily>)appContext.get(regFamilyKey);
+            familyTable = tmp;
         } else {
             return null;
         }
@@ -3142,8 +3158,10 @@
             nameTable = createdByFullName;
         } else if (fontsAreRegisteredPerAppContext) {
             AppContext appContext = AppContext.getAppContext();
-            nameTable =
+            @SuppressWarnings("unchecked")
+            Hashtable<String,Font2D> tmp =
                 (Hashtable<String,Font2D>)appContext.get(regFullNameKey);
+            nameTable = tmp;
         } else {
             return null;
         }
@@ -3305,7 +3323,7 @@
             initialiseDeferredFonts();
 
             java.security.AccessController.doPrivileged(
-                                    new java.security.PrivilegedAction() {
+                                    new java.security.PrivilegedAction<Object>() {
                 public Object run() {
                     if (fontPath == null) {
                         fontPath = getPlatformFontPath(noType1Font);
@@ -3440,7 +3458,7 @@
                 FontUtilities.getLogger().info("loadAllFontFiles() called");
             }
             java.security.AccessController.doPrivileged(
-                                    new java.security.PrivilegedAction() {
+                                    new java.security.PrivilegedAction<Object>() {
                 public Object run() {
                     if (fontPath == null) {
                         fontPath = getPlatformFontPath(noType1Font);
@@ -3682,7 +3700,7 @@
     public Font[] getAllInstalledFonts() {
         if (allFonts == null) {
             loadFonts();
-            TreeMap fontMapNames = new TreeMap();
+            TreeMap<String, Font2D> fontMapNames = new TreeMap<>();
             /* warning: the number of composite fonts could change dynamically
              * if applications are allowed to create them. "allfonts" could
              * then be stale.
@@ -3715,7 +3733,7 @@
             Font[] fonts = new Font[fontNames.length];
             for (int i=0; i < fontNames.length; i++) {
                 fonts[i] = new Font(fontNames[i], Font.PLAIN, 1);
-                Font2D f2d = (Font2D)fontMapNames.get(fontNames[i]);
+                Font2D f2d = fontMapNames.get(fontNames[i]);
                 if (f2d  != null) {
                     FontAccess.getFontAccess().setFont2D(fonts[i], f2d.handle);
                 }
@@ -3798,7 +3816,7 @@
 
     public void register1dot0Fonts() {
         java.security.AccessController.doPrivileged(
-                            new java.security.PrivilegedAction() {
+                            new java.security.PrivilegedAction<Object>() {
             public Object run() {
                 String type1Dir = "/usr/openwin/lib/X11/fonts/Type1";
                 registerFontsInDir(type1Dir, true, Font2D.TYPE1_RANK,
@@ -3840,7 +3858,7 @@
         if (systemLocale == null) {
             systemLocale = (Locale)
                 java.security.AccessController.doPrivileged(
-                                    new java.security.PrivilegedAction() {
+                                    new java.security.PrivilegedAction<Object>() {
             public Object run() {
                 /* On windows the system locale may be different than the
                  * user locale. This is an unsupported configuration, but
--- a/jdk/src/share/classes/sun/font/SunLayoutEngine.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/SunLayoutEngine.java	Tue Apr 01 15:37:15 2014 +0200
@@ -129,13 +129,13 @@
 
   // !!! don't need this unless we have more than one sun layout engine...
     public LayoutEngine getEngine(LayoutEngineKey key) {
-        ConcurrentHashMap cache = (ConcurrentHashMap)cacheref.get();
+        ConcurrentHashMap<LayoutEngineKey, LayoutEngine> cache = cacheref.get();
         if (cache == null) {
-            cache = new ConcurrentHashMap();
-            cacheref = new SoftReference(cache);
+            cache = new ConcurrentHashMap<>();
+            cacheref = new SoftReference<>(cache);
         }
 
-        LayoutEngine e = (LayoutEngine)cache.get(key);
+        LayoutEngine e = cache.get(key);
         if (e == null) {
             LayoutEngineKey copy = key.copy();
             e = new SunLayoutEngine(copy);
@@ -143,7 +143,8 @@
         }
         return e;
     }
-    private SoftReference cacheref = new SoftReference(null);
+    private SoftReference<ConcurrentHashMap<LayoutEngineKey, LayoutEngine>> cacheref =
+        new SoftReference<>(null);
 
     private SunLayoutEngine(LayoutEngineKey key) {
         this.key = key;
--- a/jdk/src/share/classes/sun/font/TrueTypeFont.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/TrueTypeFont.java	Tue Apr 01 15:37:15 2014 +0200
@@ -290,7 +290,7 @@
             try {
                 RandomAccessFile raf = (RandomAccessFile)
                 java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction() {
+                    new java.security.PrivilegedAction<Object>() {
                         public Object run() {
                             try {
                                 return new RandomAccessFile(platName, "r");
@@ -1546,7 +1546,7 @@
      * during typical start-up and the information here is likely never
      * needed.
      */
-    protected void initAllNames(int requestedID, HashSet names) {
+    protected void initAllNames(int requestedID, HashSet<String> names) {
 
         byte[] name = new byte[256];
         ByteBuffer buffer = getTableBuffer(nameTag);
@@ -1584,23 +1584,23 @@
     }
 
     String[] getAllFamilyNames() {
-        HashSet aSet = new HashSet();
+        HashSet<String> aSet = new HashSet<>();
         try {
             initAllNames(FAMILY_NAME_ID, aSet);
         } catch (Exception e) {
             /* In case of malformed font */
         }
-        return (String[])aSet.toArray(new String[0]);
+        return aSet.toArray(new String[0]);
     }
 
     String[] getAllFullNames() {
-        HashSet aSet = new HashSet();
+        HashSet<String> aSet = new HashSet<>();
         try {
             initAllNames(FULL_NAME_ID, aSet);
         } catch (Exception e) {
             /* In case of malformed font */
         }
-        return (String[])aSet.toArray(new String[0]);
+        return aSet.toArray(new String[0]);
     }
 
     /*  Used by the OpenType engine for mark positioning.
--- a/jdk/src/share/classes/sun/font/Type1Font.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/font/Type1Font.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -86,7 +86,7 @@
 
         public synchronized void dispose() {
             java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedAction() {
+                new java.security.PrivilegedAction<Object>() {
                     public Object run() {
 
                         if (fileName != null) {
@@ -98,16 +98,16 @@
         }
     }
 
-    WeakReference bufferRef = new WeakReference(null);
+    WeakReference<Object> bufferRef = new WeakReference<>(null);
 
     private String psName = null;
 
-    static private HashMap styleAbbreviationsMapping;
-    static private HashSet styleNameTokes;
+    static private HashMap<String, String> styleAbbreviationsMapping;
+    static private HashSet<String> styleNameTokes;
 
     static {
-        styleAbbreviationsMapping = new HashMap();
-        styleNameTokes = new HashSet();
+        styleAbbreviationsMapping = new HashMap<>();
+        styleNameTokes = new HashSet<>();
 
         /* These abbreviation rules are taken from Appendix 1 of Adobe Technical Note #5088 */
         /* NB: this list is not complete - we did not include abbreviations which contain
@@ -192,7 +192,7 @@
             try {
                 RandomAccessFile raf = (RandomAccessFile)
                 java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction() {
+                    new java.security.PrivilegedAction<Object>() {
                         public Object run() {
                             try {
                                 return new RandomAccessFile(platName, "r");
@@ -205,7 +205,7 @@
                 fileSize = (int)fc.size();
                 mapBuf = fc.map(FileChannel.MapMode.READ_ONLY, 0, fileSize);
                 mapBuf.position(0);
-                bufferRef = new WeakReference(mapBuf);
+                bufferRef = new WeakReference<>(mapBuf);
                 fc.close();
             } catch (NullPointerException e) {
                 throw new FontFormatException(e.toString());
@@ -232,7 +232,7 @@
         try {
             raf = (RandomAccessFile)
                 java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction() {
+                    new java.security.PrivilegedAction<Object>() {
                         public Object run() {
                             try {
                                 return new RandomAccessFile(platName, "r");
@@ -474,7 +474,7 @@
 
     private String expandAbbreviation(String abbr) {
         if (styleAbbreviationsMapping.containsKey(abbr))
-                        return (String) styleAbbreviationsMapping.get(abbr);
+                        return styleAbbreviationsMapping.get(abbr);
         return abbr;
     }
 
--- a/jdk/src/share/classes/sun/java2d/Disposer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/java2d/Disposer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -47,8 +47,9 @@
  * @see DisposerRecord
  */
 public class Disposer implements Runnable {
-    private static final ReferenceQueue queue = new ReferenceQueue();
-    private static final Hashtable records = new Hashtable();
+    private static final ReferenceQueue<Object> queue = new ReferenceQueue<>();
+    private static final Hashtable<java.lang.ref.Reference<Object>, DisposerRecord> records =
+        new Hashtable<>();
 
     private static Disposer disposerInstance;
     public static final int WEAK = 0;
@@ -77,7 +78,7 @@
         }
         disposerInstance = new Disposer();
         java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction() {
+            new java.security.PrivilegedAction<Object>() {
                 public Object run() {
                     /* The thread must be a member of a thread group
                      * which will not get GCed before VM exit.
@@ -135,11 +136,11 @@
         if (target instanceof DisposerTarget) {
             target = ((DisposerTarget)target).getDisposerReferent();
         }
-        java.lang.ref.Reference ref;
+        java.lang.ref.Reference<Object> ref;
         if (refType == PHANTOM) {
-            ref = new PhantomReference(target, queue);
+            ref = new PhantomReference<>(target, queue);
         } else {
-            ref = new WeakReference(target, queue);
+            ref = new WeakReference<>(target, queue);
         }
         records.put(ref, rec);
     }
@@ -149,7 +150,7 @@
             try {
                 Object obj = queue.remove();
                 ((Reference)obj).clear();
-                DisposerRecord rec = (DisposerRecord)records.remove(obj);
+                DisposerRecord rec = records.remove(obj);
                 rec.dispose();
                 obj = null;
                 rec = null;
@@ -214,7 +215,7 @@
                    && freed < 10000 && deferred < 100) {
                 freed++;
                 ((Reference)obj).clear();
-                DisposerRecord rec = (DisposerRecord)records.remove(obj);
+                DisposerRecord rec = records.remove(obj);
                 if (rec instanceof PollDisposable) {
                     rec.dispose();
                     obj = null;
@@ -247,17 +248,18 @@
      * so will clutter the records hashmap and no one will be cleaning up
      * the reference queue.
      */
-    public static void addReference(Reference ref, DisposerRecord rec) {
+    @SuppressWarnings("unchecked")
+    public static void addReference(Reference<Object> ref, DisposerRecord rec) {
         records.put(ref, rec);
     }
 
     public static void addObjectRecord(Object obj, DisposerRecord rec) {
-        records.put(new WeakReference(obj, queue) , rec);
+        records.put(new WeakReference<>(obj, queue) , rec);
     }
 
     /* This is intended for use in conjunction with addReference(..)
      */
-    public static ReferenceQueue getQueue() {
+    public static ReferenceQueue<Object> getQueue() {
         return queue;
     }
 
--- a/jdk/src/share/classes/sun/java2d/SunGraphics2D.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/java2d/SunGraphics2D.java	Tue Apr 01 15:37:15 2014 +0200
@@ -61,6 +61,7 @@
 import java.awt.Rectangle;
 import java.text.AttributedCharacterIterator;
 import java.awt.Font;
+import java.awt.Point;
 import java.awt.image.ImageObserver;
 import java.awt.Transparency;
 import java.awt.font.GlyphVector;
@@ -93,6 +94,13 @@
 import sun.misc.PerformanceLogger;
 
 import java.lang.annotation.Native;
+import sun.awt.image.MultiResolutionImage;
+
+import static java.awt.geom.AffineTransform.TYPE_FLIP;
+import static java.awt.geom.AffineTransform.TYPE_MASK_SCALE;
+import static java.awt.geom.AffineTransform.TYPE_TRANSLATION;
+import sun.awt.image.MultiResolutionToolkitImage;
+import sun.awt.image.ToolkitImage;
 
 /**
  * This is a the master Graphics2D superclass for all of the Sun
@@ -237,6 +245,7 @@
     protected Region devClip;           // Actual physical drawable in pixels
 
     private final int devScale;         // Actual physical scale factor
+    private int resolutionVariantHint;
 
     // cached state for text rendering
     private boolean validFontInfo;
@@ -274,6 +283,7 @@
         lcdTextContrast = lcdTextContrastDefaultValue;
         interpolationHint = -1;
         strokeHint = SunHints.INTVAL_STROKE_DEFAULT;
+        resolutionVariantHint = SunHints.INTVAL_RESOLUTION_VARIANT_DEFAULT;
 
         interpolationType = AffineTransformOp.TYPE_NEAREST_NEIGHBOR;
 
@@ -1249,6 +1259,10 @@
                 stateChanged = (strokeHint != newHint);
                 strokeHint = newHint;
                 break;
+            case SunHints.INTKEY_RESOLUTION_VARIANT:
+                stateChanged = (resolutionVariantHint != newHint);
+                resolutionVariantHint = newHint;
+                break;
             default:
                 recognized = false;
                 stateChanged = false;
@@ -1322,6 +1336,9 @@
         case SunHints.INTKEY_STROKE_CONTROL:
             return SunHints.Value.get(SunHints.INTKEY_STROKE_CONTROL,
                                       strokeHint);
+        case SunHints.INTKEY_RESOLUTION_VARIANT:
+            return SunHints.Value.get(SunHints.INTKEY_RESOLUTION_VARIANT,
+                                      resolutionVariantHint);
         }
         return null;
     }
@@ -3050,18 +3067,58 @@
     }
 // end of text rendering methods
 
-    private static boolean isHiDPIImage(final Image img) {
-        return SurfaceManager.getImageScale(img) != 1;
+    private boolean isHiDPIImage(final Image img) {
+        return (SurfaceManager.getImageScale(img) != 1) ||
+               (resolutionVariantHint != SunHints.INTVAL_RESOLUTION_VARIANT_OFF
+                    && img instanceof MultiResolutionImage);
     }
 
     private boolean drawHiDPIImage(Image img, int dx1, int dy1, int dx2,
                                    int dy2, int sx1, int sy1, int sx2, int sy2,
                                    Color bgcolor, ImageObserver observer) {
-        final int scale = SurfaceManager.getImageScale(img);
-        sx1 = Region.clipScale(sx1, scale);
-        sx2 = Region.clipScale(sx2, scale);
-        sy1 = Region.clipScale(sy1, scale);
-        sy2 = Region.clipScale(sy2, scale);
+
+        if (SurfaceManager.getImageScale(img) != 1) {  // Volatile Image
+            final int scale = SurfaceManager.getImageScale(img);
+            sx1 = Region.clipScale(sx1, scale);
+            sx2 = Region.clipScale(sx2, scale);
+            sy1 = Region.clipScale(sy1, scale);
+            sy2 = Region.clipScale(sy2, scale);
+        } else if (img instanceof MultiResolutionImage) {
+            // get scaled destination image size
+
+            int width = img.getWidth(observer);
+            int height = img.getHeight(observer);
+
+            Image resolutionVariant = getResolutionVariant(
+                    (MultiResolutionImage) img, width, height,
+                    dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2);
+
+            if (resolutionVariant != img && resolutionVariant != null) {
+                // recalculate source region for the resolution variant
+
+                ImageObserver rvObserver = MultiResolutionToolkitImage.
+                        getResolutionVariantObserver(img, observer,
+                                width, height, -1, -1);
+
+                int rvWidth = resolutionVariant.getWidth(rvObserver);
+                int rvHeight = resolutionVariant.getHeight(rvObserver);
+
+                if (0 < width && 0 < height && 0 < rvWidth && 0 < rvHeight) {
+
+                    float widthScale = ((float) rvWidth) / width;
+                    float heightScale = ((float) rvHeight) / height;
+
+                    sx1 = Region.clipScale(sx1, widthScale);
+                    sy1 = Region.clipScale(sy1, heightScale);
+                    sx2 = Region.clipScale(sx2, widthScale);
+                    sy2 = Region.clipScale(sy2, heightScale);
+
+                    observer = rvObserver;
+                    img = resolutionVariant;
+                }
+            }
+        }
+
         try {
             return imagepipe.scaleImage(this, img, dx1, dy1, dx2, dy2, sx1, sy1,
                                         sx2, sy2, bgcolor, observer);
@@ -3081,6 +3138,54 @@
         }
     }
 
+    private Image getResolutionVariant(MultiResolutionImage img,
+            int srcWidth, int srcHeight, int dx1, int dy1, int dx2, int dy2,
+            int sx1, int sy1, int sx2, int sy2) {
+
+        if (srcWidth <= 0 || srcHeight <= 0) {
+            return null;
+        }
+
+        int sw = sx2 - sx1;
+        int sh = sy2 - sy1;
+
+        if (sw == 0 || sh == 0) {
+            return null;
+        }
+
+        int type = transform.getType();
+        int dw = dx2 - dx1;
+        int dh = dy2 - dy1;
+        double destRegionWidth;
+        double destRegionHeight;
+
+        if ((type & ~(TYPE_TRANSLATION | TYPE_FLIP)) == 0) {
+            destRegionWidth = dw;
+            destRegionHeight = dh;
+        } else if ((type & ~(TYPE_TRANSLATION | TYPE_FLIP | TYPE_MASK_SCALE)) == 0) {
+            destRegionWidth = dw * transform.getScaleX();
+            destRegionHeight = dh * transform.getScaleY();
+        } else {
+            destRegionWidth = dw * Math.hypot(
+                    transform.getScaleX(), transform.getShearY());
+            destRegionHeight = dh * Math.hypot(
+                    transform.getShearX(), transform.getScaleY());
+        }
+
+        int destImageWidth = (int) Math.abs(srcWidth * destRegionWidth / sw);
+        int destImageHeight = (int) Math.abs(srcHeight * destRegionHeight / sh);
+
+        Image resolutionVariant
+                = img.getResolutionVariant(destImageWidth, destImageHeight);
+
+        if (resolutionVariant instanceof ToolkitImage
+                && ((ToolkitImage) resolutionVariant).hasError()) {
+            return null;
+        }
+
+        return resolutionVariant;
+    }
+
     /**
      * Draws an image scaled to x,y,w,h in nonblocking mode with a
      * callback object.
--- a/jdk/src/share/classes/sun/management/VMManagementImpl.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/management/VMManagementImpl.java	Tue Apr 01 15:37:15 2014 +0200
@@ -37,7 +37,6 @@
 import java.util.Collections;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import sun.security.action.GetPropertyAction;
 
 /**
  * Implementation of VMManagement interface that accesses the management
@@ -173,10 +172,8 @@
     }
 
     public String   getBootClassPath( ) {
-        PrivilegedAction<String> pa
-            = new GetPropertyAction("sun.boot.class.path");
-        String result =  AccessController.doPrivileged(pa);
-        return result;
+        return AccessController.doPrivileged(
+            (PrivilegedAction<String>) () -> System.getProperty("sun.boot.class.path"));
     }
 
     public long getUptime() {
--- a/jdk/src/share/classes/sun/misc/CharacterDecoder.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/misc/CharacterDecoder.java	Tue Apr 01 15:37:15 2014 +0200
@@ -183,25 +183,21 @@
      * buffer and returns a byte array containing the data.
      * @exception CEFormatException An error has occurred while decoding
      */
-    public byte decodeBuffer(String inputString)[] throws IOException {
-        byte    inputBuffer[] = new byte[inputString.length()];
-        ByteArrayInputStream inStream;
-        ByteArrayOutputStream outStream;
-
-        inputString.getBytes(0, inputString.length(), inputBuffer, 0);
-        inStream = new ByteArrayInputStream(inputBuffer);
-        outStream = new ByteArrayOutputStream();
+    public byte[] decodeBuffer(String inputString) throws IOException {
+        byte inputBuffer[] = inputString.getBytes();
+        ByteArrayInputStream inStream = new ByteArrayInputStream(inputBuffer);
+        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
         decodeBuffer(inStream, outStream);
-        return (outStream.toByteArray());
+        return outStream.toByteArray();
     }
 
     /**
      * Decode the contents of the inputstream into a buffer.
      */
-    public byte decodeBuffer(InputStream in)[] throws IOException {
+    public byte[] decodeBuffer(InputStream in) throws IOException {
         ByteArrayOutputStream outStream = new ByteArrayOutputStream();
         decodeBuffer(in, outStream);
-        return (outStream.toByteArray());
+        return outStream.toByteArray();
     }
 
     /**
--- a/jdk/src/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java	Tue Apr 01 15:37:15 2014 +0200
@@ -36,7 +36,7 @@
 import sun.net.dns.ResolverConfiguration;
 import sun.net.spi.nameservice.*;
 import java.security.AccessController;
-import sun.security.action.*;
+import java.security.PrivilegedAction;
 
 /*
  * A name service provider based on JNDI-DNS.
@@ -231,7 +231,7 @@
 
         // default domain
         String domain = AccessController.doPrivileged(
-            new GetPropertyAction("sun.net.spi.nameservice.domain"));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.net.spi.nameservice.domain"));
         if (domain != null && domain.length() > 0) {
             domainList = new LinkedList<String>();
             domainList.add(domain);
@@ -239,7 +239,7 @@
 
         // name servers
         String nameservers = AccessController.doPrivileged(
-            new GetPropertyAction("sun.net.spi.nameservice.nameservers"));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.net.spi.nameservice.nameservers"));
         if (nameservers != null && nameservers.length() > 0) {
             nameProviderUrl = createProviderURL(nameservers);
             if (nameProviderUrl.length() == 0) {
--- a/jdk/src/share/classes/sun/rmi/log/ReliableLog.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/log/ReliableLog.java	Tue Apr 01 15:37:15 2014 +0200
@@ -30,8 +30,6 @@
 import java.rmi.server.RMIClassLoader;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import sun.security.action.GetBooleanAction;
-import sun.security.action.GetPropertyAction;
 
 /**
  * This class is a simple implementation of a reliable Log.  The
@@ -141,7 +139,7 @@
     {
         super();
         this.Debug = AccessController.doPrivileged(
-            new GetBooleanAction("sun.rmi.log.debug")).booleanValue();
+            (PrivilegedAction<Boolean>) () -> Boolean.getBoolean("sun.rmi.log.debug"));
         dir = new File(dirPath);
         if (!(dir.exists() && dir.isDirectory())) {
             // create directory
@@ -334,7 +332,7 @@
         getLogClassConstructor() {
 
         String logClassName = AccessController.doPrivileged(
-            new GetPropertyAction("sun.rmi.log.class"));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.log.class"));
         if (logClassName != null) {
             try {
                 ClassLoader loader =
--- a/jdk/src/share/classes/sun/rmi/runtime/Log.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/runtime/Log.java	Tue Apr 01 15:37:15 2014 +0200
@@ -26,22 +26,16 @@
 package sun.rmi.runtime;
 
 import java.io.ByteArrayOutputStream;
-import java.io.IOException;
 import java.io.PrintStream;
 import java.io.OutputStream;
 import java.rmi.server.LogStream;
-import java.util.logging.ConsoleHandler;
+import java.security.PrivilegedAction;
 import java.util.logging.Handler;
-import java.util.logging.Formatter;
 import java.util.logging.SimpleFormatter;
-import java.util.logging.StreamHandler;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import java.util.logging.LogManager;
 import java.util.logging.LogRecord;
 import java.util.logging.StreamHandler;
-import java.util.Map;
-import java.util.HashMap;
 
 /**
  * Utility which provides an abstract "logger" like RMI internal API
@@ -71,10 +65,8 @@
     /* selects log implementation */
     private static final LogFactory logFactory;
     static {
-        boolean useOld =
-            Boolean.valueOf(java.security.AccessController.
-                doPrivileged(new sun.security.action.GetPropertyAction(
-                    "sun.rmi.log.useOld"))).booleanValue();
+        boolean useOld = java.security.AccessController.doPrivileged(
+            (PrivilegedAction<Boolean>) () -> Boolean.getBoolean("sun.rmi.log.useOld"));
 
         /* set factory to select the logging facility to use */
         logFactory = (useOld ? (LogFactory) new LogStreamLogFactory() :
--- a/jdk/src/share/classes/sun/rmi/runtime/RuntimeUtil.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/runtime/RuntimeUtil.java	Tue Apr 01 15:37:15 2014 +0200
@@ -33,7 +33,6 @@
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.logging.Level;
-import sun.security.action.GetIntegerAction;
 
 /**
  * RMI runtime implementation utilities.
@@ -54,8 +53,8 @@
 
     /** number of scheduler threads */
     private static final int schedulerThreads =         // default 1
-        AccessController.doPrivileged(
-            new GetIntegerAction("sun.rmi.runtime.schedulerThreads", 1));
+        AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
+            Integer.getInteger("sun.rmi.runtime.schedulerThreads", 1));
 
     /** permission required to get instance */
     private static final Permission GET_INSTANCE_PERMISSION =
--- a/jdk/src/share/classes/sun/rmi/server/Activation.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/server/Activation.java	Tue Apr 01 15:37:15 2014 +0200
@@ -107,9 +107,6 @@
 import sun.rmi.runtime.NewThreadAction;
 import sun.rmi.server.UnicastServerRef;
 import sun.rmi.transport.LiveRef;
-import sun.security.action.GetBooleanAction;
-import sun.security.action.GetIntegerAction;
-import sun.security.action.GetPropertyAction;
 import sun.security.provider.PolicyFile;
 import com.sun.rmi.rmid.ExecPermission;
 import com.sun.rmi.rmid.ExecOptionPermission;
@@ -184,7 +181,8 @@
 
     // this should be a *private* method since it is privileged
     private static int getInt(String name, int def) {
-        return AccessController.doPrivileged(new GetIntegerAction(name, def));
+        return AccessController.doPrivileged(
+                (PrivilegedAction<Integer>) () -> Integer.getInteger(name, def));
     }
 
     private transient Activator activator;
@@ -2042,13 +2040,13 @@
             }
 
             debugExec = AccessController.doPrivileged(
-                new GetBooleanAction("sun.rmi.server.activation.debugExec"));
+                (PrivilegedAction<Boolean>) () -> Boolean.getBoolean("sun.rmi.server.activation.debugExec"));
 
             /**
              * Determine class name for activation exec policy (if any).
              */
             String execPolicyClassName = AccessController.doPrivileged(
-                new GetPropertyAction("sun.rmi.activation.execPolicy", null));
+                (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.activation.execPolicy"));
             if (execPolicyClassName == null) {
                 if (!stop) {
                     DefaultExecPolicy.checkConfiguration();
@@ -2387,7 +2385,7 @@
 
     static {
         lineSeparator = AccessController.doPrivileged(
-            new GetPropertyAction("line.separator"));
+           (PrivilegedAction<String>) () -> System.getProperty("line.separator"));
         lineSeparatorLength = lineSeparator.length();
     }
 
--- a/jdk/src/share/classes/sun/rmi/server/LoaderHandler.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/server/LoaderHandler.java	Tue Apr 01 15:37:15 2014 +0200
@@ -47,6 +47,7 @@
 import java.security.Policy;
 import java.security.ProtectionDomain;
 import java.rmi.server.LogStream;
+import java.security.PrivilegedAction;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Enumeration;
@@ -57,7 +58,6 @@
 import java.util.WeakHashMap;
 import sun.reflect.misc.ReflectUtil;
 import sun.rmi.runtime.Log;
-import sun.security.action.GetPropertyAction;
 
 /**
  * <code>LoaderHandler</code> provides the implementation of the static
@@ -73,7 +73,7 @@
     /** RMI class loader log level */
     static final int logLevel = LogStream.parseLevel(
         java.security.AccessController.doPrivileged(
-            new GetPropertyAction("sun.rmi.loader.logLevel")));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.loader.logLevel")));
 
     /* loader system log */
     static final Log loaderLog =
@@ -86,7 +86,7 @@
     private static String codebaseProperty = null;
     static {
         String prop = java.security.AccessController.doPrivileged(
-            new GetPropertyAction("java.rmi.server.codebase"));
+            (PrivilegedAction<String>) () -> System.getProperty("java.rmi.server.codebase"));
         if (prop != null && prop.trim().length() > 0) {
             codebaseProperty = prop;
         }
--- a/jdk/src/share/classes/sun/rmi/server/MarshalInputStream.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/server/MarshalInputStream.java	Tue Apr 01 15:37:15 2014 +0200
@@ -36,6 +36,7 @@
 import java.security.Permission;
 
 import java.rmi.server.RMIClassLoader;
+import java.security.PrivilegedAction;
 
 /**
  * MarshalInputStream is an extension of ObjectInputStream.  When resolving
@@ -65,7 +66,7 @@
      */
     private static final boolean useCodebaseOnlyProperty =
         ! java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction(
+            (PrivilegedAction<String>) () -> System.getProperty(
                 "java.rmi.server.useCodebaseOnly", "true"))
             .equalsIgnoreCase("false");
 
--- a/jdk/src/share/classes/sun/rmi/server/UnicastRef.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/server/UnicastRef.java	Tue Apr 01 15:37:15 2014 +0200
@@ -39,11 +39,11 @@
 import java.rmi.server.RemoteObject;
 import java.rmi.server.RemoteRef;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import sun.rmi.runtime.Log;
 import sun.rmi.transport.Connection;
 import sun.rmi.transport.LiveRef;
 import sun.rmi.transport.StreamRemoteCall;
-import sun.security.action.GetBooleanAction;
 
 /**
  * NOTE: There is a JDK-internal dependency on the existence of this
@@ -64,8 +64,8 @@
      */
     public static final Log clientCallLog =
         Log.getLog("sun.rmi.client.call", "RMI",
-                   AccessController.doPrivileged(
-                       new GetBooleanAction("sun.rmi.client.logCalls")));
+                   AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
+                       Boolean.getBoolean("sun.rmi.client.logCalls")));
     private static final long serialVersionUID = 8258372400816541186L;
 
     protected LiveRef ref;
--- a/jdk/src/share/classes/sun/rmi/server/UnicastServerRef.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/server/UnicastServerRef.java	Tue Apr 01 15:37:15 2014 +0200
@@ -56,7 +56,6 @@
 import sun.rmi.transport.LiveRef;
 import sun.rmi.transport.Target;
 import sun.rmi.transport.tcp.TCPTransport;
-import sun.security.action.GetBooleanAction;
 
 /**
  * UnicastServerRef implements the remote reference layer server-side
@@ -73,7 +72,7 @@
 {
     /** value of server call log property */
     public static final boolean logCalls = AccessController.doPrivileged(
-        new GetBooleanAction("java.rmi.server.logCalls"));
+        (PrivilegedAction<Boolean>) () -> Boolean.getBoolean("java.rmi.server.logCalls"));
 
     /** server call log */
     public static final Log callLog =
@@ -84,8 +83,8 @@
 
     /** flag to enable writing exceptions to System.err */
     private static final boolean wantExceptionLog =
-        AccessController.doPrivileged(
-            new GetBooleanAction("sun.rmi.server.exceptionTrace"));
+        AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
+            Boolean.getBoolean("sun.rmi.server.exceptionTrace"));
 
     private boolean forceStubUse = false;
 
@@ -94,9 +93,8 @@
      * exceptions thrown by remote invocations to this VM
      */
     private static final boolean suppressStackTraces =
-        AccessController.doPrivileged(
-            new GetBooleanAction(
-                "sun.rmi.server.suppressStackTraces"));
+        AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
+            Boolean.getBoolean("sun.rmi.server.suppressStackTraces"));
 
     /**
      * skeleton to dispatch remote calls through, for 1.1 stub protocol
--- a/jdk/src/share/classes/sun/rmi/server/Util.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/server/Util.java	Tue Apr 01 15:37:15 2014 +0200
@@ -57,8 +57,6 @@
 import sun.rmi.runtime.Log;
 import sun.rmi.transport.LiveRef;
 import sun.rmi.transport.tcp.TCPEndpoint;
-import sun.security.action.GetBooleanAction;
-import sun.security.action.GetPropertyAction;
 
 /**
  * A utility class with static methods for creating stubs/proxies and
@@ -70,7 +68,7 @@
     /** "server" package log level */
     static final int logLevel = LogStream.parseLevel(
         AccessController.doPrivileged(
-            new GetPropertyAction("sun.rmi.server.logLevel")));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.server.logLevel")));
 
     /** server reference log */
     public static final Log serverRefLog =
@@ -79,8 +77,7 @@
     /** cached value of property java.rmi.server.ignoreStubClasses */
     private static final boolean ignoreStubClasses =
         AccessController.doPrivileged(
-            new GetBooleanAction("java.rmi.server.ignoreStubClasses")).
-            booleanValue();
+            (PrivilegedAction<Boolean>) () -> Boolean.getBoolean("java.rmi.server.ignoreStubClasses"));
 
     /** cache of  impl classes that have no corresponding stub class */
     private static final Map<Class<?>, Void> withoutStubs =
--- a/jdk/src/share/classes/sun/rmi/transport/DGCAckHandler.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/transport/DGCAckHandler.java	Tue Apr 01 15:37:15 2014 +0200
@@ -27,6 +27,7 @@
 
 import java.rmi.server.UID;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -36,7 +37,6 @@
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 import sun.rmi.runtime.RuntimeUtil;
-import sun.security.action.GetLongAction;
 
 /**
  * Holds strong references to a set of remote objects, or live remote
@@ -65,8 +65,8 @@
 
     /** timeout for holding references without receiving an acknowledgment */
     private static final long dgcAckTimeout =           // default 5 minutes
-        AccessController.doPrivileged(
-            new GetLongAction("sun.rmi.dgc.ackTimeout", 300000));
+        AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+            Long.getLong("sun.rmi.dgc.ackTimeout", 300000));
 
     /** thread pool for scheduling delayed tasks */
     private static final ScheduledExecutorService scheduler =
--- a/jdk/src/share/classes/sun/rmi/transport/DGCClient.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/transport/DGCClient.java	Tue Apr 01 15:37:15 2014 +0200
@@ -44,7 +44,6 @@
 import sun.rmi.runtime.NewThreadAction;
 import sun.rmi.server.UnicastRef;
 import sun.rmi.server.Util;
-import sun.security.action.GetLongAction;
 
 /**
  * DGCClient implements the client-side of the RMI distributed garbage
@@ -85,21 +84,18 @@
 
     /** lease duration to request (usually ignored by server) */
     private static final long leaseValue =              // default 10 minutes
-        AccessController.doPrivileged(
-            new GetLongAction("java.rmi.dgc.leaseValue",
-                              600000)).longValue();
+        AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+            Long.getLong("java.rmi.dgc.leaseValue", 600000));
 
     /** maximum interval between retries of failed clean calls */
     private static final long cleanInterval =           // default 3 minutes
-        AccessController.doPrivileged(
-            new GetLongAction("sun.rmi.dgc.cleanInterval",
-                              180000)).longValue();
+        AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+            Long.getLong("sun.rmi.dgc.cleanInterval", 180000));
 
     /** maximum interval between complete garbage collections of local heap */
     private static final long gcInterval =              // default 1 hour
-        AccessController.doPrivileged(
-            new GetLongAction("sun.rmi.dgc.client.gcInterval",
-                              3600000)).longValue();
+        AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+            Long.getLong("sun.rmi.dgc.client.gcInterval", 3600000));
 
     /** minimum retry count for dirty calls that fail */
     private static final int dirtyFailureRetries = 5;
--- a/jdk/src/share/classes/sun/rmi/transport/DGCImpl.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/transport/DGCImpl.java	Tue Apr 01 15:37:15 2014 +0200
@@ -50,8 +50,6 @@
 import sun.rmi.server.UnicastRef;
 import sun.rmi.server.UnicastServerRef;
 import sun.rmi.server.Util;
-import sun.security.action.GetLongAction;
-import sun.security.action.GetPropertyAction;
 
 /**
  * This class implements the guts of the server-side distributed GC
@@ -65,17 +63,17 @@
     /* dgc system log */
     static final Log dgcLog = Log.getLog("sun.rmi.dgc", "dgc",
         LogStream.parseLevel(AccessController.doPrivileged(
-            new GetPropertyAction("sun.rmi.dgc.logLevel"))));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.dgc.logLevel"))));
 
     /** lease duration to grant to clients */
     private static final long leaseValue =              // default 10 minutes
         AccessController.doPrivileged(
-            new GetLongAction("java.rmi.dgc.leaseValue", 600000));
+            (PrivilegedAction<Long>) () -> Long.getLong("java.rmi.dgc.leaseValue", 600000));
 
     /** lease check interval; default is half of lease grant duration */
     private static final long leaseCheckInterval =
         AccessController.doPrivileged(
-            new GetLongAction("sun.rmi.dgc.checkInterval", leaseValue / 2));
+            (PrivilegedAction<Long>) () -> Long.getLong("sun.rmi.dgc.checkInterval", leaseValue / 2));
 
     /** thread pool for scheduling delayed tasks */
     private static final ScheduledExecutorService scheduler =
--- a/jdk/src/share/classes/sun/rmi/transport/ObjectTable.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/transport/ObjectTable.java	Tue Apr 01 15:37:15 2014 +0200
@@ -37,7 +37,6 @@
 import sun.misc.GC;
 import sun.rmi.runtime.Log;
 import sun.rmi.runtime.NewThreadAction;
-import sun.security.action.GetLongAction;
 
 /**
  * Object table shared by all implementors of the Transport interface.
@@ -51,8 +50,8 @@
 
     /** maximum interval between complete garbage collections of local heap */
     private final static long gcInterval =              // default 1 hour
-        AccessController.doPrivileged(
-            new GetLongAction("sun.rmi.dgc.server.gcInterval", 3600000));
+        AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+            Long.getLong("sun.rmi.dgc.server.gcInterval", 3600000));
 
     /**
      * lock guarding objTable and implTable.
--- a/jdk/src/share/classes/sun/rmi/transport/Transport.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/transport/Transport.java	Tue Apr 01 15:37:15 2014 +0200
@@ -37,6 +37,7 @@
 import java.rmi.server.RemoteServer;
 import java.rmi.server.ServerNotActiveException;
 import java.security.AccessControlContext;
+import java.security.PrivilegedAction;
 import sun.rmi.runtime.Log;
 import sun.rmi.server.Dispatcher;
 import sun.rmi.server.UnicastServerRef;
@@ -55,7 +56,7 @@
 
     private static String getLogLevel() {
         return java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("sun.rmi.transport.logLevel"));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.transport.logLevel"));
     }
 
     /* transport package log */
--- a/jdk/src/share/classes/sun/rmi/transport/proxy/HttpSendSocket.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/transport/proxy/HttpSendSocket.java	Tue Apr 01 15:37:15 2014 +0200
@@ -26,6 +26,7 @@
 
 import java.io.*;
 import java.net.*;
+import java.security.PrivilegedAction;
 
 import sun.rmi.runtime.Log;
 
@@ -79,7 +80,7 @@
      */
     private String lineSeparator =
         java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("line.separator"));
+            (PrivilegedAction<String>) () -> System.getProperty("line.separator"));
 
     /**
      * Create a stream socket and connect it to the specified port on
--- a/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java	Tue Apr 01 15:37:15 2014 +0200
@@ -32,9 +32,6 @@
 import java.rmi.server.RMISocketFactory;
 import sun.rmi.runtime.Log;
 import sun.rmi.runtime.NewThreadAction;
-import sun.security.action.GetBooleanAction;
-import sun.security.action.GetLongAction;
-import sun.security.action.GetPropertyAction;
 
 /**
  * RMIMasterSocketFactory attempts to create a socket connection to the
@@ -53,7 +50,7 @@
 
     private static String getLogLevel() {
         return java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("sun.rmi.transport.proxy.logLevel"));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.transport.proxy.logLevel"));
     }
 
     /* proxy package log */
@@ -65,15 +62,14 @@
     private static long connectTimeout = getConnectTimeout();
 
     private static long getConnectTimeout() {
-        return java.security.AccessController.doPrivileged(
-                new GetLongAction("sun.rmi.transport.proxy.connectTimeout",
-                              15000)).longValue(); // default: 15 seconds
+        return java.security.AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+            Long.getLong("sun.rmi.transport.proxy.connectTimeout", 15000)); // default: 15 seconds
     }
 
     /** whether to fallback to HTTP on general connect failures */
     private static final boolean eagerHttpFallback =
-        java.security.AccessController.doPrivileged(new GetBooleanAction(
-            "sun.rmi.transport.proxy.eagerHttpFallback")).booleanValue();
+        java.security.AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
+            Boolean.getBoolean("sun.rmi.transport.proxy.eagerHttpFallback"));
 
     /** table of hosts successfully connected to and the factory used */
     private Hashtable<String, RMISocketFactory> successTable =
@@ -104,14 +100,14 @@
         try {
             String proxyHost;
             proxyHost = java.security.AccessController.doPrivileged(
-                new GetPropertyAction("http.proxyHost"));
+               (PrivilegedAction<String>) () -> System.getProperty("http.proxyHost"));
 
             if (proxyHost == null)
                 proxyHost = java.security.AccessController.doPrivileged(
-                    new GetPropertyAction("proxyHost"));
+                    (PrivilegedAction<String>) () -> System.getProperty("proxyHost"));
 
             boolean disable = java.security.AccessController.doPrivileged(
-                new GetPropertyAction("java.rmi.server.disableHttp", "true"))
+                (PrivilegedAction<String>) () -> System.getProperty("java.rmi.server.disableHttp", "true"))
                 .equalsIgnoreCase("true");
 
             if (!disable && proxyHost != null && proxyHost.length() > 0) {
--- a/jdk/src/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -27,6 +27,7 @@
 import java.io.*;
 import java.util.*;
 import java.rmi.server.LogStream;
+import java.security.PrivilegedAction;
 
 import sun.rmi.runtime.Log;
 
@@ -51,7 +52,7 @@
 
     private static String getLogLevel() {
         return java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("sun.rmi.transport.tcp.multiplex.logLevel"));
+           (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.transport.tcp.multiplex.logLevel"));
     }
 
     /* multiplex system log */
--- a/jdk/src/share/classes/sun/rmi/transport/tcp/TCPChannel.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/transport/tcp/TCPChannel.java	Tue Apr 01 15:37:15 2014 +0200
@@ -34,6 +34,7 @@
 import java.rmi.RemoteException;
 import java.security.AccessControlContext;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.ListIterator;
@@ -48,8 +49,6 @@
 import sun.rmi.transport.Connection;
 import sun.rmi.transport.Endpoint;
 import sun.rmi.transport.TransportConstants;
-import sun.security.action.GetIntegerAction;
-import sun.security.action.GetLongAction;
 
 /**
  * TCPChannel is the socket-based implementation of the RMI Channel
@@ -87,19 +86,18 @@
 
     /** client-side connection idle usage timeout */
     private static final long idleTimeout =             // default 15 seconds
-        AccessController.doPrivileged(
-            new GetLongAction("sun.rmi.transport.connectionTimeout", 15000));
+        AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+            Long.getLong("sun.rmi.transport.connectionTimeout", 15000));
 
     /** client-side connection handshake read timeout */
     private static final int handshakeTimeout =         // default 1 minute
-        AccessController.doPrivileged(
-            new GetIntegerAction("sun.rmi.transport.tcp.handshakeTimeout",
-                                 60000));
+        AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
+            Integer.getInteger("sun.rmi.transport.tcp.handshakeTimeout", 60000));
 
     /** client-side connection response read timeout (after handshake) */
     private static final int responseTimeout =          // default infinity
-        AccessController.doPrivileged(
-            new GetIntegerAction("sun.rmi.transport.tcp.responseTimeout", 0));
+        AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
+            Integer.getInteger("sun.rmi.transport.tcp.responseTimeout", 0));
 
     /** thread pool for scheduling delayed tasks */
     private static final ScheduledExecutorService scheduler =
--- a/jdk/src/share/classes/sun/rmi/transport/tcp/TCPEndpoint.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/transport/tcp/TCPEndpoint.java	Tue Apr 01 15:37:15 2014 +0200
@@ -38,6 +38,7 @@
 import java.rmi.server.RMIServerSocketFactory;
 import java.rmi.server.RMISocketFactory;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -50,9 +51,6 @@
 import sun.rmi.transport.Endpoint;
 import sun.rmi.transport.Target;
 import sun.rmi.transport.Transport;
-import sun.security.action.GetBooleanAction;
-import sun.security.action.GetIntegerAction;
-import sun.security.action.GetPropertyAction;
 
 /**
  * TCPEndpoint represents some communication endpoint for an address
@@ -82,12 +80,14 @@
 
     // this should be a *private* method since it is privileged
     private static int getInt(String name, int def) {
-        return AccessController.doPrivileged(new GetIntegerAction(name, def));
+        return AccessController.doPrivileged(
+                (PrivilegedAction<Integer>) () -> Integer.getInteger(name, def));
     }
 
     // this should be a *private* method since it is privileged
     private static boolean getBoolean(String name) {
-        return AccessController.doPrivileged(new GetBooleanAction(name));
+        return AccessController.doPrivileged(
+                (PrivilegedAction<Boolean>) () -> Boolean.getBoolean(name));
     }
 
     /**
@@ -95,7 +95,7 @@
      */
     private static String getHostnameProperty() {
         return AccessController.doPrivileged(
-            new GetPropertyAction("java.rmi.server.hostname"));
+            (PrivilegedAction<String>) () -> System.getProperty("java.rmi.server.hostname"));
     }
 
     /**
--- a/jdk/src/share/classes/sun/rmi/transport/tcp/TCPTransport.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/transport/tcp/TCPTransport.java	Tue Apr 01 15:37:15 2014 +0200
@@ -49,6 +49,7 @@
 import java.rmi.server.UID;
 import java.security.AccessControlContext;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
@@ -73,9 +74,6 @@
 import sun.rmi.transport.Transport;
 import sun.rmi.transport.TransportConstants;
 import sun.rmi.transport.proxy.HttpReceiveSocket;
-import sun.security.action.GetIntegerAction;
-import sun.security.action.GetLongAction;
-import sun.security.action.GetPropertyAction;
 
 /**
  * TCPTransport is the socket-based implementation of the RMI Transport
@@ -90,19 +88,18 @@
     /* tcp package log */
     static final Log tcpLog = Log.getLog("sun.rmi.transport.tcp", "tcp",
         LogStream.parseLevel(AccessController.doPrivileged(
-            new GetPropertyAction("sun.rmi.transport.tcp.logLevel"))));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.transport.tcp.logLevel"))));
 
     /** maximum number of connection handler threads */
     private static final int maxConnectionThreads =     // default no limit
-        AccessController.doPrivileged(
-            new GetIntegerAction("sun.rmi.transport.tcp.maxConnectionThreads",
-                                 Integer.MAX_VALUE));
+        AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
+            Integer.getInteger("sun.rmi.transport.tcp.maxConnectionThreads",
+                               Integer.MAX_VALUE));
 
     /** keep alive time for idle connection handler threads */
     private static final long threadKeepAliveTime =     // default 1 minute
-        AccessController.doPrivileged(
-            new GetLongAction("sun.rmi.transport.tcp.threadKeepAliveTime",
-                              60000));
+        AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+            Long.getLong("sun.rmi.transport.tcp.threadKeepAliveTime", 60000));
 
     /** thread pool for connection handlers */
     private static final ExecutorService connectionThreadPool =
@@ -143,9 +140,8 @@
      * and 20 hours.
      */
     private static final int connectionReadTimeout =    // default 2 hours
-        AccessController.doPrivileged(
-            new GetIntegerAction("sun.rmi.transport.tcp.readTimeout",
-                                 2 * 3600 * 1000));
+        AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
+            Integer.getInteger("sun.rmi.transport.tcp.readTimeout", 2 * 3600 * 1000));
 
     /**
      * Constructs a TCPTransport.
--- a/jdk/src/share/classes/sun/security/krb5/Config.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/Config.java	Tue Apr 01 15:37:15 2014 +0200
@@ -549,12 +549,11 @@
                             previous = line.substring(1).trim();
                         }
                     } else {
-                        if (previous == null) {
-                            throw new KrbException(
-                                "Config file must starts with a section");
+                        // Lines before the first section are ignored
+                        if (previous != null) {
+                            v.add(previous);
+                            previous = line;
                         }
-                        v.add(previous);
-                        previous = line;
                     }
                 }
                 if (previous != null) {
--- a/jdk/src/share/classes/sun/security/krb5/KrbApReq.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/KrbApReq.java	Tue Apr 01 15:37:15 2014 +0200
@@ -284,7 +284,7 @@
 
         if (dkey == null) {
             throw new KrbException(Krb5.API_INVALID_ARG,
-                "Cannot find key of appropriate type to decrypt AP REP - " +
+                "Cannot find key of appropriate type to decrypt AP-REQ - " +
                                    EType.toString(encPartKeyType));
         }
 
@@ -380,7 +380,7 @@
 
     /**
      * Returns the credentials that are contained in the ticket that
-     * is part of this this AP-REP.
+     * is part of this AP-REQ.
      */
     public Credentials getCreds() {
         return creds;
--- a/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java	Tue Apr 01 15:37:15 2014 +0200
@@ -94,9 +94,6 @@
             X509Certificate firstCert = certList.get(0);
             // check trusted certificate's subject
             selector.setSubject(firstCert.getIssuerX500Principal());
-            // check the validity period
-            selector.setValidityPeriod(firstCert.getNotBefore(),
-                                       firstCert.getNotAfter());
             /*
              * Facilitate certification path construction with authority
              * key identifier and subject key identifier.
--- a/jdk/src/share/classes/sun/security/tools/policytool/PolicyTool.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/security/tools/policytool/PolicyTool.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1160,7 +1160,7 @@
         if (policyFile == null) {
             String userHome;
             userHome = java.security.AccessController.doPrivileged(
-                    new sun.security.action.GetPropertyAction("user.home"));
+                (PrivilegedAction<String>) () -> System.getProperty("user.home"));
             policyFile = userHome + File.separatorChar + ".java.policy";
         }
 
--- a/jdk/src/share/classes/sun/security/util/DerInputStream.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/security/util/DerInputStream.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, 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
@@ -167,7 +167,7 @@
         if (buffer.read() != DerValue.tag_Integer) {
             throw new IOException("DER input, Integer tag error");
         }
-        return buffer.getInteger(getLength(buffer));
+        return buffer.getInteger(getDefiniteLength(buffer));
     }
 
     /**
@@ -179,7 +179,7 @@
         if (buffer.read() != DerValue.tag_Integer) {
             throw new IOException("DER input, Integer tag error");
         }
-        return buffer.getBigInteger(getLength(buffer), false);
+        return buffer.getBigInteger(getDefiniteLength(buffer), false);
     }
 
     /**
@@ -193,7 +193,7 @@
         if (buffer.read() != DerValue.tag_Integer) {
             throw new IOException("DER input, Integer tag error");
         }
-        return buffer.getBigInteger(getLength(buffer), true);
+        return buffer.getBigInteger(getDefiniteLength(buffer), true);
     }
 
     /**
@@ -205,7 +205,7 @@
         if (buffer.read() != DerValue.tag_Enumerated) {
             throw new IOException("DER input, Enumerated tag error");
         }
-        return buffer.getInteger(getLength(buffer));
+        return buffer.getInteger(getDefiniteLength(buffer));
     }
 
     /**
@@ -216,7 +216,7 @@
         if (buffer.read() != DerValue.tag_BitString)
             throw new IOException("DER input not an bit string");
 
-        return buffer.getBitString(getLength(buffer));
+        return buffer.getBitString(getDefiniteLength(buffer));
     }
 
     /**
@@ -224,21 +224,32 @@
      * not be byte-aligned.
      */
     public BitArray getUnalignedBitString() throws IOException {
-        if (buffer.read() != DerValue.tag_BitString)
+        if (buffer.read() != DerValue.tag_BitString) {
             throw new IOException("DER input not a bit string");
+        }
 
-        int length = getLength(buffer) - 1;
+        int length = getDefiniteLength(buffer);
+
+        if (length == 0) {
+            return new BitArray(0);
+        }
 
         /*
          * First byte = number of excess bits in the last octet of the
          * representation.
          */
+        length--;
         int validBits = length*8 - buffer.read();
+        if (validBits < 0) {
+            throw new IOException("valid bits of bit string invalid");
+        }
 
         byte[] repn = new byte[length];
 
-        if ((length != 0) && (buffer.read(repn) != length))
+        if ((length != 0) && (buffer.read(repn) != length)) {
             throw new IOException("short read of DER bit string");
+        }
+
         return new BitArray(validBits, repn);
     }
 
@@ -249,7 +260,7 @@
         if (buffer.read() != DerValue.tag_OctetString)
             throw new IOException("DER input not an octet string");
 
-        int length = getLength(buffer);
+        int length = getDefiniteLength(buffer);
         byte[] retval = new byte[length];
         if ((length != 0) && (buffer.read(retval) != length))
             throw new IOException("short read of DER octet string");
@@ -363,7 +374,7 @@
            if (tag != buffer.read())
                 throw new IOException("Indefinite length encoding" +
                         " not supported");
-           len = DerInputStream.getLength(buffer);
+           len = DerInputStream.getDefiniteLength(buffer);
         }
 
         if (len == 0)
@@ -480,7 +491,7 @@
             throw new IOException("DER input not a " +
                                   stringName + " string");
 
-        int length = getLength(buffer);
+        int length = getDefiniteLength(buffer);
         byte[] retval = new byte[length];
         if ((length != 0) && (buffer.read(retval) != length))
             throw new IOException("short read of DER " +
@@ -495,7 +506,7 @@
     public Date getUTCTime() throws IOException {
         if (buffer.read() != DerValue.tag_UtcTime)
             throw new IOException("DER input, UTCtime tag invalid ");
-        return buffer.getUTCTime(getLength(buffer));
+        return buffer.getUTCTime(getDefiniteLength(buffer));
     }
 
     /**
@@ -504,7 +515,7 @@
     public Date getGeneralizedTime() throws IOException {
         if (buffer.read() != DerValue.tag_GeneralizedTime)
             throw new IOException("DER input, GeneralizedTime tag invalid ");
-        return buffer.getGeneralizedTime(getLength(buffer));
+        return buffer.getGeneralizedTime(getDefiniteLength(buffer));
     }
 
     /*
@@ -570,6 +581,24 @@
         return value;
     }
 
+    int getDefiniteLength() throws IOException {
+        return getDefiniteLength(buffer);
+    }
+
+    /*
+     * Get a length from the input stream.
+     *
+     * @return the length
+     * @exception IOException on parsing error or if indefinite length found.
+     */
+    static int getDefiniteLength(InputStream in) throws IOException {
+        int len = getLength(in);
+        if (len < 0) {
+            throw new IOException("Indefinite length encoding not supported");
+        }
+        return len;
+    }
+
     /**
      * Mark the current position in the buffer, so that
      * a later call to <code>reset</code> will return here.
--- a/jdk/src/share/classes/sun/security/util/DerValue.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/security/util/DerValue.java	Tue Apr 01 15:37:15 2014 +0200
@@ -265,7 +265,7 @@
             if (tag != inbuf.read())
                 throw new IOException
                         ("Indefinite length encoding not supported");
-            length = DerInputStream.getLength(inbuf);
+            length = DerInputStream.getDefiniteLength(inbuf);
             buffer = inbuf.dup();
             buffer.truncate(length);
             data = new DerInputStream(buffer);
@@ -377,7 +377,7 @@
             if (tag != in.read())
                 throw new IOException
                         ("Indefinite length encoding not supported");
-            length = DerInputStream.getLength(in);
+            length = DerInputStream.getDefiniteLength(in);
         }
 
         if (fullyBuffered && in.available() != length)
--- a/jdk/src/share/classes/sun/security/util/ObjectIdentifier.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/security/util/ObjectIdentifier.java	Tue Apr 01 15:37:15 2014 +0200
@@ -255,7 +255,7 @@
                 + " (tag = " +  type_id + ")"
                 );
 
-        encoding = new byte[in.getLength()];
+        encoding = new byte[in.getDefiniteLength()];
         in.getBytes(encoding);
         check(encoding);
     }
--- a/jdk/src/share/classes/sun/swing/AbstractFilterComboBoxModel.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +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.  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.swing;
-
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
-import javax.swing.JFileChooser;
-import javax.swing.filechooser.FileFilter;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-/**
- * Data model for a type-face selection combo-box.
- */
-@SuppressWarnings("serial") // JDK-implementation class
-public abstract class AbstractFilterComboBoxModel
-        extends AbstractListModel<FileFilter>
-        implements ComboBoxModel<FileFilter>, PropertyChangeListener {
-
-    protected FileFilter[] filters;
-
-    protected AbstractFilterComboBoxModel() {
-        this.filters = getFileChooser().getChoosableFileFilters();
-    }
-
-    protected abstract JFileChooser getFileChooser();
-
-    @Override
-    public void propertyChange(PropertyChangeEvent event) {
-        String property = event.getPropertyName();
-        if (property == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
-            this.filters = (FileFilter[]) event.getNewValue();
-            fireContentsChanged(this, -1, -1);
-        } else if (property == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
-            fireContentsChanged(this, -1, -1);
-        }
-    }
-
-    @Override
-    public void setSelectedItem(Object filter) {
-        if (filter != null) {
-            getFileChooser().setFileFilter((FileFilter) filter);
-            fireContentsChanged(this, -1, -1);
-        }
-    }
-
-    @Override
-    public Object getSelectedItem() {
-        // Ensure that the current filter is in the list.
-        // NOTE: we should not have to do this, since JFileChooser adds
-        // the filter to the choosable filters list when the filter
-        // is set. Lets be paranoid just in case someone overrides
-        // setFileFilter in JFileChooser.
-        FileFilter currentFilter = getFileChooser().getFileFilter();
-        if (currentFilter != null) {
-            for (FileFilter filter : this.filters) {
-                if (filter == currentFilter) {
-                    return currentFilter;
-                }
-            }
-            getFileChooser().addChoosableFileFilter(currentFilter);
-        }
-        return currentFilter;
-    }
-
-    @Override
-    public int getSize() {
-        return (this.filters != null)
-                ? filters.length
-                : 0;
-    }
-
-    @Override
-    public FileFilter getElementAt(int index) {
-        if (index >= getSize()) {
-            // This shouldn't happen. Try to recover gracefully.
-            return getFileChooser().getFileFilter();
-        }
-        return (this.filters != null)
-                ? filters[index]
-                : null;
-    }
-}
--- a/jdk/src/share/classes/sun/swing/JLightweightFrame.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/swing/JLightweightFrame.java	Tue Apr 01 15:37:15 2014 +0200
@@ -36,6 +36,7 @@
 import java.awt.MouseInfo;
 import java.awt.Point;
 import java.awt.Rectangle;
+import java.awt.Window;
 import java.awt.event.ContainerEvent;
 import java.awt.event.ContainerListener;
 import java.awt.image.BufferedImage;
@@ -43,16 +44,19 @@
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.security.AccessController;
+import javax.swing.JComponent;
 
 import javax.swing.JLayeredPane;
 import javax.swing.JPanel;
 import javax.swing.JRootPane;
 import javax.swing.LayoutFocusTraversalPolicy;
+import javax.swing.RepaintManager;
 import javax.swing.RootPaneContainer;
 import javax.swing.SwingUtilities;
 
 import sun.awt.LightweightFrame;
 import sun.security.action.GetPropertyAction;
+import sun.swing.SwingUtilities2.RepaintListener;
 
 /**
  * The frame serves as a lightweight container which paints its content
@@ -90,6 +94,7 @@
     private int[] copyBuffer;
 
     private PropertyChangeListener layoutSizeListener;
+    private RepaintListener repaintListener;
 
     static {
         SwingAccessor.setJLightweightFrameAccessor(new SwingAccessor.JLightweightFrameAccessor() {
@@ -131,6 +136,30 @@
                 }
             }
         };
+
+        repaintListener = (JComponent c, int x, int y, int w, int h) -> {
+            Window jlf = SwingUtilities.getWindowAncestor(c);
+            if (jlf != JLightweightFrame.this) {
+                return;
+            }
+            Point p = SwingUtilities.convertPoint(c, x, y, jlf);
+            Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
+                    new Rectangle(0, 0, bbImage.getWidth(), bbImage.getHeight()));
+
+            if (!r.isEmpty()) {
+                notifyImageUpdated(r.x, r.y, r.width, r.height);
+            }
+        };
+
+        SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
+            RepaintManager.currentManager(this), repaintListener);
+    }
+
+    @Override
+    public void dispose() {
+        SwingAccessor.getRepaintManagerAccessor().removeRepaintListener(
+            RepaintManager.currentManager(this), repaintListener);
+        super.dispose();
     }
 
     /**
@@ -210,6 +239,13 @@
         }
     }
 
+    private void notifyImageUpdated(int x, int y, int width, int height) {
+        if (copyBufferEnabled) {
+            syncCopyBuffer(false, x, y, width, height);
+        }
+        content.imageUpdated(x, y, width, height);
+    }
+
     @SuppressWarnings("serial") // anonymous class inside
     private void initInterior() {
         contentPane = new JPanel() {
@@ -233,10 +269,7 @@
                     EventQueue.invokeLater(new Runnable() {
                         @Override
                         public void run() {
-                            if (copyBufferEnabled) {
-                                syncCopyBuffer(false, clip.x, clip.y, clip.width, clip.height);
-                            }
-                            content.imageUpdated(clip.x, clip.y, clip.width, clip.height);
+                            notifyImageUpdated(clip.x, clip.y, clip.width, clip.height);
                         }
                     });
                 } finally {
--- a/jdk/src/share/classes/sun/swing/SwingAccessor.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/swing/SwingAccessor.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -28,6 +28,7 @@
 import sun.misc.Unsafe;
 
 import java.awt.Point;
+import javax.swing.RepaintManager;
 
 import javax.swing.text.JTextComponent;
 import javax.swing.TransferHandler;
@@ -82,6 +83,14 @@
     }
 
     /**
+     * An accessor for the RepaintManager class.
+     */
+    public interface RepaintManagerAccessor {
+        void addRepaintListener(RepaintManager rm, SwingUtilities2.RepaintListener l);
+        void removeRepaintListener(RepaintManager rm, SwingUtilities2.RepaintListener l);
+    }
+
+    /**
      * The javax.swing.text.JTextComponent class accessor object.
      */
     private static JTextComponentAccessor jtextComponentAccessor;
@@ -120,6 +129,31 @@
      * Retrieve the accessor object for the JLightweightFrame class
      */
     public static JLightweightFrameAccessor getJLightweightFrameAccessor() {
+        if (jLightweightFrameAccessor == null) {
+            unsafe.ensureClassInitialized(JLightweightFrame.class);
+        }
         return jLightweightFrameAccessor;
     }
+
+    /**
+     * The RepaintManager class accessor object.
+     */
+    private static RepaintManagerAccessor repaintManagerAccessor;
+
+    /**
+     * Set an accessor object for the RepaintManager class.
+     */
+    public static void setRepaintManagerAccessor(RepaintManagerAccessor accessor) {
+        repaintManagerAccessor = accessor;
+    }
+
+    /**
+     * Retrieve the accessor object for the RepaintManager class.
+     */
+    public static RepaintManagerAccessor getRepaintManagerAccessor() {
+        if (repaintManagerAccessor == null) {
+            unsafe.ensureClassInitialized(RepaintManager.class);
+        }
+        return repaintManagerAccessor;
+    }
 }
--- a/jdk/src/share/classes/sun/swing/SwingLazyValue.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/swing/SwingLazyValue.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,9 +26,6 @@
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
-import java.lang.reflect.AccessibleObject;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
 import javax.swing.UIDefaults;
 import sun.reflect.misc.ReflectUtil;
 
@@ -69,12 +66,10 @@
             if (methodName != null) {
                 Class<?>[] types = getClassArray(args);
                 Method m = c.getMethod(methodName, types);
-                makeAccessible(m);
                 return m.invoke(c, args);
             } else {
                 Class<?>[] types = getClassArray(args);
                 Constructor<?> constructor = c.getConstructor(types);
-                makeAccessible(constructor);
                 return constructor.newInstance(args);
             }
         } catch (Exception e) {
@@ -87,15 +82,6 @@
         return null;
     }
 
-    private void makeAccessible(final AccessibleObject object) {
-        AccessController.doPrivileged(new PrivilegedAction<Void>() {
-            public Void run() {
-                object.setAccessible(true);
-                return null;
-            }
-        });
-    }
-
     private Class<?>[] getClassArray(Object[] args) {
         Class<?>[] types = null;
         if (args!=null) {
--- a/jdk/src/share/classes/sun/swing/SwingUtilities2.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/swing/SwingUtilities2.java	Tue Apr 01 15:37:15 2014 +0200
@@ -80,6 +80,9 @@
     public static final Object LAF_STATE_KEY =
             new StringBuffer("LookAndFeel State");
 
+    public static final Object MENU_SELECTION_MANAGER_LISTENER_KEY =
+            new StringBuffer("MenuSelectionManager listener key");
+
     // Maintain a cache of CACHE_SIZE fonts and the left side bearing
      // of the characters falling into the range MIN_CHAR_INDEX to
      // MAX_CHAR_INDEX. The values in fontCache are created as needed.
@@ -189,7 +192,6 @@
         new StringUIClientPropertyKey ("maxTextOffset");
 
     // security stuff
-    private static Field inputEvent_CanAccessSystemClipboard_Field = null;
     private static final String UntrustedClipboardAccess =
         "UNTRUSTED_CLIPBOARD_ACCESS_KEY";
 
@@ -1263,41 +1265,6 @@
     }
 
     /**
-     * returns canAccessSystemClipboard field from InputEvent
-     *
-     * @param ie InputEvent to get the field from
-     */
-    private static synchronized boolean inputEvent_canAccessSystemClipboard(InputEvent ie) {
-        if (inputEvent_CanAccessSystemClipboard_Field == null) {
-            inputEvent_CanAccessSystemClipboard_Field =
-                AccessController.doPrivileged(
-                    new java.security.PrivilegedAction<Field>() {
-                        public Field run() {
-                            try {
-                                Field field = InputEvent.class.
-                                    getDeclaredField("canAccessSystemClipboard");
-                                field.setAccessible(true);
-                                return field;
-                            } catch (SecurityException e) {
-                            } catch (NoSuchFieldException e) {
-                            }
-                            return null;
-                        }
-                    });
-        }
-        if (inputEvent_CanAccessSystemClipboard_Field == null) {
-            return false;
-        }
-        boolean ret = false;
-        try {
-            ret = inputEvent_CanAccessSystemClipboard_Field.
-                getBoolean(ie);
-        } catch(IllegalAccessException e) {
-        }
-        return ret;
-    }
-
-    /**
      * Returns true if the given event is corrent gesture for
      * accessing clipboard
      *
@@ -1350,7 +1317,8 @@
              */
             if (e instanceof InputEvent
                 && (! checkGesture || isAccessClipboardGesture((InputEvent)e))) {
-                return inputEvent_canAccessSystemClipboard((InputEvent)e);
+                return AWTAccessor.getInputEventAccessor().
+                        canAccessSystemClipboard((InputEvent) e);
             } else {
                 return false;
             }
@@ -1966,4 +1934,11 @@
         }
         return path;
     }
+
+    /**
+     * Used to listen to "blit" repaints in RepaintManager.
+     */
+    public interface RepaintListener {
+        void repaintPerformed(JComponent c, int x, int y, int w, int h);
+    }
 }
--- a/jdk/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java	Tue Apr 01 15:37:15 2014 +0200
@@ -927,9 +927,70 @@
      * Data model for a type-face selection combo-box.
      */
     @SuppressWarnings("serial") // JDK-implementation class
-    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
-        protected JFileChooser getFileChooser() {
-            return SynthFileChooserUIImpl.this.getFileChooser();
+    protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
+            PropertyChangeListener {
+        protected FileFilter[] filters;
+        protected FilterComboBoxModel() {
+            super();
+            filters = getFileChooser().getChoosableFileFilters();
+        }
+
+        public void propertyChange(PropertyChangeEvent e) {
+            String prop = e.getPropertyName();
+            if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
+                filters = (FileFilter[]) e.getNewValue();
+                fireContentsChanged(this, -1, -1);
+            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public void setSelectedItem(Object filter) {
+            if(filter != null) {
+                getFileChooser().setFileFilter((FileFilter) filter);
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public Object getSelectedItem() {
+            // Ensure that the current filter is in the list.
+            // NOTE: we shouldnt' have to do this, since JFileChooser adds
+            // the filter to the choosable filters list when the filter
+            // is set. Lets be paranoid just in case someone overrides
+            // setFileFilter in JFileChooser.
+            FileFilter currentFilter = getFileChooser().getFileFilter();
+            boolean found = false;
+            if(currentFilter != null) {
+                for (FileFilter filter : filters) {
+                    if (filter == currentFilter) {
+                        found = true;
+                    }
+                }
+                if(found == false) {
+                    getFileChooser().addChoosableFileFilter(currentFilter);
+                }
+            }
+            return getFileChooser().getFileFilter();
+        }
+
+        public int getSize() {
+            if(filters != null) {
+                return filters.length;
+            } else {
+                return 0;
+            }
+        }
+
+        public FileFilter getElementAt(int index) {
+            if(index > getSize() - 1) {
+                // This shouldn't happen. Try to recover gracefully.
+                return getFileChooser().getFileFilter();
+            }
+            if(filters != null) {
+                return filters[index];
+            } else {
+                return null;
+            }
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/tools/serialver/resources/serialver.properties	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,20 @@
+SerialVersionInspector=Serial Version Inspector
+File=File
+Exit=Exit
+Show=Show
+FullClassName=Full Class Name:
+SerialVersion=Serial Version:
+NotSerializable=\
+	Class {0} is not Serializable.
+ClassNotFound=\
+	Class {0} not found.
+error.parsing.classpath=\
+	Error parsing classpath {0}.
+error.missing.classpath=\
+	Missing argument for -classpath option
+invalid.flag=\
+	Invalid flag {0}.
+ignoring.classes=\
+	Cannot specify class arguments with the -show option
+usage=\
+	use: serialver [-classpath classpath] [-show] [classname...]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/tools/serialver/resources/serialver_ja.properties	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,13 @@
+SerialVersionInspector=\u30B7\u30EA\u30A2\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3\u30FB\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF
+File=\u30D5\u30A1\u30A4\u30EB
+Exit=\u7D42\u4E86
+Show=\u8868\u793A
+FullClassName=\u5B8C\u5168\u30AF\u30E9\u30B9\u540D:
+SerialVersion=\u30B7\u30EA\u30A2\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3:
+NotSerializable=\u30AF\u30E9\u30B9{0}\u306F\u76F4\u5217\u5316\u3067\u304D\u307E\u305B\u3093\u3002
+ClassNotFound=\u30AF\u30E9\u30B9{0}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
+error.parsing.classpath=\u30AF\u30E9\u30B9\u30D1\u30B9{0}\u306E\u89E3\u6790\u30A8\u30E9\u30FC\u3067\u3059\u3002
+error.missing.classpath=-classpath\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u5F15\u6570\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
+invalid.flag=\u7121\u52B9\u306A\u30D5\u30E9\u30B0{0}\u3002
+ignoring.classes=-show\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u6301\u3064\u30AF\u30E9\u30B9\u5F15\u6570\u3092\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093
+usage=\u4F7F\u7528\u65B9\u6CD5: serialver [-classpath classpath] [-show] [classname...]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/tools/serialver/resources/serialver_zh_CN.properties	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,13 @@
+SerialVersionInspector=\u5E8F\u5217\u7248\u672C\u68C0\u67E5\u5668
+File=\u6587\u4EF6
+Exit=\u9000\u51FA
+Show=\u663E\u793A
+FullClassName=\u5B8C\u6574\u7684\u7C7B\u540D:
+SerialVersion=\u5E8F\u5217\u7248\u672C:
+NotSerializable=\u7C7B{0}\u65E0\u6CD5\u5E8F\u5217\u5316\u3002
+ClassNotFound=\u627E\u4E0D\u5230\u7C7B{0}\u3002
+error.parsing.classpath=\u89E3\u6790\u7C7B\u8DEF\u5F84 {0} \u65F6\u51FA\u9519\u3002
+error.missing.classpath=\u7F3A\u5C11 -classpath \u9009\u9879\u7684\u53C2\u6570
+invalid.flag=\u65E0\u6548\u6807\u8BB0{0}\u3002
+ignoring.classes=\u65E0\u6CD5\u4F7F\u7528 -show \u9009\u9879\u6307\u5B9A\u7C7B\u53C2\u6570
+usage=\u7528\u6CD5: serialver [-classpath \u7C7B\u8DEF\u5F84] [-show] [\u7C7B\u540D\u79F0...]
--- a/jdk/src/share/classes/sun/tools/serialver/serialver.properties	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-SerialVersionInspector=Serial Version Inspector
-File=File
-Exit=Exit
-Show=Show
-FullClassName=Full Class Name:
-SerialVersion=Serial Version:
-NotSerializable=\
-	Class {0} is not Serializable.
-ClassNotFound=\
-	Class {0} not found.
-error.parsing.classpath=\
-	Error parsing classpath {0}.
-error.missing.classpath=\
-	Missing argument for -classpath option
-invalid.flag=\
-	Invalid flag {0}.
-ignoring.classes=\
-	Cannot specify class arguments with the -show option
-usage=\
-	use: serialver [-classpath classpath] [-show] [classname...]
--- a/jdk/src/share/classes/sun/tools/serialver/serialver_ja.properties	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-SerialVersionInspector=\u30B7\u30EA\u30A2\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3\u30FB\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF
-File=\u30D5\u30A1\u30A4\u30EB
-Exit=\u7D42\u4E86
-Show=\u8868\u793A
-FullClassName=\u5B8C\u5168\u30AF\u30E9\u30B9\u540D:
-SerialVersion=\u30B7\u30EA\u30A2\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3:
-NotSerializable=\u30AF\u30E9\u30B9{0}\u306F\u76F4\u5217\u5316\u3067\u304D\u307E\u305B\u3093\u3002
-ClassNotFound=\u30AF\u30E9\u30B9{0}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
-error.parsing.classpath=\u30AF\u30E9\u30B9\u30D1\u30B9{0}\u306E\u89E3\u6790\u30A8\u30E9\u30FC\u3067\u3059\u3002
-error.missing.classpath=-classpath\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u5F15\u6570\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
-invalid.flag=\u7121\u52B9\u306A\u30D5\u30E9\u30B0{0}\u3002
-ignoring.classes=-show\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u6301\u3064\u30AF\u30E9\u30B9\u5F15\u6570\u3092\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093
-usage=\u4F7F\u7528\u65B9\u6CD5: serialver [-classpath classpath] [-show] [classname...]
--- a/jdk/src/share/classes/sun/tools/serialver/serialver_zh_CN.properties	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-SerialVersionInspector=\u5E8F\u5217\u7248\u672C\u68C0\u67E5\u5668
-File=\u6587\u4EF6
-Exit=\u9000\u51FA
-Show=\u663E\u793A
-FullClassName=\u5B8C\u6574\u7684\u7C7B\u540D:
-SerialVersion=\u5E8F\u5217\u7248\u672C:
-NotSerializable=\u7C7B{0}\u65E0\u6CD5\u5E8F\u5217\u5316\u3002
-ClassNotFound=\u627E\u4E0D\u5230\u7C7B{0}\u3002
-error.parsing.classpath=\u89E3\u6790\u7C7B\u8DEF\u5F84 {0} \u65F6\u51FA\u9519\u3002
-error.missing.classpath=\u7F3A\u5C11 -classpath \u9009\u9879\u7684\u53C2\u6570
-invalid.flag=\u65E0\u6548\u6807\u8BB0{0}\u3002
-ignoring.classes=\u65E0\u6CD5\u4F7F\u7528 -show \u9009\u9879\u6307\u5B9A\u7C7B\u53C2\u6570
-usage=\u7528\u6CD5: serialver [-classpath \u7C7B\u8DEF\u5F84] [-show] [\u7C7B\u540D\u79F0...]
--- a/jdk/src/share/instrument/FileSystemSupport.h	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/instrument/FileSystemSupport.h	Tue Apr 01 15:37:15 2014 +0200
@@ -65,9 +65,3 @@
  * Resolve the child pathname string against the parent.
  */
 char* resolve(const char* parent, const char* child);
-
-/**
- * Convert a pathname to canonical form.
- * -- compiled in from src/<platform>/native/java/io/canonicalize_md.c
- */
-int canonicalize(char *original, char *resolved, int len);
--- a/jdk/src/share/instrument/InvocationAdapter.c	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/instrument/InvocationAdapter.c	Tue Apr 01 15:37:15 2014 +0200
@@ -669,6 +669,13 @@
     jplis_assert((void*)res != (void*)NULL);     \
 }
 
+/**
+ * Convert a pathname to canonical form.
+ * This method is exported from libjava.
+ */
+extern int
+Canonicalize(JNIEnv *unused, char *orig, char *out, int len);
+
 
 /*
  * This function takes the value of the Boot-Class-Path attribute,
@@ -790,7 +797,8 @@
             char* resolved;
 
             if (!haveBasePath) {
-                if (canonicalize((char*)jarfile, canonicalPath, sizeof(canonicalPath)) != 0) {
+                /* Use NULL as the JNIEnv since we know that Canonicalize does not use it. */
+                if (Canonicalize(NULL, (char*)jarfile, canonicalPath, sizeof(canonicalPath)) != 0) {
                     fprintf(stderr, "WARNING: unable to canonicalize %s\n", jarfile);
                     free(path);
                     continue;
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/bands.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/bands.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -288,7 +288,7 @@
   { e_##name,  #name, /*debug only*/ \
     cspec, ix }
 
-const band_init all_band_inits[] = {
+const band_init all_band_inits[BAND_LIMIT+1] = {
 //BAND_INIT(archive_magic, BYTE1_spec, 0),
 //BAND_INIT(archive_header, UNSIGNED5_spec, 0),
 //BAND_INIT(band_headers, BYTE1_spec, 0),
@@ -448,14 +448,8 @@
   BAND_INIT(file_modtime, DELTA5_spec, 0),
   BAND_INIT(file_options, UNSIGNED5_spec, 0),
 //BAND_INIT(file_bits, BYTE1_spec, 0),
-#ifndef PRODUCT
-  { 0, 0, 0, 0 }
-#else
-  { 0, 0 }
-#endif
+  { 0, NULL, 0, 0 }
 };
-#define NUM_BAND_INITS \
-        (sizeof(all_band_inits)/sizeof(all_band_inits[0]))
 
 band* band::makeBands(unpacker* u) {
   band* tmp_all_bands = U_NEW(band, BAND_LIMIT);
--- a/jdk/src/share/native/common/jni_util.c	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/native/common/jni_util.c	Tue Apr 01 15:37:15 2014 +0200
@@ -834,12 +834,12 @@
 /*
  * Export the platform dependent path canonicalization so that
  * VM can find it when loading system classes.
- *
+ * This function is also used by the instrumentation agent.
  */
 extern int canonicalize(char *path, const char *out, int len);
 
 JNIEXPORT int
-Canonicalize(JNIEnv *env, char *orig, char *out, int len)
+Canonicalize(JNIEnv *unused, char *orig, char *out, int len)
 {
     /* canonicalize an already natived path */
     return canonicalize(orig, out, len);
--- a/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1106,6 +1106,7 @@
     if (ddata == NULL) {
         /* Need to store it back into the array */
         if (storeRasterArray(env, srcRasterP, dstRasterP, dst) < 0) {
+            (*env)->ExceptionClear(env); // Could not store the array, try another way
             retStatus = awt_setPixels(env, dstRasterP, mlib_ImageGetData(dst));
         }
     }
@@ -2014,6 +2015,7 @@
 
     jpixels = (*env)->NewIntArray(env, nbytes);
     if (JNU_IsNull(env, jpixels)) {
+        (*env)->ExceptionClear(env);
         JNU_ThrowOutOfMemoryError(env, "Out of Memory");
         return -1;
     }
@@ -2079,6 +2081,7 @@
 
     jpixels = (*env)->NewIntArray(env, nbytes);
     if (JNU_IsNull(env, jpixels)) {
+        (*env)->ExceptionClear(env);
         JNU_ThrowOutOfMemoryError(env, "Out of Memory");
         return -1;
     }
@@ -2775,21 +2778,14 @@
 
     /* Need to grab the lookup tables.  Right now only bytes */
     rgb = (int *) (*env)->GetPrimitiveArrayCritical(env, cmP->jrgb, NULL);
+    CHECK_NULL_RETURN(rgb, -1);
 
     /* Interleaved with shared data */
     dataP = (void *) (*env)->GetPrimitiveArrayCritical(env,
                                                        rasterP->jdata, NULL);
-    if (rgb == NULL || dataP == NULL) {
+    if (dataP == NULL) {
         /* Release the lookup tables */
-        if (rgb) {
-            (*env)->ReleasePrimitiveArrayCritical(env, cmP->jrgb, rgb,
-                                                  JNI_ABORT);
-        }
-        if (dataP) {
-            (*env)->ReleasePrimitiveArrayCritical(env,
-                                                  rasterP->jdata, dataP,
-                                                  JNI_ABORT);
-        }
+        (*env)->ReleasePrimitiveArrayCritical(env, cmP->jrgb, rgb, JNI_ABORT);
         return -1;
     }
 
--- a/jdk/src/share/native/sun/awt/splashscreen/java_awt_SplashScreen.c	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/native/sun/awt/splashscreen/java_awt_SplashScreen.c	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,8 +24,9 @@
  */
 
 #include "splashscreen_impl.h"
+#include <jlong_md.h>
 #include <jni.h>
-#include <jlong_md.h>
+#include <jni_util.h>
 #include <sizecalc.h>
 
 JNIEXPORT jint JNICALL
@@ -212,8 +213,9 @@
     if (!splash) {
         return JNI_FALSE;
     }
+    pBytes = (*env)->GetByteArrayElements(env, data, NULL);
+    CHECK_NULL_RETURN(pBytes, JNI_FALSE);
     size = (*env)->GetArrayLength(env, data);
-    pBytes = (*env)->GetByteArrayElements(env, data, NULL);
     rc = SplashLoadMemory(pBytes, size);
     (*env)->ReleaseByteArrayElements(env, data, pBytes, JNI_ABORT);
     return rc ? JNI_TRUE : JNI_FALSE;
--- a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_gfx_impl.h	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_gfx_impl.h	Tue Apr 01 15:37:15 2014 +0200
@@ -189,7 +189,11 @@
             PUT(rgbquad_t, ptr, value);
             break;
         case 3:                /* not supported, LSB or MSB should always be specified */
-            *(int *) 0 = 0;    /* crash */
+            PUT(byte_t, ptr, 0xff); /* Put a stub value */
+            INCP(byte_t, ptr);
+            PUT(byte_t, ptr, 0xff);
+            INCP(byte_t, ptr);
+            PUT(byte_t, ptr, 0xff);
             break;
         case 2:
             PUT(word_t, ptr, value);
@@ -253,7 +257,7 @@
             value = GET(rgbquad_t, ptr);
             break;
         case 3:                /* not supported, LSB or MSB should always be specified */
-            *(int *) 0 = 0;
+            value = 0xFFFFFFFF; /*return a stub value */
             break;
         case 2:
             value = (rgbquad_t) GET(word_t, ptr);
--- a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c	Tue Apr 01 15:37:15 2014 +0200
@@ -25,7 +25,7 @@
 
 #include "splashscreen_impl.h"
 
-#include "../libpng/png.h"
+#include <png.h>
 
 #include <setjmp.h>
 
--- a/jdk/src/share/native/sun/java2d/opengl/OGLContext.c	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/native/sun/java2d/opengl/OGLContext.c	Tue Apr 01 15:37:15 2014 +0200
@@ -38,6 +38,8 @@
 #include "GraphicsPrimitiveMgr.h"
 #include "Region.h"
 
+#include "jvm.h"
+
 /**
  * The following methods are implemented in the windowing system (i.e. GLX
  * and WGL) source files.
--- a/jdk/src/share/native/sun/security/pkcs11/j2secmod.c	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/share/native/sun/security/pkcs11/j2secmod.c	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,20 +30,27 @@
 // #define SECMOD_DEBUG
 
 #include "j2secmod.h"
+#include "jni_util.h"
 
 
 JNIEXPORT jboolean JNICALL Java_sun_security_pkcs11_Secmod_nssVersionCheck
   (JNIEnv *env, jclass thisClass, jlong jHandle, jstring jVersion)
 {
-    const char *requiredVersion = (*env)->GetStringUTFChars(env, jVersion, NULL);
-    int res;
-    FPTR_VersionCheck versionCheck =
-        (FPTR_VersionCheck)findFunction(env, jHandle, "NSS_VersionCheck");
+    int res = 0;
+    FPTR_VersionCheck versionCheck;
+    const char *requiredVersion;
 
+    versionCheck = (FPTR_VersionCheck)findFunction(env, jHandle,
+        "NSS_VersionCheck");
     if (versionCheck == NULL) {
         return JNI_FALSE;
     }
 
+    requiredVersion = (*env)->GetStringUTFChars(env, jVersion, NULL);
+    if (requiredVersion == NULL)  {
+        return JNI_FALSE;
+    }
+
     res = versionCheck(requiredVersion);
     dprintf2("-version >=%s: %d\n", requiredVersion, res);
     (*env)->ReleaseStringUTFChars(env, jVersion, requiredVersion);
@@ -59,55 +66,73 @@
 JNIEXPORT jboolean JNICALL Java_sun_security_pkcs11_Secmod_nssInitialize
   (JNIEnv *env, jclass thisClass, jstring jFunctionName, jlong jHandle, jstring jConfigDir, jboolean jNssOptimizeSpace)
 {
-    const char *functionName =
-        (*env)->GetStringUTFChars(env, jFunctionName, NULL);
-    const char *configDir = (jConfigDir == NULL)
-        ? NULL : (*env)->GetStringUTFChars(env, jConfigDir, NULL);
+    int res = 0;
     FPTR_Initialize initialize =
         (FPTR_Initialize)findFunction(env, jHandle, "NSS_Initialize");
-    int res = 0;
     unsigned int flags = 0x00;
+    const char *configDir = NULL;
+    const char *functionName = NULL;
+
+    /* If we cannot initialize, exit now */
+    if (initialize == NULL) {
+        res = 1;
+        goto cleanup;
+    }
+
+    functionName = (*env)->GetStringUTFChars(env, jFunctionName, NULL);
+    if (functionName == NULL) {
+        res = 1;
+        goto cleanup;
+    }
+
+    if (jConfigDir != NULL) {
+        configDir = (*env)->GetStringUTFChars(env, jConfigDir, NULL);
+        if (!configDir) {
+            res = 1;
+            goto cleanup;
+        }
+    }
 
     if (jNssOptimizeSpace == JNI_TRUE) {
         flags = 0x20; // NSS_INIT_OPTIMIZESPACE flag
     }
 
-    if (initialize != NULL) {
-        /*
-         * If the NSS_Init function is requested then call NSS_Initialize to
-         * open the Cert, Key and Security Module databases, read only.
-         */
-        if (strcmp("NSS_Init", functionName) == 0) {
-            flags = flags | 0x01; // NSS_INIT_READONLY flag
-            res = initialize(configDir, "", "", "secmod.db", flags);
+    /*
+     * If the NSS_Init function is requested then call NSS_Initialize to
+     * open the Cert, Key and Security Module databases, read only.
+     */
+    if (strcmp("NSS_Init", functionName) == 0) {
+        flags = flags | 0x01; // NSS_INIT_READONLY flag
+        res = initialize(configDir, "", "", "secmod.db", flags);
 
-        /*
-         * If the NSS_InitReadWrite function is requested then call
-         * NSS_Initialize to open the Cert, Key and Security Module databases,
-         * read/write.
-         */
-        } else if (strcmp("NSS_InitReadWrite", functionName) == 0) {
-            res = initialize(configDir, "", "", "secmod.db", flags);
+    /*
+     * If the NSS_InitReadWrite function is requested then call
+     * NSS_Initialize to open the Cert, Key and Security Module databases,
+     * read/write.
+     */
+    } else if (strcmp("NSS_InitReadWrite", functionName) == 0) {
+        res = initialize(configDir, "", "", "secmod.db", flags);
 
-        /*
-         * If the NSS_NoDB_Init function is requested then call
-         * NSS_Initialize without creating Cert, Key or Security Module
-         * databases.
-         */
-        } else if (strcmp("NSS_NoDB_Init", functionName) == 0) {
-            flags = flags | 0x02  // NSS_INIT_NOCERTDB flag
-                          | 0x04  // NSS_INIT_NOMODDB flag
-                          | 0x08  // NSS_INIT_FORCEOPEN flag
-                          | 0x10; // NSS_INIT_NOROOTINIT flag
-            res = initialize("", "", "", "", flags);
+    /*
+     * If the NSS_NoDB_Init function is requested then call
+     * NSS_Initialize without creating Cert, Key or Security Module
+     * databases.
+     */
+    } else if (strcmp("NSS_NoDB_Init", functionName) == 0) {
+        flags = flags | 0x02  // NSS_INIT_NOCERTDB flag
+                      | 0x04  // NSS_INIT_NOMODDB flag
+                      | 0x08  // NSS_INIT_FORCEOPEN flag
+                      | 0x10; // NSS_INIT_NOROOTINIT flag
+        res = initialize("", "", "", "", flags);
 
-        } else {
-            res = 2;
-        }
     } else {
-        res = 1;
+        res = 2;
     }
-    (*env)->ReleaseStringUTFChars(env, jFunctionName, functionName);
+
+cleanup:
+    if (functionName != NULL) {
+        (*env)->ReleaseStringUTFChars(env, jFunctionName, functionName);
+    }
     if (configDir != NULL) {
         (*env)->ReleaseStringUTFChars(env, jConfigDir, configDir);
     }
@@ -142,13 +167,30 @@
     }
 
     jListClass = (*env)->FindClass(env, "java/util/ArrayList");
+    if (jListClass == NULL) {
+        return NULL;
+    }
     jListConstructor = (*env)->GetMethodID(env, jListClass, "<init>", "()V");
+    if (jListConstructor == NULL) {
+        return NULL;
+    }
     jAdd = (*env)->GetMethodID(env, jListClass, "add", "(Ljava/lang/Object;)Z");
+    if (jAdd == NULL) {
+        return NULL;
+    }
     jList = (*env)->NewObject(env, jListClass, jListConstructor);
-
+    if (jList == NULL) {
+        return NULL;
+    }
     jModuleClass = (*env)->FindClass(env, "sun/security/pkcs11/Secmod$Module");
+    if (jModuleClass == NULL) {
+        return NULL;
+    }
     jModuleConstructor = (*env)->GetMethodID(env, jModuleClass, "<init>",
         "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZI)V");
+    if (jModuleConstructor == NULL) {
+        return NULL;
+    }
 
     while (list != NULL) {
         module = list->module;
@@ -160,16 +202,28 @@
         dprintf1("-internal: %d\n", module->internal);
         dprintf1("-fips: %d\n", module->isFIPS);
         jCommonName = (*env)->NewStringUTF(env, module->commonName);
+        if (jCommonName == NULL) {
+            return NULL;
+        }
         if (module->dllName == NULL) {
             jDllName = NULL;
         } else {
             jDllName = (*env)->NewStringUTF(env, module->dllName);
+            if (jDllName == NULL) {
+                return NULL;
+            }
         }
         jFIPS = module->isFIPS;
         for (i = 0; i < module->slotCount; i++ ) {
             jModule = (*env)->NewObject(env, jModuleClass, jModuleConstructor,
                 jLibDir, jDllName, jCommonName, jFIPS, i);
+            if (jModule == NULL) {
+                return NULL;
+            }
             (*env)->CallVoidMethod(env, jList, jAdd, jModule);
+            if ((*env)->ExceptionCheck(env)) {
+                return NULL;
+            }
         }
         list = list->next;
     }
--- a/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,6 @@
  */
 package sun.awt.X11;
 
-import java.awt.Dialog;
 import java.awt.FileDialog;
 import java.awt.peer.FileDialogPeer;
 import java.io.File;
@@ -36,15 +35,15 @@
  *
  * @author Costantino Cerbo (c.cerbo@gmail.com)
  */
-class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer {
+final class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer {
 
-    private FileDialog fd;
+    private final FileDialog fd;
 
     // A pointer to the native GTK FileChooser widget
     private volatile long widget = 0L;
 
-    public GtkFileDialogPeer(FileDialog fd) {
-        super((Dialog) fd);
+    GtkFileDialogPeer(FileDialog fd) {
+        super(fd);
         this.fd = fd;
     }
 
@@ -172,9 +171,7 @@
                 dirname = file.getParent();
             }
         }
-        GtkFileDialogPeer.this.run(fd.getTitle(), fd.getMode(), dirname,
-                                   filename, fd.getFilenameFilter(),
-                                   fd.isMultipleMode(), fd.getX(), fd.getY());
+        run(fd.getTitle(), fd.getMode(), dirname, filename,
+            fd.getFilenameFilter(), fd.isMultipleMode(), fd.getX(), fd.getY());
     }
-
 }
--- a/jdk/src/solaris/classes/sun/awt/X11/XAWTFormatter.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/classes/sun/awt/X11/XAWTFormatter.java	Tue Apr 01 15:37:15 2014 +0200
@@ -43,8 +43,7 @@
 
     // Line separator string.  This is the value of the line.separator
     // property at the moment that the SimpleFormatter was created.
-    private String lineSeparator = java.security.AccessController.doPrivileged(
-               new sun.security.action.GetPropertyAction("line.separator"));
+    private String lineSeparator = System.lineSeparator();
 
     boolean displayFullRecord = false;
     boolean useANSI = false;
--- a/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,6 +56,7 @@
 import sun.awt.datatransfer.ToolkitThreadBlockedHandler;
 
 import java.io.ByteArrayOutputStream;
+import java.util.stream.Stream;
 
 /**
  * Platform-specific support for the data transfer subsystem.
@@ -77,11 +78,9 @@
 
     private static XDataTransferer transferer;
 
-    static XDataTransferer getInstanceImpl() {
-        synchronized (XDataTransferer.class) {
-            if (transferer == null) {
-                transferer = new XDataTransferer();
-            }
+    static synchronized XDataTransferer getInstanceImpl() {
+        if (transferer == null) {
+            transferer = new XDataTransferer();
         }
         return transferer;
     }
@@ -242,6 +241,7 @@
         }
     }
 
+    @Override
     protected String[] dragQueryFile(byte[] bytes) {
         XToolkit.awtLock();
         try {
@@ -252,8 +252,8 @@
         }
     }
 
+    @Override
     protected URI[] dragQueryURIs(InputStream stream,
-                                  byte[] bytes,
                                   long format,
                                   Transferable localeTransferable)
       throws IOException {
@@ -281,7 +281,7 @@
         try {
             reader = new BufferedReader(new InputStreamReader(stream, charset));
             String line;
-            ArrayList<URI> uriList = new ArrayList<URI>();
+            ArrayList<URI> uriList = new ArrayList<>();
             URI uri;
             while ((line = reader.readLine()) != null) {
                 try {
@@ -329,8 +329,9 @@
      * a valid MIME and return a list of flavors to which the data in this MIME
      * type can be translated by the Data Transfer subsystem.
      */
-    public List <DataFlavor> getPlatformMappingsForNative(String nat) {
-        List <DataFlavor> flavors = new ArrayList();
+    @Override
+    public List<DataFlavor> getPlatformMappingsForNative(String nat) {
+        List<DataFlavor> flavors = new ArrayList<>();
 
         if (nat == null) {
             return flavors;
@@ -390,8 +391,9 @@
      * MIME types to which the data in this flavor can be translated by the Data
      * Transfer subsystem.
      */
-    public List getPlatformMappingsForFlavor(DataFlavor df) {
-        List natives = new ArrayList(1);
+    @Override
+    public List<String> getPlatformMappingsForFlavor(DataFlavor df) {
+        List<String> natives = new ArrayList<>(1);
 
         if (df == null) {
             return natives;
@@ -410,25 +412,22 @@
         if (df.getRepresentationClass() != null &&
             (df.isRepresentationClassInputStream() ||
              df.isRepresentationClassByteBuffer() ||
-             byteArrayClass.equals(df.getRepresentationClass()))) {
+             byte[].class.equals(df.getRepresentationClass()))) {
             natives.add(mimeType);
         }
 
         if (DataFlavor.imageFlavor.equals(df)) {
             String[] mimeTypes = ImageIO.getWriterMIMETypes();
             if (mimeTypes != null) {
-                for (int i = 0; i < mimeTypes.length; i++) {
-                    Iterator writers =
-                        ImageIO.getImageWritersByMIMEType(mimeTypes[i]);
-
+                for (String mime : mimeTypes) {
+                    Iterator<ImageWriter> writers = ImageIO.getImageWritersByMIMEType(mime);
                     while (writers.hasNext()) {
-                        ImageWriter imageWriter = (ImageWriter)writers.next();
-                        ImageWriterSpi writerSpi =
-                            imageWriter.getOriginatingProvider();
+                        ImageWriter imageWriter = writers.next();
+                        ImageWriterSpi writerSpi = imageWriter.getOriginatingProvider();
 
                         if (writerSpi != null &&
-                            writerSpi.canEncodeImage(getDefaultImageTypeSpecifier())) {
-                            natives.add(mimeTypes[i]);
+                                writerSpi.canEncodeImage(getDefaultImageTypeSpecifier())) {
+                            natives.add(mime);
                             break;
                         }
                     }
--- a/jdk/src/solaris/classes/sun/awt/X11/XDesktopPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDesktopPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -33,6 +33,9 @@
 
 import java.awt.Desktop.Action;
 import java.awt.peer.DesktopPeer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 
 
 /**
@@ -43,6 +46,10 @@
  */
 public class XDesktopPeer implements DesktopPeer {
 
+    // supportedActions may be changed from native within an init() call
+    private static final List<Action> supportedActions
+            = new ArrayList<>(Arrays.asList(Action.OPEN, Action.MAIL, Action.BROWSE));
+
     private static boolean nativeLibraryLoaded = false;
     private static boolean initExecuted = false;
 
@@ -65,11 +72,11 @@
 
     static boolean isDesktopSupported() {
         initWithLock();
-        return nativeLibraryLoaded;
+        return nativeLibraryLoaded && !supportedActions.isEmpty();
     }
 
     public boolean isSupported(Action type) {
-        return type != Action.PRINT && type != Action.EDIT;
+        return supportedActions.contains(type);
     }
 
     public void open(File file) throws IOException {
--- a/jdk/src/solaris/classes/sun/awt/X11/XRepaintArea.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/classes/sun/awt/X11/XRepaintArea.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,8 +28,8 @@
 
 import java.awt.Component;
 import java.awt.Graphics;
+
 import sun.awt.RepaintArea;
-import java.awt.peer.ComponentPeer;
 
 /**
  * The <code>RepaintArea</code> is a geometric construct created for the
@@ -39,24 +39,15 @@
  *
  * @author      Eric Hawkes
  */
-class XRepaintArea extends RepaintArea {
-
-    /**
-     * Constructs a new <code>XRepaintArea</code>
-     * @since   1.3
-     */
-    public XRepaintArea() {
-    }
+final class XRepaintArea extends RepaintArea {
 
     /**
      * Calls <code>Component.update(Graphics)</code> with given Graphics.
      */
     protected void updateComponent(Component comp, Graphics g) {
         if (comp != null) {
-            final XComponentPeer peer = (XComponentPeer) comp.getPeer();
-            if (peer != null) {
-                peer.paintPeer(g);
-            }
+            // We don't call peer.paintPeer() here, because we shouldn't paint
+            // native component when processing UPDATE events.
             super.updateComponent(comp, g);
         }
     }
--- a/jdk/src/solaris/classes/sun/awt/X11/XRootWindow.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/classes/sun/awt/X11/XRootWindow.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, 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,7 +46,8 @@
     }
 
     private XRootWindow() {
-        super(new XCreateWindowParams(new Object[] {DELAYED, Boolean.TRUE}));
+        super(new XCreateWindowParams(new Object[] { DELAYED, Boolean.TRUE,
+                                                     EVENT_MASK, XConstants.StructureNotifyMask }));
     }
 
     public void postInit(XCreateWindowParams params){
--- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Tue Apr 01 15:37:15 2014 +0200
@@ -47,6 +47,7 @@
 import javax.swing.LookAndFeel;
 import javax.swing.UIDefaults;
 import sun.awt.*;
+import sun.awt.datatransfer.DataTransferer;
 import sun.font.FontConfigManager;
 import sun.java2d.SunGraphicsEnvironment;
 import sun.misc.PerformanceLogger;
@@ -299,8 +300,6 @@
         return awtAppClassName;
     }
 
-    static final String DATA_TRANSFERER_CLASS_NAME = "sun.awt.X11.XDataTransferer";
-
     public XToolkit() {
         super();
         if (PerformanceLogger.loggingEnabled()) {
@@ -322,7 +321,6 @@
 
             init();
             XWM.init();
-            SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);
 
             PrivilegedAction<Thread> action = new PrivilegedAction() {
                 public Thread run() {
@@ -823,10 +821,32 @@
                     // managers don't set this hint correctly, so we just get intersection with windowBounds
                     if (windowBounds != null && windowBounds.intersects(screenBounds))
                     {
-                        insets.left = Math.max((int)Native.getLong(native_ptr, 0), insets.left);
-                        insets.right = Math.max((int)Native.getLong(native_ptr, 1), insets.right);
-                        insets.top = Math.max((int)Native.getLong(native_ptr, 2), insets.top);
-                        insets.bottom = Math.max((int)Native.getLong(native_ptr, 3), insets.bottom);
+                        int left = (int)Native.getLong(native_ptr, 0);
+                        int right = (int)Native.getLong(native_ptr, 1);
+                        int top = (int)Native.getLong(native_ptr, 2);
+                        int bottom = (int)Native.getLong(native_ptr, 3);
+
+                        /*
+                         * struts could be relative to root window bounds, so
+                         * make them relative to the screen bounds in this case
+                         */
+                        left = rootBounds.x + left > screenBounds.x ?
+                                rootBounds.x + left - screenBounds.x : 0;
+                        right = rootBounds.x + rootBounds.width - right <
+                                screenBounds.x + screenBounds.width ?
+                                screenBounds.x + screenBounds.width -
+                                (rootBounds.x + rootBounds.width - right) : 0;
+                        top = rootBounds.y + top > screenBounds.y ?
+                                rootBounds.y + top - screenBounds.y : 0;
+                        bottom = rootBounds.y + rootBounds.height - bottom <
+                                screenBounds.y + screenBounds.height ?
+                                screenBounds.y + screenBounds.height -
+                                (rootBounds.y + rootBounds.height - bottom) : 0;
+
+                        insets.left = Math.max(left, insets.left);
+                        insets.right = Math.max(right, insets.right);
+                        insets.top = Math.max(top, insets.top);
+                        insets.bottom = Math.max(bottom, insets.bottom);
                     }
                 }
             }
@@ -1124,6 +1144,11 @@
         return false;
     }
 
+    @Override
+    public DataTransferer getDataTransferer() {
+        return XDataTransferer.getInstanceImpl();
+    }
+
     /**
      * Returns the supported cursor size
      */
@@ -2357,9 +2382,7 @@
 
     private static XEventDispatcher oops_waiter;
     private static boolean oops_updated;
-    private static boolean oops_failed;
-    private XAtom oops;
-    private static final long WORKAROUND_SLEEP = 100;
+    private static boolean oops_move;
 
     /**
      * @inheritDoc
@@ -2370,52 +2393,33 @@
         if (oops_waiter == null) {
             oops_waiter = new XEventDispatcher() {
                     public void dispatchEvent(XEvent e) {
-                        if (e.get_type() == XConstants.SelectionNotify) {
-                            XSelectionEvent pe = e.get_xselection();
-                            if (pe.get_property() == oops.getAtom()) {
-                                oops_updated = true;
-                                awtLockNotifyAll();
-                            } else if (pe.get_selection() == XAtom.get("WM_S0").getAtom() &&
-                                       pe.get_target() == XAtom.get("VERSION").getAtom() &&
-                                       pe.get_property() == 0 &&
-                                       XlibWrapper.XGetSelectionOwner(getDisplay(), XAtom.get("WM_S0").getAtom()) == 0)
-                            {
-                                // WM forgot to acquire selection  or there is no WM
-                                oops_failed = true;
-                                awtLockNotifyAll();
-                            }
-
+                        if (e.get_type() == XConstants.ConfigureNotify) {
+                            // OOPS ConfigureNotify event catched
+                            oops_updated = true;
+                            awtLockNotifyAll();
                         }
                     }
                 };
         }
 
-        if (oops == null) {
-            oops = XAtom.get("OOPS");
-        }
-
         awtLock();
         try {
             addEventDispatcher(win.getWindow(), oops_waiter);
 
             oops_updated = false;
-            oops_failed = false;
-            // Wait for selection notify for oops on win
             long event_number = getEventNumber();
-            XAtom atom = XAtom.get("WM_S0");
-            if (eventLog.isLoggable(PlatformLogger.Level.FINER)) {
-                eventLog.finer("WM_S0 selection owner {0}", XlibWrapper.XGetSelectionOwner(getDisplay(), atom.getAtom()));
-            }
-            XlibWrapper.XConvertSelection(getDisplay(), atom.getAtom(),
-                                          XAtom.get("VERSION").getAtom(), oops.getAtom(),
-                                          win.getWindow(), XConstants.CurrentTime);
+            // Generate OOPS ConfigureNotify event
+            XlibWrapper.XMoveWindow(getDisplay(), win.getWindow(), oops_move ? 0 : 1, 0);
+            // Change win position each time to avoid system optimization
+            oops_move = !oops_move;
             XSync();
 
-            eventLog.finer("Requested OOPS");
+            eventLog.finer("Generated OOPS ConfigureNotify event");
 
             long start = System.currentTimeMillis();
-            while (!oops_updated && !oops_failed) {
+            while (!oops_updated) {
                 try {
+                    // Wait for OOPS ConfigureNotify event
                     awtLockWait(timeout);
                 } catch (InterruptedException e) {
                     throw new RuntimeException(e);
@@ -2426,20 +2430,8 @@
                     throw new OperationTimedOut(Long.toString(System.currentTimeMillis() - start));
                 }
             }
-            if (oops_failed && getEventNumber() - event_number == 1) {
-                // If selection update failed we can simply wait some time
-                // hoping some events will arrive
-                awtUnlock();
-                eventLog.finest("Emergency sleep");
-                try {
-                    Thread.sleep(WORKAROUND_SLEEP);
-                } catch (InterruptedException ie) {
-                    throw new RuntimeException(ie);
-                } finally {
-                    awtLock();
-                }
-            }
-            return getEventNumber() - event_number > 2;
+            // Don't take into account OOPS ConfigureNotify event
+            return getEventNumber() - event_number > 1;
         } finally {
             removeEventDispatcher(win.getWindow(), oops_waiter);
             eventLog.finer("Exiting syncNativeQueue");
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java	Tue Apr 01 15:37:15 2014 +0200
@@ -456,6 +456,7 @@
             ColorModel cm = getColorModel();
             int pixel = PixelConverter.instance.rgbToPixel(c.getRGB(), cm);
             XlibWrapper.XSetWindowBackground(XToolkit.getDisplay(), getContentWindow(), pixel);
+            XlibWrapper.XClearWindow(XToolkit.getDisplay(), getContentWindow());
         }
         finally {
             XToolkit.awtUnlock();
--- a/jdk/src/solaris/classes/sun/awt/windows/ThemeReader.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/classes/sun/awt/windows/ThemeReader.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2006, 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
@@ -25,7 +25,10 @@
 
 package sun.awt.windows;
 
-import java.awt.*;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Insets;
+import java.awt.Point;
 
 
 /**
@@ -36,7 +39,8 @@
  *
  * @author Leif Samuelsson
  */
-public class ThemeReader {
+public final class ThemeReader {
+
     public static boolean isThemed() {
         return false;
     }
@@ -84,16 +88,18 @@
     public static Dimension getPartSize(String widget, int part, int state) {
         return null;
     }
+
     public static long getThemeTransitionDuration(String widget, int part,
                                        int stateFrom, int stateTo, int propId) {
         return 0;
     }
+
     public static boolean isGetThemeTransitionDurationDefined() {
         return false;
     }
+
     public static Insets getThemeBackgroundContentMargins(String widget,
                     int part, int state, int boundingWidth, int boundingHeight) {
         return null;
     }
-
 }
--- a/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java	Tue Apr 01 15:37:15 2014 +0200
@@ -33,6 +33,7 @@
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -173,8 +174,16 @@
     }
 
     @Override
-    public FontDescriptor[] getFontDescriptors(String fontName, int style) {
-        return new FontDescriptor[0];
+    protected FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
+        CompositeFontDescriptor[] cfi = get2DCompositeFontInfo();
+        int idx = fontIndex * NUM_STYLES + styleIndex;
+        String[] componentFaceNames = cfi[idx].getComponentFaceNames();
+        FontDescriptor[] ret = new FontDescriptor[componentFaceNames.length];
+        for (int i = 0; i < componentFaceNames.length; i++) {
+            ret[i] = new FontDescriptor(componentFaceNames[i], StandardCharsets.UTF_8.newEncoder(), new int[0]);
+        }
+
+        return ret;
     }
 
     @Override
@@ -250,10 +259,12 @@
                 }
 
                 String[] fileNames = new String[numFonts];
+                String[] faceNames = new String[numFonts];
 
                 int index;
                 for (index = 0; index < fcFonts.length; index++) {
                     fileNames[index] = fcFonts[index].fontFile;
+                    faceNames[index] = fcFonts[index].familyName;
                 }
 
                 if (installedFallbackFontFiles != null) {
@@ -266,7 +277,7 @@
                         = new CompositeFontDescriptor(
                             faceName,
                             1,
-                            null,
+                            faceNames,
                             fileNames,
                             null, null);
             }
--- a/jdk/src/solaris/classes/sun/print/CUPSPrinter.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/classes/sun/print/CUPSPrinter.java	Tue Apr 01 15:37:15 2014 +0200
@@ -252,6 +252,7 @@
                             try {
                                 return urlConnection.getOutputStream();
                             } catch (Exception e) {
+                               IPPPrintService.debug_println(debugPrefix+e);
                             }
                             return null;
                         }
@@ -282,6 +283,9 @@
 
                     if (responseMap != null && responseMap.length > 0) {
                         defaultMap = responseMap[0];
+                    } else {
+                       IPPPrintService.debug_println(debugPrefix+
+                           " empty response map for GET_DEFAULT.");
                     }
 
                     if (defaultMap == null) {
@@ -310,7 +314,10 @@
 
                     if (attribClass != null) {
                         printerInfo[0] = attribClass.getStringValue();
-                        attribClass = (AttributeClass)defaultMap.get("device-uri");
+                        attribClass = (AttributeClass)
+                            defaultMap.get("printer-uri-supported");
+                        IPPPrintService.debug_println(debugPrefix+
+                          "printer-uri-supported="+attribClass);
                         if (attribClass != null) {
                             printerInfo[1] = attribClass.getStringValue();
                         } else {
--- a/jdk/src/solaris/classes/sun/print/IPPPrintService.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/classes/sun/print/IPPPrintService.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1904,9 +1904,8 @@
                                   new HashMap[respList.size()]);
             } else {
                 debug_println(debugPrefix+
-                              "readIPPResponse client error, IPP status code-"
-                                   +Integer.toHexString(response[2])+" & "
-                                   +Integer.toHexString(response[3]));
+                          "readIPPResponse client error, IPP status code: 0x"+
+                          toHex(response[2]) + toHex(response[3]));
                 return null;
             }
 
@@ -1919,6 +1918,10 @@
         }
     }
 
+    private static String toHex(byte v) {
+        String s = Integer.toHexString(v&0xff);
+        return (s.length() == 2) ? s :  "0"+s;
+    }
 
     public String toString() {
         return "IPP Printer : " + getName();
--- a/jdk/src/solaris/classes/sun/print/UnixPrintJob.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/classes/sun/print/UnixPrintJob.java	Tue Apr 01 15:37:15 2014 +0200
@@ -409,7 +409,11 @@
                     ((IPPPrintService)service).isIPPSupportedImages(
                                                 flavor.getMimeType()))) {
                     printableJob(new ImagePrinter(instream));
-                    ((UnixPrintService)service).wakeNotifier();
+                    if (service instanceof IPPPrintService) {
+                        ((IPPPrintService)service).wakeNotifier();
+                    } else {
+                        ((UnixPrintService)service).wakeNotifier();
+                    }
                     return;
                 }
             } catch (ClassCastException cce) {
@@ -430,7 +434,11 @@
                     instream = url.openStream();
                 } else {
                     printableJob(new ImagePrinter(url));
-                    ((UnixPrintService)service).wakeNotifier();
+                    if (service instanceof IPPPrintService) {
+                        ((IPPPrintService)service).wakeNotifier();
+                    } else {
+                        ((UnixPrintService)service).wakeNotifier();
+                    }
                     return;
                 }
             } catch (ClassCastException cce) {
--- a/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java	Tue Apr 01 15:37:15 2014 +0200
@@ -273,9 +273,25 @@
         String[] printers = null; // array of printer names
         String[] printerURIs = null; //array of printer URIs
 
-        getDefaultPrintService();
+        try {
+            getDefaultPrintService();
+        } catch (Throwable t) {
+            IPPPrintService.debug_println(debugPrefix+
+              "Exception getting default printer : " + t);
+        }
         if (CUPSPrinter.isCupsRunning()) {
-            printerURIs = CUPSPrinter.getAllPrinters();
+            try {
+                printerURIs = CUPSPrinter.getAllPrinters();
+                IPPPrintService.debug_println("CUPS URIs = " + printerURIs);
+                if (printerURIs != null) {
+                    for (int p = 0; p < printerURIs.length; p++) {
+                       IPPPrintService.debug_println("URI="+printerURIs[p]);
+                    }
+                }
+            } catch (Throwable t) {
+            IPPPrintService.debug_println(debugPrefix+
+              "Exception getting all CUPS printers : " + t);
+            }
             if ((printerURIs != null) && (printerURIs.length > 0)) {
                 printers = new String[printerURIs.length];
                 for (int i=0; i<printerURIs.length; i++) {
@@ -632,8 +648,10 @@
                                       (CUPSPrinter.isCupsRunning()));
         if (CUPSPrinter.isCupsRunning()) {
             String[] printerInfo = CUPSPrinter.getDefaultPrinter();
-            defaultPrinter = printerInfo[0];
-            psuri = printerInfo[1];
+            if (printerInfo != null && printerInfo.length >= 2) {
+                defaultPrinter = printerInfo[0];
+                psuri = printerInfo[1];
+            }
         } else {
             if (isMac() || isSysV()) {
                 defaultPrinter = getDefaultPrinterNameSysV();
--- a/jdk/src/solaris/native/sun/awt/awt_Font.c	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/native/sun/awt/awt_Font.c	Tue Apr 01 15:37:15 2014 +0200
@@ -452,6 +452,7 @@
         int32_t i, size;
         char *fontsetname = NULL;
         char *nativename = NULL;
+        Boolean doFree = FALSE;
         jobjectArray componentFonts = NULL;
         jobject peer = NULL;
         jobject fontDescriptor = NULL;
@@ -491,8 +492,10 @@
 
             if (!JNU_IsNull(env, fontDescriptorName)) {
                 nativename = (char *) JNU_GetStringPlatformChars(env, fontDescriptorName, NULL);
+                doFree = TRUE;
             } else {
                 nativename = "";
+                doFree = FALSE;
             }
 
             fdata->flist[i].xlfd = malloc(strlen(nativename)
@@ -500,7 +503,7 @@
             jio_snprintf(fdata->flist[i].xlfd, strlen(nativename) + 10,
                          nativename, size * 10);
 
-            if (nativename != NULL && nativename != "")
+            if (nativename != NULL && doFree)
                 JNU_ReleaseStringPlatformChars(env, fontDescriptorName, (const char *) nativename);
 
             /*
--- a/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c	Tue Apr 01 15:37:15 2014 +0200
@@ -113,7 +113,7 @@
     jvm = vm;
 
     /* Get address of this library and the directory containing it. */
-    dladdr((void *)JNI_OnLoad, &dlinfo);
+    dladdr((void *)AWT_OnLoad, &dlinfo);
     realpath((char *)dlinfo.dli_fname, buf);
     len = strlen(buf);
     p = strrchr(buf, '/');
@@ -227,7 +227,7 @@
 
 
 #define REFLECT_VOID_FUNCTION(name, arglist, paramlist)                 \
-typedef name##_type arglist;                                            \
+typedef void name##_type arglist;                                       \
 void name arglist                                                       \
 {                                                                       \
     static name##_type *name##_ptr = NULL;                              \
--- a/jdk/src/solaris/native/sun/awt/gtk2_interface.c	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/native/sun/awt/gtk2_interface.c	Tue Apr 01 15:37:15 2014 +0200
@@ -32,6 +32,7 @@
 #include "java_awt_Transparency.h"
 #include "jvm_md.h"
 #include "sizecalc.h"
+#include <jni_util.h>
 
 #define GTK2_LIB_VERSIONED VERSIONED_JNI_LIB_NAME("gtk-x11-2.0", "0")
 #define GTK2_LIB JNI_LIB_NAME("gtk-x11-2.0")
@@ -438,10 +439,82 @@
     }
 }
 
+#define ADD_SUPPORTED_ACTION(actionStr) \
+do { \
+    jfieldID fld_action = (*env)->GetStaticFieldID(env, cls_action, actionStr, "Ljava/awt/Desktop$Action;"); \
+    if (!(*env)->ExceptionCheck(env)) { \
+        jobject action = (*env)->GetStaticObjectField(env, cls_action, fld_action); \
+        (*env)->CallBooleanMethod(env, supportedActions, mid_arrayListAdd, action); \
+    } else { \
+        (*env)->ExceptionClear(env); \
+    } \
+} while(0);
+
+
+void update_supported_actions(JNIEnv *env) {
+    GVfs * (*fp_g_vfs_get_default) (void);
+    const gchar * const * (*fp_g_vfs_get_supported_uri_schemes) (GVfs * vfs);
+    const gchar * const * schemes = NULL;
+
+    jclass cls_action = (*env)->FindClass(env, "java/awt/Desktop$Action");
+    CHECK_NULL(cls_action);
+    jclass cls_xDesktopPeer = (*env)->FindClass(env, "sun/awt/X11/XDesktopPeer");
+    CHECK_NULL(cls_xDesktopPeer);
+    jfieldID fld_supportedActions = (*env)->GetStaticFieldID(env, cls_xDesktopPeer, "supportedActions", "Ljava/util/List;");
+    CHECK_NULL(fld_supportedActions);
+    jobject supportedActions = (*env)->GetStaticObjectField(env, cls_xDesktopPeer, fld_supportedActions);
+
+    jclass cls_arrayList = (*env)->FindClass(env, "java/util/ArrayList");
+    CHECK_NULL(cls_arrayList);
+    jmethodID mid_arrayListAdd = (*env)->GetMethodID(env, cls_arrayList, "add", "(Ljava/lang/Object;)Z");
+    CHECK_NULL(mid_arrayListAdd);
+    jmethodID mid_arrayListClear = (*env)->GetMethodID(env, cls_arrayList, "clear", "()V");
+    CHECK_NULL(mid_arrayListClear);
+
+    (*env)->CallVoidMethod(env, supportedActions, mid_arrayListClear);
+
+    ADD_SUPPORTED_ACTION("OPEN");
+
+    /**
+     * gtk_show_uri() documentation says:
+     *
+     * > you need to install gvfs to get support for uri schemes such as http://
+     * > or ftp://, as only local files are handled by GIO itself.
+     *
+     * So OPEN action was safely added here.
+     * However, it looks like Solaris 11 have gvfs support only for 32-bit
+     * applications only by default.
+     */
+
+    fp_g_vfs_get_default = dl_symbol("g_vfs_get_default");
+    fp_g_vfs_get_supported_uri_schemes = dl_symbol("g_vfs_get_supported_uri_schemes");
+    dlerror();
+
+    if (fp_g_vfs_get_default && fp_g_vfs_get_supported_uri_schemes) {
+        GVfs * vfs = fp_g_vfs_get_default();
+        schemes = vfs ? fp_g_vfs_get_supported_uri_schemes(vfs) : NULL;
+        if (schemes) {
+            int i = 0;
+            while (schemes[i]) {
+                if (strcmp(schemes[i], "http") == 0) {
+                    ADD_SUPPORTED_ACTION("BROWSE");
+                    ADD_SUPPORTED_ACTION("MAIL");
+                    break;
+                }
+                i++;
+            }
+        }
+    } else {
+#ifdef INTERNAL_BUILD
+        fprintf(stderr, "Cannot load g_vfs_get_supported_uri_schemes\n");
+#endif /* INTERNAL_BUILD */
+    }
+
+}
 /**
  * Functions for awt_Desktop.c
  */
-gboolean gtk2_show_uri_load() {
+gboolean gtk2_show_uri_load(JNIEnv *env) {
      gboolean success = FALSE;
      dlerror();
      const char *gtk_version = fp_gtk_check_version(2, 14, 0);
@@ -464,9 +537,12 @@
 #ifdef INTERNAL_BUILD
              fprintf(stderr, "dlsym(gtk_show_uri) returned NULL\n");
 #endif /* INTERNAL_BUILD */
-         } else {
-             success = TRUE;
-         }
+        } else {
+#ifdef __solaris__
+            update_supported_actions(env);
+#endif
+            success = TRUE;
+        }
      }
      return success;
 }
@@ -533,7 +609,10 @@
         }
 
         /* GLib */
-        fp_glib_check_version = dl_symbol("glib_check_version");
+        fp_glib_check_version = dlsym(gtk2_libhandle, "glib_check_version");
+        if (!fp_glib_check_version) {
+            dlerror();
+        }
         fp_g_free = dl_symbol("g_free");
         fp_g_object_unref = dl_symbol("g_object_unref");
 
@@ -709,7 +788,7 @@
         /**
          * GLib thread system
          */
-        if (fp_glib_check_version(2, 20, 0) == NULL) {
+        if (GLIB_CHECK_VERSION(2, 20, 0)) {
             fp_g_thread_get_initialized = dl_symbol_gthread("g_thread_get_initialized");
         }
         fp_g_thread_init = dl_symbol_gthread("g_thread_init");
@@ -827,7 +906,7 @@
         // We can use g_thread_get_initialized () but it is available only for
         // GLib >= 2.20. We rely on GThreadHelper for GLib < 2.20.
         gboolean is_g_thread_get_initialized = FALSE;
-        if (fp_glib_check_version(2, 20, 0) == NULL) {
+        if (GLIB_CHECK_VERSION(2, 20, 0)) {
             is_g_thread_get_initialized = fp_g_thread_get_initialized();
         }
 
--- a/jdk/src/solaris/native/sun/awt/gtk2_interface.h	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/native/sun/awt/gtk2_interface.h	Tue Apr 01 15:37:15 2014 +0200
@@ -270,6 +270,7 @@
 /* We define all structure pointers to be void* */
 typedef void GError;
 typedef void GMainContext;
+typedef void GVfs;
 
 typedef struct _GSList GSList;
 struct _GSList
@@ -647,10 +648,19 @@
  * Returns :
  * NULL if the GLib library is compatible with the given version, or a string
  * describing the version mismatch.
+ * Please note that the glib_check_version() is available since 2.6,
+ * so you should use GLIB_CHECK_VERSION macro instead.
  */
 gchar* (*fp_glib_check_version)(guint required_major, guint required_minor,
                        guint required_micro);
 
+/**
+ * Returns :
+ *  TRUE if the GLib library is compatible with the given version
+ */
+#define GLIB_CHECK_VERSION(major, minor, micro) \
+    (fp_glib_check_version && fp_glib_check_version(major, minor, micro) == NULL)
+
 /*
  * Check whether the gtk2 library is available and meets the minimum
  * version requirement.  If the library is already loaded this method has no
@@ -680,7 +690,7 @@
  * gtk2_load, so it must be invoked only after a successful gtk2_load
  * invocation
  */
-gboolean gtk2_show_uri_load();
+gboolean gtk2_show_uri_load(JNIEnv *env);
 
 /*
  * Unload the gtk2 library.  If the library is already unloaded this method has
@@ -811,7 +821,7 @@
 
 /**
  * This function is available for GLIB > 2.20, so it MUST be
- * called within (fp_glib_check_version(2, 20, 0) == NULL) check.
+ * called within GLIB_CHECK_VERSION(2, 20, 0) check.
  */
 gboolean (*fp_g_thread_get_initialized)(void);
 
--- a/jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c	Tue Apr 01 15:37:15 2014 +0200
@@ -1,3 +1,28 @@
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
 #include <jni.h>
 #include <stdio.h>
 #include <jni_util.h>
--- a/jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.h	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class sun_awt_X11_GtkFileDialogPeer */
-
-#ifndef _Included_sun_awt_X11_GtkFileDialogPeer
-#define _Included_sun_awt_X11_GtkFileDialogPeer
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/*
- * Class:     sun_awt_X11_GtkFileDialogPeer
- * Method:    initIDs
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_initIDs
-(JNIEnv *, jclass);
-
-/*
- * Class:     sun_awt_X11_GtkFileDialogPeer
- * Method:    run
- * Signature: (Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/io/FilenameFilter;ZII)V
- */
-JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_run
-(JNIEnv *, jobject, jstring, jint, jstring, jstring, jobject, jboolean, jint, jint);
-
-/*
- * Class:     sun_awt_X11_GtkFileDialogPeer
- * Method:    quit
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_quit
-(JNIEnv *, jobject);
-
-/*
- * Class:     sun_awt_X11_GtkFileDialogPeer
- * Method:    toFront
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_toFront
-(JNIEnv *, jobject);
-
-/*
- * Class:     sun_awt_X11_GtkFileDialogPeer
- * Method:    setBounds
- * Signature: (IIIII)V
- */
-JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_setBounds
-(JNIEnv * env, jobject jpeer, jint x, jint y, jint width, jint height, jint op);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Tue Apr 01 15:37:15 2014 +0200
@@ -510,7 +510,7 @@
     xsdo->cData = xsdo->configData->color_data;
 
     XShared_initSurface(env, xsdo, depth, width, height, drawable);
-    xsdo->xrPic = NULL;
+    xsdo->xrPic = None;
 #endif /* !HEADLESS */
 }
 
--- a/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,6 +50,10 @@
   (JNIEnv *env, jclass thisClass, jstring jLibName)
 {
     const char *libName = (*env)->GetStringUTFChars(env, jLibName, NULL);
+    if (libName == NULL) {
+        return 0L;
+    }
+
     // look up existing handle only, do not load
 #if defined(AIX)
     void *hModule = dlopen(libName, RTLD_LAZY);
@@ -66,6 +70,9 @@
 {
     void *hModule;
     const char *libName = (*env)->GetStringUTFChars(env, jLibName, NULL);
+    if (libName == NULL) {
+       return 0L;
+    }
 
     dprintf1("-lib %s\n", libName);
     hModule = dlopen(libName, RTLD_LAZY);
--- a/jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  */
 
 /* Copyright  (c) 2002 Graz University of Technology. All rights reserved.
@@ -88,6 +88,9 @@
     const char *getFunctionListStr;
 
     const char *libraryNameStr = (*env)->GetStringUTFChars(env, jPkcs11ModulePath, 0);
+    if (libraryNameStr == NULL) {
+        return;
+    }
     TRACE1("DEBUG: connect to PKCS#11 module: %s ... ", libraryNameStr);
 
 
@@ -123,6 +126,9 @@
     // with the old JAR file jGetFunctionList is null, temporarily check for that
     if (jGetFunctionList != NULL) {
         getFunctionListStr = (*env)->GetStringUTFChars(env, jGetFunctionList, 0);
+        if (getFunctionListStr == NULL) {
+            return;
+        }
         C_GetFunctionList = (CK_C_GetFunctionList) dlsym(hModule, getFunctionListStr);
         (*env)->ReleaseStringUTFChars(env, jGetFunctionList, getFunctionListStr);
     }
--- a/jdk/src/solaris/native/sun/xawt/XToolkit.c	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/native/sun/xawt/XToolkit.c	Tue Apr 01 15:37:15 2014 +0200
@@ -699,7 +699,7 @@
     if (pollFds[0].revents) {
         // Events in X pipe
         update_poll_timeout(TIMEOUT_EVENTS);
-        PRINT2("performPoll(): TIMEOUT_EVENTS curPollTimeout = %ld \n", curPollTimeout);
+        PRINT2("performPoll(): TIMEOUT_EVENTS curPollTimeout = %d \n", curPollTimeout);
     }
     return;
 
--- a/jdk/src/solaris/native/sun/xawt/awt_Desktop.c	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/solaris/native/sun/xawt/awt_Desktop.c	Tue Apr 01 15:37:15 2014 +0200
@@ -42,7 +42,7 @@
         return JNI_TRUE;
     }
 
-    if (gtk2_load(env) && gtk2_show_uri_load()) {
+    if (gtk2_load(env) && gtk2_show_uri_load(env)) {
         gtk_has_been_loaded = TRUE;
         return JNI_TRUE;
     } else if (gnome_load()) {
--- a/jdk/src/windows/classes/sun/awt/windows/ThemeReader.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/ThemeReader.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2006, 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
@@ -25,11 +25,15 @@
 
 package sun.awt.windows;
 
-import java.awt.*;
-import java.util.*;
-import java.util.concurrent.locks.*;
-import java.beans.*;
-import javax.swing.SwingUtilities;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Insets;
+import java.awt.Point;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 /* !!!! WARNING !!!!
  * This class has to be in sync with
@@ -45,9 +49,9 @@
  * @author Bino George
  * @author Igor Kushnirskiy
  */
-public class ThemeReader {
-    private static final HashMap<String, Long> widgetToTheme =
-        new HashMap<String, Long>();
+public final class ThemeReader {
+
+    private static final Map<String, Long> widgetToTheme = new HashMap<>();
 
     // lock for the cache
     // reading should be done with readLock
@@ -70,7 +74,7 @@
         }
     }
 
-    public native static boolean isThemed();
+    public static native boolean isThemed();
 
     // this should be called only with writeLock held
     private static Long getThemeImpl(String widget) {
@@ -109,8 +113,9 @@
         return theme;
     }
 
-    public native static void paintBackground(int[] buffer, long theme, int part, int state,
-                             int x, int y, int w, int h, int stride);
+    private static native void paintBackground(int[] buffer, long theme,
+                                               int part, int state, int x,
+                                               int y, int w, int h, int stride);
 
     public static void paintBackground(int[] buffer, String widget,
            int part, int state, int x, int y, int w, int h, int stride) {
@@ -122,8 +127,8 @@
         }
     }
 
-    public native static Insets getThemeMargins(long theme, int part, int state,
- int marginType);
+    private static native Insets getThemeMargins(long theme, int part,
+                                                 int state, int marginType);
 
     public static Insets getThemeMargins(String widget, int part, int state, int marginType) {
         readLock.lock();
@@ -134,7 +139,7 @@
         }
     }
 
-    private native static boolean isThemePartDefined(long theme, int part, int state);
+    private static native boolean isThemePartDefined(long theme, int part, int state);
 
     public static boolean isThemePartDefined(String widget, int part, int state) {
         readLock.lock();
@@ -145,8 +150,8 @@
         }
     }
 
-    public native static Color getColor(long theme, int part, int state,
-                                                               int property);
+    private static native Color getColor(long theme, int part, int state,
+                                         int property);
 
     public static Color getColor(String widget, int part, int state, int property) {
         readLock.lock();
@@ -157,8 +162,8 @@
         }
     }
 
-    public native static int getInt(long theme, int part, int state,
-                                                                int property);
+    private static native int getInt(long theme, int part, int state,
+                                     int property);
 
     public static int getInt(String widget, int part, int state, int property) {
         readLock.lock();
@@ -169,8 +174,8 @@
         }
     }
 
-    public native static int getEnum(long theme, int part, int state,
-                                                                int property);
+    private static native int getEnum(long theme, int part, int state,
+                                      int property);
 
     public static int getEnum(String widget, int part, int state, int property) {
         readLock.lock();
@@ -181,8 +186,8 @@
         }
     }
 
-    public native static boolean getBoolean(long theme, int part, int state,
-                                                                int property);
+    private static native boolean getBoolean(long theme, int part, int state,
+                                             int property);
 
     public static boolean getBoolean(String widget, int part, int state,
                                      int property) {
@@ -194,7 +199,7 @@
         }
     }
 
-    public native static boolean getSysBoolean(long theme, int property);
+    private static native boolean getSysBoolean(long theme, int property);
 
     public static boolean getSysBoolean(String widget, int property) {
         readLock.lock();
@@ -205,8 +210,8 @@
         }
     }
 
-    public native static Point getPoint(long theme, int part, int state,
-                                                                int property);
+    private static native Point getPoint(long theme, int part, int state,
+                                         int property);
 
     public static Point getPoint(String widget, int part, int state, int property) {
         readLock.lock();
@@ -217,8 +222,8 @@
         }
     }
 
-    public native static Dimension getPosition(long theme, int part, int state,
-                                                                 int property);
+    private static native Dimension getPosition(long theme, int part, int state,
+                                                int property);
 
     public static Dimension getPosition(String widget, int part, int state,
                                         int property) {
@@ -230,7 +235,8 @@
         }
     }
 
-    public native static Dimension getPartSize(long theme, int part, int state);
+    private static native Dimension getPartSize(long theme, int part,
+                                                int state);
 
     public static Dimension getPartSize(String widget, int part, int state) {
         readLock.lock();
@@ -241,14 +247,15 @@
         }
     }
 
-    public native static long openTheme(String widget);
+    private static native long openTheme(String widget);
 
-    public native static void closeTheme(long theme);
+    private static native void closeTheme(long theme);
 
-    public native static void setWindowTheme(String subAppName);
+    private static native void setWindowTheme(String subAppName);
 
-    private native static long getThemeTransitionDuration(long theme, int part,
+    private static native long getThemeTransitionDuration(long theme, int part,
                                         int stateFrom, int stateTo, int propId);
+
     public static long getThemeTransitionDuration(String widget, int part,
                                        int stateFrom, int stateTo, int propId) {
         readLock.lock();
@@ -259,10 +266,12 @@
             readLock.unlock();
         }
     }
-    public native static boolean isGetThemeTransitionDurationDefined();
+
+    public static native boolean isGetThemeTransitionDurationDefined();
 
-    private native static Insets getThemeBackgroundContentMargins(long theme,
+    private static native Insets getThemeBackgroundContentMargins(long theme,
                      int part, int state, int boundingWidth, int boundingHeight);
+
     public static Insets getThemeBackgroundContentMargins(String widget,
                     int part, int state, int boundingWidth, int boundingHeight) {
         readLock.lock();
--- a/jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,6 @@
 import java.awt.image.BufferedImage;
 import java.awt.image.DataBufferInt;
 import java.awt.image.VolatileImage;
-import java.lang.ref.WeakReference;
 import java.security.AccessController;
 import sun.awt.image.BufImgSurfaceData;
 import sun.java2d.DestSurfaceProvider;
@@ -46,7 +45,6 @@
 import sun.security.action.GetPropertyAction;
 
 import static java.awt.image.VolatileImage.*;
-import static java.awt.Transparency.*;
 import static sun.java2d.pipe.hw.AccelSurface.*;
 import static sun.java2d.pipe.hw.ContextCapabilities.*;
 
@@ -59,7 +57,7 @@
  * Note: this class does not attempt to be thread safe, it is expected to be
  * called from a single thread (EDT).
  */
-public abstract class TranslucentWindowPainter {
+abstract class TranslucentWindowPainter {
 
     protected Window window;
     protected WWindowPeer peer;
@@ -231,6 +229,7 @@
             return (viBB != null ? !viBB.contentsLost() : true);
         }
 
+        @Override
         public void flush() {
             if (backBuffer != null) {
                 backBuffer.flush();
@@ -313,6 +312,7 @@
                     try {
                         BufferedContext.validateContext(as);
                         rq.flushAndInvokeNow(new Runnable() {
+                            @Override
                             public void run() {
                                 long psdops = as.getNativeOps();
                                 arr[0] = updateWindowAccel(psdops, w, h);
--- a/jdk/src/windows/classes/sun/awt/windows/WBufferStrategy.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WBufferStrategy.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -34,8 +34,9 @@
  * the back buffer associated with a Component.  If that
  * Component has a BufferStrategy with >1 buffer, then the
  * Image subclass associated with that buffer will be returned.
+ * Note: the class is used by the JAWT3d.
  */
-public class WBufferStrategy {
+public final class WBufferStrategy {
 
     private static native void initIDs(Class <?> componentClass);
 
--- a/jdk/src/windows/classes/sun/awt/windows/WButtonPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WButtonPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -37,6 +37,7 @@
 
     // ComponentPeer overrides
 
+    @Override
     public Dimension getMinimumSize() {
         FontMetrics fm = getFontMetrics(((Button)target).getFont());
         String label = ((Button)target).getLabel();
@@ -46,12 +47,14 @@
         return new Dimension(fm.stringWidth(label) + 14,
                              fm.getHeight() + 8);
     }
+    @Override
     public boolean isFocusable() {
         return true;
     }
 
     // ButtonPeer implementation
 
+    @Override
     public native void setLabel(String label);
 
     // Toolkit & peer internals
@@ -60,6 +63,7 @@
         super(target);
     }
 
+    @Override
     native void create(WComponentPeer peer);
 
     // native callbacks
@@ -70,6 +74,7 @@
         // Fixed 5064013: the InvocationEvent time should be equals
         // the time of the ActionEvent
         WToolkit.executeOnEventHandlerThread(target, new Runnable() {
+            @Override
             public void run() {
                 postEvent(new ActionEvent(target, ActionEvent.ACTION_PERFORMED,
                                           ((Button)target).getActionCommand(),
@@ -79,6 +84,7 @@
     }
 
 
+    @Override
     public boolean shouldClearRectBeforePaint() {
         return false;
     }
@@ -88,6 +94,7 @@
      */
     private static native void initIDs();
 
+    @Override
     public boolean handleJavaKeyEvent(KeyEvent e) {
          switch (e.getID()) {
             case KeyEvent.KEY_RELEASED:
--- a/jdk/src/windows/classes/sun/awt/windows/WCanvasPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WCanvasPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -24,12 +24,16 @@
  */
 package sun.awt.windows;
 
-import java.awt.*;
-import java.awt.peer.*;
-import java.lang.ref.WeakReference;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.peer.CanvasPeer;
+
+import sun.awt.PaintEventDispatcher;
 import sun.awt.SunToolkit;
-import sun.awt.Win32GraphicsDevice;
-import sun.awt.PaintEventDispatcher;
 
 class WCanvasPeer extends WComponentPeer implements CanvasPeer {
 
@@ -41,8 +45,10 @@
         super(target);
     }
 
+    @Override
     native void create(WComponentPeer parent);
 
+    @Override
     void initialize() {
         eraseBackground = !SunToolkit.getSunAwtNoerasebackground();
         boolean eraseBackgroundOnResize = SunToolkit.getSunAwtErasebackgroundonresize();
@@ -60,6 +66,7 @@
         }
     }
 
+    @Override
     public void paint(Graphics g) {
         Dimension d = ((Component)target).getSize();
         if (g instanceof Graphics2D ||
@@ -75,6 +82,7 @@
         super.paint(g);
     }
 
+    @Override
     public boolean shouldClearRectBeforePaint() {
         return eraseBackground;
     }
@@ -99,6 +107,7 @@
     private native void setNativeBackgroundErase(boolean doErase,
                                                  boolean doEraseOnResize);
 
+    @Override
     public GraphicsConfiguration getAppropriateGraphicsConfiguration(
             GraphicsConfiguration gc)
     {
--- a/jdk/src/windows/classes/sun/awt/windows/WCheckboxMenuItemPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WCheckboxMenuItemPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, 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
@@ -24,14 +24,16 @@
  */
 package sun.awt.windows;
 
-import java.awt.*;
-import java.awt.peer.*;
+import java.awt.CheckboxMenuItem;
 import java.awt.event.ItemEvent;
+import java.awt.peer.CheckboxMenuItemPeer;
 
-class WCheckboxMenuItemPeer extends WMenuItemPeer implements CheckboxMenuItemPeer {
+final class WCheckboxMenuItemPeer extends WMenuItemPeer
+        implements CheckboxMenuItemPeer {
 
     // CheckboxMenuItemPeer implementation
 
+    @Override
     public native void setState(boolean t);
 
     // Toolkit & peer internals
@@ -46,6 +48,7 @@
     public void handleAction(final boolean state) {
         final CheckboxMenuItem target = (CheckboxMenuItem)this.target;
         WToolkit.executeOnEventHandlerThread(target, new Runnable() {
+            @Override
             public void run() {
                 target.setState(state);
                 postEvent(new ItemEvent(target, ItemEvent.ITEM_STATE_CHANGED,
--- a/jdk/src/windows/classes/sun/awt/windows/WCheckboxPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WCheckboxPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -32,12 +32,16 @@
 
     // CheckboxPeer implementation
 
+    @Override
     public native void setState(boolean state);
+    @Override
     public native void setCheckboxGroup(CheckboxGroup g);
+    @Override
     public native void setLabel(String label);
 
     private static native int getCheckMarkSize();
 
+    @Override
     public Dimension getMinimumSize() {
         String lbl = ((Checkbox)target).getLabel();
         int marksize = getCheckMarkSize();
@@ -54,6 +58,7 @@
                              Math.max(fm.getHeight() + 8,  marksize));
     }
 
+    @Override
     public boolean isFocusable() {
         return true;
     }
@@ -64,8 +69,10 @@
         super(target);
     }
 
+    @Override
     native void create(WComponentPeer parent);
 
+    @Override
     void initialize() {
         Checkbox t = (Checkbox)target;
         setState(t.getState());
@@ -79,6 +86,7 @@
         super.initialize();
     }
 
+    @Override
     public boolean shouldClearRectBeforePaint() {
         return false;
     }
@@ -88,6 +96,7 @@
     void handleAction(final boolean state) {
         final Checkbox cb = (Checkbox)this.target;
         WToolkit.executeOnEventHandlerThread(cb, new Runnable() {
+            @Override
             public void run() {
                 CheckboxGroup chg = cb.getCheckboxGroup();
                 if ((chg != null) && (cb == chg.getSelectedCheckbox()) && cb.getState()) {
--- a/jdk/src/windows/classes/sun/awt/windows/WChoicePeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WChoicePeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -36,6 +36,7 @@
 
     // WComponentPeer overrides
 
+    @Override
     public Dimension getMinimumSize() {
         FontMetrics fm = getFontMetrics(((Choice)target).getFont());
         Choice c = (Choice)target;
@@ -45,23 +46,29 @@
         }
         return new Dimension(28 + w, Math.max(fm.getHeight() + 6, 15));
     }
+    @Override
     public boolean isFocusable() {
         return true;
     }
 
     // ChoicePeer implementation
 
+    @Override
     public native void select(int index);
 
+    @Override
     public void add(String item, int index) {
         addItem(item, index);
     }
 
+    @Override
     public boolean shouldClearRectBeforePaint() {
         return false;
     }
 
+    @Override
     public native void removeAll();
+    @Override
     public native void remove(int index);
 
     /**
@@ -72,6 +79,7 @@
     }
     public native void addItems(String[] items, int index);
 
+    @Override
     public synchronized native void reshape(int x, int y, int width, int height);
 
     private WindowListener windowListener;
@@ -82,8 +90,10 @@
         super(target);
     }
 
+    @Override
     native void create(WComponentPeer parent);
 
+    @Override
     @SuppressWarnings("deprecation")
     void initialize() {
         Choice opt = (Choice)target;
@@ -104,9 +114,11 @@
             WWindowPeer wpeer = (WWindowPeer)parentWindow.getPeer();
             if (wpeer != null) {
                 windowListener = new WindowAdapter() {
+                        @Override
                         public void windowIconified(WindowEvent e) {
                             closeList();
                         }
+                        @Override
                         public void windowClosing(WindowEvent e) {
                             closeList();
                         }
@@ -117,6 +129,7 @@
         super.initialize();
     }
 
+    @Override
     @SuppressWarnings("deprecation")
     protected void disposeImpl() {
         // TODO: we should somehow reset the listener when the choice
@@ -136,6 +149,7 @@
     void handleAction(final int index) {
         final Choice c = (Choice)target;
         WToolkit.executeOnEventHandlerThread(c, new Runnable() {
+            @Override
             public void run() {
                 c.select(index);
                 postEvent(new ItemEvent(c, ItemEvent.ITEM_STATE_CHANGED,
--- a/jdk/src/windows/classes/sun/awt/windows/WClipboard.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WClipboard.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, 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
@@ -28,14 +28,11 @@
 import java.awt.datatransfer.DataFlavor;
 import java.awt.datatransfer.Transferable;
 import java.awt.datatransfer.UnsupportedFlavorException;
-
 import java.io.IOException;
-
-import java.util.Iterator;
 import java.util.Map;
 
+import sun.awt.datatransfer.DataTransferer;
 import sun.awt.datatransfer.SunClipboard;
-import sun.awt.datatransfer.DataTransferer;
 
 
 /**
@@ -50,18 +47,20 @@
  *
  * @since JDK1.1
  */
-public class WClipboard extends SunClipboard {
+final class WClipboard extends SunClipboard {
 
     private boolean isClipboardViewerRegistered;
 
-    public WClipboard() {
+    WClipboard() {
         super("System");
     }
 
+    @Override
     public long getID() {
         return 0;
     }
 
+    @Override
     protected void setContentsNative(Transferable contents) {
 
         // Don't use delayed Clipboard rendering for the Transferable's data.
@@ -107,6 +106,7 @@
      * Currently delayed data rendering is not used for the Windows clipboard,
      * so there is no native context to clear.
      */
+    @Override
     protected void clearNativeContext() {}
 
     /**
@@ -115,11 +115,13 @@
      *
      * @throws IllegalStateException if the clipboard has not been opened
      */
+    @Override
     public native void openClipboard(SunClipboard newOwner) throws IllegalStateException;
     /**
      * Call the Win32 CloseClipboard function if we have clipboard ownership,
      * does nothing if we have not ownership.
      */
+    @Override
     public native void closeClipboard();
     /**
      * Call the Win32 SetClipboardData function.
@@ -131,9 +133,12 @@
         init();
     }
 
+    @Override
     protected native long[] getClipboardFormats();
+    @Override
     protected native byte[] getClipboardData(long format) throws IOException;
 
+    @Override
     protected void registerClipboardViewerChecked() {
         if (!isClipboardViewerRegistered) {
             registerClipboardViewer();
@@ -148,6 +153,7 @@
      * until the toolkit window disposing since MSDN suggests removing
      * the window from the clipboard viewer chain just before it is destroyed.
      */
+    @Override
     protected void unregisterClipboardViewerChecked() {}
 
     /**
@@ -175,6 +181,7 @@
      *
      * @since 1.5
      */
+    @Override
     protected Transferable createLocaleTransferable(long[] formats) throws IOException {
         boolean found = false;
         for (int i = 0; i < formats.length; i++) {
@@ -197,12 +204,15 @@
         final byte[] localeDataFinal = localeData;
 
         return new Transferable() {
+                @Override
                 public DataFlavor[] getTransferDataFlavors() {
                     return new DataFlavor[] { DataTransferer.javaTextEncodingFlavor };
                 }
+                @Override
                 public boolean isDataFlavorSupported(DataFlavor flavor) {
                     return flavor.equals(DataTransferer.javaTextEncodingFlavor);
                 }
+                @Override
                 public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException {
                     if (isDataFlavorSupported(flavor)) {
                         return localeDataFinal;
@@ -211,5 +221,4 @@
                 }
             };
     }
-
 }
--- a/jdk/src/windows/classes/sun/awt/windows/WColor.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WColor.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 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
@@ -29,7 +29,7 @@
 /*
  * This helper class maps Windows system colors to AWT Color objects.
  */
-class WColor {
+final class WColor {
 
     static final int WINDOW_BKGND = 1;  // COLOR_WINDOW
     static final int WINDOW_TEXT  = 2;  // COLOR_WINDOWTEXT
--- a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -93,7 +93,9 @@
     private Color background;
     private Font font;
 
+    @Override
     public native boolean isObscured();
+    @Override
     public boolean canDetermineObscurity() { return true; }
 
     // DropTarget support
@@ -101,19 +103,21 @@
     int nDropTargets;
     long nativeDropTargetContext; // native pointer
 
-    public synchronized native void pShow();
-    public synchronized native void hide();
-    public synchronized native void enable();
-    public synchronized native void disable();
+    private synchronized native void pShow();
+    synchronized native void hide();
+    synchronized native void enable();
+    synchronized native void disable();
 
     public long getHWnd() {
         return hwnd;
     }
 
     /* New 1.1 API */
+    @Override
     public native Point getLocationOnScreen();
 
     /* New 1.1 API */
+    @Override
     public void setVisible(boolean b) {
         if (b) {
             show();
@@ -130,6 +134,7 @@
     }
 
     /* New 1.1 API */
+    @Override
     public void setEnabled(boolean b) {
         if (b) {
             enable();
@@ -143,6 +148,7 @@
     private native void reshapeNoCheck(int x, int y, int width, int height);
 
     /* New 1.1 API */
+    @Override
     public void setBounds(int x, int y, int width, int height, int op) {
         // Should set paintPending before reahape to prevent
         // thread race between paint events
@@ -185,6 +191,7 @@
         final Container cont = (Container)target;
 
         WToolkit.executeOnEventHandlerThread(cont, new Runnable() {
+            @Override
             public void run() {
                 // Discarding old paint events doesn't seem to be necessary.
                 cont.invalidate();
@@ -228,6 +235,7 @@
 
     native synchronized void updateWindow();
 
+    @Override
     public void paint(Graphics g) {
         ((Component)target).paint(g);
     }
@@ -239,6 +247,7 @@
     private native int[] createPrintedPixels(int srcX, int srcY,
                                              int srcW, int srcH,
                                              int alpha);
+    @Override
     public void print(Graphics g) {
 
         Component comp = (Component)target;
@@ -275,6 +284,7 @@
         comp.print(g);
     }
 
+    @Override
     public void coalescePaintEvent(PaintEvent e) {
         Rectangle r = e.getUpdateRect();
         if (!(e instanceof IgnorePaintEvent)) {
@@ -319,6 +329,7 @@
 
     native void nativeHandleEvent(AWTEvent e);
 
+    @Override
     @SuppressWarnings("fallthrough")
     public void handleEvent(AWTEvent e) {
         int id = e.getID();
@@ -367,21 +378,25 @@
 
     native void setFocus(boolean doSetFocus);
 
+    @Override
     public Dimension getMinimumSize() {
         return ((Component)target).getSize();
     }
 
+    @Override
     public Dimension getPreferredSize() {
         return getMinimumSize();
     }
 
     // Do nothing for heavyweight implementation
+    @Override
     public void layout() {}
 
     public Rectangle getBounds() {
         return ((Component)target).getBounds();
     }
 
+    @Override
     public boolean isFocusable() {
         return false;
     }
@@ -390,6 +405,7 @@
      * Return the GraphicsConfiguration associated with this peer, either
      * the locally stored winGraphicsConfig, or that of the target Component.
      */
+    @Override
     public GraphicsConfiguration getGraphicsConfiguration() {
         if (winGraphicsConfig != null) {
             return winGraphicsConfig;
@@ -481,6 +497,7 @@
 
     public void replaceSurfaceDataLater() {
         Runnable r = new Runnable() {
+            @Override
             public void run() {
                 // Shouldn't do anything if object is disposed in meanwhile
                 // No need for sync as disposeAction in Window is performed
@@ -501,6 +518,7 @@
         }
     }
 
+    @Override
     public boolean updateGraphicsData(GraphicsConfiguration gc) {
         winGraphicsConfig = (Win32GraphicsConfig)gc;
         try {
@@ -512,6 +530,7 @@
     }
 
     //This will return null for Components not yet added to a Container
+    @Override
     public ColorModel getColorModel() {
         GraphicsConfiguration gc = getGraphicsConfiguration();
         if (gc != null) {
@@ -549,6 +568,7 @@
     // fallback default font object
     final static Font defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12);
 
+    @Override
     @SuppressWarnings("deprecation")
     public Graphics getGraphics() {
         if (isDisposed()) {
@@ -601,11 +621,13 @@
         }
         return null;
     }
+    @Override
     public FontMetrics getFontMetrics(Font font) {
         return WFontMetrics.getFontMetrics(font);
     }
 
     private synchronized native void _dispose();
+    @Override
     protected void disposeImpl() {
         SurfaceData oldData = surfaceData;
         surfaceData = null;
@@ -618,17 +640,20 @@
 
     public void disposeLater() {
         postEvent(new InvocationEvent(target, new Runnable() {
+            @Override
             public void run() {
                 dispose();
             }
         }));
     }
 
+    @Override
     public synchronized void setForeground(Color c) {
         foreground = c;
         _setForeground(c.getRGB());
     }
 
+    @Override
     public synchronized void setBackground(Color c) {
         background = c;
         _setBackground(c.getRGB());
@@ -644,19 +669,22 @@
         return background;
     }
 
-    public native void _setForeground(int rgb);
-    public native void _setBackground(int rgb);
+    private native void _setForeground(int rgb);
+    private native void _setBackground(int rgb);
 
+    @Override
     public synchronized void setFont(Font f) {
         font = f;
         _setFont(f);
     }
-    public synchronized native void _setFont(Font f);
+    synchronized native void _setFont(Font f);
+    @Override
     public void updateCursorImmediately() {
         WGlobalCursorManager.getCursorManager().updateCursorImmediately();
     }
 
     // TODO: consider moving it to KeyboardFocusManagerPeerImpl
+    @Override
     @SuppressWarnings("deprecation")
     public boolean requestFocus(Component lightweightChild, boolean temporary,
                                 boolean focusedWindowChangeAllowed, long time,
@@ -720,24 +748,29 @@
         return false;
     }
 
+    @Override
     public Image createImage(ImageProducer producer) {
         return new ToolkitImage(producer);
     }
 
+    @Override
     public Image createImage(int width, int height) {
         Win32GraphicsConfig gc =
             (Win32GraphicsConfig)getGraphicsConfiguration();
         return gc.createAcceleratedImage((Component)target, width, height);
     }
 
+    @Override
     public VolatileImage createVolatileImage(int width, int height) {
         return new SunVolatileImage((Component)target, width, height);
     }
 
+    @Override
     public boolean prepareImage(Image img, int w, int h, ImageObserver o) {
         return Toolkit.getDefaultToolkit().prepareImage(img, w, h, o);
     }
 
+    @Override
     public int checkImage(Image img, int w, int h, ImageObserver o) {
         return Toolkit.getDefaultToolkit().checkImage(img, w, h, o);
     }
@@ -891,6 +924,7 @@
      * register a DropTarget with this native peer
      */
 
+    @Override
     public synchronized void addDropTarget(DropTarget dt) {
         if (nDropTargets == 0) {
             nativeDropTargetContext = addNativeDropTarget();
@@ -902,6 +936,7 @@
      * unregister a DropTarget with this native peer
      */
 
+    @Override
     public synchronized void removeDropTarget(DropTarget dt) {
         nDropTargets--;
         if (nDropTargets == 0) {
@@ -924,6 +959,7 @@
     native void removeNativeDropTarget();
     native boolean nativeHandlesWheelScrolling();
 
+    @Override
     public boolean handlesWheelScrolling() {
         // should this be cached?
         return nativeHandlesWheelScrolling();
@@ -1001,6 +1037,7 @@
     /**
      * @see java.awt.peer.ComponentPeer#reparent
      */
+    @Override
     public void reparent(ContainerPeer newNativeParent) {
         pSetParent(newNativeParent);
     }
@@ -1008,6 +1045,7 @@
     /**
      * @see java.awt.peer.ComponentPeer#isReparentSupported
      */
+    @Override
     public boolean isReparentSupported() {
         return true;
     }
@@ -1081,6 +1119,7 @@
      * Applies the shape to the native component window.
      * @since 1.7
      */
+    @Override
     @SuppressWarnings("deprecation")
     public void applyShape(Region shape) {
         if (shapeLog.isLoggable(PlatformLogger.Level.FINER)) {
@@ -1101,6 +1140,7 @@
      * Lowers this component at the bottom of the above component. If the above parameter
      * is null then the method places this component at the top of the Z-order.
      */
+    @Override
     public void setZOrder(ComponentPeer above) {
         long aboveHWND = (above != null) ? ((WComponentPeer)above).getHWnd() : 0;
 
--- a/jdk/src/windows/classes/sun/awt/windows/WCustomCursor.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WCustomCursor.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,13 +38,14 @@
  * @see Component#setCursor
  * @author      ThomasBall
  */
-public class WCustomCursor extends CustomCursor {
+final class WCustomCursor extends CustomCursor {
 
-    public WCustomCursor(Image cursor, Point hotSpot, String name)
+    WCustomCursor(Image cursor, Point hotSpot, String name)
             throws IndexOutOfBoundsException {
         super(cursor, hotSpot, name);
     }
 
+    @Override
     protected void createNativeCursor(Image im, int[] pixels, int w, int h,
                                       int xHotSpot, int yHotSpot) {
         BufferedImage bimage = new BufferedImage(w, h,
--- a/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,6 @@
 
 import java.io.BufferedInputStream;
 import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.IOException;
@@ -85,7 +84,7 @@
  *
  * @since 1.3.1
  */
-public class WDataTransferer extends DataTransferer {
+final class WDataTransferer extends DataTransferer {
     private static final String[] predefinedClipboardNames = {
             "",
             "TEXT",
@@ -159,17 +158,14 @@
 
     private static WDataTransferer transferer;
 
-    public static WDataTransferer getInstanceImpl() {
+    static synchronized WDataTransferer getInstanceImpl() {
         if (transferer == null) {
-            synchronized (WDataTransferer.class) {
-                if (transferer == null) {
-                    transferer = new WDataTransferer();
-                }
-            }
+            transferer = new WDataTransferer();
         }
         return transferer;
     }
 
+    @Override
     public SortedMap <Long, DataFlavor> getFormatsForFlavors(
             DataFlavor[] flavors, FlavorTable map)
     {
@@ -183,10 +179,12 @@
         return retval;
     }
 
+    @Override
     public String getDefaultUnicodeEncoding() {
         return "utf-16le";
     }
 
+    @Override
     public byte[] translateTransferable(Transferable contents,
                                         DataFlavor flavor,
                                         long format) throws IOException
@@ -224,6 +222,7 @@
     }
 
     // The stream is closed as a closable object
+    @Override
     public Object translateStream(InputStream str,
                                  DataFlavor flavor, long format,
                                  Transferable localeTransferable)
@@ -239,6 +238,7 @@
 
     }
 
+    @Override
     public Object translateBytes(byte[] bytes, DataFlavor flavor, long format,
         Transferable localeTransferable) throws IOException
     {
@@ -286,14 +286,17 @@
 
     }
 
+    @Override
     public boolean isLocaleDependentTextFormat(long format) {
         return format == CF_TEXT || format == CFSTR_INETURL;
     }
 
+    @Override
     public boolean isFileFormat(long format) {
         return format == CF_HDROP || format == CF_FILEGROUPDESCRIPTORA || format == CF_FILEGROUPDESCRIPTORW;
     }
 
+    @Override
     protected Long getFormatForNativeAsLong(String str) {
         Long format = predefinedClipboardNameMap.get(str);
         if (format == null) {
@@ -302,6 +305,7 @@
         return format;
     }
 
+    @Override
     protected String getNativeForFormat(long format) {
         return (format < predefinedClipboardNames.length)
                 ? predefinedClipboardNames[(int)format]
@@ -311,6 +315,7 @@
     private final ToolkitThreadBlockedHandler handler =
             new WToolkitThreadBlockedHandler();
 
+    @Override
     public ToolkitThreadBlockedHandler getToolkitThreadBlockedHandler() {
         return handler;
     }
@@ -327,12 +332,14 @@
      */
     private static native String getClipboardFormatName(long format);
 
+    @Override
     public boolean isImageFormat(long format) {
         return format == CF_DIB || format == CF_ENHMETAFILE ||
                 format == CF_METAFILEPICT || format == CF_PNG ||
                 format == CF_JFIF;
     }
 
+    @Override
     protected byte[] imageToPlatformBytes(Image image, long format)
             throws IOException {
         String mimeType = null;
@@ -406,6 +413,7 @@
 
     private static final byte [] UNICODE_NULL_TERMINATOR =  new byte [] {0,0};
 
+    @Override
     protected ByteArrayOutputStream convertFileListToBytes(ArrayList<String> fileList)
             throws IOException
     {
@@ -443,6 +451,7 @@
      * Translates either a byte array or an input stream which contain
      * platform-specific image data in the given format into an Image.
      */
+    @Override
     protected Image platformImageBytesToImage(byte[] bytes, long format)
             throws IOException {
         String mimeType = null;
@@ -482,12 +491,14 @@
                                                        long format)
             throws IOException;
 
+    @Override
     protected native String[] dragQueryFile(byte[] bytes);
 }
 
 final class WToolkitThreadBlockedHandler extends Mutex
         implements ToolkitThreadBlockedHandler {
 
+    @Override
     public void enter() {
         if (!isOwned()) {
             throw new IllegalMonitorStateException();
@@ -497,6 +508,7 @@
         lock();
     }
 
+    @Override
     public void exit() {
         if (!isOwned()) {
             throw new IllegalMonitorStateException();
@@ -880,6 +892,7 @@
         descriptionParsed = true;
     }
 
+    @Override
     public synchronized int read() throws IOException {
         if( closed ){
             throw new IOException("Stream closed");
@@ -900,6 +913,7 @@
         return retval;
     }
 
+    @Override
     public synchronized void close() throws IOException {
         if( !closed ){
             closed = true;
--- a/jdk/src/windows/classes/sun/awt/windows/WDefaultFontCharset.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WDefaultFontCharset.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2007, 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
@@ -27,7 +27,7 @@
 import java.nio.charset.*;
 import sun.awt.AWTCharset;
 
-public class WDefaultFontCharset extends AWTCharset
+final class WDefaultFontCharset extends AWTCharset
 {
     static {
        initIDs();
@@ -36,22 +36,24 @@
     // Name for Windows FontSet.
     private String fontName;
 
-    public WDefaultFontCharset(String name){
+    WDefaultFontCharset(String name){
         super("WDefaultFontCharset", Charset.forName("windows-1252"));
         fontName = name;
     }
 
+    @Override
     public CharsetEncoder newEncoder() {
         return new Encoder();
     }
 
     private class Encoder extends AWTCharset.Encoder {
+        @Override
         public boolean canEncode(char c){
             return canConvert(c);
         }
     }
 
-    public synchronized native boolean canConvert(char ch);
+    private synchronized native boolean canConvert(char ch);
 
     /**
      * Initialize JNI field and method IDs
--- a/jdk/src/windows/classes/sun/awt/windows/WDesktopPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WDesktopPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,33 +39,39 @@
  *
  * @see DesktopPeer
  */
-public class WDesktopPeer implements DesktopPeer {
+final class WDesktopPeer implements DesktopPeer {
     /* Contants for the operation verbs */
     private static String ACTION_OPEN_VERB = "open";
     private static String ACTION_EDIT_VERB = "edit";
     private static String ACTION_PRINT_VERB = "print";
 
+    @Override
     public boolean isSupported(Action action) {
         // OPEN, EDIT, PRINT, MAIL, BROWSE all supported on windows.
         return true;
     }
 
+    @Override
     public void open(File file) throws IOException {
         this.ShellExecute(file, ACTION_OPEN_VERB);
     }
 
+    @Override
     public void edit(File file) throws IOException {
         this.ShellExecute(file, ACTION_EDIT_VERB);
     }
 
+    @Override
     public void print(File file) throws IOException {
         this.ShellExecute(file, ACTION_PRINT_VERB);
     }
 
+    @Override
     public void mail(URI uri) throws IOException {
         this.ShellExecute(uri, ACTION_OPEN_VERB);
     }
 
+    @Override
     public void browse(URI uri) throws IOException {
         this.ShellExecute(uri, ACTION_OPEN_VERB);
     }
--- a/jdk/src/windows/classes/sun/awt/windows/WDesktopProperties.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WDesktopProperties.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,7 +52,7 @@
  * like the Windows Pluggable Look-and-Feel can better adapt
  * itself when running on a Windows platform.
  */
-class WDesktopProperties {
+final class WDesktopProperties {
     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WDesktopProperties");
     private static final String PREFIX = "win.";
     private static final String FILE_PREFIX = "awt.file.";
@@ -210,6 +210,7 @@
             this.winEventName = winEventName;
         }
 
+        @Override
         public void run() {
             WDesktopProperties.this.playWindowsSound(winEventName);
         }
--- a/jdk/src/windows/classes/sun/awt/windows/WDialogPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WDialogPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, 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
@@ -24,14 +24,13 @@
  */
 package sun.awt.windows;
 
-import java.util.*;
 import java.awt.*;
 import java.awt.peer.*;
 
 import sun.awt.*;
 import sun.awt.im.*;
 
-class WDialogPeer extends WWindowPeer implements DialogPeer {
+final class WDialogPeer extends WWindowPeer implements DialogPeer {
     // Toolkit & peer internals
 
     // Platform default background for dialogs.  Gets set on target if
@@ -54,6 +53,7 @@
     }
 
     native void createAwtDialog(WComponentPeer parent);
+    @Override
     void create(WComponentPeer parent) {
         preCreate(parent);
         createAwtDialog(parent);
@@ -62,6 +62,7 @@
     native void showModal();
     native void endModal();
 
+    @Override
     void initialize() {
         Dialog target = (Dialog)this.target;
         // Need to set target's background to default _before_ a call
@@ -78,6 +79,7 @@
         setResizable(target.isResizable());
     }
 
+    @Override
     protected void realShow() {
         Dialog dlg = (Dialog)target;
         if (dlg.getModalityType() != Dialog.ModalityType.MODELESS) {
@@ -87,8 +89,9 @@
         }
     }
 
+    @Override
     @SuppressWarnings("deprecation")
-    public void hide() {
+    void hide() {
         Dialog dlg = (Dialog)target;
         if (dlg.getModalityType() != Dialog.ModalityType.MODELESS) {
             endModal();
@@ -97,6 +100,7 @@
         }
     }
 
+    @Override
     public void blockWindows(java.util.List<Window> toBlock) {
         for (Window w : toBlock) {
             WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
@@ -106,6 +110,7 @@
         }
     }
 
+    @Override
     public Dimension getMinimumSize() {
         if (((Dialog)target).isUndecorated()) {
             return super.getMinimumSize();
@@ -119,6 +124,7 @@
         return ((Dialog)target).isUndecorated();
     }
 
+    @Override
     public void reshape(int x, int y, int width, int height) {
         if (((Dialog)target).isUndecorated()) {
             super.reshape(x, y, width, height);
--- a/jdk/src/windows/classes/sun/awt/windows/WDropTargetContextPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WDropTargetContextPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -79,6 +79,7 @@
         return new WDropTargetContextPeerIStream(istream);
     }
 
+    @Override
     protected Object getNativeData(long format) {
         return getData(getNativeDragContext(), format);
     }
@@ -87,14 +88,17 @@
      * signal drop complete
      */
 
+    @Override
     protected void doDropDone(boolean success, int dropAction,
                               boolean isLocal) {
         dropDone(getNativeDragContext(), success, dropAction);
     }
 
+    @Override
     protected void eventPosted(final SunDropTargetEvent e) {
         if (e.getID() != SunDropTargetEvent.MOUSE_DROPPED) {
             Runnable runnable = new Runnable() {
+                    @Override
                     public void run() {
                         e.getDispatcher().unregisterAllEvents();
                     }
@@ -124,7 +128,7 @@
  * package private class to handle file transfers
  */
 
-class WDropTargetContextPeerFileStream extends FileInputStream {
+final class WDropTargetContextPeerFileStream extends FileInputStream {
 
     /**
      * construct file input stream
@@ -142,6 +146,7 @@
      * close
      */
 
+    @Override
     public void close() throws IOException {
         if (stgmedium != 0) {
             super.close();
@@ -167,7 +172,7 @@
  * Package private class to access IStream objects
  */
 
-class WDropTargetContextPeerIStream extends InputStream {
+final class WDropTargetContextPeerIStream extends InputStream {
 
     /**
      * construct a WDropTargetContextPeerIStream wrapper
@@ -185,6 +190,7 @@
      * @return bytes available
      */
 
+    @Override
     public int available() throws IOException {
         if (istream == 0) throw new IOException("No IStream");
         return Available(istream);
@@ -196,6 +202,7 @@
      * read
      */
 
+    @Override
     public int read() throws IOException {
         if (istream == 0) throw new IOException("No IStream");
         return Read(istream);
@@ -207,6 +214,7 @@
      * read into buffer
      */
 
+    @Override
     public int read(byte[] b, int off, int len) throws IOException {
         if (istream == 0) throw new IOException("No IStream");
         return ReadBytes(istream, b, off, len);
@@ -218,6 +226,7 @@
      * close
      */
 
+    @Override
     public void close() throws IOException {
         if (istream != 0) {
             super.close();
--- a/jdk/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -203,11 +203,11 @@
     }
 
 
-    protected native boolean isPrinterDC(long hdc);
+    private native boolean isPrinterDC(long hdc);
 
-    protected native void printBand(long hdc, byte[] data, int offset,
-                                    int sx, int sy, int swidth, int sheight,
-                                    int dx, int dy, int dwidth, int dheight);
+    private native void printBand(long hdc, byte[] data, int offset, int sx,
+                                  int sy, int swidth, int sheight, int dx,
+                                  int dy, int dwidth, int dheight);
 
     /**
      * Initialize JNI field IDs
--- a/jdk/src/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -38,12 +38,15 @@
         super(target);
     }
 
+    @Override
     native void create(WComponentPeer parent);
 
     // suppress printing of an embedded frame.
+    @Override
     public void print(Graphics g) {}
 
     // supress calling native setMinSize()
+    @Override
     public void updateMinimumSize() {}
 
     @Override
@@ -59,10 +62,12 @@
         ((EmbeddedFrame)target).notifyModalBlocked(blocker, false);
     }
 
+    @Override
     public void setBoundsPrivate(int x, int y, int width, int height) {
         setBounds(x, y, width, height, SET_BOUNDS | NO_EMBEDDED_CHECK);
     }
 
+    @Override
     public native Rectangle getBoundsPrivate();
 
     @Override
--- a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -34,11 +34,10 @@
 import java.util.ResourceBundle;
 import java.util.MissingResourceException;
 import java.util.Vector;
-import sun.awt.AppContext;
 import sun.awt.CausedFocusEvent;
 import sun.awt.AWTAccessor;
 
-public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
+final class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
 
     static {
         initIDs();
@@ -47,11 +46,12 @@
     private WComponentPeer parent;
     private FilenameFilter fileFilter;
 
-    private Vector<WWindowPeer> blockedWindows = new Vector<WWindowPeer>();
+    private Vector<WWindowPeer> blockedWindows = new Vector<>();
 
     //Needed to fix 4152317
     private static native void setFilterString(String allFilter);
 
+    @Override
     public void setFilenameFilter(FilenameFilter filter) {
         this.fileFilter = filter;
     }
@@ -70,19 +70,23 @@
         super(target);
     }
 
+    @Override
     void create(WComponentPeer parent) {
         this.parent = parent;
     }
 
     // don't use checkCreation() from WComponentPeer to avoid hwnd check
+    @Override
     protected void checkCreation() {
     }
 
+    @Override
     void initialize() {
         setFilenameFilter(((FileDialog) target).getFilenameFilter());
     }
 
     private native void _dispose();
+    @Override
     protected void disposeImpl() {
         WToolkit.targetDisposedPeer(target, this);
         _dispose();
@@ -91,15 +95,18 @@
     private native void _show();
     private native void _hide();
 
+    @Override
     public void show() {
         new Thread(new Runnable() {
+            @Override
             public void run() {
                 _show();
             }
         }).start();
     }
 
-    public void hide() {
+    @Override
+    void hide() {
         _hide();
     }
 
@@ -169,6 +176,7 @@
         fileDialogAccessor.setFiles(fileDialog, jFiles);
 
         WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() {
+             @Override
              public void run() {
                  fileDialog.setVisible(false);
              }
@@ -185,6 +193,7 @@
         AWTAccessor.getFileDialogAccessor().setDirectory(fileDialog, null);
 
         WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() {
+             @Override
              public void run() {
                  fileDialog.setVisible(false);
              }
@@ -195,6 +204,7 @@
     static {
         String filterString = AccessController.doPrivileged(
             new PrivilegedAction<String>() {
+                @Override
                 public String run() {
                     try {
                         ResourceBundle rb = ResourceBundle.getBundle("sun.awt.windows.awtLocalization");
@@ -224,6 +234,7 @@
         }
     }
 
+    @Override
     public void blockWindows(java.util.List<Window> toBlock) {
         for (Window w : toBlock) {
             WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
@@ -233,31 +244,47 @@
         }
     }
 
+    @Override
     public native void toFront();
+    @Override
     public native void toBack();
 
     // unused methods.  Overridden to disable this functionality as
     // it requires HWND which is not available for FileDialog
+    @Override
     public void updateAlwaysOnTopState() {}
+    @Override
     public void setDirectory(String dir) {}
+    @Override
     public void setFile(String file) {}
+    @Override
     public void setTitle(String title) {}
 
+    @Override
     public void setResizable(boolean resizable) {}
-    public void enable() {}
-    public void disable() {}
+    @Override
+    void enable() {}
+    @Override
+    void disable() {}
+    @Override
     public void reshape(int x, int y, int width, int height) {}
     public boolean handleEvent(Event e) { return false; }
+    @Override
     public void setForeground(Color c) {}
+    @Override
     public void setBackground(Color c) {}
+    @Override
     public void setFont(Font f) {}
+    @Override
     public void updateMinimumSize() {}
+    @Override
     public void updateIconImages() {}
     public boolean requestFocus(boolean temporary,
                                 boolean focusedWindowChangeAllowed) {
         return false;
     }
 
+    @Override
     public boolean requestFocus
          (Component lightweightChild, boolean temporary,
           boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause)
@@ -265,13 +292,20 @@
         return false;
     }
 
+    @Override
     void start() {}
+    @Override
     public void beginValidate() {}
+    @Override
     public void endValidate() {}
     void invalidate(int x, int y, int width, int height) {}
+    @Override
     public void addDropTarget(DropTarget dt) {}
+    @Override
     public void removeDropTarget(DropTarget dt) {}
+    @Override
     public void updateFocusableWindowState() {}
+    @Override
     public void setZOrder(ComponentPeer above) {}
 
     /**
@@ -280,8 +314,11 @@
     private static native void initIDs();
 
     // The effects are not supported for system dialogs.
+    @Override
     public void applyShape(sun.java2d.pipe.Region shape) {}
+    @Override
     public void setOpacity(float opacity) {}
+    @Override
     public void setOpaque(boolean isOpaque) {}
     public void updateWindow(java.awt.image.BufferedImage backBuffer) {}
 
--- a/jdk/src/windows/classes/sun/awt/windows/WFontConfiguration.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WFontConfiguration.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2005, 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
@@ -29,12 +29,10 @@
 import java.util.Hashtable;
 import sun.awt.FontDescriptor;
 import sun.awt.FontConfiguration;
-import sun.font.FontManager;
 import sun.font.SunFontManager;
-import sun.java2d.SunGraphicsEnvironment;
 import java.nio.charset.*;
 
-public class WFontConfiguration extends FontConfiguration {
+public final class WFontConfiguration extends FontConfiguration {
 
     // whether compatibility fallbacks for TimesRoman and Co. are used
     private boolean useCompatibilityFallbacks;
@@ -52,6 +50,7 @@
         useCompatibilityFallbacks = "windows-1252".equals(encoding);
     }
 
+    @Override
     protected void initReorderMap() {
         if (encoding.equalsIgnoreCase("windows-31j")) {
             localeMap = new Hashtable();
@@ -81,6 +80,7 @@
 //      reorderMap.put("windows-1252", "alphabetic");
     }
 
+    @Override
     protected void setOsNameAndVersion(){
         super.setOsNameAndVersion();
         if (osName.startsWith("Windows")){
@@ -103,6 +103,7 @@
     }
 
     // overrides FontConfiguration.getFallbackFamilyName
+    @Override
     public String getFallbackFamilyName(String fontName, String defaultFallback) {
         // maintain compatibility with old font.properties files, where
         // default file had aliases for timesroman & Co, while others didn't.
@@ -115,6 +116,7 @@
         return defaultFallback;
     }
 
+    @Override
     protected String makeAWTFontName(String platformFontName, String characterSubsetName) {
         String windowsCharset = (String) subsetCharsetMap.get(characterSubsetName);
         if (windowsCharset == null) {
@@ -123,6 +125,7 @@
         return platformFontName + "," + windowsCharset;
     }
 
+    @Override
     protected String getEncoding(String awtFontName, String characterSubsetName) {
         String encoding = (String) subsetEncodingMap.get(characterSubsetName);
         if (encoding == null) {
@@ -131,15 +134,18 @@
         return encoding;
     }
 
+    @Override
     protected Charset getDefaultFontCharset(String fontName) {
         return new WDefaultFontCharset(fontName);
     }
 
+    @Override
     public String getFaceNameFromComponentFontName(String componentFontName) {
         // for Windows, the platform name is the face name
         return componentFontName;
     }
 
+    @Override
     protected String getFileNameFromComponentFontName(String componentFontName) {
         return getFileNameFromPlatformName(componentFontName);
     }
--- a/jdk/src/windows/classes/sun/awt/windows/WFontMetrics.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WFontMetrics.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 1997, 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
@@ -33,7 +33,7 @@
  *
  * @author Jim Graham
  */
-class WFontMetrics extends FontMetrics {
+final class WFontMetrics extends FontMetrics {
 
     static {
         initIDs();
@@ -117,6 +117,7 @@
     /**
      * Get leading
      */
+    @Override
     public int getLeading() {
         return leading;
     }
@@ -124,6 +125,7 @@
     /**
      * Get ascent.
      */
+    @Override
     public int getAscent() {
         return ascent;
     }
@@ -131,6 +133,7 @@
     /**
      * Get descent
      */
+    @Override
     public int getDescent() {
         return descent;
     }
@@ -138,6 +141,7 @@
     /**
      * Get height
      */
+    @Override
     public int getHeight() {
         return height;
     }
@@ -145,6 +149,7 @@
     /**
      * Get maxAscent
      */
+    @Override
     public int getMaxAscent() {
         return maxAscent;
     }
@@ -152,6 +157,7 @@
     /**
      * Get maxDescent
      */
+    @Override
     public int getMaxDescent() {
         return maxDescent;
     }
@@ -159,6 +165,7 @@
     /**
      * Get maxAdvance
      */
+    @Override
     public int getMaxAdvance() {
         return maxAdvance;
     }
@@ -166,21 +173,25 @@
     /**
      * Return the width of the specified string in this Font.
      */
+    @Override
     public native int stringWidth(String str);
 
     /**
      * Return the width of the specified char[] in this Font.
      */
+    @Override
     public native int charsWidth(char data[], int off, int len);
 
     /**
      * Return the width of the specified byte[] in this Font.
      */
+    @Override
     public native int bytesWidth(byte data[], int off, int len);
 
     /**
      * Get the widths of the first 256 characters in the font.
      */
+    @Override
     public int[] getWidths() {
         return widths;
     }
--- a/jdk/src/windows/classes/sun/awt/windows/WFontPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WFontPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2007, 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
@@ -27,7 +27,7 @@
 
 import sun.awt.PlatformFont;
 
-public class WFontPeer extends PlatformFont {
+final class WFontPeer extends PlatformFont {
 
     private String textComponentFontName;
 
@@ -38,6 +38,7 @@
         }
     }
 
+    @Override
     protected char getMissingGlyphCharacter() {
         return '\u2751';
     }
--- a/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -41,7 +41,9 @@
     private static native void initIDs();
 
     // FramePeer implementation
+    @Override
     public native void setState(int state);
+    @Override
     public native int getState();
 
     // sync target and peer
@@ -62,6 +64,7 @@
             new GetPropertyAction(
             "sun.awt.keepWorkingSetOnMinimize")));
 
+    @Override
     public void setMaximizedBounds(Rectangle b) {
         if (b == null) {
             clearMaximizedBounds();
@@ -123,6 +126,7 @@
         return ((Frame)target).isUndecorated();
     }
 
+    @Override
     public void reshape(int x, int y, int width, int height) {
         if (((Frame)target).isUndecorated()) {
             super.reshape(x, y, width, height);
@@ -131,6 +135,7 @@
         }
     }
 
+    @Override
     public Dimension getMinimumSize() {
         Dimension d = new Dimension();
         if (!((Frame)target).isUndecorated()) {
@@ -145,6 +150,7 @@
     // Note: Because this method calls resize(), which may be overridden
     // by client code, this method must not be executed on the toolkit
     // thread.
+    @Override
     public void setMenuBar(MenuBar mb) {
         WMenuBarPeer mbPeer = (WMenuBarPeer) WToolkit.targetToPeer(mb);
         setMenuBar0(mbPeer);
@@ -170,11 +176,13 @@
     }
 
     native void createAwtFrame(WComponentPeer parent);
+    @Override
     void create(WComponentPeer parent) {
         preCreate(parent);
         createAwtFrame(parent);
     }
 
+    @Override
     void initialize() {
         super.initialize();
 
@@ -194,14 +202,17 @@
       InputMethodManager.getInstance().notifyChangeRequest((Component)target);
     }
 
+    @Override
     public void setBoundsPrivate(int x, int y, int width, int height) {
         setBounds(x, y, width, height, SET_BOUNDS);
     }
+    @Override
     public Rectangle getBoundsPrivate() {
         return getBounds();
     }
 
     // TODO: implement it in peers. WLightweightFramePeer may implement lw version.
+    @Override
     public void emulateActivation(boolean activate) {
         synthesizeWmActivate(activate);
     }
--- a/jdk/src/windows/classes/sun/awt/windows/WGlobalCursorManager.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WGlobalCursorManager.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
 import java.awt.*;
 import sun.awt.GlobalCursorManager;
 
-public final class WGlobalCursorManager extends GlobalCursorManager {
+final class WGlobalCursorManager extends GlobalCursorManager {
     private static WGlobalCursorManager manager;
 
     public static GlobalCursorManager getCursorManager() {
@@ -46,12 +46,16 @@
         WGlobalCursorManager.getCursorManager().updateCursorLater(heavy);
     }
 
+    @Override
     protected native void setCursor(Component comp, Cursor cursor, boolean u);
+    @Override
     protected native void getCursorPos(Point p);
     /*
      * two native methods to call corresponding methods in Container and
      * Component
      */
+    @Override
     protected native Component findHeavyweightUnderCursor(boolean useCache);
+    @Override
     protected native Point getLocationOnScreen(Component com);
 }
--- a/jdk/src/windows/classes/sun/awt/windows/WInputMethod.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WInputMethod.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -42,7 +42,7 @@
 import java.util.Map;
 import sun.awt.im.InputMethodAdapter;
 
-public class WInputMethod extends InputMethodAdapter
+final class WInputMethod extends InputMethodAdapter
 {
     /**
      * The input method context, which is used to dispatch input method
@@ -127,6 +127,7 @@
         }
     }
 
+    @Override
     protected void finalize() throws Throwable
     {
         // Release the resources used by the native input context.
@@ -137,10 +138,12 @@
         super.finalize();
     }
 
+    @Override
     public synchronized void setInputMethodContext(InputMethodContext context) {
         inputContext = context;
     }
 
+    @Override
     public final void dispose() {
         // Due to a memory management problem in Windows 98, we should retain
         // the native input context until this object is finalized. So do
@@ -152,10 +155,12 @@
      *
      * @see java.awt.im.spi.InputMethod#getControlObject
      */
+    @Override
     public Object getControlObject() {
         return null;
     }
 
+    @Override
     public boolean setLocale(Locale lang) {
         return setLocale(lang, false);
     }
@@ -178,6 +183,7 @@
         return false;
     }
 
+    @Override
     public Locale getLocale() {
         if (isActive) {
             currentLocale = getNativeLocale();
@@ -193,6 +199,7 @@
      *
      * @see java.awt.im.spi.InputMethod#setCharacterSubsets
      */
+    @Override
     public void setCharacterSubsets(Subset[] subsets) {
         if (subsets == null){
             setConversionStatus(context, cmode);
@@ -266,6 +273,7 @@
         }
     }
 
+    @Override
     public void dispatchEvent(AWTEvent e) {
         if (e instanceof ComponentEvent) {
             Component comp = ((ComponentEvent) e).getComponent();
@@ -281,6 +289,7 @@
         }
     }
 
+    @Override
     public void activate() {
         boolean isAc = haveActiveClient();
 
@@ -317,6 +326,7 @@
 
     }
 
+    @Override
     public void deactivate(boolean isTemporary)
     {
         // Sync currentLocale with the Windows keyboard layout which might be changed
@@ -336,6 +346,7 @@
      * Explicitly disable the native IME. Native IME is not disabled when
      * deactivate is called.
      */
+    @Override
     public void disableInputMethod() {
         if (lastFocussedComponentPeer != null) {
             disableNativeIME(lastFocussedComponentPeer);
@@ -348,6 +359,7 @@
      * Returns a string with information about the windows input method,
      * or null.
      */
+    @Override
     public String getNativeInputMethodInfo() {
         return getNativeIMMDescription();
     }
@@ -358,6 +370,7 @@
      * Calling stopListening to give other input method the keybaord input
      * focus.
      */
+    @Override
     protected void stopListening() {
         // Since the native input method is not disabled when deactivate is
         // called, we need to call disableInputMethod to explicitly turn off the
@@ -366,6 +379,7 @@
     }
 
     // implements sun.awt.im.InputMethodAdapter.setAWTFocussedComponent
+    @Override
     protected void setAWTFocussedComponent(Component component) {
         if (component == null) {
             return;
@@ -386,6 +400,7 @@
     }
 
     // implements java.awt.im.spi.InputMethod.hideWindows
+    @Override
     public void hideWindows() {
         if (awtFocussedComponentPeer != null) {
             /* Hide the native status window including the Windows language
@@ -401,6 +416,7 @@
     /**
      * @see java.awt.im.spi.InputMethod#removeNotify
      */
+    @Override
     public void removeNotify() {
         endCompositionNative(context, DISCARD_INPUT);
         awtFocussedComponent = null;
@@ -427,10 +443,12 @@
     }
 
     // see sun.awt.im.InputMethodAdapter.supportsBelowTheSpot
+    @Override
     protected boolean supportsBelowTheSpot() {
         return true;
     }
 
+    @Override
     public void endComposition()
     {
         //right now the native endCompositionNative() just cancel
@@ -442,6 +460,7 @@
     /**
      * @see java.awt.im.spi.InputMethod#setCompositionEnabled(boolean)
      */
+    @Override
     public void setCompositionEnabled(boolean enable) {
         setOpenStatus(context, enable);
     }
@@ -449,6 +468,7 @@
     /**
      * @see java.awt.im.spi.InputMethod#isCompositionEnabled
      */
+    @Override
     public boolean isCompositionEnabled() {
         return getOpenStatus(context);
     }
@@ -557,6 +577,7 @@
         // AWT Event thread.  Otherwise, a potential deadlock
         // could happen.
         Runnable r = new Runnable() {
+            @Override
             public void run() {
                 int x = 0;
                 int y = 0;
--- a/jdk/src/windows/classes/sun/awt/windows/WInputMethodDescriptor.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WInputMethodDescriptor.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2007, 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
@@ -40,11 +40,12 @@
  * @since JDK1.3
  */
 
-class WInputMethodDescriptor implements InputMethodDescriptor {
+final class WInputMethodDescriptor implements InputMethodDescriptor {
 
     /**
      * @see java.awt.im.spi.InputMethodDescriptor#getAvailableLocales
      */
+    @Override
     public Locale[] getAvailableLocales() {
         // returns a copy of internal list for public API
         Locale[] locales = getAvailableLocalesInternal();
@@ -60,6 +61,7 @@
     /**
      * @see java.awt.im.spi.InputMethodDescriptor#hasDynamicLocaleList
      */
+    @Override
     public boolean hasDynamicLocaleList() {
         return true;
     }
@@ -67,6 +69,7 @@
     /**
      * @see java.awt.im.spi.InputMethodDescriptor#getInputMethodDisplayName
      */
+    @Override
     public synchronized String getInputMethodDisplayName(Locale inputLocale, Locale displayLanguage) {
         // We ignore the input locale.
         // When displaying for the default locale, rely on the localized AWT properties;
@@ -81,6 +84,7 @@
     /**
      * @see java.awt.im.spi.InputMethodDescriptor#getInputMethodIcon
      */
+    @Override
     public Image getInputMethodIcon(Locale inputLocale) {
         return null;
     }
@@ -88,6 +92,7 @@
     /**
      * @see java.awt.im.spi.InputMethodDescriptor#createInputMethod
      */
+    @Override
     public InputMethod createInputMethod() throws Exception {
         return new WInputMethod();
     }
--- a/jdk/src/windows/classes/sun/awt/windows/WKeyboardFocusManagerPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WKeyboardFocusManagerPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
 import sun.awt.KeyboardFocusManagerPeerImpl;
 import sun.awt.CausedFocusEvent;
 
-class WKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl {
+final class WKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl {
     static native void setNativeFocusOwner(ComponentPeer peer);
     static native Component getNativeFocusOwner();
     static native Window getNativeFocusedWindow();
--- a/jdk/src/windows/classes/sun/awt/windows/WListPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WListPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -31,12 +31,14 @@
 
 final class WListPeer extends WComponentPeer implements ListPeer {
 
+    @Override
     public boolean isFocusable() {
         return true;
     }
 
     // ListPeer implementation
 
+    @Override
     public int[] getSelectedIndexes() {
         List l = (List)target;
         int len = l.countItems();
@@ -53,26 +55,31 @@
     }
 
     /* New method name for 1.1 */
+    @Override
     public void add(String item, int index) {
         addItem(item, index);
     }
 
     /* New method name for 1.1 */
+    @Override
     public void removeAll() {
         clear();
     }
 
     /* New method name for 1.1 */
+    @Override
     public void setMultipleMode (boolean b) {
         setMultipleSelections(b);
     }
 
     /* New method name for 1.1 */
+    @Override
     public Dimension getPreferredSize(int rows) {
         return preferredSize(rows);
     }
 
     /* New method name for 1.1 */
+    @Override
     public Dimension getMinimumSize(int rows) {
         return minimumSize(rows);
     }
@@ -83,13 +90,17 @@
     }
     native void addItems(String[] items, int index, int width);
 
+    @Override
     public native void delItems(int start, int end);
     public void clear() {
         List l = (List)target;
         delItems(0, l.countItems());
     }
+    @Override
     public native void select(int index);
+    @Override
     public native void deselect(int index);
+    @Override
     public native void makeVisible(int index);
     public native void setMultipleSelections(boolean v);
     public native int  getMaxWidth();
@@ -114,8 +125,10 @@
         super(target);
     }
 
+    @Override
     native void create(WComponentPeer parent);
 
+    @Override
     void initialize() {
         List li = (List)target;
 
@@ -169,6 +182,7 @@
         super.initialize();
     }
 
+    @Override
     public boolean shouldClearRectBeforePaint() {
         return false;
     }
@@ -178,7 +192,8 @@
     /*public*/ native boolean isSelected(int index);
 
     // update the fontmetrics when the font changes
-    public synchronized void _setFont(Font f)
+    @Override
+    synchronized void _setFont(Font f)
     {
         super._setFont( f );
             fm = getFontMetrics( ((List)target).getFont() );
@@ -190,6 +205,7 @@
     void handleAction(final int index, final long when, final int modifiers) {
         final List l = (List)target;
         WToolkit.executeOnEventHandlerThread(l, new Runnable() {
+            @Override
             public void run() {
                 l.select(index);
                 postEvent(new ActionEvent(target, ActionEvent.ACTION_PERFORMED,
@@ -201,6 +217,7 @@
     void handleListChanged(final int index) {
         final List l = (List)target;
         WToolkit.executeOnEventHandlerThread(l, new Runnable() {
+            @Override
             public void run() {
                 postEvent(new ItemEvent(l, ItemEvent.ITEM_STATE_CHANGED,
                                 Integer.valueOf(index),
--- a/jdk/src/windows/classes/sun/awt/windows/WMenuBarPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WMenuBarPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2004, 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
@@ -27,13 +27,16 @@
 import java.awt.*;
 import java.awt.peer.*;
 
-class WMenuBarPeer extends WMenuPeer implements MenuBarPeer {
+final class WMenuBarPeer extends WMenuPeer implements MenuBarPeer {
 
     // MenuBarPeer implementation
 
+    @Override
     public native void addMenu(Menu m);
+    @Override
     public native void delMenu(int index);
 
+    @Override
     public void addHelpMenu(Menu m) {
         addMenu(m);
     }
--- a/jdk/src/windows/classes/sun/awt/windows/WMenuPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WMenuPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2005, 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,10 +31,13 @@
 
     // MenuPeer implementation
 
+    @Override
     public native void addSeparator();
+    @Override
     public void addItem(MenuItem item) {
         WMenuItemPeer itemPeer = (WMenuItemPeer) WToolkit.targetToPeer(item);
     }
+    @Override
     public native void delItem(int index);
 
     // Toolkit & peer internals
--- a/jdk/src/windows/classes/sun/awt/windows/WMouseDragGestureRecognizer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WMouseDragGestureRecognizer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,19 +25,14 @@
 
 package sun.awt.windows;
 
-import java.awt.Toolkit;
 import java.awt.Component;
-
 import java.awt.Point;
 import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DragGestureListener;
 import java.awt.dnd.DragSource;
 import java.awt.dnd.MouseDragGestureRecognizer;
-import java.awt.dnd.DragGestureListener;
-
 import java.awt.event.InputEvent;
 import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.MouseMotionListener;
 
 import sun.awt.dnd.SunDragSourceContextPeer;
 
@@ -54,7 +49,7 @@
  * @see java.awt.dnd.DragSource
  */
 
-class WMouseDragGestureRecognizer extends MouseDragGestureRecognizer {
+final class WMouseDragGestureRecognizer extends MouseDragGestureRecognizer {
 
     private static final long serialVersionUID = -3527844310018033570L;
 
@@ -140,6 +135,7 @@
      * Invoked when the mouse has been clicked on a component.
      */
 
+    @Override
     public void mouseClicked(MouseEvent e) {
         // do nothing
     }
@@ -148,6 +144,7 @@
      * Invoked when a mouse button has been pressed on a component.
      */
 
+    @Override
     public void mousePressed(MouseEvent e) {
         events.clear();
 
@@ -165,6 +162,7 @@
      * Invoked when a mouse button has been released on a component.
      */
 
+    @Override
     public void mouseReleased(MouseEvent e) {
         events.clear();
     }
@@ -173,6 +171,7 @@
      * Invoked when the mouse enters a component.
      */
 
+    @Override
     public void mouseEntered(MouseEvent e) {
         events.clear();
     }
@@ -181,6 +180,7 @@
      * Invoked when the mouse exits a component.
      */
 
+    @Override
     public void mouseExited(MouseEvent e) {
 
         if (!events.isEmpty()) { // gesture pending
@@ -196,6 +196,7 @@
      * Invoked when a mouse button is pressed on a component.
      */
 
+    @Override
     public void mouseDragged(MouseEvent e) {
         if (!events.isEmpty()) { // gesture pending
             int dop = mapDragOperationFromModifiers(e);
@@ -225,6 +226,7 @@
      * (with no buttons no down).
      */
 
+    @Override
     public void mouseMoved(MouseEvent e) {
         // do nothing
     }
--- a/jdk/src/windows/classes/sun/awt/windows/WPageDialog.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WPageDialog.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, 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
@@ -34,7 +34,7 @@
 import java.awt.print.PageFormat;
 import java.awt.print.Printable;
 
-public class WPageDialog extends WPrintDialog {
+final class WPageDialog extends WPrintDialog {
     static {
         initIDs();
     }
@@ -55,6 +55,7 @@
         this.painter = painter;
     }
 
+    @Override
     @SuppressWarnings("deprecation")
     public void addNotify() {
         synchronized(getTreeLock()) {
--- a/jdk/src/windows/classes/sun/awt/windows/WPageDialogPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WPageDialogPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, 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
@@ -25,7 +25,7 @@
 
 package sun.awt.windows;
 
-public class WPageDialogPeer extends WPrintDialogPeer {
+final class WPageDialogPeer extends WPrintDialogPeer {
 
     WPageDialogPeer(WPageDialog target) {
         super(target);
@@ -37,8 +37,10 @@
      */
     private native boolean _show();
 
+    @Override
     public void show() {
         new Thread(new Runnable() {
+                @Override
                 public void run() {
                     // Call pageSetup even with no printer installed, this
                     // will display Windows error dialog and return false.
--- a/jdk/src/windows/classes/sun/awt/windows/WPanelPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WPanelPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2008, 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
@@ -27,14 +27,13 @@
 import java.awt.*;
 import java.awt.peer.*;
 
-import java.util.Vector;
-
 import sun.awt.SunGraphicsCallback;
 
 class WPanelPeer extends WCanvasPeer implements PanelPeer {
 
     // ComponentPeer overrides
 
+    @Override
     public void paint(Graphics g) {
         super.paint(g);
         SunGraphicsCallback.PaintHeavyweightComponentsCallback.getInstance().
@@ -42,6 +41,7 @@
                           SunGraphicsCallback.LIGHTWEIGHTS |
                           SunGraphicsCallback.HEAVYWEIGHTS);
     }
+    @Override
     public void print(Graphics g) {
         super.print(g);
         SunGraphicsCallback.PrintHeavyweightComponentsCallback.getInstance().
@@ -52,6 +52,7 @@
 
     // ContainerPeer (via PanelPeer) implementation
 
+    @Override
     public Insets getInsets() {
         return insets_;
     }
@@ -73,6 +74,7 @@
         super(target);
     }
 
+    @Override
     void initialize() {
         super.initialize();
         insets_ = new Insets(0,0,0,0);
--- a/jdk/src/windows/classes/sun/awt/windows/WPathGraphics.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WPathGraphics.java	Tue Apr 01 15:37:15 2014 +0200
@@ -74,7 +74,7 @@
 import sun.print.PathGraphics;
 import sun.print.ProxyGraphics2D;
 
-class WPathGraphics extends PathGraphics {
+final class WPathGraphics extends PathGraphics {
 
     /**
      * For a drawing application the initial user space
@@ -896,6 +896,7 @@
      * @param   handlingTransparency if being recursively called to
      *                    print opaque region of transparent image
      */
+    @Override
     protected boolean drawImageToPlatform(Image image, AffineTransform xform,
                                           Color bgcolor,
                                           int srcX, int srcY,
@@ -1335,6 +1336,7 @@
      * Have the printing application redraw everything that falls
      * within the page bounds defined by <code>region</code>.
      */
+    @Override
     public void redrawRegion(Rectangle2D region, double scaleX, double scaleY,
                              Shape savedClip, AffineTransform savedTransform)
             throws PrinterException {
@@ -1434,6 +1436,7 @@
      * with the specified color.
      * The path is provided in device coordinates.
      */
+    @Override
     protected void deviceFill(PathIterator pathIter, Color color) {
 
         WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob();
@@ -1448,6 +1451,7 @@
      * path defined by <code>pathIter</code>
      * The path is provided in device coordinates.
      */
+    @Override
     protected void deviceClip(PathIterator pathIter) {
 
         WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob();
@@ -1459,6 +1463,7 @@
     /**
      * Draw the bounding rectangle using transformed coordinates.
      */
+     @Override
      protected void deviceFrameRect(int x, int y, int width, int height,
                                      Color color) {
 
@@ -1548,6 +1553,7 @@
       * GDI fillRect function.
       * Boundaries are determined by the given coordinates.
       */
+    @Override
     protected void deviceFillRect(int x, int y, int width, int height,
                                   Color color) {
         /*
@@ -1584,6 +1590,7 @@
      * Draw a line using a pen created using the specified color
      * and current stroke properties.
      */
+    @Override
     protected void deviceDrawLine(int xBegin, int yBegin, int xEnd, int yEnd,
                                   Color color) {
         Stroke stroke = getStroke();
--- a/jdk/src/windows/classes/sun/awt/windows/WPopupMenuPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WPopupMenuPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -29,12 +29,12 @@
 
 import sun.awt.AWTAccessor;
 
-public class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer {
+final class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer {
     // We can't use target.getParent() for TrayIcon popup
     // because this method should return null for the TrayIcon
     // popup regardless of that whether it has parent or not.
 
-    public WPopupMenuPeer(PopupMenu target) {
+    WPopupMenuPeer(PopupMenu target) {
         this.target = target;
         MenuContainer parent = null;
 
@@ -67,7 +67,7 @@
         }
     }
 
-    native void createMenu(WComponentPeer parent);
+    private native void createMenu(WComponentPeer parent);
 
     public void show(Event e) {
         Component origin = (Component)e.target;
@@ -106,5 +106,5 @@
         _show(e);
     }
 
-    public native void _show(Event e);
+    private native void _show(Event e);
 }
--- a/jdk/src/windows/classes/sun/awt/windows/WPrintDialog.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WPrintDialog.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,9 @@
 
 import java.awt.print.PrinterJob;
 
-public class WPrintDialog extends Dialog {
+import sun.awt.AWTAccessor;
+
+class WPrintDialog extends Dialog {
     static {
         initIDs();
     }
@@ -38,21 +40,23 @@
     protected PrintJob job;
     protected PrinterJob pjob;
 
-    public WPrintDialog(Frame parent, PrinterJob control) {
+    WPrintDialog(Frame parent, PrinterJob control) {
         super(parent, true);
         this.pjob = control;
         setLayout(null);
     }
 
-    public WPrintDialog(Dialog parent, PrinterJob control) {
+    WPrintDialog(Dialog parent, PrinterJob control) {
         super(parent, "", true);
         this.pjob = control;
         setLayout(null);
     }
 
-    // Use native code to circumvent access restrictions on Component.peer
-    protected native void setPeer(ComponentPeer peer);
+    final void setPeer(final ComponentPeer p){
+        AWTAccessor.getComponentAccessor().setPeer(this, p);
+    }
 
+    @Override
     @SuppressWarnings("deprecation")
     public void addNotify() {
         synchronized(getTreeLock()) {
@@ -72,11 +76,11 @@
 
     private boolean retval = false;
 
-    public void setRetVal(boolean ret) {
+    final void setRetVal(boolean ret) {
         retval = ret;
     }
 
-    public boolean getRetVal() {
+    final boolean getRetVal() {
         return retval;
     }
 
--- a/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,11 +30,10 @@
 import java.awt.peer.ComponentPeer;
 import java.awt.dnd.DropTarget;
 import java.util.Vector;
-import sun.awt.AppContext;
 import sun.awt.CausedFocusEvent;
 import sun.awt.AWTAccessor;
 
-public class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
+class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
 
     static {
         initIDs();
@@ -42,29 +41,34 @@
 
     private WComponentPeer parent;
 
-    private Vector<WWindowPeer> blockedWindows = new Vector<WWindowPeer>();
+    private Vector<WWindowPeer> blockedWindows = new Vector<>();
 
     WPrintDialogPeer(WPrintDialog target) {
         super(target);
     }
 
+    @Override
     void create(WComponentPeer parent) {
         this.parent = parent;
     }
 
     // fix for CR 6178323:
     // don't use checkCreation() from WComponentPeer to avoid hwnd check
+    @Override
     protected void checkCreation() {
     }
 
+    @Override
     protected void disposeImpl() {
         WToolkit.targetDisposedPeer(target, this);
     }
 
     private native boolean _show();
 
+    @Override
     public void show() {
         new Thread(new Runnable() {
+            @Override
             public void run() {
                 try {
                     ((WPrintDialog)target).setRetVal(_show());
@@ -102,6 +106,7 @@
         }
     }
 
+    @Override
     public void blockWindows(java.util.List<Window> toBlock) {
         for (Window w : toBlock) {
             WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
@@ -111,28 +116,43 @@
         }
     }
 
+    @Override
     public native void toFront();
+    @Override
     public native void toBack();
 
     // unused methods.  Overridden to disable this functionality as
     // it requires HWND which is not available for FileDialog
+    @Override
     void initialize() {}
+    @Override
     public void updateAlwaysOnTopState() {}
+    @Override
     public void setResizable(boolean resizable) {}
-    public void hide() {}
-    public void enable() {}
-    public void disable() {}
+    @Override
+    void hide() {}
+    @Override
+    void enable() {}
+    @Override
+    void disable() {}
+    @Override
     public void reshape(int x, int y, int width, int height) {}
     public boolean handleEvent(Event e) { return false; }
+    @Override
     public void setForeground(Color c) {}
+    @Override
     public void setBackground(Color c) {}
+    @Override
     public void setFont(Font f) {}
+    @Override
     public void updateMinimumSize() {}
+    @Override
     public void updateIconImages() {}
     public boolean requestFocus(boolean temporary, boolean focusedWindowChangeAllowed) {
         return false;
     }
 
+    @Override
     public boolean requestFocus
          (Component lightweightChild, boolean temporary,
           boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause)
@@ -141,13 +161,20 @@
         return false;
     }
 
+    @Override
     public void updateFocusableWindowState() {}
+    @Override
     void start() {}
+    @Override
     public void beginValidate() {}
+    @Override
     public void endValidate() {}
     void invalidate(int x, int y, int width, int height) {}
+    @Override
     public void addDropTarget(DropTarget dt) {}
+    @Override
     public void removeDropTarget(DropTarget dt) {}
+    @Override
     public void setZOrder(ComponentPeer above) {}
 
     /**
@@ -156,8 +183,11 @@
     private static native void initIDs();
 
     // The effects are not supported for system dialogs.
+    @Override
     public void applyShape(sun.java2d.pipe.Region shape) {}
+    @Override
     public void setOpacity(float opacity) {}
+    @Override
     public void setOpaque(boolean isOpaque) {}
     public void updateWindow(java.awt.image.BufferedImage backBuffer) {}
 
--- a/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,26 +57,19 @@
 import java.awt.print.PrinterException;
 import javax.print.PrintService;
 
-import java.io.IOException;
 import java.io.File;
 
-import java.util.Hashtable;
-import java.util.Properties;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
-import sun.awt.Win32GraphicsEnvironment;
-
 import sun.print.PeekGraphics;
 import sun.print.PeekMetrics;
 
-import java.net.URL;
 import java.net.URI;
 import java.net.URISyntaxException;
 
 import javax.print.PrintServiceLookup;
 import javax.print.attribute.PrintRequestAttributeSet;
-import javax.print.attribute.HashPrintServiceAttributeSet;
 import javax.print.attribute.HashPrintRequestAttributeSet;
 import javax.print.attribute.Attribute;
 import javax.print.attribute.standard.Sides;
@@ -84,7 +77,6 @@
 import javax.print.attribute.standard.PrintQuality;
 import javax.print.attribute.standard.PrinterResolution;
 import javax.print.attribute.standard.SheetCollate;
-import javax.print.attribute.IntegerSyntax;
 import javax.print.attribute.standard.Copies;
 import javax.print.attribute.standard.Destination;
 import javax.print.attribute.standard.OrientationRequested;
@@ -92,17 +84,13 @@
 import javax.print.attribute.standard.MediaSizeName;
 import javax.print.attribute.standard.MediaSize;
 import javax.print.attribute.standard.MediaTray;
-import javax.print.attribute.standard.PrinterName;
-import javax.print.attribute.standard.JobMediaSheetsSupported;
 import javax.print.attribute.standard.PageRanges;
-import javax.print.attribute.Size2DSyntax;
 
 import sun.awt.Win32FontManager;
 
 import sun.print.RasterPrinterJob;
 import sun.print.SunAlternateMedia;
 import sun.print.SunPageSelection;
-import sun.print.SunMinMaxPage;
 import sun.print.Win32MediaTray;
 import sun.print.Win32PrintService;
 import sun.print.Win32PrintServiceLookup;
@@ -121,7 +109,8 @@
  *
  * @author Richard Blanchard
  */
-public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
+public final class WPrinterJob extends RasterPrinterJob
+        implements DisposerTarget {
 
  /* Class Constants */
 
@@ -290,6 +279,7 @@
         private long mPrintHDevMode;
         private long mPrintHDevNames;
 
+        @Override
         public void dispose() {
             WPrinterJob.deleteDC(mPrintDC, mPrintHDevMode, mPrintHDevNames);
         }
@@ -402,6 +392,7 @@
      */
     private Object disposerReferent = new Object();
 
+    @Override
     public Object getDisposerReferent() {
         return disposerReferent;
     }
@@ -430,6 +421,7 @@
      * @see java.awt.GraphicsEnvironment#isHeadless
      * @since     JDK1.2
      */
+    @Override
     public PageFormat pageDialog(PageFormat page) throws HeadlessException {
         if (GraphicsEnvironment.isHeadless()) {
             throw new HeadlessException();
@@ -570,6 +562,7 @@
      * returns true.
      * @see java.awt.GraphicsEnvironment#isHeadless
      */
+    @Override
     public boolean printDialog() throws HeadlessException {
 
         if (GraphicsEnvironment.isHeadless()) {
@@ -603,6 +596,7 @@
      * @throws PrinterException if the specified service does not support
      * 2D printing.
      */
+    @Override
     public void setPrintService(PrintService service)
         throws PrinterException {
         super.setPrintService(service);
@@ -628,6 +622,7 @@
         }
     }
 
+    @Override
     public PrintService getPrintService() {
         if (myService == null) {
             String printerName = getNativePrintService();
@@ -681,6 +676,7 @@
      * In the event that the user changes the printer using the
       dialog, then it is up to GDI to report back all changed values.
      */
+    @Override
     protected void setAttributes(PrintRequestAttributeSet attributes)
         throws PrinterException {
 
@@ -705,7 +701,9 @@
                     setColorAttrib(attr);
                 }
                 else if (attr.getCategory() == PrinterResolution.class) {
-                    setResolutionAttrib(attr);
+                    if (myService.isAttributeValueSupported(attr, null, null)) {
+                        setResolutionAttrib(attr);
+                    }
                 }
                 else if (attr.getCategory() == PrintQuality.class) {
                     setQualityAttrib(attr);
@@ -750,6 +748,7 @@
      * Note: PageFormat.getPaper() returns a clone and getDefaultPage()
      * gets that clone so it won't overwrite the original paper.
      */
+    @Override
     public PageFormat defaultPage(PageFormat page) {
         PageFormat newPage = (PageFormat)page.clone();
         getDefaultPage(newPage);
@@ -759,6 +758,7 @@
     /**
      * validate the paper size against the current printer.
      */
+    @Override
     protected native void validatePaper(Paper origPaper, Paper newPaper );
 
     /**
@@ -774,6 +774,7 @@
      * causes the print job to be rasterized.
      */
 
+    @Override
     protected Graphics2D createPathGraphics(PeekGraphics peekGraphics,
                                             PrinterJob printerJob,
                                             Printable painter,
@@ -810,6 +811,7 @@
     }
 
 
+    @Override
     protected double getXRes() {
         if (mAttXRes != 0) {
             return mAttXRes;
@@ -818,6 +820,7 @@
         }
     }
 
+    @Override
     protected double getYRes() {
         if (mAttYRes != 0) {
             return mAttYRes;
@@ -826,26 +829,32 @@
         }
     }
 
+    @Override
     protected double getPhysicalPrintableX(Paper p) {
         return mPrintPhysX;
     }
 
+    @Override
     protected double getPhysicalPrintableY(Paper p) {
         return mPrintPhysY;
     }
 
+    @Override
     protected double getPhysicalPrintableWidth(Paper p) {
         return mPrintWidth;
     }
 
+    @Override
     protected double getPhysicalPrintableHeight(Paper p) {
         return mPrintHeight;
     }
 
+    @Override
     protected double getPhysicalPageWidth(Paper p) {
         return mPageWidth;
     }
 
+    @Override
     protected double getPhysicalPageHeight(Paper p) {
         return mPageHeight;
     }
@@ -857,6 +866,7 @@
      * collation requests - which can only originate from the print dialog.
      * REMIND: check if this can be deleted already.
      */
+    @Override
     protected boolean isCollated() {
         return userRequestedCollation;
     }
@@ -869,6 +879,7 @@
      * book need only be printed once and the copies
      * will be collated and made in the printer.
      */
+    @Override
     protected int getCollatedCopies() {
         debug_println("driverDoesMultipleCopies="+driverDoesMultipleCopies
                       +" driverDoesCollation="+driverDoesCollation);
@@ -891,6 +902,7 @@
      * iterate over the number of copies, this method always returns
      * 1.
      */
+    @Override
     protected int getNoncollatedCopies() {
         if (driverDoesMultipleCopies || super.isCollated()) {
             return 1;
@@ -1128,6 +1140,7 @@
     /**
      * Remove control characters.
      */
+    @Override
     protected String removeControlChars(String str) {
         return super.removeControlChars(str);
     }
@@ -1267,6 +1280,7 @@
     /**
      * Begin a new page.
      */
+    @Override
     protected void startPage(PageFormat format, Printable painter,
                              int index, boolean paperChanged) {
 
@@ -1283,6 +1297,7 @@
     /**
      * End a page.
      */
+    @Override
     protected void endPage(PageFormat format, Printable painter,
                            int index) {
 
@@ -1302,6 +1317,7 @@
     /**
      * Set the number of copies to be printed.
      */
+    @Override
     public void setCopies(int copies) {
         super.setCopies(copies);
         defaultCopies = false;
@@ -1315,7 +1331,7 @@
     /**
      * Set copies in device.
      */
-    public native void setNativeCopies(int copies);
+    private native void setNativeCopies(int copies);
 
     /**
      * Displays the print dialog and records the user's settings
@@ -1328,6 +1344,7 @@
     /* Make sure printer DC is intialised and that info about the printer
      * is reflected back up to Java code
      */
+    @Override
     protected native void initPrinter();
 
     /**
@@ -1343,6 +1360,7 @@
      */
     private native boolean _startDoc(String dest, String jobName)
                                      throws PrinterException;
+    @Override
     protected void startDoc() throws PrinterException {
         if (!_startDoc(mDestination, getJobName())) {
             cancel();
@@ -1353,12 +1371,14 @@
      * Call Window's EndDoc routine to end a
      * print job.
      */
+    @Override
     protected native void endDoc();
 
     /**
      * Call Window's AbortDoc routine to abort a
      * print job.
      */
+    @Override
     protected native void abortDoc();
 
     /**
@@ -1386,6 +1406,7 @@
      * page. The width and height of the band is
      * specified by the caller.
      */
+    @Override
     protected native void printBand(byte[] data, int x, int y,
                                     int width, int height);
 
@@ -2204,6 +2225,7 @@
         }
     }
 
+    @Override
     public void actionPerformed(ActionEvent event) {
         setVisible(false);
         dispose();
--- a/jdk/src/windows/classes/sun/awt/windows/WRobotPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WRobotPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
 import java.awt.*;
 import java.awt.peer.RobotPeer;
 
-class WRobotPeer extends WObjectPeer implements RobotPeer
+final class WRobotPeer extends WObjectPeer implements RobotPeer
 {
     WRobotPeer() {
         create();
@@ -39,27 +39,36 @@
 
     private synchronized native void _dispose();
 
+    @Override
     protected void disposeImpl() {
         _dispose();
     }
 
     public native void create();
     public native void mouseMoveImpl(int x, int y);
+    @Override
     public void mouseMove(int x, int y) {
         mouseMoveImpl(x, y);
     }
+    @Override
     public native void mousePress(int buttons);
+    @Override
     public native void mouseRelease(int buttons);
+    @Override
     public native void mouseWheel(int wheelAmt);
 
+    @Override
     public native void keyPress( int keycode );
+    @Override
     public native void keyRelease( int keycode );
 
+    @Override
     public int getRGBPixel(int x, int y) {
          // See 7002846: that's ineffective, but works correctly with non-opaque windows
         return getRGBPixels(new Rectangle(x, y, 1, 1))[0];
     }
 
+    @Override
     public int [] getRGBPixels(Rectangle bounds) {
         int pixelArray[] = new int[bounds.width*bounds.height];
         getRGBPixels(bounds.x, bounds.y, bounds.width, bounds.height, pixelArray);
--- a/jdk/src/windows/classes/sun/awt/windows/WScrollPanePeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WScrollPanePeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -33,7 +33,7 @@
 
 import sun.util.logging.PlatformLogger;
 
-class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
+final class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
 
     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WScrollPanePeer");
 
@@ -47,6 +47,7 @@
     }
 
     static native void initIDs();
+    @Override
     native void create(WComponentPeer parent);
     native int getOffset(int orient);
 
@@ -56,6 +57,7 @@
         scrollbarHeight = _getHScrollbarHeight();
     }
 
+    @Override
     void initialize() {
         super.initialize();
         setInsets();
@@ -63,22 +65,27 @@
         setScrollPosition(-i.left,-i.top);
     }
 
+    @Override
     public void setUnitIncrement(Adjustable adj, int p) {
         // The unitIncrement is grabbed from the target as needed.
     }
 
+    @Override
     public Insets insets() {
         return getInsets();
     }
     private native void setInsets();
 
+    @Override
     public native synchronized void setScrollPosition(int x, int y);
 
+    @Override
     public int getHScrollbarHeight() {
         return scrollbarHeight;
     }
     private native int _getHScrollbarHeight();
 
+    @Override
     public int getVScrollbarWidth() {
         return scrollbarWidth;
     }
@@ -96,6 +103,7 @@
      * the actual windows may not have changed yet, so the size
      * information from the java-level is passed down and used.
      */
+    @Override
     public void childResized(int width, int height) {
         ScrollPane sp = (ScrollPane)target;
         Dimension vs = sp.getSize();
@@ -112,6 +120,7 @@
      * of adjustables, whether it was modified externally or from the
      * native scrollbars themselves.
      */
+    @Override
     public void setValue(Adjustable adj, int v) {
         Component c = getScrollChild();
         if (c == null) {
@@ -160,6 +169,7 @@
             super(source, runnable, 0L);
         }
 
+        @Override
         public PeerEvent coalesceEvents(PeerEvent newEvent) {
             if (log.isLoggable(PlatformLogger.Level.FINEST)) {
                 log.finest("ScrollEvent coalesced: " + newEvent);
@@ -187,6 +197,7 @@
             this.isAdjusting = isAdjusting;
         }
 
+        @Override
         public void run() {
             if (getScrollChild() == null) {
                 return;
--- a/jdk/src/windows/classes/sun/awt/windows/WSystemTrayPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WSystemTrayPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -30,11 +30,12 @@
 import java.awt.Toolkit;
 import java.awt.peer.SystemTrayPeer;
 
-public class WSystemTrayPeer extends WObjectPeer implements SystemTrayPeer {
+final class WSystemTrayPeer extends WObjectPeer implements SystemTrayPeer {
     WSystemTrayPeer(SystemTray target) {
         this.target = target;
     }
 
+    @Override
     public Dimension getTrayIconSize() {
         return new Dimension(WTrayIconPeer.TRAY_ICON_WIDTH, WTrayIconPeer.TRAY_ICON_HEIGHT);
     }
@@ -43,6 +44,7 @@
         return ((WToolkit)Toolkit.getDefaultToolkit()).isTraySupported();
     }
 
+    @Override
     protected void disposeImpl() {
     }
 }
--- a/jdk/src/windows/classes/sun/awt/windows/WTextAreaPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WTextAreaPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -53,6 +53,7 @@
     public Dimension getPreferredSize(int rows, int cols) {
         return getMinimumSize(rows, cols);
     }
+
     @Override
     public Dimension getMinimumSize(int rows, int cols) {
         FontMetrics fm = getFontMetrics(((TextArea)target).getFont());
--- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -42,6 +42,7 @@
 import sun.awt.SunToolkit;
 import sun.awt.Win32GraphicsDevice;
 import sun.awt.Win32GraphicsEnvironment;
+import sun.awt.datatransfer.DataTransferer;
 import sun.java2d.d3d.D3DRenderQueue;
 import sun.java2d.opengl.OGLRenderQueue;
 
@@ -66,7 +67,7 @@
 import sun.misc.PerformanceLogger;
 import sun.util.logging.PlatformLogger;
 
-public class WToolkit extends SunToolkit implements Runnable {
+public final class WToolkit extends SunToolkit implements Runnable {
 
     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WToolkit");
 
@@ -97,6 +98,7 @@
         if (!loaded) {
             java.security.AccessController.doPrivileged(
                 new java.security.PrivilegedAction<Void>() {
+                    @Override
                     public Void run() {
                         System.loadLibrary("awt");
                         return null;
@@ -120,6 +122,7 @@
         AccessController.doPrivileged(
             new PrivilegedAction <Void> ()
         {
+            @Override
             public Void run() {
                 String browserProp = System.getProperty("browser");
                 if (browserProp != null && browserProp.equals("sun.plugin")) {
@@ -210,9 +213,8 @@
      */
     public native void embeddedEventLoopIdleProcessing();
 
-    public static final String DATA_TRANSFERER_CLASS_NAME = "sun.awt.windows.WDataTransferer";
-
     static class ToolkitDisposer implements sun.java2d.DisposerRecord {
+        @Override
         public void dispose() {
             WToolkit.postDispose();
         }
@@ -255,8 +257,6 @@
             // swallow the exception
         }
 
-        SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);
-
         // Enabled "live resizing" by default.  It remains controlled
         // by the native system though.
         setDynamicLayout(true);
@@ -269,6 +269,7 @@
 
     private final void registerShutdownHook() {
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            @Override
             public Void run() {
                 ThreadGroup currentTG =
                     Thread.currentThread().getThreadGroup();
@@ -278,6 +279,7 @@
                     parentTG = currentTG.getParent();
                 }
                 Thread shutdown = new Thread(currentTG, new Runnable() {
+                    @Override
                     public void run() {
                         shutdown();
                     }
@@ -289,6 +291,7 @@
         });
      }
 
+    @Override
     public void run() {
         Thread.currentThread().setPriority(Thread.NORM_PRIORITY+1);
         boolean startPump = init();
@@ -333,85 +336,98 @@
      * WARNING: startSecondaryEventLoop must only be called from the "AWT-
      * Windows" thread.
      */
-    public static native void startSecondaryEventLoop();
-    public static native void quitSecondaryEventLoop();
+    static native void startSecondaryEventLoop();
+    static native void quitSecondaryEventLoop();
 
     /*
      * Create peer objects.
      */
 
+    @Override
     public ButtonPeer createButton(Button target) {
         ButtonPeer peer = new WButtonPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public TextFieldPeer createTextField(TextField target) {
         TextFieldPeer peer = new WTextFieldPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public LabelPeer createLabel(Label target) {
         LabelPeer peer = new WLabelPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public ListPeer createList(List target) {
         ListPeer peer = new WListPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public CheckboxPeer createCheckbox(Checkbox target) {
         CheckboxPeer peer = new WCheckboxPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public ScrollbarPeer createScrollbar(Scrollbar target) {
         ScrollbarPeer peer = new WScrollbarPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public ScrollPanePeer createScrollPane(ScrollPane target) {
         ScrollPanePeer peer = new WScrollPanePeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public TextAreaPeer createTextArea(TextArea target) {
         TextAreaPeer peer = new WTextAreaPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public ChoicePeer createChoice(Choice target) {
         ChoicePeer peer = new WChoicePeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public FramePeer  createFrame(Frame target) {
         FramePeer peer = new WFramePeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public FramePeer createLightweightFrame(LightweightFrame target) {
         FramePeer peer = new WLightweightFramePeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public CanvasPeer createCanvas(Canvas target) {
         CanvasPeer peer = new WCanvasPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     @SuppressWarnings("deprecation")
     public void disableBackgroundErase(Canvas canvas) {
         WCanvasPeer peer = (WCanvasPeer)canvas.getPeer();
@@ -421,60 +437,70 @@
         peer.disableBackgroundErase();
     }
 
+    @Override
     public PanelPeer createPanel(Panel target) {
         PanelPeer peer = new WPanelPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public WindowPeer createWindow(Window target) {
         WindowPeer peer = new WWindowPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public DialogPeer createDialog(Dialog target) {
         DialogPeer peer = new WDialogPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public FileDialogPeer createFileDialog(FileDialog target) {
         FileDialogPeer peer = new WFileDialogPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public MenuBarPeer createMenuBar(MenuBar target) {
         MenuBarPeer peer = new WMenuBarPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public MenuPeer createMenu(Menu target) {
         MenuPeer peer = new WMenuPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public PopupMenuPeer createPopupMenu(PopupMenu target) {
         PopupMenuPeer peer = new WPopupMenuPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public MenuItemPeer createMenuItem(MenuItem target) {
         MenuItemPeer peer = new WMenuItemPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) {
         CheckboxMenuItemPeer peer = new WCheckboxMenuItemPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public RobotPeer createRobot(Robot target, GraphicsDevice screen) {
         // (target is unused for now)
         // Robot's don't need to go in the peer map since
@@ -500,28 +526,38 @@
         return peer;
     }
 
+    @Override
     public TrayIconPeer createTrayIcon(TrayIcon target) {
         WTrayIconPeer peer = new WTrayIconPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public SystemTrayPeer createSystemTray(SystemTray target) {
         return new WSystemTrayPeer(target);
     }
 
+    @Override
     public boolean isTraySupported() {
         return true;
     }
 
+    @Override
+    public DataTransferer getDataTransferer() {
+        return WDataTransferer.getInstanceImpl();
+    }
+
+    @Override
     public KeyboardFocusManagerPeer getKeyboardFocusManagerPeer()
       throws HeadlessException
     {
         return WKeyboardFocusManagerPeer.getInstance();
     }
 
-    protected native void setDynamicLayoutNative(boolean b);
+    private native void setDynamicLayoutNative(boolean b);
 
+    @Override
     public void setDynamicLayout(boolean b) {
         if (b == dynamicLayoutSetting) {
             return;
@@ -531,6 +567,7 @@
         setDynamicLayoutNative(b);
     }
 
+    @Override
     protected boolean isDynamicLayoutSet() {
         return dynamicLayoutSetting;
     }
@@ -539,8 +576,9 @@
      * Called from lazilyLoadDynamicLayoutSupportedProperty because
      * Windows doesn't always send WM_SETTINGCHANGE when it should.
      */
-    protected native boolean isDynamicLayoutSupportedNative();
+    private native boolean isDynamicLayoutSupportedNative();
 
+    @Override
     public boolean isDynamicLayoutActive() {
         return (isDynamicLayoutSet() && isDynamicLayoutSupported());
     }
@@ -548,6 +586,7 @@
     /**
      * Returns <code>true</code> if this frame state is supported.
      */
+    @Override
     public boolean isFrameStateSupported(int state) {
         switch (state) {
           case Frame.NORMAL:
@@ -572,25 +611,31 @@
         return config.getColorModel();
     }
 
+    @Override
     public ColorModel getColorModel() {
         return getStaticColorModel();
     }
 
+    @Override
     public Insets getScreenInsets(GraphicsConfiguration gc)
     {
         return getScreenInsets(((Win32GraphicsDevice) gc.getDevice()).getScreen());
     }
 
+    @Override
     public int getScreenResolution() {
         Win32GraphicsEnvironment ge = (Win32GraphicsEnvironment)
             GraphicsEnvironment.getLocalGraphicsEnvironment();
         return ge.getXResolution();
     }
+    @Override
     protected native int getScreenWidth();
+    @Override
     protected native int getScreenHeight();
-    protected native Insets getScreenInsets(int screen);
+    private native Insets getScreenInsets(int screen);
 
 
+    @Override
     public FontMetrics getFontMetrics(Font font) {
         // This is an unsupported hack, but left in for a customer.
         // Do not remove.
@@ -602,6 +647,7 @@
         return super.getFontMetrics(font);
     }
 
+    @Override
     public FontPeer getFontPeer(String name, int style) {
         FontPeer retval = null;
         String lcName = name.toLowerCase();
@@ -625,6 +671,7 @@
 
     private native void nativeSync();
 
+    @Override
     public void sync() {
         // flush the GDI/DD buffers
         nativeSync();
@@ -634,11 +681,13 @@
         D3DRenderQueue.sync();
     }
 
+    @Override
     public PrintJob getPrintJob(Frame frame, String doctitle,
                                 Properties props) {
         return getPrintJob(frame, doctitle, null, null);
     }
 
+    @Override
     public PrintJob getPrintJob(Frame frame, String doctitle,
                                 JobAttributes jobAttributes,
                                 PageAttributes pageAttributes)
@@ -657,8 +706,10 @@
         return printJob;
     }
 
+    @Override
     public native void beep();
 
+    @Override
     public boolean getLockingKeyState(int key) {
         if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK ||
                key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) {
@@ -667,8 +718,9 @@
         return getLockingKeyStateNative(key);
     }
 
-    public native boolean getLockingKeyStateNative(int key);
+    private native boolean getLockingKeyStateNative(int key);
 
+    @Override
     public void setLockingKeyState(int key, boolean on) {
         if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK ||
                key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) {
@@ -677,8 +729,9 @@
         setLockingKeyStateNative(key, on);
     }
 
-    public native void setLockingKeyStateNative(int key, boolean on);
+    private native void setLockingKeyStateNative(int key, boolean on);
 
+    @Override
     public Clipboard getSystemClipboard() {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
@@ -692,6 +745,7 @@
         return clipboard;
     }
 
+    @Override
     protected native void loadSystemColors(int[] systemColors);
 
     public static final Object targetToPeer(Object target) {
@@ -705,6 +759,7 @@
     /**
      * Returns a new input method adapter descriptor for native input methods.
      */
+    @Override
     public InputMethodDescriptor getInputMethodAdapterDescriptor() {
         return new WInputMethodDescriptor();
     }
@@ -712,6 +767,7 @@
     /**
      * Returns a style map for the input method highlight.
      */
+    @Override
     public Map<java.awt.font.TextAttribute,?> mapInputMethodHighlight(
         InputMethodHighlight highlight)
     {
@@ -722,6 +778,7 @@
      * Returns whether enableInputMethods should be set to true for peered
      * TextComponent instances on this platform.
      */
+    @Override
     public boolean enableInputMethodsForTextComponent() {
         return true;
     }
@@ -729,6 +786,7 @@
     /**
      * Returns the default keyboard locale of the underlying operating system
      */
+    @Override
     public Locale getDefaultKeyboardLocale() {
         Locale locale = WInputMethod.getNativeLocale();
 
@@ -742,6 +800,7 @@
     /**
      * Returns a new custom cursor.
      */
+    @Override
     public Cursor createCustomCursor(Image cursor, Point hotSpot, String name)
         throws IndexOutOfBoundsException {
         return new WCustomCursor(cursor, hotSpot, name);
@@ -750,11 +809,13 @@
     /**
      * Returns the supported cursor size (Win32 only has one).
      */
+    @Override
     public Dimension getBestCursorSize(int preferredWidth, int preferredHeight) {
         return new Dimension(WCustomCursor.getCursorWidth(),
                              WCustomCursor.getCursorHeight());
     }
 
+    @Override
     public native int getMaximumCursorColors();
 
     static void paletteChanged() {
@@ -770,6 +831,7 @@
      */
     static public void displayChanged() {
         EventQueue.invokeLater(new Runnable() {
+            @Override
             public void run() {
                 ((Win32GraphicsEnvironment)GraphicsEnvironment
                 .getLocalGraphicsEnvironment())
@@ -782,10 +844,12 @@
      * create the peer for a DragSourceContext
      */
 
+    @Override
     public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
         return WDragSourceContextPeer.createDragSourceContextPeer(dge);
     }
 
+    @Override
     public <T extends DragGestureRecognizer> T
         createDragGestureRecognizer(Class<T> abstractRecognizerClass,
                                     DragSource ds, Component c, int srcActions,
@@ -806,6 +870,7 @@
     private static final String awtPrefix  = "awt.";
     private static final String dndPrefix  = "DnD.";
 
+    @Override
     protected Object lazilyLoadDesktopProperty(String name) {
         if (name.startsWith(prefix)) {
             String cursorName = name.substring(prefix.length(), name.length()) + postfix;
@@ -872,6 +937,7 @@
      */
     private void windowsSettingChange() {
         EventQueue.invokeLater(new Runnable() {
+            @Override
             public void run() {
                 updateProperties();
             }
@@ -894,6 +960,7 @@
         }
     }
 
+    @Override
     public synchronized void addPropertyChangeListener(String name, PropertyChangeListener pcl) {
         if (name == null) {
             // See JavaDoc for the Toolkit.addPropertyChangeListener() method
@@ -914,6 +981,7 @@
      * initialize only static props here and do not try to initialize props which depends on wprops,
      * this should be done in lazilyLoadDesktopProperty() only.
      */
+    @Override
     protected synchronized void initializeDesktopProperties() {
         desktopProperties.put("DnD.Autoscroll.initialDelay",
                               Integer.valueOf(50));
@@ -929,6 +997,7 @@
      * This returns the value for the desktop property "awt.font.desktophints"
      * This requires that the Windows properties have already been gathered.
      */
+    @Override
     protected synchronized RenderingHints getDesktopAAHints() {
         if (wprops == null) {
             return null;
@@ -937,6 +1006,7 @@
         }
     }
 
+    @Override
     public boolean isModalityTypeSupported(Dialog.ModalityType modalityType) {
         return (modalityType == null) ||
                (modalityType == Dialog.ModalityType.MODELESS) ||
@@ -945,6 +1015,7 @@
                (modalityType == Dialog.ModalityType.TOOLKIT_MODAL);
     }
 
+    @Override
     public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType exclusionType) {
         return (exclusionType == null) ||
                (exclusionType == Dialog.ModalExclusionType.NO_EXCLUDE) ||
@@ -984,6 +1055,7 @@
         return !Win32GraphicsEnvironment.isDWMCompositionEnabled();
     }
 
+    @Override
     @SuppressWarnings("deprecation")
     public void grab(Window w) {
         if (w.getPeer() != null) {
@@ -991,6 +1063,7 @@
         }
     }
 
+    @Override
     @SuppressWarnings("deprecation")
     public void ungrab(Window w) {
         if (w.getPeer() != null) {
@@ -998,17 +1071,21 @@
         }
     }
 
+    @Override
     public native boolean syncNativeQueue(final long timeout);
+    @Override
     public boolean isDesktopSupported() {
         return true;
     }
 
+    @Override
     public DesktopPeer createDesktopPeer(Desktop target) {
         return new WDesktopPeer();
     }
 
-    public static native void setExtraMouseButtonsEnabledNative(boolean enable);
+    private static native void setExtraMouseButtonsEnabledNative(boolean enable);
 
+    @Override
     public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
         return areExtraMouseButtonsEnabled;
     }
--- a/jdk/src/windows/classes/sun/awt/windows/WTrayIconPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WTrayIconPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2007, 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
@@ -36,9 +36,8 @@
 import java.awt.image.*;
 import sun.awt.SunToolkit;
 import sun.awt.image.IntegerComponentRaster;
-import sun.awt.windows.WPopupMenuPeer;
 
-public class WTrayIconPeer extends WObjectPeer implements TrayIconPeer {
+final class WTrayIconPeer extends WObjectPeer implements TrayIconPeer {
     final static int TRAY_ICON_WIDTH = 16;
     final static int TRAY_ICON_HEIGHT = 16;
     final static int TRAY_ICON_MASK_SIZE = (TRAY_ICON_WIDTH * TRAY_ICON_HEIGHT) / 8;
@@ -48,6 +47,7 @@
     Frame popupParent = new Frame("PopupMessageWindow");
     PopupMenu popup;
 
+    @Override
     protected void disposeImpl() {
         if (popupParent != null) {
             popupParent.dispose();
@@ -64,6 +64,7 @@
         updateImage();
     }
 
+    @Override
     public void updateImage() {
         Image image = ((TrayIcon)target).getImage();
         if (image != null) {
@@ -71,13 +72,16 @@
         }
     }
 
+    @Override
     public native void setToolTip(String tooltip);
 
+    @Override
     public synchronized void showPopupMenu(final int x, final int y) {
         if (isDisposed())
             return;
 
         SunToolkit.executeOnEventHandlerThread(target, new Runnable() {
+                @Override
                 public void run() {
                     PopupMenu newPopup = ((TrayIcon)target).getPopupMenu();
                     if (popup != newPopup) {
@@ -96,6 +100,7 @@
             });
     }
 
+    @Override
     public void displayMessage(String caption, String text, String messageType) {
         // The situation when both caption and text are null is processed in the shared code.
         if (caption == null) {
@@ -185,6 +190,7 @@
     native void _displayMessage(String caption, String text, String messageType);
 
     class IconObserver implements ImageObserver {
+        @Override
         public boolean imageUpdate(Image image, int flags, int x, int y, int width, int height) {
             if (image != ((TrayIcon)target).getImage() || // if the image has been changed
                 isDisposed())
--- a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -90,6 +90,7 @@
     }
 
     // WComponentPeer overrides
+    @Override
     @SuppressWarnings("unchecked")
     protected void disposeImpl() {
         AppContext appContext = SunToolkit.targetToAppContext(target);
@@ -118,24 +119,30 @@
 
     // WindowPeer implementation
 
+    @Override
     public void toFront() {
         updateFocusableWindowState();
         _toFront();
     }
-    native void _toFront();
+    private native void _toFront();
+
+    @Override
     public native void toBack();
 
-    public native void setAlwaysOnTopNative(boolean value);
+    private native void setAlwaysOnTopNative(boolean value);
+
     public void setAlwaysOnTop(boolean value) {
         if ((value && ((Window)target).isVisible()) || !value) {
             setAlwaysOnTopNative(value);
         }
     }
 
+    @Override
     public void updateAlwaysOnTopState() {
         setAlwaysOnTop(((Window)target).isAlwaysOnTop());
     }
 
+    @Override
     public void updateFocusableWindowState() {
         setFocusableWindow(((Window)target).isFocusableWindow());
     }
@@ -150,12 +157,13 @@
         }
         _setTitle(title);
     }
-    native void _setTitle(String title);
+    private native void _setTitle(String title);
 
     public void setResizable(boolean resizable) {
         _setResizable(resizable);
     }
-    public native void _setResizable(boolean resizable);
+
+    private native void _setResizable(boolean resizable);
 
     // Toolkit & peer internals
 
@@ -163,6 +171,7 @@
         super(target);
     }
 
+    @Override
     void initialize() {
         super.initialize();
 
@@ -210,6 +219,7 @@
         windowType = ((Window)target).getType();
     }
 
+    @Override
     void create(WComponentPeer parent) {
         preCreate(parent);
         createAwtWindow(parent);
@@ -226,6 +236,7 @@
         super.show();
     }
 
+    @Override
     public void show() {
         updateFocusableWindowState();
 
@@ -289,7 +300,7 @@
         }
         return requestWindowFocus(cause == CausedFocusEvent.Cause.MOUSE_EVENT);
     }
-    public native boolean requestWindowFocus(boolean isMouseEventCause);
+    private native boolean requestWindowFocus(boolean isMouseEventCause);
 
     public boolean focusAllowedFor() {
         Window window = (Window)this.target;
@@ -305,7 +316,8 @@
         return true;
     }
 
-    public void hide() {
+    @Override
+    void hide() {
         WindowListener listener = windowListener;
         if (listener != null) {
             // We're not getting WINDOW_CLOSING from the native code when hiding
@@ -316,6 +328,7 @@
     }
 
     // WARNING: it's called on the Toolkit thread!
+    @Override
     void preprocessPostEvent(AWTEvent event) {
         if (event instanceof WindowEvent) {
             WindowListener listener = windowListener;
@@ -340,6 +353,7 @@
         windowListener = AWTEventMulticaster.remove(windowListener, l);
     }
 
+    @Override
     public void updateMinimumSize() {
         Dimension minimumSize = null;
         if (((Component)target).isMinimumSizeSet()) {
@@ -356,6 +370,7 @@
         }
     }
 
+    @Override
     public void updateIconImages() {
         java.util.List<Image> imageList = ((Window)target).getIconImages();
         if (imageList == null || imageList.size() == 0) {
@@ -393,6 +408,7 @@
         return modalBlocker != null;
     }
 
+     @Override
      @SuppressWarnings("deprecation")
     public void setModalBlocked(Dialog dialog, boolean blocked) {
         synchronized (((Component)getTarget()).getTreeLock()) // State lock should always be after awtLock
@@ -459,6 +475,7 @@
     void draggedToNewScreen() {
         SunToolkit.executeOnEventHandlerThread((Component)target,new Runnable()
         {
+            @Override
             public void run() {
                 displayChanged();
             }
@@ -519,6 +536,7 @@
      * reflects the current display depth information, which has
      * just changed).
      */
+    @Override
     public void displayChanged() {
         updateGC();
     }
@@ -527,6 +545,7 @@
      * Part of the DisplayChangedListener interface: components
      * do not need to react to this event
      */
+    @Override
     public void paletteChanged() {
     }
 
@@ -565,6 +584,7 @@
      private volatile int sysW = 0;
      private volatile int sysH = 0;
 
+     @Override
      public native void repositionSecurityWarning();
 
      @Override
@@ -620,6 +640,7 @@
     private native void setOpacity(int iOpacity);
     private float opacity = 1.0f;
 
+    @Override
     public void setOpacity(float opacity) {
         if (!((SunToolkit)((Window)target).getToolkit()).
             isWindowOpacitySupported())
@@ -663,6 +684,7 @@
 
     private native void setOpaqueImpl(boolean isOpaque);
 
+    @Override
     public void setOpaque(boolean isOpaque) {
         synchronized (getStateLock()) {
             if (this.isOpaque == isOpaque) {
@@ -720,8 +742,9 @@
         }
     }
 
-    public native void updateWindowImpl(int[] data, int width, int height);
+    native void updateWindowImpl(int[] data, int width, int height);
 
+    @Override
     public void updateWindow() {
         updateWindow(false);
     }
@@ -770,6 +793,7 @@
      * unregisters ActiveWindowListener listener.
      */
     private static class GuiDisposedListener implements PropertyChangeListener {
+        @Override
         public void propertyChange(PropertyChangeEvent e) {
             boolean isDisposed = (Boolean)e.getNewValue();
             if (isDisposed != true) {
@@ -795,6 +819,7 @@
      */
     @SuppressWarnings( value = {"deprecation", "unchecked"})
     private static class ActiveWindowListener implements PropertyChangeListener {
+        @Override
         public void propertyChange(PropertyChangeEvent e) {
             Window w = (Window)e.getNewValue();
             if (w == null) {
--- a/jdk/src/windows/classes/sun/awt/windows/WingDings.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WingDings.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2005, 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
@@ -29,11 +29,12 @@
 import java.nio.CharBuffer;
 import java.nio.charset.*;
 
-public class WingDings extends Charset {
+final class WingDings extends Charset {
     public WingDings () {
         super("WingDings", null);
     }
 
+    @Override
     public CharsetEncoder newEncoder() {
         return new Encoder(this);
     }
@@ -41,10 +42,12 @@
     /* Seems like supporting a decoder is required, but we aren't going
      * to be publically exposing this class, so no need to waste work
      */
+    @Override
     public CharsetDecoder newDecoder() {
         throw new Error("Decoder isn't implemented for WingDings Charset");
     }
 
+    @Override
     public boolean contains(Charset cs) {
         return cs instanceof WingDings;
     }
@@ -54,6 +57,7 @@
             super(cs, 1.0f, 1.0f);
         }
 
+        @Override
         public boolean canEncode(char c) {
             if(c >= 0x2701 && c <= 0x27be){
                 if (table[c - 0x2700] != 0x00)
@@ -64,6 +68,7 @@
             return false;
         }
 
+        @Override
         protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
             char[] sa = src.array();
             int sp = src.arrayOffset() + src.position();
@@ -156,6 +161,7 @@
         };
 
         /* The default implementation creates a decoder and we don't have one */
+        @Override
         public boolean isLegalReplacement(byte[] repl) {
             return true;
         }
--- a/jdk/src/windows/native/sun/net/spi/DefaultProxySelector.c	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/native/sun/net/spi/DefaultProxySelector.c	Tue Apr 01 15:37:15 2014 +0200
@@ -127,12 +127,13 @@
   char regserver[MAX_STR_LEN];
   char override[MAX_STR_LEN];
   char *s, *s2;
+  char *ctx = NULL;
   int pport = 0;
   int defport = 0;
   char *phost;
 
   /**
-   * Let's opem the Registry entry. We'll check a few values in it:
+   * Let's open the Registry entry. We'll check a few values in it:
    *
    * - ProxyEnable: 0 means no proxy, 1 means use the proxy
    * - ProxyServer: a string that can take 2 forms:
@@ -177,7 +178,7 @@
            * The semicolons (;) separated entries have to be matched with the
            * the beginning of the hostname.
            */
-          s = strtok(override, "; ");
+          s = strtok_s(override, "; ", &ctx);
           urlhost = (*env)->GetStringUTFChars(env, host, &isCopy);
           if (urlhost == NULL) {
             if (!(*env)->ExceptionCheck(env))
@@ -194,7 +195,7 @@
                 (*env)->ReleaseStringUTFChars(env, host, urlhost);
               goto noproxy;
             }
-            s = strtok(NULL, "; ");
+            s = strtok_s(NULL, "; ", &ctx);
           }
           if (isCopy == JNI_TRUE)
             (*env)->ReleaseStringUTFChars(env, host, urlhost);
--- a/jdk/src/windows/native/sun/windows/MouseInfo.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/native/sun/windows/MouseInfo.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, 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
@@ -95,7 +95,9 @@
         env->DeleteLocalRef(pointClassLocal);
     }
     xID = env->GetFieldID(pointClass, "x", "I");
+    CHECK_NULL_RETURN(xID, (jint)0);
     yID = env->GetFieldID(pointClass, "y", "I");
+    CHECK_NULL_RETURN(yID, (jint)0);
     env->SetIntField(point, xID, pt.x);
     env->SetIntField(point, yID, pt.y);
 
--- a/jdk/src/windows/native/sun/windows/awt_DataTransferer.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/native/sun/windows/awt_DataTransferer.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -274,6 +274,9 @@
 
         jclass str_clazz = env->FindClass("java/lang/String");
         DASSERT(str_clazz != NULL);
+        if (str_clazz == NULL) {
+           throw std::bad_alloc();
+        }
         jobjectArray filenames = env->NewObjectArray(nFilenames, str_clazz,
                                                      NULL);
         if (filenames == NULL) {
@@ -827,6 +830,7 @@
     TRY;
 
     LPCTSTR cStr = JNU_GetStringPlatformChars(env, str, NULL);
+    CHECK_NULL_RETURN(cStr, 0);
     jlong value = ::RegisterClipboardFormat(cStr);
     JNU_ReleaseStringPlatformChars(env, str, cStr);
 
--- a/jdk/src/windows/native/sun/windows/awt_Insets.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/native/sun/windows/awt_Insets.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -46,14 +46,20 @@
     TRY;
 
     AwtInsets::leftID = env->GetFieldID(cls, "left", "I");
+    DASSERT(AwtInsets::leftID != NULL);
+    CHECK_NULL(AwtInsets::leftID);
+
     AwtInsets::rightID = env->GetFieldID(cls, "right", "I");
-    AwtInsets::topID = env->GetFieldID(cls, "top", "I");
-    AwtInsets::bottomID = env->GetFieldID(cls, "bottom", "I");
+    DASSERT(AwtInsets::rightID != NULL);
+    CHECK_NULL(AwtInsets::rightID);
 
-    DASSERT(AwtInsets::leftID != NULL);
-    DASSERT(AwtInsets::rightID != NULL);
+    AwtInsets::topID = env->GetFieldID(cls, "top", "I");
     DASSERT(AwtInsets::topID != NULL);
+    CHECK_NULL(AwtInsets::topID);
+
+    AwtInsets::bottomID = env->GetFieldID(cls, "bottom", "I");
     DASSERT(AwtInsets::bottomID != NULL);
+    CHECK_NULL(AwtInsets::bottomID);
 
     CATCH_BAD_ALLOC;
 }
--- a/jdk/src/windows/native/sun/windows/awt_Label.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/native/sun/windows/awt_Label.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2005, 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
@@ -319,10 +319,12 @@
 
     /* init field ids */
     AwtLabel::textID = env->GetFieldID(cls, "text", "Ljava/lang/String;");
-    AwtLabel::alignmentID = env->GetFieldID(cls, "alignment", "I");
+    DASSERT(AwtLabel::textID != NULL);
+    CHECK_NULL(AwtLabel::textID);
 
-    DASSERT(AwtLabel::textID != NULL);
+    AwtLabel::alignmentID = env->GetFieldID(cls, "alignment", "I");
     DASSERT(AwtLabel::alignmentID != NULL);
+    CHECK_NULL(AwtLabel::alignmentID);
 
     CATCH_BAD_ALLOC;
 }
--- a/jdk/src/windows/native/sun/windows/awt_PrintDialog.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/native/sun/windows/awt_PrintDialog.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, 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
@@ -166,17 +166,6 @@
 }
 
 JNIEXPORT void JNICALL
-Java_sun_awt_windows_WPrintDialog_setPeer(JNIEnv *env, jobject target,
-                                          jobject peer)
-{
-    TRY;
-
-    env->SetObjectField(target, AwtComponent::peerID, peer);
-
-    CATCH_BAD_ALLOC;
-}
-
-JNIEXPORT void JNICALL
 Java_sun_awt_windows_WPrintDialogPeer_initIDs(JNIEnv *env, jclass cls)
 {
     TRY;
--- a/jdk/src/windows/native/sun/windows/awt_Rectangle.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/native/sun/windows/awt_Rectangle.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -46,14 +46,20 @@
     TRY;
 
     AwtRectangle::xID = env->GetFieldID(cls, "x", "I");
+    DASSERT(AwtRectangle::xID != NULL);
+    CHECK_NULL(AwtRectangle::xID);
+
     AwtRectangle::yID = env->GetFieldID(cls, "y", "I");
-    AwtRectangle::widthID = env->GetFieldID(cls, "width", "I");
-    AwtRectangle::heightID = env->GetFieldID(cls, "height", "I");
+    DASSERT(AwtRectangle::yID != NULL);
+    CHECK_NULL(AwtRectangle::yID);
 
-    DASSERT(AwtRectangle::xID != NULL);
-    DASSERT(AwtRectangle::yID != NULL);
+    AwtRectangle::widthID = env->GetFieldID(cls, "width", "I");
     DASSERT(AwtRectangle::widthID != NULL);
+    CHECK_NULL(AwtRectangle::widthID);
+
+    AwtRectangle::heightID = env->GetFieldID(cls, "height", "I");
     DASSERT(AwtRectangle::heightID != NULL);
+    CHECK_NULL(AwtRectangle::heightID);
 
     CATCH_BAD_ALLOC;
 }
--- a/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -503,6 +503,7 @@
             env->GetMethodID(mouseEventCls, "<init>",
                              "(Ljava/awt/Component;IJIIIIIIZI)V");
         DASSERT(mouseEventConst);
+        CHECK_NULL(mouseEventConst);
     }
     if (env->EnsureLocalCapacity(2) < 0) {
         return;
@@ -556,6 +557,7 @@
             env->GetMethodID(actionEventCls, "<init>",
                              "(Ljava/lang/Object;ILjava/lang/String;JI)V");
         DASSERT(actionEventConst);
+        CHECK_NULL(actionEventConst);
     }
     if (env->EnsureLocalCapacity(2) < 0) {
         return;
@@ -736,6 +738,7 @@
     }
 
     tooltipStr = JNU_GetStringPlatformChars(env, jtooltip, (jboolean *)NULL);
+    if (env->ExceptionCheck()) goto ret;
     trayIcon->SetToolTip(tooltipStr);
     JNU_ReleaseStringPlatformChars(env, jtooltip, tooltipStr);
 ret:
@@ -855,9 +858,18 @@
     trayIcon = (AwtTrayIcon *)pData;
 
     captionStr = JNU_GetStringPlatformChars(env, jcaption, (jboolean *)NULL);
+    if (env->ExceptionCheck()) goto ret;
     textStr = JNU_GetStringPlatformChars(env, jtext, (jboolean *)NULL);
+    if (env->ExceptionCheck()) {
+        JNU_ReleaseStringPlatformChars(env, jcaption, captionStr);
+        goto ret;
+    }
     msgTypeStr = JNU_GetStringPlatformChars(env, jmsgType, (jboolean *)NULL);
-
+    if (env->ExceptionCheck()) {
+        JNU_ReleaseStringPlatformChars(env, jcaption, captionStr);
+        JNU_ReleaseStringPlatformChars(env, jtext, textStr);
+        goto ret;
+    }
     trayIcon->DisplayMessage(captionStr, textStr, msgTypeStr);
 
     JNU_ReleaseStringPlatformChars(env, jcaption, captionStr);
@@ -889,10 +901,12 @@
 
     /* init field ids */
     AwtTrayIcon::idID = env->GetFieldID(cls, "id", "I");
-    AwtTrayIcon::actionCommandID = env->GetFieldID(cls, "actionCommand", "Ljava/lang/String;");
+    DASSERT(AwtTrayIcon::idID != NULL);
+    CHECK_NULL(AwtTrayIcon::idID);
 
-    DASSERT(AwtTrayIcon::idID != NULL);
+    AwtTrayIcon::actionCommandID = env->GetFieldID(cls, "actionCommand", "Ljava/lang/String;");
     DASSERT(AwtTrayIcon::actionCommandID != NULL);
+    CHECK_NULL( AwtTrayIcon::actionCommandID);
 
     CATCH_BAD_ALLOC;
 }
@@ -981,8 +995,11 @@
     jint *intRasterDataPtr = NULL;
     HBITMAP hColor = NULL;
     try {
-        intRasterDataPtr =
-            (jint *)env->GetPrimitiveArrayCritical(intRasterData, 0);
+        intRasterDataPtr = (jint *)env->GetPrimitiveArrayCritical(intRasterData, 0);
+        if (intRasterDataPtr == NULL) {
+            ::DeleteObject(hMask);
+            return;
+        }
         hColor = AwtTrayIcon::CreateBMP(NULL, (int *)intRasterDataPtr, nSS, nW, nH);
     } catch (...) {
         if (intRasterDataPtr != NULL) {
--- a/jdk/test/ProblemList.txt	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/ProblemList.txt	Tue Apr 01 15:37:15 2014 +0200
@@ -221,15 +221,6 @@
 java/security/KeyPairGenerator/SolarisShortDSA.java             solaris-all
 sun/security/tools/keytool/standard.sh                          solaris-all
 
-# 8000439: NPG: REGRESSION : sun/security/krb5/auto/MaxRetries.java fails with timeout
-sun/security/krb5/auto/MaxRetries.java                          solaris-sparcv9
-
-# 8006690: sun/security/krb5/auto/BadKdc1.java fails intermittently
-sun/security/krb5/auto/BadKdc1.java                             solaris-sparcv9
-sun/security/krb5/auto/BadKdc2.java                             solaris-sparcv9
-sun/security/krb5/auto/BadKdc3.java                             solaris-sparcv9
-sun/security/krb5/auto/BadKdc4.java                             solaris-sparcv9
-
 ############################################################################
 
 # jdk_sound
--- a/jdk/test/com/sun/awt/SecurityWarning/CustomSecurityManager.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/com/sun/awt/SecurityWarning/CustomSecurityManager.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,10 +1,35 @@
-import sun.security.util.SecurityConstants;
+/*
+ * 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.
+ */
+
+import sun.awt.AWTPermissions;
 import java.security.Permission;
 
 public class CustomSecurityManager extends SecurityManager {
     @Override
     public void checkPermission(Permission perm) {
-        if (perm.implies(SecurityConstants.AWT.TOPLEVEL_WINDOW_PERMISSION)) {
+        if (perm.implies(AWTPermissions.TOPLEVEL_WINDOW_PERMISSION)) {
             throw new SecurityException();
         }
     }
--- a/jdk/test/com/sun/crypto/provider/Cipher/DES/PerformanceTest.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/com/sun/crypto/provider/Cipher/DES/PerformanceTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, 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
@@ -24,12 +24,9 @@
 /*
  * @test
  * @bug 0000000
- * @ignore run main/timeout=900 PerformanceTest
- * @summary PerformanceTest
+ * @summary This test checks performance of various ciphers.
  * @author Jan Luehe
- *
- * ignore since this test exists for performance
- * purpose and can be run separately if needed.
+ * @run main/manual PerformanceTest
  */
 import java.security.*;
 import java.security.spec.*;
--- a/jdk/test/com/sun/security/auth/callback/TextCallbackHandler/Default.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/com/sun/security/auth/callback/TextCallbackHandler/Default.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 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
@@ -25,8 +25,7 @@
  * @test
  * @bug 4470717
  * @summary fix default handling and other misc
- *
- * @ignore run these by hand
+ * @run main/manual Default
  */
 
 import com.sun.security.auth.callback.TextCallbackHandler;
--- a/jdk/test/com/sun/security/auth/callback/TextCallbackHandler/Password.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/com/sun/security/auth/callback/TextCallbackHandler/Password.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -25,7 +25,7 @@
  * @test
  * @bug 6825240
  * @summary Password.readPassword() echos the input when System.Console is null
- * @ignore run these by hand
+ * @run main/manual Password
  */
 
 import com.sun.security.auth.callback.TextCallbackHandler;
--- a/jdk/test/com/sun/security/sasl/gsskerb/AuthOnly.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/com/sun/security/sasl/gsskerb/AuthOnly.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -25,11 +25,14 @@
  * @test
  * @bug 4634892
  * @summary Ensure authentication via GSS-API/Kerberos v5 works.
- * @ignore see runwjaas.csh for instructions for how to run this test
+ * @run main/manual AuthOnly
  */
+
 /*
- * Can set logging to FINEST to view exchange.
+ * Set logging to FINEST to view exchange.
+ * See runwjaas.csh for instructions for how to run this test.
  */
+
 import javax.security.sasl.*;
 import javax.security.auth.callback.*;
 import java.security.*;
--- a/jdk/test/com/sun/security/sasl/gsskerb/ConfSecurityLayer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/com/sun/security/sasl/gsskerb/ConfSecurityLayer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,12 +25,15 @@
  * @test
  * @bug 5014493
  * @summary SaslServer.wrap throws NullPointerException when security
- *    layer negotiated
- * @ignore see run-conf-wjaas.csh for instructions for how to run this test
+ *    layer negotiated.
+ * @run main/manual ConfSecurityLayer
  */
+
 /*
- * Can set logging to FINEST to view exchange.
+ * Set logging to FINEST to view exchange.
+ * See run-conf-wjaas.csh for instructions for how to run this test.
  */
+
 import javax.security.sasl.*;
 import javax.security.auth.callback.*;
 import java.security.*;
--- a/jdk/test/com/sun/security/sasl/gsskerb/NoSecurityLayer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/com/sun/security/sasl/gsskerb/NoSecurityLayer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -24,13 +24,16 @@
 /*
  * @test
  * @bug 4873552
- * @summary GSS-API/krb5 SASL mechanism should throw IllegalStateException for auth-only
-
- * @ignore see run-nosec-wjaas.csh for instructions for how to run this test
+ * @summary GSS-API/krb5 SASL mechanism should throw IllegalStateException
+ *     for auth-only
+ * @run main/manual NoSecurityLayer
  */
+
 /*
- * Can set logging to FINEST to view exchange.
+ * Set logging to FINEST to view exchange.
+ * See run-nosec-wjaas.csh for instructions for how to run this test.
  */
+
 import javax.security.sasl.*;
 import javax.security.auth.callback.*;
 import java.security.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Choice/ChoiceLocationTest/ChoiceLocationTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ @test
+  @bug 7159566
+  @summary The choice positioned in the top of applet when clicking the choice.
+  @author Petr Pchelko
+  @library ../../regtesthelpers
+  @build Util
+  @run main ChoiceLocationTest
+ */
+
+import java.awt.*;
+import javax.swing.*;
+import java.awt.event.InputEvent;
+import java.util.stream.Stream;
+
+import test.java.awt.regtesthelpers.Util;
+
+public class ChoiceLocationTest {
+
+    private static final int FRAME_LOCATION = 100;
+    private static final int FRAME_SIZE = 400;
+    private static final int CLICK_STEP = 5;
+
+    private static String[] choiceItems = new String[] {
+            "test item 1",
+            "test item 2",
+            "test item 3"
+    };
+
+    private static volatile Frame frame;
+    private static volatile Choice choice;
+
+    public static void main(String[] args) throws Exception {
+        try {
+            SwingUtilities.invokeAndWait(ChoiceLocationTest::initAndShowUI);
+            Robot r = new Robot();
+            r.waitForIdle();
+            r.delay(100);
+
+            Util.clickOnComp(choice, r);
+
+            choice.addItemListener(event -> {throw new RuntimeException("Failed: the choice popup is in the wrong place");});
+
+            // Test: click in several places on the top of the frame an ensure there' no choice there
+            Point locOnScreen = frame.getLocationOnScreen();
+            int x = locOnScreen.x + FRAME_SIZE / 2;
+            for (int y = locOnScreen.y + frame.getInsets().top + 10; y < locOnScreen.y + FRAME_SIZE / 3 ; y += CLICK_STEP) {
+                r.mouseMove(x, y);
+                r.waitForIdle();
+                r.mousePress(InputEvent.BUTTON1_MASK);
+                r.mouseRelease(InputEvent.BUTTON1_MASK);
+                r.waitForIdle();
+                r.delay(100);
+            }
+        } finally {
+            if (frame != null) {
+                frame.dispose();
+            }
+        }
+
+    }
+
+    private static void initAndShowUI() {
+        frame = new Frame("Test frame");
+        choice = new Choice();
+        Stream.of(choiceItems).forEach(choice::add);
+        frame.add(choice);
+        frame.setBounds(FRAME_LOCATION, FRAME_LOCATION, FRAME_SIZE, FRAME_SIZE);
+        frame.setVisible(true);
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.html	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,32 @@
+<!--
+ Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+    <head>
+        <title>High resolution custom cursor test, bug ID 8028212</title>
+    </head>
+    <body>
+    <applet CODE="MultiResolutionCursorTest.class" WIDTH=300 HEIGHT=100></applet>
+    <p> See the dialog box (usually in upper left corner) for instructions</p>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,266 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.Label;
+import java.awt.Point;
+import java.awt.TextArea;
+import java.awt.Toolkit;
+import java.awt.image.BufferedImage;
+import java.util.LinkedList;
+import java.util.List;
+import javax.swing.JApplet;
+import sun.awt.OSInfo;
+import sun.awt.image.MultiResolutionImage;
+
+/**
+ * @test
+ * @bug 8028212
+ * @summary [macosx] Custom Cursor HiDPI support
+ * @author Alexander Scherbatiy
+ * @run applet/manual=yesno MultiResolutionCursorTest.html
+ */
+public class MultiResolutionCursorTest extends JApplet {
+    //Declare things used in the test, like buttons and labels here
+
+    static final int sizes[] = {16, 32, 128};
+    static final Color colors[] = {Color.WHITE, Color.RED, Color.GREEN, Color.BLUE};
+
+    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());
+
+        if (OSInfo.getOSType().equals(OSInfo.OSType.MACOSX)) {
+            String[] instructions = {
+                "Verify that high resolution custom cursor is used"
+                + " on HiDPI displays.",
+                "1) Run the test on Retina display or enable the Quartz Debug"
+                + " and select the screen resolution with (HiDPI) label",
+                "2) Move the cursor to the Test Frame",
+                "3) Check that cursor has red, green or blue color",
+                "If so, press PASS, else press FAIL."
+            };
+            Sysout.createDialogWithInstructions(instructions);
+
+        } else {
+            String[] instructions = {
+                "This test is not applicable to the current platform. Press PASS."
+            };
+            Sysout.createDialogWithInstructions(instructions);
+        }
+    }//End  init()
+
+    public void start() {
+        //Get things going.  Request focus, set size, et cetera
+        setSize(200, 200);
+        setVisible(true);
+        validate();
+
+        final Image image = new MultiResolutionCursor();
+
+        int center = sizes[0] / 2;
+        Cursor cursor = Toolkit.getDefaultToolkit().createCustomCursor(
+                image, new Point(center, center), "multi-resolution cursor");
+
+        Frame frame = new Frame("Test Frame");
+        frame.setSize(300, 300);
+        frame.setLocation(300, 50);
+        frame.add(new Label("Move cursor here"));
+        frame.setCursor(cursor);
+        frame.setVisible(true);
+    }// start()
+
+
+    static class MultiResolutionCursor extends BufferedImage implements MultiResolutionImage {
+
+        List<Image> highResolutionImages;
+
+        public MultiResolutionCursor() {
+            super(sizes[0], sizes[0], BufferedImage.TYPE_INT_RGB);
+
+            draw(getGraphics(), 0);
+            highResolutionImages = new LinkedList<>();
+            highResolutionImages.add(this);
+
+            for (int i = 1; i < sizes.length; i++) {
+                BufferedImage highResolutionImage =
+                        new BufferedImage(sizes[i], sizes[i], BufferedImage.TYPE_INT_RGB);
+                draw(highResolutionImage.getGraphics(), i);
+                highResolutionImages.add(highResolutionImage);
+            }
+        }
+
+        @Override
+        public Image getResolutionVariant(int width, int height) {
+
+            for (int i = 0; i < sizes.length; i++) {
+                Image image = highResolutionImages.get(i);
+                int w = image.getWidth(null);
+                int h = image.getHeight(null);
+
+                if (width <= w && height <= h) {
+                    return image;
+                }
+            }
+
+            return highResolutionImages.get(highResolutionImages.size() - 1);
+        }
+
+        void draw(Graphics graphics, int index) {
+            Graphics2D g2 = (Graphics2D) graphics;
+            Color color = colors[index];
+            g2.setColor(color);
+            g2.fillRect(0, 0, sizes[index], sizes[index]);
+        }
+
+        @Override
+        public List<Image> getResolutionVariants() {
+            return highResolutionImages;
+        }
+    }
+}// class BlockedWindowTest
+
+/* Place other classes related to the test after this line */
+/**
+ * **************************************************
+ * 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();
+
+        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);
+    }
+}// Te
\ No newline at end of file
--- a/jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/InterprocessMessages.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/InterprocessMessages.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,5 +24,6 @@
 interface InterprocessMessages {
     final static int EXECUTION_IS_SUCCESSFULL = 0;
     final static int DATA_IS_CORRUPTED = 212;
+    final static int NO_DROP_HAPPENED = 112;
 }
 
--- a/jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 <!--
- Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 <html>
 <!--  
   @test
-  @bug 8005932
+  @bug 8005932 8017456
   @summary Java 7 on mac os x only provides text clipboard formats
   @author mikhail.cherkasov@oracle.com
   @library ../../regtesthelpers
--- a/jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,17 +21,6 @@
  * questions.
  */
 
-/*
-  @bug 8005932
-  @summary Java 7 on mac os x only provides text clipboard formats
-  @author mikhail.cherkasov@oracle.com
-  @library ../../regtesthelpers
-  @library ../../regtesthelpers/process
-  @build Util
-  @build ProcessResults ProcessCommunicator
-  @run applet/othervm MissedHtmlAndRtfBug.html
-*/
-
 import java.awt.*;
 import java.awt.datatransfer.DataFlavor;
 import java.awt.event.*;
@@ -47,6 +36,7 @@
 import static java.lang.Thread.sleep;
 
 public class MissedHtmlAndRtfBug extends Applet {
+
     public void init() {
         setLayout(new BorderLayout());
     }//End  init()
@@ -82,9 +72,6 @@
         args.add(concatStrings(DataFlavorSearcher.RICH_TEXT_NAMES));
 
         ProcessResults processResults =
-//                ProcessCommunicator.executeChildProcess(this.getClass(), "/Users/mcherkasov/ws/clipboard/DataFlover/out/production/DataFlover" +
-//                        " -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 ",
-//                        args.toArray(new String[0]));
                 ProcessCommunicator.executeChildProcess(this.getClass(),
                         "." + File.separator + System.getProperty("java.class.path"), args.toArray(new String[]{}));
 
@@ -117,6 +104,13 @@
             throw new RuntimeException("TEST IS FAILED: Target has received" +
                     " corrupted data.");
         }
+        if (InterprocessMessages.NO_DROP_HAPPENED ==
+                processResults.getExitValue()) {
+            processResults.printProcessErrorOutput(System.err);
+            throw new RuntimeException("Error. Drop did not happen." +
+                " Target frame is possibly covered by a window of other application." +
+                " Please, rerun the test with all windows minimized.");
+        }
         processResults.verifyStdErr(System.err);
         processResults.verifyProcessExitValue(System.err);
         processResults.printProcessStandartOutput(System.out);
@@ -184,7 +178,7 @@
         }
     }
 
-    public static void main(String[] args) {
+    public static void main(String[] args) throws InterruptedException {
         Point dragSourcePoint = new Point(InterprocessArguments.DRAG_SOURCE_POINT_X_ARGUMENT.extractInt(args),
                 InterprocessArguments.DRAG_SOURCE_POINT_Y_ARGUMENT.extractInt(args));
         Point targetFrameLocation = new Point(InterprocessArguments.TARGET_FRAME_X_POSITION_ARGUMENT.extractInt(args),
@@ -197,6 +191,8 @@
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
+        sleep(5000);
+        System.exit(InterprocessMessages.NO_DROP_HAPPENED);
     }
 
 
--- a/jdk/test/java/awt/Desktop/OpenByUNCPathNameTest/OpenByUNCPathNameTest.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/java/awt/Desktop/OpenByUNCPathNameTest/OpenByUNCPathNameTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -45,6 +45,10 @@
             System.out.println("java.awt.Desktop is not supported on this platform.");
         } else {
             Desktop desktop = Desktop.getDesktop();
+            if (!desktop.isSupported(Desktop.Action.OPEN)) {
+                System.out.println("Action.OPEN is not supported on this platform.");
+                return;
+            }
             File file = File.createTempFile("Read Me File", ".txt");
             try {
                 // Test opening of the file with Windows local file path.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/EventDispatchThread/EDTShutdownTest/EDTShutdownTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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 8031694
+  @summary [macosx] TwentyThousandTest test intermittently hangs
+  @author Oleg Pekhovskiy
+  @run main EDTShutdownTest
+ */
+
+import java.awt.EventQueue;
+import java.awt.Toolkit;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import sun.awt.AWTAccessor;
+
+public class EDTShutdownTest {
+
+    private static boolean passed = false;
+
+    public static void main(String[] args) {
+        // Force EDT start with InvocationEvent
+        EventQueue.invokeLater(() -> {
+            // EventQueue is empty now
+            EventQueue queue = Toolkit.getDefaultToolkit()
+                               .getSystemEventQueue();
+            Thread thread = AWTAccessor.getEventQueueAccessor()
+                            .getDispatchThread(queue);
+            try {
+                /*
+                 * Clear EventDispatchThread.doDispatch flag to break message
+                 * loop in EventDispatchThread.pumpEventsForFilter()
+                 */
+                Method stopDispatching = thread.getClass()
+                        .getDeclaredMethod("stopDispatching", null);
+                stopDispatching.setAccessible(true);
+                stopDispatching.invoke(thread, null);
+
+                /*
+                 * Post another InvocationEvent that must be handled by another
+                 * instance of EDT
+                 */
+                EventQueue.invokeLater(() -> {
+                    passed = true;
+                });
+            }
+            catch (InvocationTargetException | NoSuchMethodException
+                   | IllegalAccessException e) {
+            }
+        });
+
+        // Wait for EDT shutdown
+        EventQueue queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
+        Thread thread = AWTAccessor.getEventQueueAccessor()
+                        .getDispatchThread(queue);
+        try {
+            thread.join();
+
+            /*
+             * Wait for another EDT instance to handle the InvocationEvent
+             * and shutdown
+             */
+            thread = AWTAccessor.getEventQueueAccessor()
+                     .getDispatchThread(queue);
+            if (thread != null) {
+                thread.join();
+            }
+        }
+        catch (InterruptedException e) {
+        }
+
+        if (passed) {
+            System.out.println("Test PASSED!");
+        }
+        else {
+            throw new RuntimeException("Test FAILED!");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.html	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--
+  @test
+  @bug 8026869
+  @summary Support apple.awt.use-file-dialog-packages property.
+  @author Petr Pchelko area=awt.filedialog
+  @library ../../regtesthelpers
+  @build Sysout
+  @run applet/manual=yesno FileDialogForPackages.html
+  -->
+<head>
+    <title> FileDialogForPackages </title>
+</head>
+<body>
+
+<h1>FileDialogForPackages<br>Bug ID: 8026869</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="FileDialogForPackages.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import sun.awt.OSInfo;
+import test.java.awt.regtesthelpers.Sysout;
+
+import java.applet.Applet;
+import java.awt.Button;
+import java.awt.FileDialog;
+import java.awt.Frame;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+public class FileDialogForPackages extends Applet implements ActionListener {
+    private static final String APPLICATIONS_FOLDER = "/Applications";
+
+    private volatile Button showBtn;
+    private volatile FileDialog fd;
+
+    @Override
+    public void init() {
+        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+            Sysout.createDialogWithInstructions(new String[]{
+                    "Press PASS, this test is for MacOS X only."});
+            return;
+        }
+
+        System.setProperty("apple.awt.use-file-dialog-packages", "true");
+
+        setLayout(new GridLayout(1, 1));
+
+        fd = new FileDialog(new Frame(), "Open");
+        fd.setDirectory(APPLICATIONS_FOLDER);
+
+        showBtn = new Button("Show File Dialog");
+        showBtn.addActionListener(this);
+        add(showBtn);
+        String[] instructions = {
+                "1) Click on 'Show File Dialog' button. A file dialog will come up.",
+                "2) Navigate to the Applications folder if not already there",
+                "3) Check that the application bundles can be selected and can not be navigated",
+                "4) If it's true then the test passed, otherwise it failed."};
+        Sysout.createDialogWithInstructions(instructions);
+    }
+
+    @Override
+    public void start() {
+        setSize(200, 200);
+        show();
+    }
+
+    @Override
+    public void actionPerformed(ActionEvent e) {
+        if (e.getSource() == showBtn) {
+            fd.setVisible(true);
+            String output = fd.getFile();
+            if (output != null) {
+                Sysout.println(output + " is selected");
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,103 @@
+/*
+ * 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 8032078
+   @summary Frame.setExtendedState throws RuntimeException, if
+            windowState=ICONIFIED|MAXIMIZED_BOTH, on OS X
+   @author Anton Litvinov
+*/
+
+import java.awt.*;
+
+import sun.awt.SunToolkit;
+
+public class ExceptionOnSetExtendedStateTest {
+    private static final int[] frameStates = { Frame.NORMAL, Frame.ICONIFIED, Frame.MAXIMIZED_BOTH };
+    private static final SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit();
+
+    private static boolean validatePlatform() {
+        String osName = System.getProperty("os.name");
+        if (osName == null) {
+            throw new RuntimeException("Name of the current OS could not be retrieved.");
+        }
+        return osName.startsWith("Mac");
+    }
+
+    private static void testStateChange(int oldState, int newState, boolean decoratedFrame) {
+        System.out.println(String.format(
+            "testStateChange: oldState='%d', newState='%d', decoratedFrame='%b'",
+            oldState, newState, decoratedFrame));
+
+        Frame frame = new Frame("ExceptionOnSetExtendedStateTest");
+        frame.setSize(200, 200);
+        frame.setUndecorated(!decoratedFrame);
+        frame.setVisible(true);
+        toolkit.realSync();
+
+        frame.setExtendedState(oldState);
+        sleep(1000);
+        frame.setExtendedState(newState);
+
+        boolean stateWasNotChanged = true;
+        int currentState = 0;
+        for (int i = 0; (i < 3) && stateWasNotChanged; i++) {
+            sleep(1000);
+            currentState = frame.getExtendedState();
+            if ((currentState == newState) ||
+                (((newState & Frame.ICONIFIED) != 0) && ((currentState & Frame.ICONIFIED) != 0))) {
+                stateWasNotChanged = false;
+            }
+        }
+        frame.dispose();
+
+        if (stateWasNotChanged) {
+            throw new RuntimeException(String.format(
+                "Frame state was not changed. currentState='%d'", currentState));
+        }
+    }
+
+    private static void sleep(int millis) {
+        try {
+            Thread.sleep(millis);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void main(String[] args) {
+        if (!validatePlatform()) {
+            System.out.println("This test is only for OS X.");
+            return;
+        }
+
+        // Verify that changing states of decorated/undecorated frame to/from supported states
+        // and the state bit mask ICONIFIED | MAXIMIZED_BOTH does not raise RuntimeException.
+        for (int i = 0; i < frameStates.length; i++) {
+            testStateChange(frameStates[i], Frame.ICONIFIED | Frame.MAXIMIZED_BOTH, true);
+            testStateChange(frameStates[i], Frame.ICONIFIED | Frame.MAXIMIZED_BOTH, false);
+            testStateChange(Frame.ICONIFIED | Frame.MAXIMIZED_BOTH, frameStates[i], true);
+            testStateChange(Frame.ICONIFIED | Frame.MAXIMIZED_BOTH, frameStates[i], false);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Multiscreen/MouseEventTest/MouseEventTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,99 @@
+/*
+ * 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 8017472
+  @summary MouseEvent has wrong coordinates when using multiple monitors
+  @run main MouseEventTest
+ */
+
+import sun.awt.SunToolkit;
+
+import java.awt.*;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+public class MouseEventTest {
+    static volatile boolean crossed = false;
+
+    static void sleep() throws InterruptedException {
+        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        Thread.sleep(500);
+    }
+
+    public static void main(String[] args) throws AWTException, InterruptedException {
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+        GraphicsDevice[] gds = ge.getScreenDevices();
+        if (gds.length < 2) {
+            System.out.println("It's a multiscreen test... skipping!");
+            return;
+        }
+
+        for (int i = 0; i < gds.length; ++i) {
+            GraphicsDevice gd = gds[i];
+            GraphicsConfiguration gc = gd.getDefaultConfiguration();
+            Rectangle screen = gc.getBounds();
+            Robot robot = new Robot(gd);
+            robot.setAutoDelay(100);
+
+
+            Frame frame = new Frame(gc);
+            frame.setUndecorated(true);
+            frame.setSize(200, 200);
+            frame.setLocation(screen.x + 200, screen.y + 200);
+            frame.setBackground(Color.YELLOW);
+            frame.setVisible(true);
+            sleep();
+
+            Point loc = frame.getLocationOnScreen();
+            Dimension size = frame.getSize();
+            final Point point = new Point(
+                    loc.x + size.width / 2,
+                    loc.y + size.height / 2);
+
+            crossed = false;
+
+            frame.addMouseMotionListener(new MouseAdapter() {
+                @Override
+                public void mouseMoved(MouseEvent e) {
+                    if (point.equals(e.getLocationOnScreen())) {
+                        crossed = true;
+                    }
+                }
+            });
+
+            robot.mouseMove(point.x - 1, point.y - 1);
+            robot.mouseMove(point.x, point.y);
+
+            sleep();
+            frame.dispose();
+
+            if (!crossed) {
+                throw new RuntimeException("An expected mouse motion event was not received on the screen #" + i);
+            }
+        }
+
+        System.out.println("Test PASSED!");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Multiscreen/MultiScreenInsetsTest/MultiScreenInsetsTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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.
+ */
+
+/*
+  @test
+  @bug 8020443
+  @summary Frame is not created on the specified GraphicsDevice with two
+monitors
+  @author Oleg Pekhovskiy
+  @run main MultiScreenInsetsTest
+ */
+
+import java.awt.Frame;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.Insets;
+import java.awt.Rectangle;
+import java.awt.Toolkit;
+import sun.awt.OSInfo;
+
+public class MultiScreenInsetsTest {
+    private static final int SIZE = 100;
+
+    public static void main(String[] args) throws InterruptedException {
+        OSInfo.OSType type = OSInfo.getOSType();
+        if (type != OSInfo.OSType.LINUX && type != OSInfo.OSType.SOLARIS) {
+            System.out.println("This test is for Solaris and Linux only..." +
+                               "skipping!");
+            return;
+        }
+
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+        GraphicsDevice[] gds = ge.getScreenDevices();
+        if (gds.length < 2) {
+            System.out.println("It's a multi-screen test... skipping!");
+            return;
+        }
+
+        for (int screen = 0; screen < gds.length; ++screen) {
+            GraphicsDevice gd = gds[screen];
+            GraphicsConfiguration gc = gd.getDefaultConfiguration();
+            Rectangle bounds = gc.getBounds();
+            Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc);
+
+            Frame frame = new Frame(gc);
+            frame.setLocation(bounds.x + (bounds.width - SIZE) / 2,
+                              bounds.y + (bounds.height - SIZE) / 2);
+            frame.setSize(SIZE, SIZE);
+            frame.setUndecorated(true);
+            frame.setVisible(true);
+
+            // Maximize Frame to reach the struts
+            frame.setExtendedState(java.awt.Frame.MAXIMIZED_BOTH);
+            Thread.sleep(2000);
+
+            Rectangle frameBounds = frame.getBounds();
+            frame.dispose();
+            if (bounds.x + insets.left != frameBounds.x
+                || bounds.y + insets.top != frameBounds.y
+                || bounds.width - insets.right - insets.left != frameBounds.width
+                || bounds.height - insets.bottom - insets.top != frameBounds.height) {
+                throw new RuntimeException("Test FAILED! Wrong screen #" +
+                                           screen + " insets: " + insets);
+            }
+        }
+        System.out.println("Test PASSED!");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Multiscreen/MultiScreenLocationTest/MultiScreenLocationTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,110 @@
+/*
+ * 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 8013116
+  @summary Robot moves mouse to point which differs from set in mouseMove on
+ Unity shell
+  @author Oleg Pekhovskiy
+  @library ../../regtesthelpers
+  @build Util
+  @run main MultiScreenLocationTest
+ */
+
+import java.awt.AWTException;
+import java.awt.Color;
+import java.awt.Frame;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.MouseInfo;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.image.BufferedImage;
+import test.java.awt.regtesthelpers.Util;
+
+public class MultiScreenLocationTest {
+    private static final Point mouseOffset = new Point(150, 150);
+    private static final Point frameOffset = new Point(100, 100);
+    private static final Color color = Color.YELLOW;
+
+    private static String getErrorText(final String name, int screen)
+    {
+        return name + " test failed on Screen #" + screen + "!";
+    }
+
+    public static void main(String[] args) throws AWTException
+    {
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+        GraphicsDevice[] gds = ge.getScreenDevices();
+        if (gds.length < 2) {
+            System.out.println("It's a multiscreen test... skipping!");
+            return;
+        }
+
+        for (int i = 0; i < gds.length; ++i) {
+            GraphicsDevice gd = gds[i];
+            GraphicsConfiguration gc = gd.getDefaultConfiguration();
+            Rectangle screen = gc.getBounds();
+            Robot robot = new Robot(gd);
+
+            // check Robot.mouseMove()
+            robot.mouseMove(screen.x + mouseOffset.x, screen.y + mouseOffset.y);
+            Point mouse = MouseInfo.getPointerInfo().getLocation();
+            Point point = screen.getLocation();
+            point.translate(mouseOffset.x, mouseOffset.y);
+            if (!point.equals(mouse)) {
+                throw new RuntimeException(getErrorText("Robot.mouseMove", i));
+            }
+
+            // check Robot.getPixelColor()
+            Frame frame = new Frame(gc);
+            frame.setUndecorated(true);
+            frame.setSize(100, 100);
+            frame.setLocation(screen.x + frameOffset.x, screen.y + frameOffset.y);
+            frame.setBackground(color);
+            frame.setVisible(true);
+            robot.waitForIdle();
+            Rectangle bounds = frame.getBounds();
+            if (!Util.testBoundsColor(bounds, color, 5, 1000, robot)) {
+                throw new RuntimeException(getErrorText("Robot.getPixelColor", i));
+            }
+
+            // check Robot.createScreenCapture()
+            BufferedImage image = robot.createScreenCapture(bounds);
+            int rgb = color.getRGB();
+            if (image.getRGB(0, 0) != rgb
+                || image.getRGB(image.getWidth() - 1, 0) != rgb
+                || image.getRGB(image.getWidth() - 1, image.getHeight() - 1) != rgb
+                || image.getRGB(0, image.getHeight() - 1) != rgb) {
+                    throw new RuntimeException(
+                            getErrorText("Robot.createScreenCapture", i));
+            }
+            frame.dispose();
+        }
+
+        System.out.println("Test PASSED!");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Paint/PaintNativeOnUpdate.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,98 @@
+/*
+ * 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.Color;
+import java.awt.Component;
+import java.awt.Frame;
+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
+ * @author Sergey Bylokhov
+ */
+public final class PaintNativeOnUpdate extends Label {
+
+    private boolean fullUpdate = true;
+
+    public static void main(final String[] args) throws AWTException {
+        final Frame frame = new Frame();
+        final Component label = new PaintNativeOnUpdate();
+        frame.setBackground(Color.RED);
+        frame.add(label);
+        frame.setSize(300, 300);
+        frame.setUndecorated(true);
+        frame.setLocationRelativeTo(null);
+        frame.setVisible(true);
+        sleep();
+        label.repaint();// first paint
+        sleep();
+        label.repaint();// incremental paint
+        sleep();
+
+        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);
+        if (!color.equals(Color.GREEN)) {
+            System.err.println("Expected color = " + Color.GREEN);
+            System.err.println("Actual color = " + color);
+            throw new RuntimeException();
+        }
+        frame.dispose();
+    }
+
+    @Override
+    public void update(final Graphics g) {
+        if (fullUpdate) {
+            //full paint
+            g.setColor(Color.GREEN);
+            g.fillRect(0, 0, getWidth(), getHeight());
+            fullUpdate = false;
+        } else {
+            // Do nothing
+            // incremental paint
+        }
+    }
+
+    @Override
+    public void paint(final Graphics g) {
+        // Do nothing
+    }
+
+    private static void sleep() {
+        try {
+            ((SunToolkit) (Toolkit.getDefaultToolkit())).realSync();
+            Thread.sleep(1000);
+        } catch (InterruptedException ignored) {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/SplashScreen/FullscreenAfterSplash/FullScreenAfterSplash.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*/
+
+import sun.awt.OSInfo;
+
+import java.awt.*;
+import java.awt.Robot;
+import java.awt.event.InputEvent;
+import java.lang.InterruptedException;
+import java.lang.System;
+import java.lang.Thread;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import javax.swing.*;
+
+/*
+ * @test
+ * @bug 8024185
+ * @summary Native Mac OS X full screen does not work after showing the splash
+ * @library ../
+ * @build GenerateTestImage
+ * @run main GenerateTestImage
+ * @author Petr Pchelko area=awt.event
+ * @run main/othervm -splash:test.png FullScreenAfterSplash
+ */
+public class FullScreenAfterSplash {
+
+    private static JFrame frame;
+
+    private static volatile boolean windowEnteringFullScreen = false;
+    private static volatile boolean windowEnteredFullScreen = false;
+
+    public static void main(String[] args) throws Exception {
+
+        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+            System.out.println("The test is applicable only to Mac OS X. Passed");
+            return;
+        }
+        try {
+            //Move the mouse out, because it could interfere with the test.
+            Robot r = new Robot();
+            r.mouseMove(0, 0);
+            sleep();
+
+            SwingUtilities.invokeAndWait(FullScreenAfterSplash::createAndShowGUI);
+            sleep();
+
+            Point fullScreenButtonPos = frame.getLocation();
+            fullScreenButtonPos.translate(frame.getWidth() - 10, 10);
+            r.mouseMove(fullScreenButtonPos.x, fullScreenButtonPos.y);
+
+            //Cant use waitForIdle for full screen transition.
+            int waitCount = 0;
+            while (!windowEnteringFullScreen) {
+                r.mousePress(InputEvent.BUTTON1_MASK);
+                r.mouseRelease(InputEvent.BUTTON1_MASK);
+                Thread.sleep(100);
+                if (waitCount++ > 10) {
+                    System.err.println("Can't enter full screen mode. Failed.");
+                    System.exit(1);
+                }
+            }
+
+            waitCount = 0;
+            while (!windowEnteredFullScreen) {
+                Thread.sleep(100);
+                if (waitCount++ > 10) {
+                    System.err.println("Can't enter full screen mode. Failed.");
+                    System.exit(1);
+                }
+            }
+        } finally {
+            if (frame != null) {
+                frame.dispose();
+            }
+        }
+    }
+
+    private static void createAndShowGUI() {
+        frame = new JFrame(" Fullscreen OSX Bug ");
+        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+        enableFullScreen(frame);
+        frame.setBounds(100, 100, 100, 100);
+        frame.pack();
+        frame.setVisible(true);
+    }
+
+    /*
+     *  Use reflection to make a test compilable on not Mac OS X
+     */
+    private static void enableFullScreen(Window window) {
+        try {
+            Class<?> fullScreenUtilities = Class.forName("com.apple.eawt.FullScreenUtilities");
+            Method setWindowCanFullScreen = fullScreenUtilities.getMethod("setWindowCanFullScreen", Window.class, boolean.class);
+            setWindowCanFullScreen.invoke(fullScreenUtilities, window, true);
+            Class fullScreenListener = Class.forName("com.apple.eawt.FullScreenListener");
+            Object listenerObject = Proxy.newProxyInstance(fullScreenListener.getClassLoader(), new Class[]{fullScreenListener}, (proxy, method, args) -> {
+                switch (method.getName()) {
+                    case "windowEnteringFullScreen":
+                        windowEnteringFullScreen = true;
+                        break;
+                    case "windowEnteredFullScreen":
+                        windowEnteredFullScreen = true;
+                        break;
+                }
+                return null;
+            });
+            Method addFullScreenListener = fullScreenUtilities.getMethod("addFullScreenListenerTo", Window.class, fullScreenListener);
+            addFullScreenListener.invoke(fullScreenUtilities, window, listenerObject);
+        } catch (Exception e) {
+            throw new RuntimeException("FullScreen utilities not available", e);
+        }
+    }
+
+    private static void sleep() {
+        try {
+            Thread.sleep(500);
+        } catch (InterruptedException ignored) { }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/SplashScreen/GenerateTestImage.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*/
+
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.FileOutputStream;
+
+/**
+ * A utility to generate a test image for the SplashScreen test
+ */
+public class GenerateTestImage {
+    private static final int IMAGE_SIZE = 20;
+
+    public static void main(String[] args) throws Exception {
+        String path = System.getProperty("test.classes") + File.separator + "test.png";
+
+        BufferedImage image = new BufferedImage(IMAGE_SIZE, IMAGE_SIZE, BufferedImage.TYPE_INT_ARGB);
+        Graphics2D graphics2D = image.createGraphics();
+        graphics2D.setColor(Color.red);
+        graphics2D.fillOval(0, 0, IMAGE_SIZE, IMAGE_SIZE);
+        graphics2D.dispose();;
+
+        try(FileOutputStream fos = new FileOutputStream(path)) {
+            ImageIO.write(image, "png", fos);
+        }
+    }
+}
--- a/jdk/test/java/awt/TextArea/SelectionVisible/SelectionVisible.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/java/awt/TextArea/SelectionVisible/SelectionVisible.java	Tue Apr 01 15:37:15 2014 +0200
@@ -31,32 +31,32 @@
 
 public final class SelectionVisible extends Applet {
 
-    TextArea tf;
+    private TextArea ta;
 
     @Override
     public void init() {
-        tf = new TextArea(3, 20);
-        tf.setText("0123456789");
-        tf.select(0, 6);
+        ta = new TextArea(4, 20);
+        ta.setText("01234\n56789");
+        ta.select(3, 9);
 
-        final TextArea ta = new TextArea("INSTRUCTIONS:\n"
-                                                 + "The text 012345 should be selected in the TextArea.\n"
+        final TextArea instruction = new TextArea("INSTRUCTIONS:\n"
+                                                 + "The text 34567 should be selected in the TextArea.\n"
                                                  + "If this is what you observe, then the test passes.\n"
                                                  + "Otherwise, the test fails.", 40, 5,
                                          TextArea.SCROLLBARS_NONE);
-        ta.setEditable(false);
-        ta.setPreferredSize(new Dimension(300, 70));
+        instruction.setEditable(false);
+        instruction.setPreferredSize(new Dimension(300, 70));
         final Panel panel = new Panel();
         panel.setLayout(new FlowLayout());
-        panel.add(tf);
+        panel.add(ta);
         setLayout(new BorderLayout());
-        add(ta, BorderLayout.CENTER);
+        add(instruction, BorderLayout.CENTER);
         add(panel, BorderLayout.PAGE_END);
     }
 
     @Override
     public void start() {
         setVisible(true);
-        tf.requestFocus();
+        ta.requestFocus();
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/TrayIcon/AddPopupAfterShowTest/AddPopupAfterShowTest.html	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--
+  @test
+  @bug 8007220
+  @summary The popup menu is not added to the tray icon after it was added to tray
+  @author Petr Pchelko
+  @library ../../regtesthelpers
+  @build Sysout
+  @run applet/manual=yesno AddPopupAfterShowTest.html
+  -->
+<head>
+    <title> AddPopupAfterShowTest </title>
+</head>
+<body>
+
+<h1>AddPopupAfterShowTest<br>Bug ID: 8007220</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="AddPopupAfterShowTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/TrayIcon/AddPopupAfterShowTest/AddPopupAfterShowTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import test.java.awt.regtesthelpers.Sysout;
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+
+public class AddPopupAfterShowTest extends Applet {
+    @Override
+    public void init() {
+        if (!SystemTray.isSupported()) {
+            Sysout.createDialogWithInstructions(new String[]{
+                    "Press PASS, the System Tray is not supported"});
+            return;
+        }
+
+
+        String[] instructions = {
+                "1) The red circle icon was added to the system tray.",
+                "2) Check that a popup menu is opened when the icon is clicked.",
+                "3) If true the test is passed, otherwise failed."};
+        Sysout.createDialogWithInstructions(instructions);
+    }
+
+    @Override
+    public void start() {
+        setSize(200, 200);
+        show();
+
+        createSystemTrayIcon();
+    }
+
+    private static void createSystemTrayIcon() {
+        final TrayIcon trayIcon = new TrayIcon(createTrayIconImage());
+        trayIcon.setImageAutoSize(true);
+
+        try {
+            // Add tray icon to system tray *before* adding popup menu to demonstrate buggy behaviour
+            SystemTray.getSystemTray().add(trayIcon);
+            trayIcon.setPopupMenu(createTrayIconPopupMenu());
+        } catch (final AWTException awte) {
+            awte.printStackTrace();
+        }
+    }
+
+    private static Image createTrayIconImage() {
+        /**
+         * Create a small image of a red circle to use as the icon for the tray icon
+         */
+        int trayIconImageSize = 32;
+        final BufferedImage trayImage = new BufferedImage(trayIconImageSize, trayIconImageSize, BufferedImage.TYPE_INT_ARGB);
+        final Graphics2D trayImageGraphics = (Graphics2D) trayImage.getGraphics();
+
+        trayImageGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+
+        trayImageGraphics.setColor(new Color(255, 255, 255, 0));
+        trayImageGraphics.fillRect(0, 0, trayImage.getWidth(), trayImage.getHeight());
+
+        trayImageGraphics.setColor(Color.red);
+
+        int trayIconImageInset = 4;
+        trayImageGraphics.fillOval(trayIconImageInset,
+                trayIconImageInset,
+                trayImage.getWidth() - 2 * trayIconImageInset,
+                trayImage.getHeight() - 2 * trayIconImageInset);
+
+        trayImageGraphics.setColor(Color.darkGray);
+
+        trayImageGraphics.drawOval(trayIconImageInset,
+                trayIconImageInset,
+                trayImage.getWidth() - 2 * trayIconImageInset,
+                trayImage.getHeight() - 2 * trayIconImageInset);
+
+        return trayImage;
+    }
+
+    private static PopupMenu createTrayIconPopupMenu() {
+        final PopupMenu trayIconPopupMenu = new PopupMenu();
+        final MenuItem popupMenuItem = new MenuItem("TEST PASSED!");
+        trayIconPopupMenu.add(popupMenuItem);
+        return trayIconPopupMenu;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ @test
+  @bug 8007220
+  @summary Reference to the popup leaks after the TrayIcon is removed
+  @author Petr Pchelko
+  @run main/othervm -Xmx50m PopupMenuLeakTest
+ */
+
+import java.awt.*;
+import javax.swing.SwingUtilities;
+import sun.awt.SunToolkit;
+
+import java.awt.image.BufferedImage;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.concurrent.atomic.AtomicReference;
+
+public class PopupMenuLeakTest {
+
+    static final AtomicReference<WeakReference<TrayIcon>> iconWeakReference = new AtomicReference<>();
+    static final AtomicReference<WeakReference<PopupMenu>> popupWeakReference = new AtomicReference<>();
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(PopupMenuLeakTest::createSystemTrayIcon);
+        sleep();
+        // To make the test automatic we explicitly call addNotify on a popup to create the peer
+        SwingUtilities.invokeAndWait(PopupMenuLeakTest::addNotifyPopup);
+        sleep();
+        SwingUtilities.invokeAndWait(PopupMenuLeakTest::removeIcon);
+        sleep();
+        assertCollected(popupWeakReference.get(), "Failed, reference to popup not collected");
+        assertCollected(iconWeakReference.get(), "Failed, reference to tray icon not collected");
+    }
+
+    private static void addNotifyPopup() {
+        PopupMenu menu = popupWeakReference.get().get();
+        if (menu == null) {
+            throw new RuntimeException("Failed: popup collected too early");
+        }
+        menu.addNotify();
+    }
+
+    private static void removeIcon() {
+        TrayIcon icon = iconWeakReference.get().get();
+        if (icon == null) {
+            throw new RuntimeException("Failed: TrayIcon collected too early");
+        }
+        SystemTray.getSystemTray().remove(icon);
+    }
+
+    private static void assertCollected(WeakReference<?> reference, String message) {
+        java.util.List<byte[]> bytes = new ArrayList<>();
+        for (int i = 0; i < 5; i ++) {
+            try {
+                while (true) {
+                    bytes.add(new byte[1024]);
+                }
+            } catch (OutOfMemoryError err) {
+                bytes = new ArrayList<>();
+            }
+        }
+        if (reference.get() != null) {
+            throw new RuntimeException(message);
+        }
+    }
+
+    private static void createSystemTrayIcon() {
+        final TrayIcon trayIcon = new TrayIcon(createTrayIconImage());
+        trayIcon.setImageAutoSize(true);
+
+        try {
+            // Add tray icon to system tray *before* adding popup menu to demonstrate buggy behaviour
+            trayIcon.setPopupMenu(createTrayIconPopupMenu());
+            SystemTray.getSystemTray().add(trayIcon);
+            iconWeakReference.set(new WeakReference<>(trayIcon));
+            popupWeakReference.set(new WeakReference<>(trayIcon.getPopupMenu()));
+        } catch (final AWTException awte) {
+            awte.printStackTrace();
+        }
+    }
+
+    private static Image createTrayIconImage() {
+        /**
+         * Create a small image of a red circle to use as the icon for the tray icon
+         */
+        int trayIconImageSize = 32;
+        final BufferedImage trayImage = new BufferedImage(trayIconImageSize, trayIconImageSize, BufferedImage.TYPE_INT_ARGB);
+        final Graphics2D trayImageGraphics = (Graphics2D) trayImage.getGraphics();
+
+        trayImageGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+
+        trayImageGraphics.setColor(new Color(255, 255, 255, 0));
+        trayImageGraphics.fillRect(0, 0, trayImage.getWidth(), trayImage.getHeight());
+
+        trayImageGraphics.setColor(Color.red);
+
+        int trayIconImageInset = 4;
+        trayImageGraphics.fillOval(trayIconImageInset,
+                trayIconImageInset,
+                trayImage.getWidth() - 2 * trayIconImageInset,
+                trayImage.getHeight() - 2 * trayIconImageInset);
+
+        trayImageGraphics.setColor(Color.darkGray);
+
+        trayImageGraphics.drawOval(trayIconImageInset,
+                trayIconImageInset,
+                trayImage.getWidth() - 2 * trayIconImageInset,
+                trayImage.getHeight() - 2 * trayIconImageInset);
+
+        return trayImage;
+    }
+
+    private static PopupMenu createTrayIconPopupMenu() {
+        final PopupMenu trayIconPopupMenu = new PopupMenu();
+        final MenuItem popupMenuItem = new MenuItem("TEST!");
+        trayIconPopupMenu.add(popupMenuItem);
+        return trayIconPopupMenu;
+    }
+
+    private static void sleep() {
+        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        try {
+            Thread.sleep(100);
+        } catch (InterruptedException ignored) { }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/AlwaysOnTop/TestAlwaysOnTopBeforeShow.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,472 @@
+/*
+ * 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 6236247
+@summary Test that setting of always-on-top flags before showing window works
+@author dom@sparc.spb.su: area=awt.toplevel
+@run main TestAlwaysOnTopBeforeShow
+*/
+
+/**
+ * TestAlwaysOnTopBeforeShow.java
+ *
+ * summary:  Test that always-on-top works in the following situations:
+ * - when set on a window before showing
+ * - when set on a child dialog
+ * - that it doesn't generate focus event when set on an invisible window
+ */
+
+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 ***
+
+public class TestAlwaysOnTopBeforeShow
+{
+
+    //*** test-writer defined static variables go here ***
+
+    private static AtomicBoolean focused = new AtomicBoolean();
+    private static AtomicBoolean pressed = new AtomicBoolean();
+    private static volatile Object pressedTarget;
+    private static void init()
+    {
+        //*** Create instructions for the user here ***
+
+        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+                public void eventDispatched(AWTEvent e) {
+                    if (e.getID() == MouseEvent.MOUSE_PRESSED) {
+                        synchronized(pressed) {
+                            pressed.set(true);
+                            pressedTarget = e.getSource();
+                            pressed.notifyAll();
+                        }
+                    }
+                }
+            }, AWTEvent.MOUSE_EVENT_MASK);
+
+        Frame f = new Frame("always-on-top");
+        f.setBounds(0, 0, 200, 200);
+        f.addFocusListener(new FocusAdapter() {
+                public void focusGained(FocusEvent e) {
+                    synchronized(focused) {
+                        focused.set(true);
+                        focused.notifyAll();
+                    }
+                }
+            });
+
+        f.setAlwaysOnTop(true);
+
+        waitForIdle(1000);
+        if (focused.get()) {
+            throw new RuntimeException("Always-on-top generated focus event");
+        }
+
+        f.setVisible(true);
+
+        waitFocused(f, focused);
+        focused.set(false);
+
+        Frame f2 = new Frame("auxilary");
+        f2.setBounds(100, 0, 200, 100);
+        f2.setVisible(true);
+        f2.toFront();
+        waitForIdle(1000);
+
+        Point location = f.getLocationOnScreen();
+        Dimension size = f.getSize();
+        checkOnTop(f, f2, location.x + size.width / 2, location.y + size.height / 2);
+
+        Dialog d = new Dialog(f, "Always-on-top");
+        d.pack();
+        d.setBounds(0, 0, 100, 100);
+
+        waitForIdle(1000);
+        checkOnTop(f, f2, location.x + size.width / 2, location.y + size.height / 2);
+        waitForIdle(1000);
+
+        focused.set(false);
+        f.setVisible(false);
+        f.setAlwaysOnTop(false);
+        waitForIdle(1000);
+        if (focused.get()) {
+            throw new RuntimeException("Always-on-top generated focus event");
+        }
+
+        TestAlwaysOnTopBeforeShow.pass();
+
+    }//End  init()
+
+    private static void waitForIdle(int mls) {
+        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        try {
+            Thread.sleep(mls);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+    }
+
+    static void waitFocused(Window w, AtomicBoolean b) {
+        try {
+            synchronized(b) {
+                if (w.isFocusOwner()) {
+                    return;
+                }
+                b.wait(3000);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        if (!w.isFocusOwner()) {
+            throw new RuntimeException("Can't make " + w + " focus owner");
+        }
+    }
+
+    static void checkOnTop(Window ontop, Window under, int x, int y) {
+        under.toFront();
+        try {
+            Robot robot = new Robot();
+            robot.mouseMove(x, y);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            synchronized(pressed) {
+                if (pressed.get()) {
+                    if (pressedTarget != ontop) {
+                        throw new RuntimeException("Pressed at wrong location: " + pressedTarget);
+                    }
+                } else {
+                    pressed.wait(5000);
+                }
+            }
+            if (!pressed.get() || pressedTarget != ontop) {
+                throw new RuntimeException("Pressed at wrong location: " + pressedTarget);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /*****************************************************
+     * 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 TestAlwaysOnTopBeforeShow
+
+//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
+
+         TestAlwaysOnTopBeforeShow.pass();
+       }
+      else if( tries == 20 )
+       {
+         //tried too many times without getting enough events so fail
+
+         TestAlwaysOnTopBeforeShow.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 )
+    {
+        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/Window/BackgroundIsNotUpdated/BackgroundIsNotUpdated.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.AWTException;
+import java.awt.Color;
+import java.awt.Frame;
+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
+ */
+public final class BackgroundIsNotUpdated extends Window {
+
+    public BackgroundIsNotUpdated(final Frame owner) {
+        super(owner);
+    }
+
+    @Override
+    public void paint(final Graphics ignored) {
+        // Intentionally left blank
+    }
+
+    @Override
+    public void update(final Graphics ignored) {
+        // Intentionally left blank
+    }
+
+    public static void main(final String[] args) throws AWTException {
+        final Window window = new BackgroundIsNotUpdated(null);
+        window.setSize(300, 300);
+        window.setLocationRelativeTo(null);
+        window.setVisible(true);
+        sleep();
+        window.setBackground(Color.GREEN);
+        sleep();
+        final Robot robot = new Robot();
+        robot.setAutoDelay(200);
+        Point point = window.getLocationOnScreen();
+        Color color = robot.getPixelColor(point.x + window.getWidth() / 2,
+                                          point.y + window.getHeight() / 2);
+        window.dispose();
+        if (!color.equals(Color.GREEN)) {
+            throw new RuntimeException(
+                    "Expected: " + Color.GREEN + " , Actual: " + color);
+        }
+    }
+
+    private static void sleep() {
+        try {
+            ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+            Thread.sleep(1000);
+        } catch (InterruptedException ignored) {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/AcceptDropMultipleTimes/AcceptDropMultipleTimes.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8029979
+ * @summary Checks if acceptDrop() can be called several times
+ * @library ../../regtesthelpers
+ * @build Util
+ * @compile AcceptDropMultipleTimes.java
+ * @run main/othervm AcceptDropMultipleTimes
+ * @author anthony.petrov@oracle.com
+ */
+
+import test.java.awt.regtesthelpers.Util;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.datatransfer.*;
+import java.awt.dnd.*;
+import java.awt.event.InputEvent;
+
+public class AcceptDropMultipleTimes {
+
+    private static final int FRAME_SIZE = 100;
+    private static final int FRAME_LOCATION = 100;
+
+    private static volatile Frame f;
+
+    private static void initAndShowUI() {
+        f = new Frame("Test frame");
+        f.setBounds(FRAME_LOCATION, FRAME_LOCATION, FRAME_SIZE, FRAME_SIZE);
+
+        final DraggablePanel dragSource = new DraggablePanel();
+        dragSource.setBackground(Color.yellow);
+        DropTarget dt = new DropTarget(dragSource, new DropTargetAdapter() {
+            @Override public void drop(DropTargetDropEvent dtde) {
+                // The first call always succeeds
+                dtde.acceptDrop(DnDConstants.ACTION_COPY);
+
+                // The second call should succeed if the fix works
+                dtde.acceptDrop(DnDConstants.ACTION_MOVE);
+
+                dtde.dropComplete(true);
+            }
+        });
+        dragSource.setDropTarget(dt);
+        f.add(dragSource);
+
+        f.setVisible(true);
+    }
+
+    public static void main(String[] args) throws Throwable {
+        try {
+
+            SwingUtilities.invokeAndWait(() -> initAndShowUI());
+
+            Robot r = new Robot();
+            Util.waitForIdle(r);
+            Util.drag(r,
+                    new Point(FRAME_LOCATION + FRAME_SIZE / 3, FRAME_LOCATION + FRAME_SIZE / 3),
+                    new Point(FRAME_LOCATION + FRAME_SIZE / 3 * 2, FRAME_LOCATION + FRAME_SIZE / 3 * 2),
+                    InputEvent.BUTTON1_MASK);
+            Util.waitForIdle(r);
+        } finally {
+            if (f != null) {
+                f.dispose();
+            }
+        }
+    }
+
+    private static class DraggablePanel extends Panel implements DragGestureListener {
+
+        public DraggablePanel() {
+            (new DragSource()).createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY, this);
+        }
+
+        @Override
+        public void dragGestureRecognized(DragGestureEvent dge) {
+            dge.startDrag(Cursor.getDefaultCursor(), new StringSelection("test"));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/BadSerializaionTest/BadSerializationTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,75 @@
+/*
+ * 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 8030050
+ * @summary Validate fields on DnD class deserialization
+ * @author petr.pchelko@oracle.com
+ */
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
+import java.util.stream.Stream;
+
+public class BadSerializationTest {
+
+    private static final String[] badSerialized = new String[] {
+            "badAction",
+            "noEvents",
+            "nullComponent",
+            "nullDragSource",
+            "nullOrigin"
+    };
+
+    private static final String goodSerialized = "good";
+
+    public static void main(String[] args) throws Exception {
+        String testSrc = System.getProperty("test.src") + File.separator;
+        testReadObject(testSrc + goodSerialized, false);
+        Stream.of(badSerialized).forEach(file -> testReadObject(testSrc + file, true));
+    }
+
+    private static void testReadObject(String filename, boolean expectException) {
+        Exception exceptionCaught = null;
+        try (FileInputStream fileInputStream = new FileInputStream(filename);
+             ObjectInputStream ois = new ObjectInputStream(fileInputStream)) {
+            ois.readObject();
+        } catch (InvalidObjectException e) {
+            exceptionCaught = e;
+        } catch (IOException e) {
+            throw new RuntimeException("FAILED: IOException", e);
+        } catch (ClassNotFoundException e) {
+            throw new RuntimeException("FAILED: ClassNotFoundException", e);
+        }
+        if (exceptionCaught != null && !expectException) {
+            throw new RuntimeException("FAILED: UnexpectedException", exceptionCaught);
+        }
+        if (exceptionCaught == null && expectException) {
+            throw new RuntimeException("FAILED: Invalid object was created with no exception");
+        }
+    }
+}
Binary file jdk/test/java/awt/dnd/BadSerializaionTest/badAction has changed
Binary file jdk/test/java/awt/dnd/BadSerializaionTest/good has changed
Binary file jdk/test/java/awt/dnd/BadSerializaionTest/noEvents has changed
Binary file jdk/test/java/awt/dnd/BadSerializaionTest/nullComponent has changed
Binary file jdk/test/java/awt/dnd/BadSerializaionTest/nullDragSource has changed
Binary file jdk/test/java/awt/dnd/BadSerializaionTest/nullOrigin has changed
--- a/jdk/test/java/awt/dnd/Button2DragTest/Button2DragTest.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/java/awt/dnd/Button2DragTest/Button2DragTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,6 +112,7 @@
         Util.drag(robot, startPoint, endPoint, InputEvent.BUTTON2_MASK);
 
         Util.waitForIdle(robot);
+        robot.delay(500);
 
         if (dropSuccess) {
             System.err.println("test passed");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/InterprocessMessages.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public interface InterprocessMessages {
+    final static int EXECUTION_IS_SUCCESSFULL = 0;
+    final static int WRONG_FILES_NUMBER_ON_TARGET = 212;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/SourceFileListFrame.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import test.java.awt.regtesthelpers.Util;
+
+import java.awt.*;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DragGestureEvent;
+import java.awt.dnd.DragGestureListener;
+import java.awt.dnd.DragSource;
+import java.io.File;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+
+class SourceFileListFrame extends Frame implements DragGestureListener {
+
+    private final static int SOURCE_POINT_SHIFT = 3;
+
+    private List list = new List(URIListToFileListBetweenJVMsTest.VISIBLE_RAWS_IN_LIST);
+    private File[] files;
+
+    SourceFileListFrame() {
+        super("Source File List Frame");
+        extractFilesFromTheWorkingDirectory();
+        initList();
+        initGUI();
+        new DragSource().createDefaultDragGestureRecognizer(list,
+                DnDConstants.ACTION_COPY,this);
+    }
+
+    private void extractFilesFromTheWorkingDirectory() {
+        files = new File(System.getProperty("java.home", "")).listFiles();
+    }
+
+    private void initList() {
+        for (File currFile:files) {
+            list.add(currFile.getName());
+        }
+    }
+
+    private void initGUI() {
+        this.addWindowListener(Util.getClosingWindowAdapter());
+        this.setLocation(300,250);
+        this.add(new Panel().add(list));
+        this.pack();
+        this.setVisible(true);
+    }
+
+    int getNextLocationX() {
+        return getX()+getWidth();
+    }
+
+    int getNextLocationY() {
+        return getY();
+    }
+
+    int getDragSourcePointX() {
+        return (int)list.getLocationOnScreen().getX()+(list.getWidth()/2);
+    }
+
+   int getDragSourcePointY() {
+        return (int)list.getLocationOnScreen().getY()+ SOURCE_POINT_SHIFT;
+    }
+
+    int getSourceFilesNumber() {
+        return files.length;
+    }
+
+    public void dragGestureRecognized(DragGestureEvent dge) {
+        java.util.List<URI> uriList = Stream.of(list.getItems())
+                                                .map(File::new)
+                                                .map(File::toURI)
+                                                .collect(Collectors.toList());
+
+        dge.startDrag(null, new URIListTransferable(uriList));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/TargetFileListFrame.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.awt.dnd.*;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.File;
+import java.io.IOException;
+
+class TargetFileListFrame extends Frame implements DropTargetListener {
+
+    private List list = new List(URIListToFileListBetweenJVMsTest.VISIBLE_RAWS_IN_LIST);
+    private int expectationTransferredFilesNumber;
+
+    TargetFileListFrame(Point location, int expectationTransferredFilesNumber) {
+        this.expectationTransferredFilesNumber = expectationTransferredFilesNumber;
+        initGUI(location);
+        setDropTarget(new DropTarget(list, DnDConstants.ACTION_COPY, this));
+    }
+
+    private void initGUI(Point location) {
+        this.setLocation(location);
+        this.addWindowListener(new WindowAdapter() {
+            public void windowClosing(WindowEvent e) {
+                TargetFileListFrame.this.dispose();
+            }
+        });
+        this.add(new Panel().add(list));
+        this.pack();
+        this.setVisible(true);
+    }
+
+    public void dragEnter(DropTargetDragEvent dtde) {
+        if (dtde.getCurrentDataFlavorsAsList().contains(DataFlavor.javaFileListFlavor)) {
+            dtde.acceptDrag(DnDConstants.ACTION_COPY);
+        }
+    }
+
+    public void dragOver(DropTargetDragEvent dtde) {
+        if (dtde.getCurrentDataFlavorsAsList().contains(DataFlavor.javaFileListFlavor)) {
+            dtde.acceptDrag(DnDConstants.ACTION_COPY);
+        }
+    }
+
+    public void dropActionChanged(DropTargetDragEvent dtde) {
+        if (dtde.getCurrentDataFlavorsAsList().contains(DataFlavor.javaFileListFlavor)) {
+            dtde.acceptDrag(DnDConstants.ACTION_COPY);
+        }
+    }
+
+    public void dragExit(DropTargetEvent dte) {}
+
+    public void drop(DropTargetDropEvent dtde) {
+        list.removeAll();
+        dtde.acceptDrop(DnDConstants.ACTION_COPY);
+        java.util.List<File> fileList = extractListOfFiles(dtde);
+        for (File file:fileList) {
+            list.add(file.getName());
+        }
+
+        if (fileList.size() != expectationTransferredFilesNumber)
+        {
+            System.err.println("ERROR: Expected file number:"
+                    + expectationTransferredFilesNumber
+                    + "; Received file number: "
+                    + fileList.size());
+            TargetFileListFrame.this.dispose();
+            System.exit(InterprocessMessages.WRONG_FILES_NUMBER_ON_TARGET);
+        }
+
+        TargetFileListFrame.this.dispose();
+
+    }
+
+    private java.util.List<File> extractListOfFiles(DropTargetDropEvent dtde) {
+        java.util.List<File> fileList = null;
+        try {
+            fileList = (java.util.List<File>)dtde.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
+        } catch (UnsupportedFlavorException | IOException e) {
+            e.printStackTrace();
+        }
+        return fileList;
+    }
+
+    Point getDropTargetPoint() {
+       return new Point((int)list.getLocationOnScreen().getX()+(list.getWidth()/2),
+                        (int)list.getLocationOnScreen().getY()+(list.getHeight()/2));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.html	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,48 @@
+<!--
+ Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--  
+  @test
+  @bug 8029565
+  @summary Conversion of a URI list to File list fails
+  @author Petr Pchelko <petr.pchelko@oracle.com>
+  @library ../../regtesthelpers
+  @library ../../regtesthelpers/process
+  @build Util
+  @build ProcessResults ProcessCommunicator
+  @run applet/othervm URIListToFileListBetweenJVMsTest.html
+
+-->
+<head>
+<title> DnD of File-List across JVM </title>
+</head>
+<body>
+
+<h1>URIListToFileListBetweenJVMsTest<br>Bug ID: 5079469</h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="URIListToFileListBetweenJVMsTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  test
+  @bug 8029565
+  @summary Conversion of a URI list to File list fails
+  @author Petr Pchelko <petr.pchelko@oracle.com>
+  @library ../../regtesthelpers
+  @library ../../regtesthelpers/process
+  @build Util
+  @build ProcessResults ProcessCommunicator
+  @run applet/othervm URIListToFileListBetweenJVMsTest.html
+ */
+
+/**
+ * URIListToFileListBetweenJVMsTest.java
+ *
+ * summary: DnD of File-List across JVM adds two empty items to the list
+ */
+
+import test.java.awt.regtesthelpers.Util;
+import test.java.awt.regtesthelpers.process.ProcessCommunicator;
+import test.java.awt.regtesthelpers.process.ProcessResults;
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.InputEvent;
+
+import static java.lang.Thread.sleep;
+
+public class URIListToFileListBetweenJVMsTest extends Applet {
+
+    // information related to the test in common
+    static int VISIBLE_RAWS_IN_LIST=15;
+
+    public void init() {
+        setLayout(new BorderLayout());
+    }
+
+    public void start() {
+
+        SourceFileListFrame sourceFrame = new SourceFileListFrame();
+
+        Util.waitForIdle(null);
+
+        String [] args = new String [] {
+                String.valueOf(sourceFrame.getNextLocationX()),
+                String.valueOf(sourceFrame.getNextLocationY()),
+                String.valueOf(sourceFrame.getDragSourcePointX()),
+                String.valueOf(sourceFrame.getDragSourcePointY()),
+                String.valueOf(sourceFrame.getSourceFilesNumber())
+        };
+
+        ProcessResults processResults = ProcessCommunicator.executeChildProcess(this.getClass(), args);
+
+        verifyTestResults(processResults);
+
+    }
+
+    private static void verifyTestResults(ProcessResults processResults) {
+        if ( InterprocessMessages.WRONG_FILES_NUMBER_ON_TARGET == processResults.getExitValue()) {
+            processResults.printProcessErrorOutput(System.err);
+            throw new RuntimeException("TEST IS FAILED: Target has recieved wrong number of files.");
+        }
+        processResults.verifyStdErr(System.err);
+        processResults.verifyProcessExitValue(System.err);
+        processResults.printProcessStandartOutput(System.out);
+    }
+
+    //We cannot make an instance of the applet without the default constructor
+    public URIListToFileListBetweenJVMsTest() {
+        super();
+    }
+
+    //We need in this constructor to pass frame position between JVMs
+    public URIListToFileListBetweenJVMsTest(Point targetFrameLocation,
+                                            Point dragSourcePoint,
+                                            int transferredFilesNumber) throws InterruptedException
+    {
+        TargetFileListFrame targetFrame = new TargetFileListFrame(targetFrameLocation, transferredFilesNumber);
+
+        Util.waitForIdle(null);
+
+        final Robot robot = Util.createRobot();
+
+        robot.mouseMove((int)dragSourcePoint.getX(),(int)dragSourcePoint.getY());
+        sleep(100);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        sleep(100);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        sleep(100);
+
+        Util.drag(robot, dragSourcePoint, targetFrame.getDropTargetPoint(), InputEvent.BUTTON1_MASK);
+
+    }
+
+    enum InterprocessArguments {
+        TARGET_FRAME_X_POSITION_ARGUMENT,
+        TARGET_FRAME_Y_POSITION_ARGUMENT,
+        DRAG_SOURCE_POINT_X_ARGUMENT,
+        DRAG_SOURCE_POINT_Y_ARGUMENT,
+        FILES_IN_THE_LIST_NUMBER_ARGUMENT;
+
+        int extract (String [] args) {
+            return Integer.parseInt(args[this.ordinal()]);
+        }
+    }
+
+    public static void main (String [] args) throws Exception {
+        Point dragSourcePoint = new Point(InterprocessArguments.DRAG_SOURCE_POINT_X_ARGUMENT.extract(args),
+                InterprocessArguments.DRAG_SOURCE_POINT_Y_ARGUMENT.extract(args));
+        Point targetFrameLocation = new Point(InterprocessArguments.TARGET_FRAME_X_POSITION_ARGUMENT.extract(args),
+                InterprocessArguments.TARGET_FRAME_Y_POSITION_ARGUMENT.extract(args));
+        int transferredFilesNumber = InterprocessArguments.FILES_IN_THE_LIST_NUMBER_ARGUMENT.extract(args);
+
+        new URIListToFileListBetweenJVMsTest(targetFrameLocation, dragSourcePoint, transferredFilesNumber);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListTransferable.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.IOException;
+import java.net.URI;
+import java.util.List;
+
+class URIListTransferable implements Transferable {
+
+    private final DataFlavor supportedFlavor;
+
+    private List<URI> list;
+
+    public URIListTransferable(List<URI> list) {
+        try {
+            this.supportedFlavor = new DataFlavor("text/uri-list;class=java.lang.String");
+        } catch (ClassNotFoundException e) {
+            throw new RuntimeException("FAILED: could not create a DataFlavor");
+        }
+        this.list = list;
+    }
+
+    public DataFlavor[] getTransferDataFlavors() {
+        return new DataFlavor[] { supportedFlavor };
+    }
+
+    public boolean isDataFlavorSupported(DataFlavor flavor) {
+        return supportedFlavor.equals(flavor);
+    }
+
+    public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
+        if (supportedFlavor.equals(flavor)) {
+            return list.stream()
+                    .map(URI::toASCIIString)
+                    .collect(StringBuilder::new,
+                             (builder, uri)-> { builder.append(uri).append("\r\n"); },
+                             StringBuilder::append).toString();
+        }
+        throw new UnsupportedFlavorException(flavor);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/URLDragTest/URLDragTest.html	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--  
+  @test
+  @bug 8031964
+  @summary Dragging images from the browser does not work
+  @author Petr Pchelko : area=dnd
+  @library ../../regtesthelpers
+  @build Sysout
+  @run applet/manual=yesno URLDragTest.html
+-->
+<head>
+<title> DnD of URL across JVM </title>
+</head>
+<body>
+
+<h1>URLDragTest<br>Bug ID: 8031964</h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="URLDragTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/URLDragTest/URLDragTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  test
+  @bug 8031964
+  @summary Dragging images from the browser does not work
+  @author Petr Pchelko : area=dnd
+  @library ../../regtesthelpers
+  @build Sysout
+  @run applet/manual=yesno URLDragTest.html
+*/
+
+import test.java.awt.regtesthelpers.Sysout;
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DropTarget;
+import java.awt.dnd.DropTargetAdapter;
+import java.awt.dnd.DropTargetDragEvent;
+import java.awt.dnd.DropTargetDropEvent;
+
+public class URLDragTest extends Applet {
+
+
+    @Override
+    public void init() {
+        setBackground(Color.red);
+        setDropTarget(new DropTarget(this,
+                DnDConstants.ACTION_COPY,
+                new DropTargetAdapter() {
+                    @Override
+                    public void dragEnter(DropTargetDragEvent dtde) {
+                        dtde.acceptDrag(DnDConstants.ACTION_COPY);
+                    }
+
+                    @Override
+                    public void dragOver(DropTargetDragEvent dtde) {
+                        dtde.acceptDrag(DnDConstants.ACTION_COPY);
+                    }
+
+                    @Override
+                    public void drop(DropTargetDropEvent dtde) {
+                        dtde.acceptDrop(DnDConstants.ACTION_COPY);
+                        dtde.getCurrentDataFlavorsAsList()
+                                .stream()
+                                .map(DataFlavor::toString)
+                                .forEach(Sysout::println);
+                    }
+                }));
+
+        String[] instructions = {
+                "1) Open the browser.",
+                "2) Drag any image from the browser page to the red square",
+                "3) When the image is dropped you should se the list of available DataFlavors",
+                "4) If you see application/x-java-url and text/uri-list flavors - test PASSED",
+                "5) Otherwise the test is FAILED"};
+        Sysout.createDialogWithInstructions(instructions);
+    }
+
+    @Override
+    public void start() {
+        setSize(200, 200);
+        setVisible(true);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/MultiResolutionImageTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,620 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.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.io.File;
+import java.lang.reflect.Method;
+import java.net.URL;
+import javax.imageio.ImageIO;
+import sun.awt.OSInfo;
+import sun.awt.SunHints;
+import java.awt.MediaTracker;
+import java.awt.geom.AffineTransform;
+import java.awt.image.ImageObserver;
+import java.util.Arrays;
+import java.util.List;
+import javax.swing.JPanel;
+import sun.awt.SunToolkit;
+import sun.awt.image.MultiResolutionImage;
+
+/**
+ * @test
+ * @bug 8011059
+ * @author Alexander Scherbatiy
+ * @summary [macosx] Make JDK demos look perfect on retina displays
+ * @run main MultiResolutionImageTest CUSTOM
+ * @run main MultiResolutionImageTest TOOLKIT_PREPARE
+ * @run main MultiResolutionImageTest TOOLKIT_LOAD
+ * @run main MultiResolutionImageTest TOOLKIT
+ */
+public class MultiResolutionImageTest {
+
+    private static final int IMAGE_WIDTH = 300;
+    private static final int IMAGE_HEIGHT = 200;
+    private static final Color COLOR_1X = Color.GREEN;
+    private static final Color COLOR_2X = Color.BLUE;
+    private static final String IMAGE_NAME_1X = "image.png";
+    private static final String IMAGE_NAME_2X = "image@2x.png";
+
+    public static void main(String[] args) throws Exception {
+
+        System.out.println("args: " + args.length);
+
+        if (args.length == 0) {
+            throw new RuntimeException("Not found a test");
+        }
+
+        String test = args[0];
+
+        System.out.println("TEST: " + test);
+        System.out.println("CHECK OS: " + checkOS());
+
+        if ("CUSTOM".equals(test)) {
+            testCustomMultiResolutionImage();
+        } else if (checkOS()) {
+            switch (test) {
+                case "CUSTOM":
+                    break;
+                case "TOOLKIT_PREPARE":
+                    testToolkitMultiResolutionImagePrepare();
+                    break;
+                case "TOOLKIT_LOAD":
+                    testToolkitMultiResolutionImageLoad();
+                    break;
+                case "TOOLKIT":
+                    testToolkitMultiResolutionImage();
+                    testImageNameTo2xParsing();
+                    break;
+                default:
+                    throw new RuntimeException("Unknown test: " + test);
+            }
+        }
+    }
+
+    static boolean checkOS() {
+        return OSInfo.getOSType() == OSInfo.OSType.MACOSX;
+    }
+
+    public static void testCustomMultiResolutionImage() {
+        testCustomMultiResolutionImage(false);
+        testCustomMultiResolutionImage(true);
+    }
+
+    public static void testCustomMultiResolutionImage(boolean enableImageScaling) {
+
+        Image image = new MultiResolutionBufferedImage();
+
+        // Same image size
+        BufferedImage bufferedImage = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT,
+                BufferedImage.TYPE_INT_RGB);
+        Graphics2D g2d = (Graphics2D) bufferedImage.getGraphics();
+        setImageScalingHint(g2d, enableImageScaling);
+        g2d.drawImage(image, 0, 0, null);
+        checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 4, 3 * IMAGE_HEIGHT / 4), false);
+
+        // Twice image size
+        bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT,
+                BufferedImage.TYPE_INT_RGB);
+        g2d = (Graphics2D) bufferedImage.getGraphics();
+        setImageScalingHint(g2d, enableImageScaling);
+        g2d.drawImage(image, 0, 0, 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null);
+        checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
+
+        // Scale 2x
+        bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+        g2d = (Graphics2D) bufferedImage.getGraphics();
+        setImageScalingHint(g2d, enableImageScaling);
+        g2d.scale(2, 2);
+        g2d.drawImage(image, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null);
+        checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
+
+        // Rotate
+        bufferedImage = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT,
+                BufferedImage.TYPE_INT_RGB);
+        g2d = (Graphics2D) bufferedImage.getGraphics();
+        setImageScalingHint(g2d, enableImageScaling);
+        g2d.drawImage(image, 0, 0, null);
+        g2d.rotate(Math.PI / 4);
+        checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 4, 3 * IMAGE_HEIGHT / 4), false);
+
+        // Scale 2x and Rotate
+        bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+        g2d = (Graphics2D) bufferedImage.getGraphics();
+        setImageScalingHint(g2d, enableImageScaling);
+        g2d.scale(-2, 2);
+        g2d.rotate(-Math.PI / 10);
+        g2d.drawImage(image, -IMAGE_WIDTH, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null);
+        checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
+
+        // General Transform
+        bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+        g2d = (Graphics2D) bufferedImage.getGraphics();
+        setImageScalingHint(g2d, enableImageScaling);
+        float delta = 0.05f;
+        float cos = 1 - delta * delta / 2;
+        float sin = 1 + delta;
+        AffineTransform transform = new AffineTransform(2 * cos, 0.1, 0.3, -2 * sin, 10, -5);
+        g2d.setTransform(transform);
+        g2d.drawImage(image, 0, -IMAGE_HEIGHT, IMAGE_WIDTH, IMAGE_HEIGHT, null);
+        checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
+
+        int D = 10;
+        // From Source to small Destination region
+        bufferedImage = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+        g2d = (Graphics2D) bufferedImage.getGraphics();
+        setImageScalingHint(g2d, enableImageScaling);
+        g2d.drawImage(image, IMAGE_WIDTH / 2, IMAGE_HEIGHT / 2, IMAGE_WIDTH - D, IMAGE_HEIGHT - D,
+                D, D, IMAGE_WIDTH - D, IMAGE_HEIGHT - D, null);
+        checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 4, 3 * IMAGE_HEIGHT / 4), false);
+
+        // From Source to large Destination region
+        bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+        g2d = (Graphics2D) bufferedImage.getGraphics();
+        setImageScalingHint(g2d, enableImageScaling);
+        g2d.drawImage(image, D, D, 2 * IMAGE_WIDTH - D, 2 * IMAGE_HEIGHT - D,
+                IMAGE_WIDTH / 2, IMAGE_HEIGHT / 2, IMAGE_WIDTH - D, IMAGE_HEIGHT - D, null);
+        checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
+    }
+
+    static class MultiResolutionBufferedImage extends BufferedImage
+            implements MultiResolutionImage {
+
+        Image highResolutionImage;
+
+        public MultiResolutionBufferedImage() {
+            super(IMAGE_WIDTH, IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+            highResolutionImage = new BufferedImage(
+                    2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+            draw(getGraphics(), 1);
+            draw(highResolutionImage.getGraphics(), 2);
+        }
+
+        void draw(Graphics graphics, float resolution) {
+            Graphics2D g2 = (Graphics2D) graphics;
+            g2.scale(resolution, resolution);
+            g2.setColor((resolution == 1) ? COLOR_1X : COLOR_2X);
+            g2.fillRect(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT);
+        }
+
+        @Override
+        public Image getResolutionVariant(int width, int height) {
+            return ((width <= getWidth() && height <= getHeight()))
+                    ? this : highResolutionImage;
+        }
+
+        @Override
+        public List<Image> getResolutionVariants() {
+            return Arrays.asList(this, highResolutionImage);
+        }
+    }
+
+    static void testToolkitMultiResolutionImagePrepare() throws Exception {
+
+        generateImages();
+
+        File imageFile = new File(IMAGE_NAME_1X);
+        String fileName = imageFile.getAbsolutePath();
+
+        Image image = Toolkit.getDefaultToolkit().getImage(fileName);
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        toolkit.prepareImage(image, IMAGE_WIDTH, IMAGE_HEIGHT, new LoadImageObserver(image));
+
+        testToolkitMultiResolutionImageLoad(image);
+    }
+
+    static void testToolkitMultiResolutionImageLoad() throws Exception {
+
+        generateImages();
+
+        File imageFile = new File(IMAGE_NAME_1X);
+        String fileName = imageFile.getAbsolutePath();
+        Image image = Toolkit.getDefaultToolkit().getImage(fileName);
+        testToolkitMultiResolutionImageLoad(image);
+    }
+
+    static void testToolkitMultiResolutionImageLoad(Image image) throws Exception {
+
+        MediaTracker tracker = new MediaTracker(new JPanel());
+        tracker.addImage(image, 0);
+        tracker.waitForID(0);
+        if (tracker.isErrorAny()) {
+            throw new RuntimeException("Error during image loading");
+        }
+        tracker.removeImage(image, 0);
+
+        testImageLoaded(image);
+
+        int w = image.getWidth(null);
+        int h = image.getHeight(null);
+
+        Image resolutionVariant = ((MultiResolutionImage) image)
+                .getResolutionVariant(2 * w, 2 * h);
+
+        if (image == resolutionVariant) {
+            throw new RuntimeException("Resolution variant is not loaded");
+        }
+
+        testImageLoaded(resolutionVariant);
+    }
+
+    static void testImageLoaded(Image image) {
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+        int flags = toolkit.checkImage(image, IMAGE_WIDTH, IMAGE_WIDTH, new SilentImageObserver());
+        if ((flags & (ImageObserver.FRAMEBITS | ImageObserver.ALLBITS)) == 0) {
+            throw new RuntimeException("Image is not loaded!");
+        }
+    }
+
+    static class SilentImageObserver implements ImageObserver {
+
+        @Override
+        public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
+            throw new RuntimeException("Observer should not be called!");
+        }
+    }
+
+    static class LoadImageObserver implements ImageObserver {
+
+        Image image;
+
+        public LoadImageObserver(Image image) {
+            this.image = image;
+        }
+
+        @Override
+        public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
+
+            if (image != img) {
+                throw new RuntimeException("Original image is not passed to the observer");
+            }
+
+            if ((infoflags & ImageObserver.WIDTH) != 0) {
+                if (width != IMAGE_WIDTH) {
+                    throw new RuntimeException("Original width is not passed to the observer");
+                }
+            }
+
+            if ((infoflags & ImageObserver.HEIGHT) != 0) {
+                if (height != IMAGE_HEIGHT) {
+                    throw new RuntimeException("Original height is not passed to the observer");
+                }
+            }
+
+            return (infoflags & ALLBITS) == 0;
+        }
+
+    }
+
+    static void testToolkitMultiResolutionImage() throws Exception {
+
+        generateImages();
+
+        File imageFile = new File(IMAGE_NAME_1X);
+        String fileName = imageFile.getAbsolutePath();
+        URL url = imageFile.toURI().toURL();
+        testToolkitMultiResolutionImageChache(fileName, url);
+
+        Image image = Toolkit.getDefaultToolkit().getImage(fileName);
+        testToolkitImageObserver(image);
+        testToolkitMultiResolutionImage(image, false);
+        testToolkitMultiResolutionImage(image, true);
+
+        image = Toolkit.getDefaultToolkit().getImage(url);
+        testToolkitImageObserver(image);
+        testToolkitMultiResolutionImage(image, false);
+        testToolkitMultiResolutionImage(image, true);
+    }
+
+    static void testToolkitMultiResolutionImageChache(String fileName, URL url) {
+
+        Image img1 = Toolkit.getDefaultToolkit().getImage(fileName);
+        if (!(img1 instanceof MultiResolutionImage)) {
+            throw new RuntimeException("Not a MultiResolutionImage");
+        }
+
+        Image img2 = Toolkit.getDefaultToolkit().getImage(fileName);
+        if (img1 != img2) {
+            throw new RuntimeException("Image is not cached");
+        }
+
+        img1 = Toolkit.getDefaultToolkit().getImage(url);
+        if (!(img1 instanceof MultiResolutionImage)) {
+            throw new RuntimeException("Not a MultiResolutionImage");
+        }
+
+        img2 = Toolkit.getDefaultToolkit().getImage(url);
+        if (img1 != img2) {
+            throw new RuntimeException("Image is not cached");
+        }
+    }
+
+    static void testToolkitMultiResolutionImage(Image image, boolean enableImageScaling)
+            throws Exception {
+
+        MediaTracker tracker = new MediaTracker(new JPanel());
+        tracker.addImage(image, 0);
+        tracker.waitForID(0);
+        if (tracker.isErrorAny()) {
+            throw new RuntimeException("Error during image loading");
+        }
+
+        final BufferedImage bufferedImage1x = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT,
+                BufferedImage.TYPE_INT_RGB);
+        Graphics2D g1x = (Graphics2D) bufferedImage1x.getGraphics();
+        setImageScalingHint(g1x, false);
+        g1x.drawImage(image, 0, 0, null);
+        checkColor(bufferedImage1x.getRGB(3 * IMAGE_WIDTH / 4, 3 * IMAGE_HEIGHT / 4), false);
+
+        Image resolutionVariant = ((MultiResolutionImage) image).
+                getResolutionVariant(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT);
+
+        if (resolutionVariant == null) {
+            throw new RuntimeException("Resolution variant is null");
+        }
+
+        MediaTracker tracker2x = new MediaTracker(new JPanel());
+        tracker2x.addImage(resolutionVariant, 0);
+        tracker2x.waitForID(0);
+        if (tracker2x.isErrorAny()) {
+            throw new RuntimeException("Error during scalable image loading");
+        }
+
+        final BufferedImage bufferedImage2x = new BufferedImage(2 * IMAGE_WIDTH,
+                2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g2x = (Graphics2D) bufferedImage2x.getGraphics();
+        setImageScalingHint(g2x, enableImageScaling);
+        g2x.drawImage(image, 0, 0, 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null);
+        checkColor(bufferedImage2x.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
+
+        if (!(image instanceof MultiResolutionImage)) {
+            throw new RuntimeException("Not a MultiResolutionImage");
+        }
+
+        MultiResolutionImage multiResolutionImage = (MultiResolutionImage) image;
+
+        Image image1x = multiResolutionImage.getResolutionVariant(IMAGE_WIDTH, IMAGE_HEIGHT);
+        Image image2x = multiResolutionImage.getResolutionVariant(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT);
+
+        if (image1x.getWidth(null) * 2 != image2x.getWidth(null)
+                || image1x.getHeight(null) * 2 != image2x.getHeight(null)) {
+            throw new RuntimeException("Wrong resolution variant size");
+        }
+    }
+
+    static void testToolkitImageObserver(final Image image) {
+
+        ImageObserver observer = new ImageObserver() {
+
+            @Override
+            public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
+
+                if (img != image) {
+                    throw new RuntimeException("Wrong image in observer");
+                }
+
+                if ((infoflags & (ImageObserver.ERROR | ImageObserver.ABORT)) != 0) {
+                    throw new RuntimeException("Error during image loading");
+                }
+
+                return (infoflags & ImageObserver.ALLBITS) == 0;
+
+            }
+        };
+
+        final BufferedImage bufferedImage2x = new BufferedImage(2 * IMAGE_WIDTH,
+                2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g2x = (Graphics2D) bufferedImage2x.getGraphics();
+        setImageScalingHint(g2x, true);
+
+        g2x.drawImage(image, 0, 0, 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, observer);
+
+    }
+
+    static void setImageScalingHint(Graphics2D g2d, boolean enableImageScaling) {
+        g2d.setRenderingHint(SunHints.KEY_RESOLUTION_VARIANT, enableImageScaling
+                ? SunHints.VALUE_RESOLUTION_VARIANT_ON
+                : SunHints.VALUE_RESOLUTION_VARIANT_OFF);
+    }
+
+    static void checkColor(int rgb, boolean isImageScaled) {
+
+        if (!isImageScaled && COLOR_1X.getRGB() != rgb) {
+            throw new RuntimeException("Wrong 1x color: " + new Color(rgb));
+        }
+
+        if (isImageScaled && COLOR_2X.getRGB() != rgb) {
+            throw new RuntimeException("Wrong 2x color" + new Color(rgb));
+        }
+    }
+
+    static void generateImages() throws Exception {
+        if (!new File(IMAGE_NAME_1X).exists()) {
+            generateImage(1);
+        }
+
+        if (!new File(IMAGE_NAME_2X).exists()) {
+            generateImage(2);
+        }
+    }
+
+    static void generateImage(int scale) throws Exception {
+        BufferedImage image = new BufferedImage(scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT,
+                BufferedImage.TYPE_INT_RGB);
+        Graphics g = image.getGraphics();
+        g.setColor(scale == 1 ? COLOR_1X : COLOR_2X);
+        g.fillRect(0, 0, scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT);
+        File file = new File(scale == 1 ? IMAGE_NAME_1X : IMAGE_NAME_2X);
+        ImageIO.write(image, "png", file);
+    }
+
+    static void testImageNameTo2xParsing() throws Exception {
+
+        for (String[] testNames : TEST_FILE_NAMES) {
+            String testName = testNames[0];
+            String goldenName = testNames[1];
+            String resultName = getTestScaledImageName(testName);
+
+            if (!isValidPath(testName) && resultName == null) {
+                continue;
+            }
+
+            if (goldenName.equals(resultName)) {
+                continue;
+            }
+
+            throw new RuntimeException("Test name " + testName
+                    + ", result name: " + resultName);
+        }
+
+        for (URL[] testURLs : TEST_URLS) {
+            URL testURL = testURLs[0];
+            URL goldenURL = testURLs[1];
+            URL resultURL = getTestScaledImageURL(testURL);
+
+            if (!isValidPath(testURL.getPath()) && resultURL == null) {
+                continue;
+            }
+
+            if (goldenURL.equals(resultURL)) {
+                continue;
+            }
+
+            throw new RuntimeException("Test url: " + testURL
+                    + ", result url: " + resultURL);
+        }
+
+    }
+
+    static URL getTestScaledImageURL(URL url) throws Exception {
+        Method method = getScalableImageMethod("getScaledImageURL", URL.class);
+        return (URL) method.invoke(null, url);
+    }
+
+    static String getTestScaledImageName(String name) throws Exception {
+        Method method = getScalableImageMethod("getScaledImageName", String.class);
+        return (String) method.invoke(null, name);
+    }
+
+    private static boolean isValidPath(String path) {
+        return !path.isEmpty() && !path.endsWith("/") && !path.endsWith(".")
+                && !path.contains("@2x");
+    }
+
+    private static Method getScalableImageMethod(String name,
+            Class... parameterTypes) throws Exception {
+        Toolkit toolkit = Toolkit.getDefaultToolkit();
+        Method method = toolkit.getClass().getDeclaredMethod(name, parameterTypes);
+        method.setAccessible(true);
+        return method;
+    }
+    private static final String[][] TEST_FILE_NAMES;
+    private static final URL[][] TEST_URLS;
+
+    static {
+        TEST_FILE_NAMES = new String[][]{
+            {"", null},
+            {".", null},
+            {"..", null},
+            {"/", null},
+            {"/.", null},
+            {"dir/", null},
+            {"dir/.", null},
+            {"aaa@2x.png", null},
+            {"/dir/aaa@2x.png", null},
+            {"image", "image@2x"},
+            {"image.ext", "image@2x.ext"},
+            {"image.aaa.ext", "image.aaa@2x.ext"},
+            {"dir/image", "dir/image@2x"},
+            {"dir/image.ext", "dir/image@2x.ext"},
+            {"dir/image.aaa.ext", "dir/image.aaa@2x.ext"},
+            {"dir/aaa.bbb/image", "dir/aaa.bbb/image@2x"},
+            {"dir/aaa.bbb/image.ext", "dir/aaa.bbb/image@2x.ext"},
+            {"dir/aaa.bbb/image.ccc.ext", "dir/aaa.bbb/image.ccc@2x.ext"},
+            {"/dir/image", "/dir/image@2x"},
+            {"/dir/image.ext", "/dir/image@2x.ext"},
+            {"/dir/image.aaa.ext", "/dir/image.aaa@2x.ext"},
+            {"/dir/aaa.bbb/image", "/dir/aaa.bbb/image@2x"},
+            {"/dir/aaa.bbb/image.ext", "/dir/aaa.bbb/image@2x.ext"},
+            {"/dir/aaa.bbb/image.ccc.ext", "/dir/aaa.bbb/image.ccc@2x.ext"}
+        };
+        try {
+            TEST_URLS = new URL[][]{
+                // file
+                {new URL("file:/aaa"), new URL("file:/aaa@2x")},
+                {new URL("file:/aaa.ext"), new URL("file:/aaa@2x.ext")},
+                {new URL("file:/aaa.bbb.ext"), new URL("file:/aaa.bbb@2x.ext")},
+                {new URL("file:/ccc/aaa.bbb.ext"),
+                    new URL("file:/ccc/aaa.bbb@2x.ext")},
+                {new URL("file:/ccc.ddd/aaa.bbb.ext"),
+                    new URL("file:/ccc.ddd/aaa.bbb@2x.ext")},
+                {new URL("file:///~/image"), new URL("file:///~/image@2x")},
+                {new URL("file:///~/image.ext"),
+                    new URL("file:///~/image@2x.ext")},
+                // http
+                {new URL("http://www.test.com"), null},
+                {new URL("http://www.test.com/"), null},
+                {new URL("http://www.test.com///"), null},
+                {new URL("http://www.test.com/image"),
+                    new URL("http://www.test.com/image@2x")},
+                {new URL("http://www.test.com/image.ext"),
+                    new URL("http://www.test.com/image@2x.ext")},
+                {new URL("http://www.test.com/dir/image"),
+                    new URL("http://www.test.com/dir/image@2x")},
+                {new URL("http://www.test.com:80/dir/image.aaa.ext"),
+                    new URL("http://www.test.com:80/dir/image.aaa@2x.ext")},
+                {new URL("http://www.test.com:8080/dir/image.aaa.ext"),
+                    new URL("http://www.test.com:8080/dir/image.aaa@2x.ext")},
+                // jar
+                {new URL("jar:file:/dir/Java2D.jar!/image"),
+                    new URL("jar:file:/dir/Java2D.jar!/image@2x")},
+                {new URL("jar:file:/dir/Java2D.jar!/image.aaa.ext"),
+                    new URL("jar:file:/dir/Java2D.jar!/image.aaa@2x.ext")},
+                {new URL("jar:file:/dir/Java2D.jar!/images/image"),
+                    new URL("jar:file:/dir/Java2D.jar!/images/image@2x")},
+                {new URL("jar:file:/dir/Java2D.jar!/images/image.ext"),
+                    new URL("jar:file:/dir/Java2D.jar!/images/image@2x.ext")},
+                {new URL("jar:file:/aaa.bbb/Java2D.jar!/images/image.ext"),
+                    new URL("jar:file:/aaa.bbb/Java2D.jar!/images/image@2x.ext")},
+                {new URL("jar:file:/dir/Java2D.jar!/aaa.bbb/image.ext"),
+                    new URL("jar:file:/dir/Java2D.jar!/aaa.bbb/image@2x.ext")},};
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    static class PreloadedImageObserver implements ImageObserver {
+
+        @Override
+        public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
+            throw new RuntimeException("Image should be already preloaded");
+        }
+    }
+}
--- a/jdk/test/java/awt/regtesthelpers/Util.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/java/awt/regtesthelpers/Util.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,7 @@
 import java.awt.IllegalComponentStateException;
 import java.awt.AWTException;
 import java.awt.AWTEvent;
+import java.awt.Color;
 
 import java.awt.event.InputEvent;
 import java.awt.event.WindowAdapter;
@@ -184,6 +185,57 @@
         }
     }
 
+    /**
+     * Tests whether screen pixel has the expected color performing several
+     * attempts. This method is useful for asynchronous window manager where
+     * it's impossible to determine when drawing actually takes place.
+     *
+     * @param x X position of pixel
+     * @param y Y position of pixel
+     * @param color expected color
+     * @param attempts number of attempts to undertake
+     * @param delay delay before each attempt
+     * @param robot a robot to use for retrieving pixel color
+     * @return true if pixel color matches the color expected, otherwise false
+     */
+    public static boolean testPixelColor(int x, int y, final Color color, int attempts, int delay, final Robot robot) {
+        while (attempts-- > 0) {
+            robot.delay(delay);
+            Color screen = robot.getPixelColor(x, y);
+            if (screen.equals(color)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Tests whether the area within boundaries has the expected color
+     * performing several attempts. This method is useful for asynchronous
+     * window manager where it's impossible to determine when drawing actually
+     * takes place.
+     *
+     * @param bounds position of area
+     * @param color expected color
+     * @param attempts number of attempts to undertake
+     * @param delay delay before each attempt
+     * @param robot a robot to use for retrieving pixel color
+     * @return true if area color matches the color expected, otherwise false
+     */
+    public static boolean testBoundsColor(final Rectangle bounds, final Color color, int attempts, int delay, final Robot robot) {
+        int right = bounds.x + bounds.width - 1;
+        int bottom = bounds.y + bounds.height - 1;
+        while (attempts-- > 0) {
+            if (testPixelColor(bounds.x, bounds.y, color, 1, delay, robot)
+                && testPixelColor(right, bounds.y, color, 1, 0, robot)
+                && testPixelColor(right, bottom, color, 1, 0, robot)
+                && testPixelColor(bounds.x, bottom, color, 1, 0, robot)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     public static void waitForIdle(final Robot robot) {
         // we do not use robot for now, use SunToolkit.realSync() instead
         ((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync();
--- a/jdk/test/java/beans/Introspector/Test4168833.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/java/beans/Introspector/Test4168833.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2007, 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
@@ -23,10 +23,11 @@
 
 /*
  * @test
- * @bug 4168833
+ * @bug 4168833 8034085
  * @summary Tests that Introspector does not create IndexedPropertyDescriptor
  *          from non-indexed PropertyDescriptor
  * @author Mark Davidson
+ * @author Sergey Malenkov
  */
 
 import java.awt.Color;
@@ -42,10 +43,6 @@
  */
 public class Test4168833 {
     public static void main(String[] args) throws Exception {
-        IndexedPropertyDescriptor ipd = BeanUtils.getIndexedPropertyDescriptor(Base.class, "prop");
-        if (!ipd.getIndexedPropertyType().equals(Dimension.class)) {
-            error(ipd, "Base.prop property should a Dimension");
-        }
         // When the Sub class is introspected,
         // the property type should be color.
         // The complete "classic" set of properties
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/Introspector/Test8034085.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,236 @@
+/*
+ * 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.Window;
+import java.beans.IndexedPropertyDescriptor;
+import java.beans.PropertyDescriptor;
+
+/*
+ * @test
+ * @bug 8034085
+ * @summary Tests that Introspector ignores indexed getter and setter for incorrect types
+ * @author Sergey Malenkov
+ */
+
+public class Test8034085 {
+    public static final StringBuilder ERROR = new StringBuilder();
+
+    public static void main(String[] args) {
+        test(Window.class, false, true, false, false);
+
+        test(Bean0000.class, false, false, false, false);
+        test(Bean0001.class, false, false, false, true);
+        test(Bean0010.class, false, false, true, false);
+        test(Bean0011.class, false, false, true, true);
+        test(Bean0100.class, false, true, false, false);
+        test(Bean0101.class, false, true, false, false);
+        test(Bean0110.class, false, true, false, false);
+        test(Bean0111.class, false, true, false, false);
+        test(Bean1000.class, true, false, false, false);
+        test(Bean1001.class, true, false, false, false);
+        test(Bean1010.class, true, false, false, false);
+        test(Bean1011.class, true, false, false, false);
+        test(Bean1100.class, true, true, false, false);
+        test(Bean1101.class, true, true, false, false);
+        test(Bean1110.class, true, true, false, false);
+        test(Bean1111.class, true, true, false, false);
+
+        if (0 < ERROR.length()) {
+            throw new Error(ERROR.toString());
+        }
+    }
+
+    private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
+        PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
+        if (pd != null) {
+            test(type, "read", read, null != pd.getReadMethod());
+            test(type, "write", write, null != pd.getWriteMethod());
+            if (pd instanceof IndexedPropertyDescriptor) {
+                IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
+                test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
+                test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
+            } else if (readIndexed || writeIndexed) {
+                error(type, "indexed property does not exist");
+            }
+        } else if (read || write || readIndexed || writeIndexed) {
+            error(type, "property does not exist");
+        }
+    }
+
+    private static void test(Class<?> type, String name, boolean expected, boolean actual) {
+        if (expected && !actual) {
+            error(type, name + " method does not exist");
+        } else if (!expected && actual) {
+            error(type, name + " method is not expected");
+        }
+    }
+
+    private static void error(Class<?> type, String message) {
+        ERROR.append("\n\t\t").append(type.getSimpleName()).append(".size: ").append(message);
+    }
+
+    public static class Bean0000 {
+    }
+
+    public static class Bean0001 {
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean0010 {
+        public int getSize(int index) {
+            return 0;
+        }
+    }
+
+    public static class Bean0011 {
+        public int getSize(int index) {
+            return 0;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean0100 {
+        public void setSize(int value) {
+        }
+    }
+
+    public static class Bean0101 {
+        public void setSize(int value) {
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean0110 {
+        public void setSize(int value) {
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+    }
+
+    public static class Bean0111 {
+        public void setSize(int value) {
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean1000 {
+        public int getSize() {
+            return 0;
+        }
+    }
+
+    public static class Bean1001 {
+        public int getSize() {
+            return 0;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean1010 {
+        public int getSize() {
+            return 0;
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+    }
+
+    public static class Bean1011 {
+        public int getSize() {
+            return 0;
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean1100 {
+        public int getSize() {
+            return 0;
+        }
+
+        public void setSize(int value) {
+        }
+    }
+
+    public static class Bean1101 {
+        public int getSize() {
+            return 0;
+        }
+
+        public void setSize(int value) {
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean1110 {
+        public int getSize() {
+            return 0;
+        }
+
+        public void setSize(int value) {
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+    }
+
+    public static class Bean1111 {
+        public int getSize() {
+            return 0;
+        }
+
+        public void setSize(int value) {
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/Introspector/Test8034164.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,233 @@
+/*
+ * 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.beans.IndexedPropertyDescriptor;
+import java.beans.PropertyDescriptor;
+
+/*
+ * @test
+ * @bug 8034164
+ * @summary Tests that Introspector does not ignore indexed getter and setter for correct types
+ * @author Sergey Malenkov
+ */
+
+public class Test8034164 {
+    public static final StringBuilder ERROR = new StringBuilder();
+
+    public static void main(String[] args) {
+        test(Bean0000.class, false, false, false, false);
+        test(Bean0001.class, false, false, false, true);
+        test(Bean0010.class, false, false, true, false);
+        test(Bean0011.class, false, false, true, true);
+        test(Bean0100.class, false, true, false, false);
+        test(Bean0101.class, false, true, false, true);
+        test(Bean0110.class, false, true, true, false);
+        test(Bean0111.class, false, true, true, true);
+        test(Bean1000.class, true, false, false, false);
+        test(Bean1001.class, true, false, false, true);
+        test(Bean1010.class, true, false, true, false);
+        test(Bean1011.class, true, false, true, true);
+        test(Bean1100.class, true, true, false, false);
+        test(Bean1101.class, true, true, false, true);
+        test(Bean1110.class, true, true, true, false);
+        test(Bean1111.class, true, true, true, true);
+
+        if (0 < ERROR.length()) {
+            throw new Error(ERROR.toString());
+        }
+    }
+
+    private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
+        PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
+        if (pd != null) {
+            test(type, "read", read, null != pd.getReadMethod());
+            test(type, "write", write, null != pd.getWriteMethod());
+            if (pd instanceof IndexedPropertyDescriptor) {
+                IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
+                test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
+                test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
+            } else if (readIndexed || writeIndexed) {
+                error(type, "indexed property does not exist");
+            }
+        } else if (read || write || readIndexed || writeIndexed) {
+            error(type, "property does not exist");
+        }
+    }
+
+    private static void test(Class<?> type, String name, boolean expected, boolean actual) {
+        if (expected && !actual) {
+            error(type, name + " method does not exist");
+        } else if (!expected && actual) {
+            error(type, name + " method is not expected");
+        }
+    }
+
+    private static void error(Class<?> type, String message) {
+        ERROR.append("\n\t\t").append(type.getSimpleName()).append(".size: ").append(message);
+    }
+
+    public static class Bean0000 {
+    }
+
+    public static class Bean0001 {
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean0010 {
+        public int getSize(int index) {
+            return 0;
+        }
+    }
+
+    public static class Bean0011 {
+        public int getSize(int index) {
+            return 0;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean0100 {
+        public void setSize(int[] value) {
+        }
+    }
+
+    public static class Bean0101 {
+        public void setSize(int[] value) {
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean0110 {
+        public void setSize(int[] value) {
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+    }
+
+    public static class Bean0111 {
+        public void setSize(int[] value) {
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean1000 {
+        public int[] getSize() {
+            return null;
+        }
+    }
+
+    public static class Bean1001 {
+        public int[] getSize() {
+            return null;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean1010 {
+        public int[] getSize() {
+            return null;
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+    }
+
+    public static class Bean1011 {
+        public int[] getSize() {
+            return null;
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean1100 {
+        public int[] getSize() {
+            return null;
+        }
+
+        public void setSize(int[] value) {
+        }
+    }
+
+    public static class Bean1101 {
+        public int[] getSize() {
+            return null;
+        }
+
+        public void setSize(int[] value) {
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean1110 {
+        public int[] getSize() {
+            return null;
+        }
+
+        public void setSize(int[] value) {
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+    }
+
+    public static class Bean1111 {
+        public int[] getSize() {
+            return null;
+        }
+
+        public void setSize(int[] value) {
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/SequenceInputStream/LotsOfStreams.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 7011804
+ * @summary SequenceInputStream#read() was implemented recursivly,
+ *          which may cause stack overflow
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.SequenceInputStream;
+import java.util.Enumeration;
+
+public class LotsOfStreams {
+
+    static final int MAX_SUBSTREAMS = 32000;
+
+    public static void main(String[] argv) throws Exception {
+        try (InputStream stream =
+                new SequenceInputStream(new LOSEnumeration())) {
+            stream.read();
+        }
+        try (InputStream stream =
+                new SequenceInputStream(new LOSEnumeration())) {
+            byte[] b = new byte[1];
+            stream.read(b, 0, 1);
+        }
+    }
+
+    static class LOSEnumeration
+            implements Enumeration<InputStream> {
+
+        private static InputStream inputStream =
+                new ByteArrayInputStream(new byte[0]);
+        private int left = MAX_SUBSTREAMS;
+
+        public boolean hasMoreElements() {
+            return (left > 0);
+        }
+        public InputStream nextElement() {
+            left--;
+            return inputStream;
+        }
+    }
+}
--- a/jdk/test/java/lang/ClassLoader/Assert.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/java/lang/ClassLoader/Assert.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2002, 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
@@ -24,7 +24,8 @@
 /*
  * @test
  * @bug 4290640 4785473
- * @run shell/timeout=300 Assert.sh
+ * @build package1.Class1 package2.Class2 package1.package3.Class3 Assert
+ * @run main/othervm Assert
  * @summary Test the assertion facility
  * @author Mike McCloskey
  */
--- a/jdk/test/java/lang/ClassLoader/Assert.sh	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-#
-# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin )
-    FS="/"
-    CHMOD="${FS}bin${FS}chmod"
-    ;;
-  Windows* | CYGWIN* )
-    CHMOD="chmod"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${COMPILEJAVA}" = "" ]; then
-  COMPILEJAVA="${TESTJAVA}"
-fi
-echo "COMPILEJAVA=${COMPILEJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-cp ${TESTSRC}/Assert.java .
-cp -R ${TESTSRC}/package1 .
-cp -R ${TESTSRC}/package2 .
-${CHMOD} -R u+w *
-
-${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} Assert.java 
-
-${TESTJAVA}/bin/java ${TESTVMOPTS} Assert
-
-result=$?
-if [ $result -eq 0 ]
-then
-  echo "Passed"
-else
-  echo "Failed"
-fi
-exit $result
-
-
--- a/jdk/test/java/lang/ProcessBuilder/CloseRace.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/java/lang/ProcessBuilder/CloseRace.java	Tue Apr 01 15:37:15 2014 +0200
@@ -33,6 +33,8 @@
 import java.io.*;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
 
 public class CloseRace {
     private static final String BIG_FILE = "bigfile";
@@ -43,6 +45,9 @@
     private static final int testDurationSeconds
         = Integer.getInteger("test.duration", 600);
 
+    private static final CountDownLatch threadsStarted
+        = new CountDownLatch(2);
+
     static boolean fdInUse(int i) {
         return new File("/proc/self/fd/" + i).exists();
     }
@@ -61,6 +66,18 @@
         return count;
     }
 
+    static void dumpAllStacks() {
+        System.err.println("Start of dump");
+        final Map<Thread, StackTraceElement[]> allStackTraces
+                = Thread.getAllStackTraces();
+        for (Thread thread : allStackTraces.keySet()) {
+            System.err.println("Thread " + thread.getName());
+            for (StackTraceElement element : allStackTraces.get(thread))
+                System.err.println("\t" + element);
+        }
+        System.err.println("End of dump");
+    }
+
     public static void main(String args[]) throws Exception {
         if (!(new File("/proc/self/fd").isDirectory()))
             return;
@@ -84,26 +101,41 @@
         for (Thread thread : threads)
             thread.start();
 
+        threadsStarted.await();
         Thread.sleep(testDurationSeconds * 1000);
 
         for (Thread thread : threads)
             thread.interrupt();
-        for (Thread thread : threads)
-            thread.join();
+        for (Thread thread : threads) {
+            thread.join(10_000);
+            if (thread.isAlive()) {
+                dumpAllStacks();
+                throw new Error("At least one child thread ("
+                        + thread.getName()
+                        + ") failed to finish gracefully");
+            }
+        }
     }
 
     static class OpenLoop implements Runnable {
         public void run() {
+            threadsStarted.countDown();
             while (!Thread.interrupted()) {
                 try {
                     // wait for ExecLoop to finish creating process
-                    do {} while (count(procFDsInUse()) != 3);
+                    do {
+                        if (Thread.interrupted())
+                            return;
+                    } while (count(procFDsInUse()) != 3);
                     List<InputStream> iss = new ArrayList<>(4);
 
                     // eat up three "holes" (closed ends of pipe fd pairs)
                     for (int i = 0; i < 3; i++)
                         iss.add(new FileInputStream(BIG_FILE));
-                    do {} while (count(procFDsInUse()) == procFDs.length);
+                    do {
+                        if (Thread.interrupted())
+                            return;
+                    } while (count(procFDsInUse()) == procFDs.length);
                     // hopefully this will racily occupy empty fd slot
                     iss.add(new FileInputStream(BIG_FILE));
                     Thread.sleep(1); // Widen race window
@@ -120,11 +152,15 @@
 
     static class ExecLoop implements Runnable {
         public void run() {
+            threadsStarted.countDown();
             ProcessBuilder builder = new ProcessBuilder("/bin/true");
             while (!Thread.interrupted()) {
                 try {
                     // wait for OpenLoop to finish
-                    do {} while (count(procFDsInUse()) > 0);
+                    do {
+                        if (Thread.interrupted())
+                            return;
+                    } while (count(procFDsInUse()) > 0);
                     Process process = builder.start();
                     InputStream is = process.getInputStream();
                     process.waitFor();
--- a/jdk/test/java/lang/invoke/MethodHandles/TestCatchException.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/java/lang/invoke/MethodHandles/TestCatchException.java	Tue Apr 01 15:37:15 2014 +0200
@@ -72,19 +72,55 @@
         assertEquals(x, 17);
     }
 
+    final static Object masterParam = new Object();
+    final static Object[] masterTail = new Object[] { "str" };
+    static Exception masterEx = new Exception();
 
     public static Object m1(Object o1, Object o2, Object o3, Object o4, Object o5,
                             Object o6, Object o7, Object o8, Object... tail) {
+        assertEquals(masterParam, o1);
+        assertEquals(masterParam, o2);
+        assertEquals(masterParam, o3);
+        assertEquals(masterParam, o4);
+        assertEquals(masterParam, o5);
+        assertEquals(masterParam, o6);
+        assertEquals(masterParam, o7);
+        assertEquals(masterParam, o8);
+        assertEquals(masterTail, tail);
         return tail;
     }
 
     public static Object m2(Exception e, Object o1, Object o2, Object o3, Object o4,
                             Object o5, Object o6, Object o7, Object o8, Object... tail) {
+        assertEquals(masterEx, e);
+        assertEquals(masterParam, o1);
+        assertEquals(masterParam, o2);
+        assertEquals(masterParam, o3);
+        assertEquals(masterParam, o4);
+        assertEquals(masterParam, o5);
+        assertEquals(masterParam, o6);
+        assertEquals(masterParam, o7);
+        assertEquals(masterParam, o8);
+        assertEquals(masterTail, tail);
         return tail;
     }
 
+    public static Object throwEx(Object o1, Object o2, Object o3, Object o4, Object o5,
+                                 Object o6, Object o7, Object o8, Object... tail) throws Exception {
+        assertEquals(masterParam, o1);
+        assertEquals(masterParam, o2);
+        assertEquals(masterParam, o3);
+        assertEquals(masterParam, o4);
+        assertEquals(masterParam, o5);
+        assertEquals(masterParam, o6);
+        assertEquals(masterParam, o7);
+        assertEquals(masterParam, o8);
+        assertEquals(masterTail, tail);
+        throw masterEx;
+    }
+
     @Test
-    public void testVarargsCollector() throws Throwable {
+    public void testVarargsCollectorNoThrow() throws Throwable {
         MethodType t1 = MethodType.methodType(Object.class, Object.class, Object.class, Object.class, Object.class,
                 Object.class, Object.class, Object.class, Object.class, Object[].class);
 
@@ -92,17 +128,34 @@
 
         MethodHandle target = LOOKUP.findStatic(TestCatchException.class, "m1", t1)
                                     .asVarargsCollector(Object[].class);
-
-        MethodHandle catcher = LOOKUP.findStatic(TestCatchException.class, "m2", t2);
-
+        MethodHandle catcher = LOOKUP.findStatic(TestCatchException.class, "m2", t2)
+                                     .asVarargsCollector(Object[].class);
         MethodHandle gwc = MethodHandles.catchException(target, Exception.class, catcher);
 
-        Object o = new Object();
-        Object[] obj1 = new Object[] { "str" };
+        Object o = masterParam;
+        Object[] obj1 = masterTail;
+
+        Object r2 = gwc.invokeExact(o, o, o, o, o, o, o, o, obj1);
+        assertEquals(r2, obj1);
+    }
+
+    @Test
+    public void testVarargsCollectorThrow() throws Throwable {
+        MethodType t1 = MethodType.methodType(Object.class, Object.class, Object.class, Object.class, Object.class,
+                Object.class, Object.class, Object.class, Object.class, Object[].class);
 
-        Object r1 = target.invokeExact(o, o, o, o, o, o, o, o, obj1);
+        MethodType t2 = t1.insertParameterTypes(0, Exception.class);
+
+        MethodHandle target = LOOKUP.findStatic(TestCatchException.class, "throwEx", t1)
+                                    .asVarargsCollector(Object[].class);
+        MethodHandle catcher = LOOKUP.findStatic(TestCatchException.class, "m2", t2)
+                                     .asVarargsCollector(Object[].class);
+        MethodHandle gwc = MethodHandles.catchException(target, Exception.class, catcher);
+
+        Object o = masterParam;
+        Object[] obj1 = masterTail;
+
         Object r2 = gwc.invokeExact(o, o, o, o, o, o, o, o, obj1);
-        assertEquals(r1, obj1);
         assertEquals(r2, obj1);
     }
 
@@ -110,7 +163,8 @@
         TestCatchException test = new TestCatchException();
         test.testNoThrowPath();
         test.testThrowPath();
-        test.testVarargsCollector();
+        test.testVarargsCollectorNoThrow();
+        test.testVarargsCollectorThrow();
         System.out.println("TEST PASSED");
     }
 }
--- a/jdk/test/java/lang/management/ThreadMXBean/Locks.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/java/lang/management/ThreadMXBean/Locks.java	Tue Apr 01 15:37:15 2014 +0200
@@ -166,6 +166,9 @@
     private static CheckerThread checker;
     static class WaitingThread extends Thread {
         private final Phaser p;
+
+        volatile boolean waiting = false;
+
         public WaitingThread(Phaser p) {
             super("WaitingThread");
             this.p = p;
@@ -175,7 +178,9 @@
                 System.out.println("WaitingThread about to wait on objC");
                 try {
                     // Signal checker thread, about to wait on objC.
+                    waiting = false;
                     p.arriveAndAwaitAdvance(); // Phase 1 (waiting)
+                    waiting = true;
                     objC.wait();
                 } catch (InterruptedException e) {
                     e.printStackTrace();
@@ -194,7 +199,9 @@
             synchronized(objC) {
                 try {
                     // signal checker thread, about to wait on objC
+                    waiting = false;
                     p.arriveAndAwaitAdvance(); // Phase 3 (waiting)
+                    waiting = true;
                     objC.wait();
                 } catch (InterruptedException e) {
                     e.printStackTrace();
@@ -203,25 +210,35 @@
             }
             System.out.println("WaitingThread about to exit waiting on objC 2");
         }
-    }
-    static class CheckerThread extends Thread {
-        private final Phaser p;
-        public CheckerThread(Phaser p) {
-            super("CheckerThread");
-            this.p = p;
+
+        public void waitForWaiting() {
+            p.arriveAndAwaitAdvance();
+            while (!waiting) {
+                goSleep(10);
+            }
+            waitForState(State.WAITING);
+        }
+
+        public void waitForBlocked() {
+            p.arriveAndAwaitAdvance();
+            waitForState(State.BLOCKED);
         }
 
         private void waitForState(Thread.State state) {
-            p.arriveAndAwaitAdvance();
             while (!waiter.isInterrupted() && waiter.getState() != state) {
-                goSleep(10);
+                Thread.yield();
             }
         }
+    }
+    static class CheckerThread extends Thread {
+        public CheckerThread() {
+            super("CheckerThread");
+        }
 
         public void run() {
             synchronized (ready) {
                 // wait until WaitingThread about to wait for objC
-                waitForState(Thread.State.WAITING); // Phase 1 (waiting)
+                waiter.waitForWaiting(); // Phase 1 (waiting)
                 checkBlockedObject(waiter, objC, null, Thread.State.WAITING);
 
                 synchronized (objC) {
@@ -230,13 +247,13 @@
 
                 // wait for waiter thread to about to enter
                 // synchronized object ready.
-                waitForState(Thread.State.BLOCKED); // Phase 2 (waiting)
+                waiter.waitForBlocked(); // Phase 2 (waiting)
                 checkBlockedObject(waiter, ready, this, Thread.State.BLOCKED);
             }
 
             // wait for signal from waiting thread that it is about
             // wait for objC.
-            waitForState(Thread.State.WAITING); // Phase 3 (waiting)
+            waiter.waitForWaiting(); // Phase 3 (waiting)
             synchronized(objC) {
                 checkBlockedObject(waiter, objC, Thread.currentThread(), Thread.State.WAITING);
                 objC.notify();
@@ -284,7 +301,7 @@
         waiter = new WaitingThread(p);
         waiter.start();
 
-        checker = new CheckerThread(p);
+        checker = new CheckerThread();
         checker.start();
 
         try {
--- a/jdk/test/java/security/Policy/Root/Root.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/java/security/Policy/Root/Root.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 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
@@ -25,12 +25,13 @@
  *
  * @bug 4619757
  * @summary User Policy Setting is not recognized on Netscape 6
- *              when invoked as root
- * @ignore - must run test as root
- *
- * place Root.policy in the root home directory (/), as /.java.policy
- * run this test as root:
- *      java Root
+ *          when invoked as root.
+ * @run main/manual Root
+ */
+
+/*
+ * Place Root.policy in the root home directory (/),
+ * as /.java.policy and run as test as root user.
  */
 
 import java.security.*;
--- a/jdk/test/java/security/cert/X509Certificate/X509BadCertificate.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/java/security/cert/X509Certificate/X509BadCertificate.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 8028431
+ * @bug 8028431 8028591
  * @summary Make sure that proper CertificateException is thrown
  *          when loading bad x509 certificate
  * @author Artem Smotrakov
@@ -39,6 +39,7 @@
 
     public static void main(String[] args) throws Exception {
         test("bad-cert-1.pem");
+        test("bad-cert-2.pem");
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/cert/X509Certificate/bad-cert-2.pem	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,21 @@
+-----BEGIN CERTIFICATE-----
+MIIDZzCCAk+gAwIBAgIJAJYB3qu9C2kiMA0GCSqGSIb3DQEBBQUAMEoxDTALBgNV
+BAMMBFRlc3QxDTALBgNVBAsMBEphdmExDzANBgNVBAoMBk9yYWNsZTEMMAoGA1UE
+BwwDU1BCMQswCQYDVQQGEwJSVTAeFw0xMzEyMjMwNzA4MDhaFw0yMzEyMjEwNzA4
+MDhaMEoxDTALBgNVBAMMBFRlc3QxDTALBgNVBAsMBEphdmExDzANBgNVBAoMBk9y
+YWNsZTEMMAoGA1UEBwwDU1BCMQswCQYDVQQGEwJSVTCCASIwDQYJKoZIhvcNAQEB
+BQADgGEPADCCAQoCggEBAOqiCN4gFxehl547Q7/VNGbGApr+wszLdanHPucAH6Wf
+LtcRhKNUSqtBAQxEpFrTpMNEqm2GElAjiPa6m48qIjLVSvOb/9w3G/yXB8zyZbIm
+/Nfp2sT4OEaa1JSEZSpolhS4FfqYzjGQp5cn4Xn4zKjDgiceHgfLls5x2dRydQZO
+Yf91qSIioZxVHUtlo8yztkieiSaqPWt3nJ4PIwhFbsu1HVmWaYZD+nBYCKgVHqrS
+cueO98Ca4Doz73O27X1dVbQBdLS0JI7qVAG8LD388iPL8qbsOkgWPzmEQ+kLRKO4
+g7RpuwlXuwaMSh95NWaxlu4Ob6GRJQmpconYoe13+7ECAwEAAaNQME4wHQYDVR0O
+BBYEFIG8TPobXcbNbDi+zKudd9whpxoNMB8GA1UdIwQYMBaAFIG8TPobXcbNbDi+
+zKudd9whpxoNMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAynN+e7
+h+ufT5SBKN/gBuJAnF1mKIPESiipuv5KoYUGZOY8ShgYLcwY+qnbuHYFUlvq6Zns
+K4/e+x/16h32vD7dEPkNvukbvER4YJQQiN6osDfXpTPzixYftWdmtX0u8xQfwb/g
+R8DS7bazz99jVXk+jTK4yWBY+gMwEat+LyNQ5cyq8Qhi1oBKUbGRbiOts19B97fn
+Rv8TsyXN3INLGYhdVxZoD7E5tyG1ydSFmOMadulAC2epBXDHOXZnz2UWauJc0XW5
+1L/YQVri47VkdHS3tisBzELEJdLmdMDb+5tAU+lItXmTXe2/PB53WIvsEIb4t+eQ
+wY0hCj9lVJlajTQ=
+-----END CERTIFICATE-----
--- a/jdk/test/java/util/Collection/CollectionDefaults.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/java/util/Collection/CollectionDefaults.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -44,8 +45,8 @@
 import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentSkipListMap;
+import java.util.function.Function;
 import java.util.function.Predicate;
-import java.util.function.Supplier;
 
 /**
  * @test
@@ -59,26 +60,25 @@
     public static final Predicate<Integer> pEven = x -> 0 == x % 2;
     public static final Predicate<Integer> pOdd = x -> 1 == x % 2;
 
-    @SuppressWarnings("unchecked")
-    private static final Supplier<?>[] TEST_CLASSES = {
-        // Collection
-        ExtendsAbstractCollection<Integer>::new,
+    private static final List<Function<Collection<Integer>, Collection<Integer>>> TEST_SUPPLIERS = Arrays.asList(
+            // Collection
+            ExtendsAbstractCollection<Integer>::new,
 
-        // Lists
-        java.util.ArrayList<Integer>::new,
-        java.util.LinkedList<Integer>::new,
-        java.util.Vector<Integer>::new,
-        java.util.concurrent.CopyOnWriteArrayList<Integer>::new,
-        ExtendsAbstractList<Integer>::new,
+            // Lists
+            java.util.ArrayList<Integer>::new,
+            java.util.LinkedList<Integer>::new,
+            java.util.Vector<Integer>::new,
+            java.util.concurrent.CopyOnWriteArrayList<Integer>::new,
+            ExtendsAbstractList<Integer>::new,
 
-        // Sets
-        java.util.HashSet<Integer>::new,
-        java.util.LinkedHashSet<Integer>::new,
-        java.util.TreeSet<Integer>::new,
-        java.util.concurrent.ConcurrentSkipListSet<Integer>::new,
-        java.util.concurrent.CopyOnWriteArraySet<Integer>::new,
-        ExtendsAbstractSet<Integer>::new
-    };
+            // Sets
+            java.util.HashSet<Integer>::new,
+            java.util.LinkedHashSet<Integer>::new,
+            java.util.TreeSet<Integer>::new,
+            java.util.concurrent.ConcurrentSkipListSet<Integer>::new,
+            java.util.concurrent.CopyOnWriteArraySet<Integer>::new,
+            ExtendsAbstractSet<Integer>::new
+       );
 
     private static final int SIZE = 100;
 
@@ -94,7 +94,7 @@
         cases.add(new Object[] { new ExtendsAbstractSet<>() });
 
         cases.add(new Object[] { Collections.newSetFromMap(new HashMap<>()) });
-        cases.add(new Object[] { Collections.newSetFromMap(new LinkedHashMap()) });
+        cases.add(new Object[] { Collections.newSetFromMap(new LinkedHashMap<>()) });
         cases.add(new Object[] { Collections.newSetFromMap(new TreeMap<>()) });
         cases.add(new Object[] { Collections.newSetFromMap(new ConcurrentHashMap<>()) });
         cases.add(new Object[] { Collections.newSetFromMap(new ConcurrentSkipListMap<>()) });
@@ -107,24 +107,23 @@
     }
 
     @Test(dataProvider = "setProvider")
-    public void testProvidedWithNull(final Set<Integer> set) throws Exception {
+    public void testProvidedWithNull(final Set<Integer> set) {
         try {
             set.forEach(null);
             fail("expected NPE not thrown");
-        } catch (NullPointerException expected) {
-                ; // expected
-            }
+        } catch (NullPointerException expected) { // expected
+        }
         try {
             set.removeIf(null);
             fail("expected NPE not thrown");
-        } catch (NullPointerException expected) {
-               ; // expected
+        } catch (NullPointerException expected) { // expected
         }
     }
 
     @Test
-    public void testForEach() throws Exception {
-        final CollectionSupplier<Collection<Integer>> supplier = new CollectionSupplier((Supplier<Collection<Integer>>[]) TEST_CLASSES, SIZE);
+    public void testForEach() {
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<Collection<Integer>> supplier = new CollectionSupplier(TEST_SUPPLIERS, SIZE);
 
         for (final CollectionSupplier.TestCase<Collection<Integer>> test : supplier.get()) {
             final Collection<Integer> original = test.expected;
@@ -133,8 +132,7 @@
             try {
                 set.forEach(null);
                 fail("expected NPE not thrown");
-            } catch (NullPointerException expected) {
-                ; // expected
+            } catch (NullPointerException expected) { // expected
             }
             if (set instanceof Set && !((set instanceof SortedSet) || (set instanceof LinkedHashSet))) {
                 CollectionAsserts.assertContentsUnordered(set, original, test.toString());
@@ -155,8 +153,9 @@
     }
 
     @Test
-    public void testRemoveIf() throws Exception {
-        final CollectionSupplier<Collection<Integer>> supplier = new CollectionSupplier((Supplier<Collection<Integer>>[]) TEST_CLASSES, SIZE);
+    public void testRemoveIf() {
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<Collection<Integer>> supplier = new CollectionSupplier(TEST_SUPPLIERS, SIZE);
         for (final CollectionSupplier.TestCase<Collection<Integer>> test : supplier.get()) {
             final Collection<Integer> original = test.expected;
             final Collection<Integer> set = test.collection;
@@ -164,8 +163,7 @@
             try {
                 set.removeIf(null);
                 fail("expected NPE not thrown");
-            } catch (NullPointerException expected) {
-                ; // expected
+            } catch (NullPointerException expected) { // expected
             }
             if (set instanceof Set && !((set instanceof SortedSet) || (set instanceof LinkedHashSet))) {
                 CollectionAsserts.assertContentsUnordered(set, original, test.toString());
--- a/jdk/test/java/util/Collection/testlibrary/CollectionSupplier.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/java/util/Collection/testlibrary/CollectionSupplier.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 import java.lang.Integer;
 import java.lang.Iterable;
 import java.lang.Override;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.LinkedList;
 import java.util.List;
@@ -36,6 +37,7 @@
 
 import java.util.Collection;
 import java.util.Collections;
+import java.util.function.Function;
 import java.util.function.Supplier;
 
 /**
@@ -44,20 +46,24 @@
  */
 public final class CollectionSupplier<C extends Collection<Integer>> implements Supplier<Iterable<CollectionSupplier.TestCase<C>>> {
 
-    private final Supplier<C>[] classes;
+    private final List<Function<Collection<Integer>, C>> suppliers;
     private final int size;
 
     /**
      * A Collection test case.
      */
     public static final class TestCase<C extends Collection<Integer>> {
-
         /**
          * The name of the test case.
          */
         public final String name;
 
         /**
+         * The supplier of a collection
+         */
+        public Function<Collection<Integer>, C> supplier;
+
+        /**
          * Unmodifiable reference collection, useful for comparisons.
          */
         public final List<Integer> expected;
@@ -71,11 +77,11 @@
          * Create a Collection test case.
          *
          * @param name name of the test case
-         * @param expected reference collection
          * @param collection the modifiable test collection
          */
-        public TestCase(String name, C collection) {
+        public TestCase(String name, Function<Collection<Integer>, C> supplier, C collection) {
             this.name = name;
+            this.supplier = supplier;
             this.expected = Collections.unmodifiableList(
                 Arrays.asList(collection.toArray(new Integer[0])));
             this.collection = collection;
@@ -107,54 +113,52 @@
     }
 
     /**
-     * Create a {@code Supplier} that creates instances of specified collection
-     * classes of specified length.
+     * Create a {@code CollectionSupplier} that creates instances of specified
+     * collection suppliers of the specified size.
      *
-     * @param classNames class names that implement {@code Collection}
+     * @param suppliers the suppliers names that supply {@code Collection}
+     *        instances
      * @param size the desired size of each collection
      */
-    public CollectionSupplier(Supplier<C>[] classes, int size) {
-        this.classes = Arrays.copyOf(classes, classes.length);
+    public CollectionSupplier(List<Function<Collection<Integer>, C>> suppliers, int size) {
+        this.suppliers = suppliers;
         this.size = size;
     }
 
     @Override
     public Iterable<TestCase<C>> get() {
         final Collection<TestCase<C>> cases = new LinkedList<>();
-        for (final Supplier<C> type : classes) {
+        for (final Function<Collection<Integer>, C> supplier : suppliers)
             try {
-                final Collection<Integer> empty = type.get();
-                cases.add(new TestCase("empty", empty));
+                cases.add(new TestCase<>("empty", supplier, supplier.apply(Collections.emptyList())));
 
-                final Collection<Integer> single = type.get();
-                single.add(42);
-                cases.add(new TestCase("single", single));
+                cases.add(new TestCase<>("single", supplier, supplier.apply(Arrays.asList(42))));
 
-                final Collection<Integer> regular = type.get();
+                final Collection<Integer> regular = new ArrayList<>();
                 for (int i = 0; i < size; i++) {
                     regular.add(i);
                 }
-                cases.add(new TestCase("regular", regular));
+                cases.add(new TestCase<>("regular", supplier, supplier.apply(regular)));
 
-                final Collection<Integer> reverse = type.get();
+                final Collection<Integer> reverse = new ArrayList<>();
                 for (int i = size; i >= 0; i--) {
                     reverse.add(i);
                 }
-                cases.add(new TestCase("reverse", reverse));
+                cases.add(new TestCase<>("reverse", supplier, supplier.apply(reverse)));
 
-                final Collection<Integer> odds = type.get();
+                final Collection<Integer> odds = new ArrayList<>();
                 for (int i = 0; i < size; i++) {
                     odds.add((i * 2) + 1);
                 }
-                cases.add(new TestCase("odds", odds));
+                cases.add(new TestCase<>("odds", supplier, supplier.apply(odds)));
 
-                final Collection<Integer> evens = type.get();
+                final Collection<Integer> evens = new ArrayList<>();
                 for (int i = 0; i < size; i++) {
                     evens.add(i * 2);
                 }
-                cases.add(new TestCase("evens", evens));
+                cases.add(new TestCase<>("evens", supplier, supplier.apply(evens)));
 
-                final Collection<Integer> fibonacci = type.get();
+                final Collection<Integer> fibonacci = new ArrayList<>();
                 int prev2 = 0;
                 int prev1 = 1;
                 for (int i = 0; i < size; i++) {
@@ -166,58 +170,62 @@
                     prev2 = prev1;
                     prev1 = n;
                 }
-                cases.add(new TestCase("fibonacci", fibonacci));
+                cases.add(new TestCase<>("fibonacci", supplier, supplier.apply(fibonacci)));
+
 
-            // variants where the size of the backing storage != reported size
+                boolean isStructurallyModifiable = false;
+                try {
+                    C t = supplier.apply(Collections.emptyList());
+                    t.add(1);
+                    isStructurallyModifiable = true;
+                } catch (UnsupportedOperationException e) { }
+
+                if (!isStructurallyModifiable)
+                    continue;
+
+
+                // variants where the size of the backing storage != reported size
                 // created by removing half of the elements
-                final Collection<Integer> emptyWithSlack = type.get();
+                final C emptyWithSlack = supplier.apply(Collections.emptyList());
                 emptyWithSlack.add(42);
                 assertTrue(emptyWithSlack.remove(42));
-                cases.add(new TestCase("emptyWithSlack", emptyWithSlack));
+                cases.add(new TestCase<>("emptyWithSlack", supplier, emptyWithSlack));
 
-                final Collection<Integer> singleWithSlack = type.get();
+                final C singleWithSlack = supplier.apply(Collections.emptyList());
                 singleWithSlack.add(42);
                 singleWithSlack.add(43);
                 assertTrue(singleWithSlack.remove(43));
-                cases.add(new TestCase("singleWithSlack", singleWithSlack));
+                cases.add(new TestCase<>("singleWithSlack", supplier, singleWithSlack));
 
-                final Collection<Integer> regularWithSlack = type.get();
+                final C regularWithSlack = supplier.apply(Collections.emptyList());
                 for (int i = 0; i < (2 * size); i++) {
                     regularWithSlack.add(i);
                 }
-                assertTrue(regularWithSlack.removeIf((x) -> {
-                    return x >= size;
-                }));
-                cases.add(new TestCase("regularWithSlack", regularWithSlack));
+                assertTrue(regularWithSlack.removeIf(x -> x < size));
+                cases.add(new TestCase<>("regularWithSlack", supplier, regularWithSlack));
 
-                final Collection<Integer> reverseWithSlack = type.get();
+                final C reverseWithSlack = supplier.apply(Collections.emptyList());
                 for (int i = 2 * size; i >= 0; i--) {
                     reverseWithSlack.add(i);
                 }
-                assertTrue(reverseWithSlack.removeIf((x) -> {
-                    return x < size;
-                }));
-                cases.add(new TestCase("reverseWithSlack", reverseWithSlack));
+                assertTrue(reverseWithSlack.removeIf(x -> x < size));
+                cases.add(new TestCase<>("reverseWithSlack", supplier, reverseWithSlack));
 
-                final Collection<Integer> oddsWithSlack = type.get();
+                final C oddsWithSlack = supplier.apply(Collections.emptyList());
                 for (int i = 0; i < 2 * size; i++) {
                     oddsWithSlack.add((i * 2) + 1);
                 }
-                assertTrue(oddsWithSlack.removeIf((x) -> {
-                    return x >= size;
-                }));
-                cases.add(new TestCase("oddsWithSlack", oddsWithSlack));
+                assertTrue(oddsWithSlack.removeIf(x -> x >= size));
+                cases.add(new TestCase<>("oddsWithSlack", supplier, oddsWithSlack));
 
-                final Collection<Integer> evensWithSlack = type.get();
+                final C evensWithSlack = supplier.apply(Collections.emptyList());
                 for (int i = 0; i < 2 * size; i++) {
                     evensWithSlack.add(i * 2);
                 }
-                assertTrue(evensWithSlack.removeIf((x) -> {
-                    return x >= size;
-                }));
-                cases.add(new TestCase("evensWithSlack", evensWithSlack));
+                assertTrue(evensWithSlack.removeIf(x -> x >= size));
+                cases.add(new TestCase<>("evensWithSlack", supplier, evensWithSlack));
 
-                final Collection<Integer> fibonacciWithSlack = type.get();
+                final C fibonacciWithSlack = supplier.apply(Collections.emptyList());
                 prev2 = 0;
                 prev1 = 1;
                 for (int i = 0; i < size; i++) {
@@ -229,15 +237,12 @@
                     prev2 = prev1;
                     prev1 = n;
                 }
-                assertTrue(fibonacciWithSlack.removeIf((x) -> {
-                    return x < 20;
-                }));
-                cases.add(new TestCase("fibonacciWithSlack",
-                    fibonacciWithSlack));
-            } catch (Exception failed) {
+                assertTrue(fibonacciWithSlack.removeIf(x -> x < 20));
+                cases.add(new TestCase<>("fibonacciWithSlack", supplier, fibonacciWithSlack));
+            }
+            catch (Exception failed) {
                 throw new TestException(failed);
             }
-        }
 
         return cases;
     }
--- a/jdk/test/java/util/List/ListDefaults.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/java/util/List/ListDefaults.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
@@ -43,31 +44,45 @@
 
 import java.lang.reflect.Constructor;
 import java.util.ConcurrentModificationException;
+import java.util.function.Consumer;
+import java.util.function.Function;
 import java.util.function.Predicate;
 import java.util.function.Supplier;
 
 /**
  * @test
  * @summary Unit tests for extension methods on List
- * @bug 8023367
+ * @bug 8023367 8037106
  * @library ../Collection/testlibrary
  * @build CollectionAsserts CollectionSupplier ExtendsAbstractList
  * @run testng ListDefaults
  */
 public class ListDefaults {
 
-    private static final Supplier<?>[] LIST_CLASSES = {
-        java.util.ArrayList::new,
-        java.util.LinkedList::new,
-        java.util.Vector::new,
-        java.util.concurrent.CopyOnWriteArrayList::new,
-        ExtendsAbstractList::new
-     };
+    // Suppliers of lists that can support structural modifications
+    private static final List<Function<Collection, List>> LIST_STRUCT_MOD_SUPPLIERS = Arrays.asList(
+            java.util.ArrayList::new,
+            java.util.LinkedList::new,
+            java.util.Vector::new,
+            java.util.concurrent.CopyOnWriteArrayList::new,
+            ExtendsAbstractList::new
+    );
 
-    private static final Supplier<?>[] LIST_CME_CLASSES = {
-        java.util.ArrayList::new,
-        java.util.Vector::new
-     };
+    // Suppliers of lists that can support in place modifications
+    private static final List<Function<Collection, List>> LIST_SUPPLIERS = Arrays.asList(
+            java.util.ArrayList::new,
+            java.util.LinkedList::new,
+            java.util.Vector::new,
+            java.util.concurrent.CopyOnWriteArrayList::new,
+            ExtendsAbstractList::new,
+            c -> Arrays.asList(c.toArray())
+    );
+
+    // Suppliers of lists supporting CMEs
+    private static final List<Function<Collection, List>> LIST_CME_SUPPLIERS = Arrays.asList(
+            java.util.ArrayList::new,
+            java.util.Vector::new
+    );
 
     private static final Predicate<Integer> pEven = x -> 0 == x % 2;
     private static final Predicate<Integer> pOdd = x -> 1 == x % 2;
@@ -83,17 +98,13 @@
     private static final int SUBLIST_TO = SIZE - 5;
     private static final int SUBLIST_SIZE = SUBLIST_TO - SUBLIST_FROM;
 
-    private static interface Callback {
-        void call(List<Integer> list);
-    }
-
     // call the callback for each recursive subList
-    private void trimmedSubList(final List<Integer> list, final Callback callback) {
+    private void trimmedSubList(final List<Integer> list, final Consumer<List<Integer>> callback) {
         int size = list.size();
         if (size > 1) {
             // trim 1 element from both ends
             final List<Integer> subList = list.subList(1, size - 1);
-            callback.call(subList);
+            callback.accept(subList);
             trimmedSubList(subList, callback);
         }
     }
@@ -107,17 +118,21 @@
         cases.add(new Object[] { new Vector<>() });
         cases.add(new Object[] { new Stack<>() });
         cases.add(new Object[] { new CopyOnWriteArrayList<>() });
+        cases.add(new Object[] { Arrays.asList() });
 
-        cases.add(new Object[] { new ArrayList(){{add(42);}} });
-        cases.add(new Object[] { new LinkedList(){{add(42);}} });
-        cases.add(new Object[] { new Vector(){{add(42);}} });
-        cases.add(new Object[] { new Stack(){{add(42);}} });
-        cases.add(new Object[] { new CopyOnWriteArrayList(){{add(42);}} });
+        List<Integer> l = Arrays.asList(42);
+        cases.add(new Object[] { new ArrayList<>(l) });
+        cases.add(new Object[] { new LinkedList<>(l) });
+        cases.add(new Object[] { new Vector<>(l) });
+        Stack<Integer> s = new Stack<>(); s.addAll(l);
+        cases.add(new Object[]{s});
+        cases.add(new Object[] { new CopyOnWriteArrayList<>(l) });
+        cases.add(new Object[] { l });
         return cases.toArray(new Object[0][cases.size()]);
     }
 
     @Test(dataProvider = "listProvider")
-    public void testProvidedWithNull(final List<Integer> list) throws Exception {
+    public void testProvidedWithNull(final List<Integer> list) {
         try {
             list.forEach(null);
             fail("expected NPE not thrown");
@@ -138,11 +153,12 @@
     }
 
     @Test
-    public void testForEach() throws Exception {
-        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier((Supplier<List<Integer>>[])LIST_CLASSES, SIZE);
+    public void testForEach() {
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier(LIST_SUPPLIERS, SIZE);
         for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
-            final List<Integer> original = ((List<Integer>) test.expected);
-            final List<Integer> list = ((List<Integer>) test.collection);
+            final List<Integer> original = test.expected;
+            final List<Integer> list = test.collection;
 
             try {
                 list.forEach(null);
@@ -165,23 +181,21 @@
                 }
             }
 
-            trimmedSubList(list, new Callback() {
-                @Override
-                public void call(final List<Integer> list) {
-                    final List<Integer> actual = new LinkedList<>();
-                    list.forEach(actual::add);
-                    CollectionAsserts.assertContents(actual, list);
-                }
-            });
+            trimmedSubList(list, l -> {
+                    final List<Integer> a = new LinkedList<>();
+                    l.forEach(a::add);
+                    CollectionAsserts.assertContents(a, l);
+                });
         }
     }
 
     @Test
-    public void testRemoveIf() throws Exception {
-        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier((Supplier<List<Integer>>[])LIST_CLASSES, SIZE);
+    public void testRemoveIf() {
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier(LIST_STRUCT_MOD_SUPPLIERS, SIZE);
         for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
-            final List<Integer> original = ((List<Integer>) test.expected);
-            final List<Integer> list = ((List<Integer>) test.collection);
+            final List<Integer> original = test.expected;
+            final List<Integer> list = test.collection;
 
             try {
                 list.removeIf(null);
@@ -195,9 +209,9 @@
             }
         }
 
-        for (final CollectionSupplier.TestCase test : supplier.get()) {
-            final List<Integer> original = ((List<Integer>) test.expected);
-            final List<Integer> list = ((List<Integer>) test.collection);
+        for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
+            final List<Integer> original = test.expected;
+            final List<Integer> list = test.collection;
             list.removeIf(pOdd);
             for (int i : list) {
                 assertTrue((i % 2) == 0);
@@ -211,9 +225,9 @@
             assertTrue(list.isEmpty());
         }
 
-        for (final CollectionSupplier.TestCase test : supplier.get()) {
-            final List<Integer> original = ((List<Integer>) test.expected);
-            final List<Integer> list = ((List<Integer>) test.collection);
+        for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
+            final List<Integer> original = test.expected;
+            final List<Integer> list = test.collection;
             final List<Integer> listCopy = new ArrayList<>(list);
             if (original.size() > SUBLIST_SIZE) {
                 final List<Integer> subList = list.subList(SUBLIST_FROM, SUBLIST_TO);
@@ -237,22 +251,19 @@
             }
         }
 
-        for (final CollectionSupplier.TestCase test : supplier.get()) {
-            final List<Integer> list = ((List<Integer>) test.collection);
-            trimmedSubList(list, new Callback() {
-                @Override
-                public void call(final List<Integer> list) {
-                    final List<Integer> copy = new ArrayList<>(list);
-                    list.removeIf(pOdd);
-                    for (int i : list) {
-                        assertTrue((i % 2) == 0);
-                    }
-                    for (int i : copy) {
-                        if (i % 2 == 0) {
-                            assertTrue(list.contains(i));
-                        } else {
-                            assertFalse(list.contains(i));
-                        }
+        for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
+            final List<Integer> list = test.collection;
+            trimmedSubList(list, l -> {
+                final List<Integer> copy = new ArrayList<>(l);
+                l.removeIf(pOdd);
+                for (int i : l) {
+                    assertTrue((i % 2) == 0);
+                }
+                for (int i : copy) {
+                    if (i % 2 == 0) {
+                        assertTrue(l.contains(i));
+                    } else {
+                        assertFalse(l.contains(i));
                     }
                 }
             });
@@ -267,12 +278,13 @@
     }
 
     @Test
-    public void testReplaceAll() throws Exception {
+    public void testReplaceAll() {
         final int scale = 3;
-        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier((Supplier<List<Integer>>[])LIST_CLASSES, SIZE);
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier(LIST_SUPPLIERS, SIZE);
         for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
-            final List<Integer> original = ((List<Integer>) test.expected);
-            final List<Integer> list = ((List<Integer>) test.collection);
+            final List<Integer> original = test.expected;
+            final List<Integer> list = test.collection;
 
             try {
                 list.replaceAll(null);
@@ -281,7 +293,7 @@
             CollectionAsserts.assertContents(list, original);
 
             list.replaceAll(x -> scale * x);
-            for (int i=0; i < original.size(); i++) {
+            for (int i = 0; i < original.size(); i++) {
                 assertTrue(list.get(i) == (scale * original.get(i)), "mismatch at index " + i);
             }
 
@@ -306,28 +318,26 @@
             }
         }
 
-        for (final CollectionSupplier.TestCase test : supplier.get()) {
-            final List<Integer> list = ((List<Integer>) test.collection);
-            trimmedSubList(list, new Callback() {
-                @Override
-                public void call(final List<Integer> list) {
-                    final List<Integer> copy = new ArrayList<>(list);
-                    final int offset = 5;
-                    list.replaceAll(x -> offset + x);
-                    for (int i=0; i < copy.size(); i++) {
-                        assertTrue(list.get(i) == (offset + copy.get(i)), "mismatch at index " + i);
-                    }
+        for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
+            final List<Integer> list = test.collection;
+            trimmedSubList(list, l -> {
+                final List<Integer> copy = new ArrayList<>(l);
+                final int offset = 5;
+                l.replaceAll(x -> offset + x);
+                for (int i = 0; i < copy.size(); i++) {
+                    assertTrue(l.get(i) == (offset + copy.get(i)), "mismatch at index " + i);
                 }
             });
         }
     }
 
     @Test
-    public void testSort() throws Exception {
-        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier((Supplier<List<Integer>>[])LIST_CLASSES, SIZE);
+    public void testSort() {
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier(LIST_SUPPLIERS, SIZE);
         for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
-            final List<Integer> original = ((List<Integer>) test.expected);
-            final List<Integer> list = ((List<Integer>) test.collection);
+            final List<Integer> original = test.expected;
+            final List<Integer> list = test.collection;
             CollectionSupplier.shuffle(list);
             list.sort(Integer::compare);
             CollectionAsserts.assertSorted(list, Integer::compare);
@@ -338,23 +348,23 @@
 
             CollectionSupplier.shuffle(list);
             list.sort(null);
-            CollectionAsserts.assertSorted(list, Comparator.<Integer>naturalOrder());
+            CollectionAsserts.assertSorted(list, Comparator.naturalOrder());
             if (test.name.startsWith("reverse")) {
                 Collections.reverse(list);
             }
             CollectionAsserts.assertContents(list, original);
 
             CollectionSupplier.shuffle(list);
-            list.sort(Comparator.<Integer>naturalOrder());
-            CollectionAsserts.assertSorted(list, Comparator.<Integer>naturalOrder());
+            list.sort(Comparator.naturalOrder());
+            CollectionAsserts.assertSorted(list, Comparator.naturalOrder());
             if (test.name.startsWith("reverse")) {
                 Collections.reverse(list);
             }
             CollectionAsserts.assertContents(list, original);
 
             CollectionSupplier.shuffle(list);
-            list.sort(Comparator.<Integer>reverseOrder());
-            CollectionAsserts.assertSorted(list, Comparator.<Integer>reverseOrder());
+            list.sort(Comparator.reverseOrder());
+            CollectionAsserts.assertSorted(list, Comparator.reverseOrder());
             if (!test.name.startsWith("reverse")) {
                 Collections.reverse(list);
             }
@@ -365,32 +375,35 @@
             CollectionAsserts.assertSorted(list, BIT_COUNT_COMPARATOR);
             // check sort by verifying that bitCount increases and never drops
             int minBitCount = 0;
-            int bitCount = 0;
             for (final Integer i : list) {
-                bitCount = Integer.bitCount(i);
+                int bitCount = Integer.bitCount(i);
                 assertTrue(bitCount >= minBitCount);
                 minBitCount = bitCount;
             }
 
+            // Resuse the supplier to store AtomicInteger instead of Integer
+            // Hence the use of raw type and cast
+            List<AtomicInteger> incomparablesData = new ArrayList<>();
+            for (int i = 0; i < test.expected.size(); i++) {
+                incomparablesData.add(new AtomicInteger(i));
+            }
+            Function f = test.supplier;
             @SuppressWarnings("unchecked")
-            final Constructor<? extends List<?>> defaultConstructor = ((Class<? extends List<?>>)test.collection.getClass()).getConstructor();
-            final List<AtomicInteger> incomparables = (List<AtomicInteger>) defaultConstructor.newInstance();
+            List<AtomicInteger> incomparables = (List<AtomicInteger>) f.apply(incomparablesData);
 
-            for (int i=0; i < test.expected.size(); i++) {
-                incomparables.add(new AtomicInteger(i));
-            }
             CollectionSupplier.shuffle(incomparables);
             incomparables.sort(ATOMIC_INTEGER_COMPARATOR);
-            for (int i=0; i < test.expected.size(); i++) {
+            for (int i = 0; i < test.expected.size(); i++) {
                 assertEquals(i, incomparables.get(i).intValue());
             }
 
+
             if (original.size() > SUBLIST_SIZE) {
                 final List<Integer> copy = new ArrayList<>(list);
                 final List<Integer> subList = list.subList(SUBLIST_FROM, SUBLIST_TO);
                 CollectionSupplier.shuffle(subList);
-                subList.sort(Comparator.<Integer>naturalOrder());
-                CollectionAsserts.assertSorted(subList, Comparator.<Integer>naturalOrder());
+                subList.sort(Comparator.naturalOrder());
+                CollectionAsserts.assertSorted(subList, Comparator.naturalOrder());
                 // verify that elements [0, from) remain unmodified
                 for (int i = 0; i < SUBLIST_FROM; i++) {
                     assertTrue(list.get(i) == copy.get(i),
@@ -404,25 +417,22 @@
             }
         }
 
-        for (final CollectionSupplier.TestCase test : supplier.get()) {
-            final List<Integer> list = ((List<Integer>) test.collection);
-            trimmedSubList(list, new Callback() {
-                @Override
-                public void call(final List<Integer> list) {
-                    final List<Integer> copy = new ArrayList<>(list);
-                    CollectionSupplier.shuffle(list);
-                    list.sort(Comparator.<Integer>naturalOrder());
-                    CollectionAsserts.assertSorted(list, Comparator.<Integer>naturalOrder());
-                }
+        for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
+            final List<Integer> list = test.collection;
+            trimmedSubList(list, l -> {
+                CollectionSupplier.shuffle(l);
+                l.sort(Comparator.naturalOrder());
+                CollectionAsserts.assertSorted(l, Comparator.naturalOrder());
             });
         }
     }
 
     @Test
-    public void testForEachThrowsCME() throws Exception {
-        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier((Supplier<List<Integer>>[])LIST_CME_CLASSES, SIZE);
+    public void testForEachThrowsCME() {
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier(LIST_CME_SUPPLIERS, SIZE);
         for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
-            final List<Integer> list = ((List<Integer>) test.collection);
+            final List<Integer> list = test.collection;
 
             if (list.size() <= 1) {
                 continue;
@@ -430,7 +440,7 @@
             boolean gotException = false;
             try {
                 // bad predicate that modifies its list, should throw CME
-                list.forEach((x) -> {list.add(x);});
+                list.forEach(list::add);
             } catch (ConcurrentModificationException cme) {
                 gotException = true;
             }
@@ -441,11 +451,11 @@
     }
 
     @Test
-    public void testRemoveIfThrowsCME() throws Exception {
-        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier((Supplier<List<Integer>>[])LIST_CME_CLASSES, SIZE);
+    public void testRemoveIfThrowsCME() {
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier(LIST_CME_SUPPLIERS, SIZE);
         for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
-            final List<Integer> original = ((List<Integer>) test.expected);
-            final List<Integer> list = ((List<Integer>) test.collection);
+            final List<Integer> list = test.collection;
 
             if (list.size() <= 1) {
                 continue;
@@ -453,7 +463,7 @@
             boolean gotException = false;
             try {
                 // bad predicate that modifies its list, should throw CME
-                list.removeIf((x) -> {return list.add(x);});
+                list.removeIf(list::add);
             } catch (ConcurrentModificationException cme) {
                 gotException = true;
             }
@@ -464,10 +474,11 @@
     }
 
     @Test
-    public void testReplaceAllThrowsCME() throws Exception {
-        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier((Supplier<List<Integer>>[])LIST_CME_CLASSES, SIZE);
+    public void testReplaceAllThrowsCME() {
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier(LIST_CME_SUPPLIERS, SIZE);
         for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
-            final List<Integer> list = ((List<Integer>) test.collection);
+            final List<Integer> list = test.collection;
 
             if (list.size() <= 1) {
                 continue;
@@ -486,10 +497,11 @@
     }
 
     @Test
-    public void testSortThrowsCME() throws Exception {
-        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier((Supplier<List<Integer>>[])LIST_CME_CLASSES, SIZE);
+    public void testSortThrowsCME() {
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier(LIST_CME_SUPPLIERS, SIZE);
         for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
-            final List<Integer> list = ((List<Integer>) test.collection);
+            final List<Integer> list = test.collection;
 
             if (list.size() <= 1) {
                 continue;
@@ -523,7 +535,7 @@
     }
 
     @Test(dataProvider = "shortIntListProvider")
-    public void testRemoveIfFromSlice(final List<Integer> list) throws Exception {
+    public void testRemoveIfFromSlice(final List<Integer> list) {
         final List<Integer> sublist = list.subList(3, 6);
         assertTrue(sublist.removeIf(x -> x == 4));
         CollectionAsserts.assertContents(list, SLICED_EXPECTED);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/print/PrintServiceLookup/CountPrintServices.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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.
+ */
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import javax.print.PrintService;
+import javax.print.PrintServiceLookup;
+import javax.print.attribute.AttributeSet;
+import javax.print.attribute.HashAttributeSet;
+import javax.print.attribute.standard.PrinterName;
+
+/*
+ * @test
+ * @bug 8032693
+ * @summary Test that lpstat and JDK agree whether there are printers.
+ */
+public class CountPrintServices {
+
+  public static void main(String[] args) throws Exception {
+    String os = System.getProperty("os.name").toLowerCase();
+    System.out.println("OS is " + os);
+    if (!os.equals("linux")) {
+        System.out.println("Linux specific test. No need to continue");
+        return;
+    }
+    PrintService services[] =
+        PrintServiceLookup.lookupPrintServices(null, null);
+    if (services.length > 0) {
+       System.out.println("Services found. No need to test further.");
+       return;
+    }
+    String[] lpcmd = { "lpstat", "-a" };
+    Process proc = Runtime.getRuntime().exec(lpcmd);
+    proc.waitFor();
+    InputStreamReader ir = new InputStreamReader(proc.getInputStream());
+    BufferedReader br = new BufferedReader(ir);
+    int count = 0;
+    String printer;
+    while ((printer = br.readLine()) != null) {
+       System.out.println("lpstat:: " + printer);
+       count++;
+    }
+    if (count > 0) {
+        throw new RuntimeException("Services exist, but not found by JDK.");
+    }
+ }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/print/attribute/TestUnsupportedResolution.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,107 @@
+/*
+ * 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 8033277
+ * @summary Confirm that scaling of printout is correct.  Manual comparison with printout using a supported resolution is needed.
+ * @run main/manual TestUnsupportedResolution
+ */
+
+import java.awt.Graphics;
+import java.awt.print.PageFormat;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+
+import javax.print.*;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.standard.*;
+import javax.print.attribute.ResolutionSyntax;
+
+public class TestUnsupportedResolution implements Printable
+{
+public static void main(String[] args)
+{
+    System.out.println("USAGE: default or no args: it will test 300 dpi\n       args is \"600\" : it will test 600 dpi\n------------------------------------------------------\n");
+    TestUnsupportedResolution pt=new TestUnsupportedResolution();
+    pt.printWorks(args);
+}
+
+public void printWorks(String[] args)
+{
+    PrinterJob job=PrinterJob.getPrinterJob();
+    job.setPrintable(this);
+    PrintRequestAttributeSet settings=new HashPrintRequestAttributeSet();
+    PrinterResolution pr = new PrinterResolution(300, 300, ResolutionSyntax.DPI);
+    if (args.length > 0 && (args[0].compareTo("600") == 0)) {
+        pr = new PrinterResolution(600, 600, ResolutionSyntax.DPI);
+        System.out.println("Adding 600 Dpi attribute");
+    } else {
+        System.out.println("Adding 300 Dpi attribute");
+    }
+    PrintService ps = job.getPrintService();
+    boolean resolutionSupported = ps.isAttributeValueSupported(pr, null, null);
+    System.out.println("Is "+pr+" supported by "+ps+"?    "+resolutionSupported);
+    if (resolutionSupported) {
+        System.out.println("Resolution is supported.\nTest is not applicable, PASSED");
+    }
+    settings.add(pr);
+    if (args.length > 0 && (args[0].equalsIgnoreCase("fidelity"))) {
+        settings.add(Fidelity.FIDELITY_TRUE);
+        System.out.println("Adding Fidelity.FIDELITY_TRUE attribute");
+   }
+
+   if (job.printDialog(settings))
+   {
+        try {
+            job.print(settings);
+        } catch (PrinterException e) {
+            e.printStackTrace();
+        }
+    }
+}
+
+public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
+{
+    if (pageIndex>0)
+    {
+        return NO_SUCH_PAGE;
+    }
+
+    StringBuffer s=new StringBuffer();
+    for (int i=0;i<10;i++)
+    {
+        s.append("1234567890ABCDEFGHIJ");
+    }
+
+    int x=(int) pageFormat.getImageableX();
+    int y=(int) (pageFormat.getImageableY()+50);
+    graphics.drawString(s.toString(), x, y);
+
+    return PAGE_EXISTS;
+}
+}
+
--- a/jdk/test/javax/security/auth/kerberos/KerberosHashEqualsTest.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/javax/security/auth/kerberos/KerberosHashEqualsTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -25,7 +25,11 @@
  * @test
  * @bug 4641821
  * @summary hashCode() and equals() for KerberosKey and KerberosTicket
- * @ignore Must set up KDC and setup Kerberos configuration file
+ * @run main/manual KerberosHashEqualsTest
+ */
+
+/*
+ * Must setup KDC and Kerberos configuration file
  */
 
 import java.net.InetAddress;
--- a/jdk/test/javax/security/auth/kerberos/KerberosTixDateTest.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/javax/security/auth/kerberos/KerberosTixDateTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,11 @@
  * @test
  * @bug 6659990
  * @summary test the immutability of the Date fields in KerberosTicket class.
- * @ignore Must set up KDC and setup Kerberos configuration file
+ * @run main/manual KerberosTixDateTest
+ */
+
+/*
+ * Must setup KDC and Kerberos configuration file
  */
 
 import java.net.InetAddress;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JButton/JButtonPaintNPE/JButtonPaintNPE.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.Graphics;
+import java.awt.Toolkit;
+import java.awt.image.BufferedImage;
+import java.lang.reflect.InvocationTargetException;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 8009919
+ * @author Sergey Bylokhov
+ */
+public final class JButtonPaintNPE {
+
+    private static JFrame frame;
+
+    public static void main(final String[] args)
+            throws InvocationTargetException, InterruptedException {
+        SwingUtilities.invokeAndWait(() -> {
+            frame = new JFrame();
+            frame.add(new JButton() {
+                @Override
+                protected void paintComponent(final Graphics g) {
+                    Graphics gg = new BufferedImage(getWidth(), getHeight(),
+                                  BufferedImage.TYPE_INT_ARGB).createGraphics();
+                    super.paintComponent(gg);
+                    gg.dispose();
+                }
+            });
+            frame.setSize(300, 300);
+            frame.setLocationRelativeTo(null);
+            frame.setVisible(true);
+        });
+        sleep();
+        SwingUtilities.invokeAndWait(() -> {
+            if (frame != null) {
+                frame.dispose();
+            }
+        });
+    }
+
+    private static void sleep() {
+        try {
+            ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+            Thread.sleep(1000);
+        } catch (final InterruptedException ignored) {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/8010718/bug8010718.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8010718
+ * @summary [macosx] JFileChooser current filter nullified by addChoosableFileFilter
+ * @author Tomas Hurka
+ */
+import java.io.File;
+import javax.swing.*;
+import javax.swing.filechooser.FileFilter;
+
+public class bug8010718 {
+
+    public static void main(String[] args) throws Exception {
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                JFileChooser fileChooser = new JFileChooser();
+                fileChooser.addChoosableFileFilter(new FileFilter() {
+                    @Override
+                    public boolean accept(File f) {
+                        return f.isDirectory() || f.getName().toLowerCase().endsWith(".xml");
+                    }
+
+                    @Override
+                    public String getDescription() {
+                        return "XML";
+                    }
+                });
+                fileChooser.addChoosableFileFilter(new FileFilter() {
+                    @Override
+                    public boolean accept(File f) {
+                        return f.isDirectory() || f.getName().toLowerCase().endsWith(".txt");
+                    }
+
+                    @Override
+                    public String getDescription() {
+                        return "TXT";
+                    }
+                });
+                if (fileChooser.getFileFilter() == null) {
+                    throw new RuntimeException("getFileFilter() should not return null");
+                }
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JMenuItem/8031573/bug8031573.html	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,40 @@
+<!--
+ Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<body>
+
+Verify that high resolution system icons are used JCheckBoxMenuItem 
+on HiDPI displays.
+
+If the display does not support HiDPI mode press PASS.
+
+1. Run the test on HiDPI Display.
+2. Press the Menu in the applet
+3. Check that the icon on the JCheckBoxMenuItem is smooth
+If so, press PASS, else press FAIL.
+
+<applet  code="bug8031573.class" width=250 height=250></applet>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JMenuItem/8031573/bug8031573.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.awt.FlowLayout;
+import javax.swing.JApplet;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.SwingUtilities;
+
+/* @test
+ * @bug 8031573
+ * @summary [macosx] Checkmarks of JCheckBoxMenuItems aren't rendered
+ *           in high resolution on Retina
+ * @author Alexander Scherbatiy
+ * @run applet/manual=yesno bug8031573.html
+ */
+public class bug8031573 extends JApplet {
+
+    @Override
+    public void init() {
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+
+                @Override
+                public void run() {
+                    JMenuBar bar = new JMenuBar();
+                    JMenu menu = new JMenu("Menu");
+                    JCheckBoxMenuItem checkBoxMenuItem
+                            = new JCheckBoxMenuItem("JCheckBoxMenuItem");
+                    checkBoxMenuItem.setSelected(true);
+                    menu.add(checkBoxMenuItem);
+                    bar.add(menu);
+                    setJMenuBar(bar);
+                }
+            });
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JOptionPane/8024926/bug8024926.html	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,32 @@
+<!--
+ Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+    <head>
+        <title>High resolution icon test, bug ID 8024926</title>
+    </head>
+    <body>
+    <applet CODE="bug8024926.class" WIDTH=300 HEIGHT=100></applet>
+    <p> See the dialog box (usually in upper left corner) for instructions</p>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JOptionPane/8024926/bug8024926.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.awt.BorderLayout;
+import java.awt.Dialog;
+import java.awt.EventQueue;
+import java.awt.Frame;
+import java.awt.TextArea;
+import javax.swing.JApplet;
+import javax.swing.JOptionPane;
+import sun.awt.OSInfo;
+
+/**
+ * @test
+ * @bug 8024926
+ * @summary [macosx] AquaIcon HiDPI support
+ * @author Alexander Scherbatiy
+ * @run applet/manual=yesno bug8024926.html
+ */
+public class bug8024926 extends JApplet {
+    //Declare things used in the test, like buttons and labels here
+
+    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());
+
+
+        if (OSInfo.getOSType().equals(OSInfo.OSType.MACOSX)) {
+            String[] instructions = {
+                "Verify that high resolution system icons are used"
+                + " in JOptionPane on HiDPI displays.",
+                "1) Run the test on Retina display or enable the Quartz Debug"
+                + " and select the screen resolution with (HiDPI) label",
+                "2) Check that the error icon on the JOptionPane is smooth",
+                "If so, press PASS, else press FAIL."
+            };
+            Sysout.createDialogWithInstructions(instructions);
+
+        } else {
+            String[] instructions = {
+                "This test is not applicable to the current platform. Press PASS."
+            };
+            Sysout.createDialogWithInstructions(instructions);
+        }
+
+
+    }//End  init()
+
+    public void start() {
+        //Get things going.  Request focus, set size, et cetera
+        setSize(200, 200);
+        setVisible(true);
+        validate();
+        EventQueue.invokeLater(new Runnable() {
+
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+    }// start()
+
+    //The rest of this class is the actions which perform the test...
+    //Use Sysout.println to communicate with the user NOT System.out!!
+    //Sysout.println ("Something Happened!");
+    private static void createAndShowGUI() {
+        JOptionPane.showMessageDialog(null,
+                "Icons should have high resolution.",
+                "High resolution icon test.",
+                JOptionPane.ERROR_MESSAGE);
+    }
+}// class BlockedWindowTest
+
+/* Place other classes related to the test after this line */
+/**
+ * **************************************************
+ * 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();
+
+        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/javax/swing/JPopupMenu/6694823/bug6694823.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/javax/swing/JPopupMenu/6694823/bug6694823.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
 import java.awt.*;
 import sun.awt.SunToolkit;
 import java.security.Permission;
-import sun.security.util.SecurityConstants;
+import sun.awt.AWTPermissions;
 
 public class bug6694823 {
     private static JFrame frame;
@@ -61,7 +61,8 @@
 
         System.setSecurityManager(new SecurityManager(){
 
-            private String allowsAlwaysOnTopPermission = SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION.getName();
+            private String allowsAlwaysOnTopPermission =
+                AWTPermissions.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION.getName();
 
             @Override
             public void checkPermission(Permission perm) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JPopupMenu/7154841/bug7154841.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 7154841
+  @summary JPopupMenu is overlapped by a Dock on Mac OS X
+  @author Petr Pchelko
+ */
+
+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;
+
+public class bug7154841 {
+
+    private static final int STEP = 10;
+
+    private static volatile boolean passed = false;
+    private static JFrame frame;
+    private static JPopupMenu popupMenu;
+    private static AtomicReference<Rectangle> screenBounds = new AtomicReference<>();
+
+    private static void initAndShowUI() {
+        popupMenu = new JPopupMenu();
+        for (int i = 0; i < 100; i++) {
+            JRadioButtonMenuItem item = new JRadioButtonMenuItem(" Test " + i);
+            item.addMouseMotionListener(new MouseMotionAdapter() {
+                @Override
+                public void mouseMoved(MouseEvent e) {
+                    passed = true;
+                }
+            });
+            popupMenu.add(item);
+        }
+
+        frame = new JFrame();
+        screenBounds.set(getScreenBounds());
+        frame.setBounds(screenBounds.get());
+        frame.setVisible(true);
+    }
+
+    public static void main(String[] args) throws Exception {
+        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+            return; // Test only for Mac OS X
+        }
+
+        try {
+            Robot r = new Robot();
+            r.setAutoDelay(100);
+            r.setAutoWaitForIdle(true);
+            r.mouseMove(0, 0);
+
+            SwingUtilities.invokeAndWait(bug7154841::initAndShowUI);
+
+            sleep();
+
+            SwingUtilities.invokeAndWait(() -> {
+                popupMenu.show(frame, frame.getX() + frame.getWidth() / 2, frame.getY() + frame.getHeight() / 2);
+            });
+
+            sleep();
+
+            int y = (int)screenBounds.get().getY() + (int)screenBounds.get().getHeight() - 10;
+            int center = (int)(screenBounds.get().getX() + screenBounds.get().getWidth() / 2);
+            for (int x = center - 10 * STEP; x < center + 10 * STEP; x += STEP) {
+                r.mouseMove(x, y);
+            }
+
+            if (!passed) {
+                throw new RuntimeException("Failed: no mouse events on the popup menu");
+            }
+        } finally {
+            SwingUtilities.invokeLater(() -> {
+                if (frame != null) {
+                    frame.dispose();
+                }
+            });
+        }
+    }
+
+    public static Rectangle getScreenBounds() {
+        return GraphicsEnvironment
+                .getLocalGraphicsEnvironment()
+                .getDefaultScreenDevice()
+                .getDefaultConfiguration()
+                .getBounds();
+    }
+
+    private static void sleep() {
+        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        try {
+            Thread.sleep(200);
+        } catch (InterruptedException ignored) { }
+    }
+}
--- a/jdk/test/javax/swing/JPopupMenu/7160604/bug7160604.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/javax/swing/JPopupMenu/7160604/bug7160604.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,16 +38,24 @@
 import javax.swing.JPopupMenu;
 import javax.swing.JWindow;
 import javax.swing.SwingUtilities;
-import java.awt.BorderLayout;
-import java.awt.Color;
+import java.awt.*;
 import java.awt.event.ActionEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
+import static java.awt.GraphicsDevice.WindowTranslucency.*;
 
 public class bug7160604 extends JApplet {
 
     public void init() {
         SwingUtilities.invokeLater(() -> {
+            if (!GraphicsEnvironment
+                    .getLocalGraphicsEnvironment()
+                    .getDefaultScreenDevice()
+                    .isWindowTranslucencySupported(PERPIXEL_TRANSLUCENT)) {
+                // Tested translucency is not supported. Test passed
+                return;
+            }
+
             final JWindow window = new JWindow();
             window.setLocation(200, 200);
             window.setSize(300, 300);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JSpinner/8008657/bug8008657.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,155 @@
+/*
+ * 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.ComponentOrientation;
+import java.awt.Toolkit;
+import java.util.Calendar;
+import java.util.Date;
+import javax.swing.JFrame;
+import javax.swing.JSpinner;
+import javax.swing.JTextField;
+import javax.swing.SpinnerDateModel;
+import javax.swing.SpinnerModel;
+import javax.swing.SpinnerNumberModel;
+import javax.swing.SwingUtilities;
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 8008657
+ * @author Alexander Scherbatiy
+ * @summary JSpinner setComponentOrientation doesn't affect on text orientation
+ * @run main bug8008657
+ */
+public class bug8008657 {
+
+    private static SunToolkit toolkit;
+    private static JSpinner spinner;
+
+    public static void main(String[] args) throws Exception {
+
+        toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+        SwingUtilities.invokeAndWait(() -> {
+            createDateSpinner();
+            createAndShowUI();
+        });
+
+        toolkit.realSync();
+        testSpinner(false);
+
+        SwingUtilities.invokeAndWait(() -> {
+            createNumberSpinner();
+            createAndShowUI();
+        });
+
+        toolkit.realSync();
+        testSpinner(true);
+    }
+
+    static void testSpinner(boolean checkHorizontalAligment)
+            throws Exception {
+
+        SwingUtilities.invokeAndWait(() -> {
+            spinner.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        });
+        toolkit.realSync();
+
+        SwingUtilities.invokeAndWait(() -> {
+
+            JTextField textField = getTextField();
+            if (!ComponentOrientation.RIGHT_TO_LEFT.equals(
+                    textField.getComponentOrientation())) {
+                throw new RuntimeException("Wrong orientation!");
+            }
+
+            if (checkHorizontalAligment
+                    && textField.getHorizontalAlignment() != JTextField.LEFT) {
+                throw new RuntimeException("Wrong horizontal aligment!");
+            }
+
+            spinner.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        });
+
+        toolkit.realSync();
+
+        SwingUtilities.invokeAndWait(() -> {
+            JTextField textField = getTextField();
+            if (!ComponentOrientation.LEFT_TO_RIGHT.equals(
+                    textField.getComponentOrientation())) {
+                throw new RuntimeException("Wrong orientation!");
+            }
+
+            if (checkHorizontalAligment
+                    && textField.getHorizontalAlignment() != JTextField.RIGHT) {
+                throw new RuntimeException("Wrong horizontal aligment!");
+            }
+
+            spinner.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        });
+    }
+
+    static JTextField getTextField() {
+        return ((JSpinner.DefaultEditor) spinner.getEditor()).getTextField();
+    }
+
+    static String getOrientation(ComponentOrientation orientation) {
+        return orientation == ComponentOrientation.LEFT_TO_RIGHT ? "LEFT_TO_RIGHT" : "RIGHT_TO_LEFT";
+    }
+
+    static void createDateSpinner() {
+        Calendar calendar = Calendar.getInstance();
+        Date initDate = calendar.getTime();
+        calendar.add(Calendar.YEAR, -1);
+        Date earliestDate = calendar.getTime();
+        calendar.add(Calendar.YEAR, 1);
+        Date latestDate = calendar.getTime();
+        SpinnerModel dateModel = new SpinnerDateModel(initDate,
+                earliestDate,
+                latestDate,
+                Calendar.YEAR);
+        spinner = new JSpinner();
+        spinner.setModel(dateModel);
+    }
+
+    static void createNumberSpinner() {
+        Calendar calendar = Calendar.getInstance();
+        calendar.add(Calendar.YEAR, -1);
+        calendar.add(Calendar.YEAR, 1);
+        int currentYear = calendar.get(Calendar.YEAR);
+        SpinnerModel yearModel = new SpinnerNumberModel(currentYear, //initial value
+                currentYear - 1, //min
+                currentYear + 2, //max
+                1);                //step
+        spinner = new JSpinner();
+        spinner.setModel(yearModel);
+    }
+
+    static void createAndShowUI() {
+        JFrame frame = new JFrame("Test");
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setSize(300, 100);
+        frame.getContentPane().add(spinner);
+        frame.setVisible(true);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTable/8031971/bug8031971.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.util.Date;
+import java.util.Hashtable;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
+
+/**
+ * @test
+ * @bug 8031971
+ * @author Alexander Scherbatiy
+ * @summary Use only public methods in the SwingLazyValue
+ * @run main bug8031971
+ */
+public class bug8031971 {
+
+    static Object[][] RENDERERS = {
+        {Object.class, "javax.swing.table.DefaultTableCellRenderer$UIResource"},
+        {Number.class, "javax.swing.JTable$NumberRenderer"},
+        {Float.class, "javax.swing.JTable$DoubleRenderer"},
+        {Double.class, "javax.swing.JTable$DoubleRenderer"},
+        {Date.class, "javax.swing.JTable$DateRenderer"},
+        {Icon.class, "javax.swing.JTable$IconRenderer"},
+        {ImageIcon.class, "javax.swing.JTable$IconRenderer"},
+        {Boolean.class, "javax.swing.JTable$BooleanRenderer"}
+    };
+
+    static Object[][] EDITORS = {
+        {Object.class, "javax.swing.JTable$GenericEditor"},
+        {Number.class, "javax.swing.JTable$NumberEditor"},
+        {Boolean.class, "javax.swing.JTable$BooleanEditor"}
+    };
+
+    public static void main(String[] args) throws Exception {
+
+        SwingUtilities.invokeAndWait(() -> {
+
+            TestTable table = new TestTable();
+            test(table.getDefaultRenderersByColumnClass(), RENDERERS);
+            test(table.getDefaultEditorsByColumnClass(), EDITORS);
+        });
+    }
+
+    static void test(Hashtable table, Object[][] values) {
+        for (int i = 0; i < values.length; i++) {
+            test(table.get(values[i][0]), (String) values[i][1]);
+        }
+    }
+
+    static void test(Object obj, String className) {
+        if (!obj.getClass().getCanonicalName().equals(className.replace('$', '.'))) {
+            throw new RuntimeException("Wrong value!");
+        }
+    }
+
+    static class TestTable extends JTable {
+
+        Hashtable getDefaultRenderersByColumnClass() {
+            return defaultRenderersByColumnClass;
+        }
+
+        Hashtable getDefaultEditorsByColumnClass() {
+            return defaultEditorsByColumnClass;
+        }
+    }
+}
--- a/jdk/test/javax/swing/text/AbstractDocument/7146146/bug7146146.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 7146146
-   @summary Deadlock between subclass of AbstractDocument and UndoManager
-   @author Pavel Porvatov
-*/
-
-import javax.swing.text.BadLocationException;
-import javax.swing.text.PlainDocument;
-import javax.swing.text.StringContent;
-import javax.swing.undo.UndoManager;
-
-public class bug7146146 {
-    public static void main(String[] args) throws Exception {
-        for (int i = 0; i < 1000; i++) {
-            System.out.print("Iteration " + i);
-
-            test();
-
-            System.out.print(" passed");
-        }
-    }
-
-    private static void test() throws Exception {
-        final PlainDocument doc = new PlainDocument(new StringContent());
-        final UndoManager undoManager = new UndoManager();
-
-        doc.addUndoableEditListener(undoManager);
-        doc.insertString(0, "<Test 1>", null);
-
-        Thread t1 = new Thread("Thread 1") {
-            @Override
-            public void run() {
-                try {
-                    doc.insertString(0, "<Test 2>", null);
-                } catch (BadLocationException e) {
-                    throw new RuntimeException(e);
-                }
-            }
-        };
-
-        Thread t2 = new Thread("Thread 2") {
-            @Override
-            public void run() {
-                undoManager.undo();
-            }
-        };
-
-        t1.start();
-        t2.start();
-
-        t1.join();
-        t2.join();
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/AbstractDocument/8030118/Test8030118.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.PlainDocument;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+/*
+ * @test
+ * @bug 8030118
+ * @summary Tests that AbstractDocument cannot be modified from another thread
+ * @author Sergey Malenkov
+ */
+
+public class Test8030118 implements DocumentListener, Runnable {
+    private final CountDownLatch latch = new CountDownLatch(1);
+    private final PlainDocument doc = new PlainDocument();
+
+    private Test8030118(String string) throws Exception {
+        this.doc.addDocumentListener(this);
+        this.doc.insertString(0, string, null);
+    }
+
+    @Override
+    public void run() {
+        try {
+            this.doc.remove(0, this.doc.getLength());
+        } catch (BadLocationException exception) {
+            throw new Error("unexpected", exception);
+        }
+        this.latch.countDown();
+    }
+
+    @Override
+    public void insertUpdate(DocumentEvent event) {
+        new Thread(this).start();
+        try {
+            this.latch.await(10, TimeUnit.SECONDS);
+        } catch (InterruptedException exception) {
+            throw new Error("unexpected", exception);
+        }
+        try {
+            event.getDocument().getText(event.getOffset(), event.getLength());
+        } catch (BadLocationException exception) {
+            throw new Error("concurrent modification", exception);
+        }
+    }
+
+    @Override
+    public void removeUpdate(DocumentEvent event) {
+    }
+
+    @Override
+    public void changedUpdate(DocumentEvent event) {
+    }
+
+    public static void main(String[] args) throws Exception {
+        new Test8030118("string");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/html/parser/Parser/8028616/bug8028616.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,77 @@
+/*
+ * 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 8028616
+ * @summary Tests correct parsing of the text with leading slash (/)
+ * @author Dmitry Markov
+ */
+
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLEditorKit;
+import java.io.StringReader;
+
+public class bug8028616 {
+    private static final String text = "/ at start is bad";
+    private static Object lock = new Object();
+    private static boolean isCallbackInvoked = false;
+    private static Exception exception = null;
+
+    public static void main(String[] args) throws Exception {
+        ParserCB cb = new ParserCB();
+        HTMLEditorKit htmlKit = new HTMLEditorKit();
+        HTMLDocument htmlDoc = (HTMLDocument) htmlKit.createDefaultDocument();
+
+        htmlDoc.getParser().parse(new StringReader(text), cb, true);
+
+        synchronized (lock) {
+            if (!isCallbackInvoked) {
+                lock.wait(5000);
+            }
+        }
+
+        if (!isCallbackInvoked) {
+            throw new RuntimeException("Test Failed: ParserCallback.handleText() is not invoked for text - " + text);
+        }
+
+        if (exception != null) {
+            throw exception;
+        }
+    }
+
+    private static class ParserCB extends HTMLEditorKit.ParserCallback {
+        @Override
+        public void handleText(char[] data, int pos) {
+            synchronized (lock) {
+                if (!text.equals(new String(data)) || pos != 0) {
+                    exception = new RuntimeException(
+                        "Test Failed: the data passed to ParserCallback.handleText() does not meet the expectation");
+                }
+                isCallbackInvoked = true;
+                lock.notifyAll();
+            }
+        }
+    }
+}
+
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -98,6 +98,7 @@
             ServerSocketFactory ssf =
                 PostThruProxy.getServerSocketFactory(useSSL);
             ServerSocket ss = ssf.createServerSocket(serverPort);
+            ss.setSoTimeout(30000);  // 30 seconds
             serverPort = ss.getLocalPort();
             new TestServer(ss);
         } catch (Exception e) {
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -100,6 +100,7 @@
             ServerSocketFactory ssf =
                 PostThruProxyWithAuth.getServerSocketFactory(useSSL);
             ServerSocket ss = ssf.createServerSocket(serverPort);
+            ss.setSoTimeout(30000);  // 30 seconds
             serverPort = ss.getLocalPort();
             new TestServer(ss);
         } catch (Exception e) {
--- a/jdk/test/sun/security/krb5/auto/BadKdc.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/krb5/auto/BadKdc.java	Tue Apr 01 15:37:15 2014 +0200
@@ -39,7 +39,29 @@
     //                                               ^ kdc#         ^ timeout
     static final Pattern re = Pattern.compile(
             ">>> KDCCommunication: kdc=kdc.rabbit.hole UDP:(\\d)...., " +
-            "timeout=(\\d)000,");
+            "timeout=(\\d+),");
+
+    // Ratio for timeout values of all timeout tests. Not final so that
+    // each test can choose their own.
+    static float ratio = 2f;
+
+    static void setRatio(float ratio) {
+        BadKdc.ratio = ratio;
+    }
+
+    static float getRatio() {
+        return ratio;
+    }
+
+    // Gets real timeout value. This method is called when writing krb5.conf
+    static int toReal(int from) {
+        return (int)(from * ratio + .5);
+    }
+
+    // De-ratio a millisecond value to second
+    static int toSymbolicSec(int from) {
+        return (int)(from / ratio / 1000f + 0.5);
+    }
 
     /*
      * There are several cases this test fails:
@@ -101,7 +123,7 @@
 
         fw.write("[libdefaults]\n" +
                 "default_realm = " + OneKDC.REALM + "\n" +
-                "kdc_timeout = 2000\n");
+                "kdc_timeout = " + toReal(2000) + "\n");
         fw.write("[realms]\n" + OneKDC.REALM + " = {\n" +
                 "kdc = " + OneKDC.KDCHOST + ":" + p1 + "\n" +
                 "kdc = " + OneKDC.KDCHOST + ":" + p2 + "\n" +
@@ -184,7 +206,8 @@
             Matcher m = re.matcher(line);
             if (m.find()) {
                 System.out.println(line);
-                sb.append(m.group(1)).append(m.group(2));
+                sb.append(m.group(1))
+                        .append(toSymbolicSec(Integer.parseInt(m.group(2))));
             }
         }
         if (failed) sb.append('-');
--- a/jdk/test/sun/security/krb5/auto/BadKdc1.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/krb5/auto/BadKdc1.java	Tue Apr 01 15:37:15 2014 +0200
@@ -28,14 +28,21 @@
  * @summary krb5 should not try to access unavailable kdc too often
  */
 
-import java.io.*;
 import java.security.Security;
 
 public class BadKdc1 {
 
    public static void main(String[] args)
            throws Exception {
-       Security.setProperty("krb5.kdc.bad.policy", "tryLess");
+
+       // 5 sec is default timeout for tryLess
+       if (BadKdc.getRatio() > 2.5) {
+           Security.setProperty("krb5.kdc.bad.policy",
+                   "tryLess:1," + BadKdc.toReal(2000));
+       } else {
+           Security.setProperty("krb5.kdc.bad.policy", "tryLess");
+       }
+
        BadKdc.go(
                "121212222222(32){1,2}1222(32){1,2}", // 1 2
                // The above line means try kdc1 for 2 seconds then kdc1
--- a/jdk/test/sun/security/krb5/auto/BadKdc2.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/krb5/auto/BadKdc2.java	Tue Apr 01 15:37:15 2014 +0200
@@ -35,7 +35,12 @@
 
     public static void main(String[] args)
             throws Exception {
-        Security.setProperty("krb5.kdc.bad.policy", "tryLess:2,1000");
+
+        // 1 sec is too short.
+        BadKdc.setRatio(3.0f);
+
+        Security.setProperty(
+                "krb5.kdc.bad.policy", "tryLess:2," + BadKdc.toReal(1000));
         BadKdc.go(
                 "121212222222(32){1,2}11112121(32){1,2}", // 1 2
                 "11112121(32){1,2}11112121(32){1,2}", // 1 2
--- a/jdk/test/sun/security/krb5/auto/MaxRetries.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/krb5/auto/MaxRetries.java	Tue Apr 01 15:37:15 2014 +0200
@@ -60,7 +60,7 @@
         test1(5000, 2);         // 2 2
 
         // For tryLess
-        Security.setProperty("krb5.kdc.bad.policy", "tryless");
+        Security.setProperty("krb5.kdc.bad.policy", "tryless:1," + BadKdc.toReal(5000));
         rewriteMaxRetries(4);
         test1(4000, 7);         // 1 1 1 1 2 1 2
         test1(4000, 4);         // 1 2 1 2
@@ -94,7 +94,7 @@
      * @param count the expected total try
      */
     private static void test1(int timeout, int count) throws Exception {
-        String timeoutTag = "timeout=" + timeout;
+        String timeoutTag = "timeout=" + BadKdc.toReal(timeout);
         ByteArrayOutputStream bo = new ByteArrayOutputStream();
         PrintStream oldout = System.out;
         System.setOut(new PrintStream(bo));
@@ -192,12 +192,12 @@
             if (s.startsWith("[realms]")) {
                 // Reconfig global setting
                 fw.write("max_retries = 2\n");
-                fw.write("kdc_timeout = 5000\n");
+                fw.write("kdc_timeout = " + BadKdc.toReal(5000) + "\n");
             } else if (s.trim().startsWith("kdc = ")) {
                 if (value != -1) {
                     // Reconfig for realm
                     fw.write("    max_retries = " + value + "\n");
-                    fw.write("    kdc_timeout = " + (value*1000) + "\n");
+                    fw.write("    kdc_timeout = " + BadKdc.toReal(value*1000) + "\n");
                 }
                 // Add a bad KDC as the first candidate
                 fw.write("    kdc = localhost:33333\n");
--- a/jdk/test/sun/security/krb5/auto/TcpTimeout.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/krb5/auto/TcpTimeout.java	Tue Apr 01 15:37:15 2014 +0200
@@ -63,7 +63,7 @@
                     "udp_preference_limit = 1\n" +
                     "max_retries = 2\n" +
                     "default_realm = " + OneKDC.REALM + "\n" +
-                    "kdc_timeout = 5000\n");
+                    "kdc_timeout = " + BadKdc.toReal(5000) + "\n");
             fw.write("[realms]\n" + OneKDC.REALM + " = {\n" +
                     "kdc = " + OneKDC.KDCHOST + ":" + p1 + "\n" +
                     "kdc = " + OneKDC.KDCHOST + ":" + p2 + "\n" +
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/config/ExtraLines.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,52 @@
+/*
+ * 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 8036971
+ * @compile -XDignore.symbol.file ExtraLines.java
+ * @run main/othervm ExtraLines
+ * @summary krb5.conf does not accept directive lines before the first section
+ */
+
+import sun.security.krb5.Config;
+import java.nio.file.*;
+import java.util.Objects;
+
+public class ExtraLines {
+    public static void main(String[] args) throws Exception {
+        Path base = Paths.get("krb5.conf");
+        Path include = Paths.get("included.conf");
+        String baseConf = "include " + include.toAbsolutePath().toString()
+                + "\n[x]\na = b\n";
+        String includeConf = "[y]\nc = d\n";
+        Files.write(include, includeConf.getBytes());
+        Files.write(base, baseConf.getBytes());
+
+        System.setProperty("java.security.krb5.conf", base.toString());
+        Config.refresh();
+
+        if (!Objects.equals(Config.getInstance().get("x", "a"), "b")) {
+            throw new Exception("Failed");
+        }
+    }
+}
--- a/jdk/test/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -26,10 +26,13 @@
  * @bug 6313675 6323647
  * @summary Verify that all ciphersuites work in FIPS mode
  * @library ..
- * @ignore JSSE supported cipher suites are changed with CR 6916074,
- *     need to update this test case in JDK 7 soon
- * @run main/othervm ClientJSSEServerJSSE
  * @author Andreas Sterbenz
+ * @run main/manual ClientJSSEServerJSSE
+ */
+
+/*
+ * JSSE supported cipher suites are changed with CR 6916074,
+ * need to update this test case in JDK 7 soon
  */
 
 import java.security.*;
--- a/jdk/test/sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 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
@@ -23,8 +23,7 @@
 
 /*
  * @test
- * @bug 4231980
- * @bug 4233913
+ * @bug 4231980 4233913
  * @summary Make sure that when no system policy and user policy files exist,
  * the built-in default policy will be used, which - amongst other things -
  * grants standard extensions the AllPermission. This regression is for 2
@@ -34,7 +33,7 @@
  *
  * @build SomeExtensionClass
  * @build GrantAllPermToExtWhenNoPolicy
- * @ignore shell GrantAllPermToExtWhenNoPolicy.sh
+ * @run shell/manual GrantAllPermToExtWhenNoPolicy.sh
  */
 
 import java.security.*;
--- a/jdk/test/sun/security/provider/PolicyParser/ExtDirs.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/provider/PolicyParser/ExtDirs.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 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
@@ -26,13 +26,16 @@
  * @bug 4215035
  * @summary standard extensions path is hard-coded in default
  *      system policy file
- * @ignore run this by hand
- *
- *      java    -Djava.security.manager \
- *              -Djava.ext.dirs=./ExtDirsA:./ExtDirsB \
- *              -Djava.security.policy==./ExtDirs.policy \
- *              -Djava.security.debug=parser \
- *              ExtDirs
+ * @run main/manual ExtDirs
+ */
+
+/*
+ * Run this test manually with:
+ * java    -Djava.security.manager \
+ *         -Djava.ext.dirs=./ExtDirsA:./ExtDirsB \
+ *         -Djava.security.policy==./ExtDirs.policy \
+ *         -Djava.security.debug=parser \
+ *         ExtDirs
  */
 
 public class ExtDirs {
--- a/jdk/test/sun/security/provider/PolicyParser/ExtDirsChange.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/provider/PolicyParser/ExtDirsChange.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,16 +26,19 @@
  * @bug 4993819
  * @summary standard extensions path is hard-coded in default
  *      system policy file
- * @ignore run this by hand
- *
- *      javac ExtDirChange
- *      rm ExtDirsA*.class ExtDirsB*.class
- *      java    -Djava.security.manager \
- *              -Dtest.src=. \
- *              -Djava.security.policy=ExtDirsChange.policy \
- *              -Djava.security.debug=parser \
- *              -cp ExtDirsA/a.jar:ExtDirsB/b.jar:. \
- *              ExtDirsChange
+ * @run main/manual ExtDirsChange
+ */
+
+/*
+ * Run this test manually with:
+ * javac ExtDirChange
+ * rm ExtDirsA*.class ExtDirsB*.class
+ * java    -Djava.security.manager \
+ *         -Dtest.src=. \
+ *         -Djava.security.policy=ExtDirsChange.policy \
+ *         -Djava.security.debug=parser \
+ *         -cp ExtDirsA/a.jar:ExtDirsB/b.jar:. \
+ *         ExtDirsChange
  */
 
 import java.io.File;
--- a/jdk/test/sun/security/provider/PolicyParser/ExtDirsDefaultPolicy.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/provider/PolicyParser/ExtDirsDefaultPolicy.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,22 +26,25 @@
  * @bug 4993819
  * @summary standard extensions path is hard-coded in default
  *      system policy file
- * @ignore run this by hand
- *
- *      java    -Djava.security.manager \
- *              -Djava.ext.dirs=./ExtDirsA:./ExtDirsB \
- *              -Djava.security.debug=parser \
- *              ExtDirsDefaultPolicy
+ * @run main/manual ExtDirsDefaultPolicy
+ */
+
+/*
+ * Run this test manually with:
+ * java    -Djava.security.manager \
+ *         -Djava.ext.dirs=./ExtDirsA:./ExtDirsB \
+ *         -Djava.security.debug=parser \
+ *         ExtDirsDefaultPolicy
  *
  * To test other varients of the ${{java.ext.dirs}} protocol, remove
  * the grant statement for java.ext.dirs in $JAVA_HOME/lib/security/java.policy
  * and then run against the 3 different policy files.
  *
- *      java    -Djava.security.manager \
- *              -Djava.ext.dirs=./ExtDirsA:./ExtDirsB \
- *              -Djava.security.debug=parser \
- *              -Djava.security.policy=ExtDirs{1,2,3}.policy \
- *              ExtDirsDefaultPolicy
+ * java    -Djava.security.manager \
+ *         -Djava.ext.dirs=./ExtDirsA:./ExtDirsB \
+ *         -Djava.security.debug=parser \
+ *         -Djava.security.policy=ExtDirs{1,2,3}.policy \
+ *         ExtDirsDefaultPolicy
  */
 
 public class ExtDirsDefaultPolicy {
--- a/jdk/test/sun/security/provider/PolicyParser/PrincipalExpansionError.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/provider/PolicyParser/PrincipalExpansionError.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,56 +25,54 @@
  * @test
  * @bug 4373996
  * @summary parser incorrectly ignores a principal if the principal name
- *      expands to nothing.  this test is a bit complicated.
- *
- *      1) PrincipalExpansionError.java
- *              the test itself.  this test creates a Subject with a
- *              SolarisPrincipal("TestPrincipal") and calls doAs
- *              with a PrincipalExpansionErrorAction.
- *
- *      2) PrincipalExpansionErrorAction
- *              this action tries to read the file, /testfile
+ *      expands to nothing.
+ * @run main/manual PrincipalExpansionError
+ */
+
+/*
+ * This test is a bit complicated.
+ * 1) PrincipalExpansionError.java
+ *         the test itself.  this test creates a Subject with a
+ *         SolarisPrincipal("TestPrincipal") and calls doAs
+ *         with a PrincipalExpansionErrorAction.
+ * 2) PrincipalExpansionErrorAction
+ *         this action tries to read the file, /testfile
+ * 3) to run the test:
+ *         a) jtreg -verbose:all -testjdk:<your_jdk>/build/sparc
+ *                 PrincipalExpansionError.java
+ *         b) PrincipalExpansionError is compiled and put into
+ *                 the "test.classes" directory
+ *         c) PrincipalExpansionErrorAction is compiled and put into
+ *                 the "test.classes"/apackage directory
+ *                 (since it belongs to the 'apackage' package
+ *         d) the PrincipalExpansionError shell script moves
+ *                 test.classes/apackage to test.src/apackage.
+ *                 this guarantees that the test will run
+ *                 with codebase test.classes, and the action
+ *                 will run with codebase test.src.
+ *         e) the test is executed.  permissions to read the file,
+ *                 /testfile, were granted to the PrincipalExpansionError.
+ *                 the policy entry for PrincipalExpansionErrorAction
+ *                 running as SolarisPrincipal("TestPrincipal")
+ *                 was also granted the file permission,
+ *                 but it has a bogus second SolarisPrincipal with
+ *                 a name that can't be property-expanded.
  *
- *      3) to run the test:
- *              a) jtreg -verbose:all -testjdk:<your_jdk>/build/sparc
- *                      PrincipalExpansionError.java
- *              b) PrincipalExpansionError is compiled and put into
- *                      the "test.classes" directory
- *              c) PrincipalExpansionErrorAction is compiled and put into
- *                      the "test.classes"/apackage directory
- *                      (since it belongs to the 'apackage' package
- *              d) the PrincipalExpansionError shell script moves
- *                      test.classes/apackage to test.src/apackage.
- *                      this guarantees that the test will run
- *                      with codebase test.classes, and the action
- *                      will run with codebase test.src.
- *              e) the test is executed.  permissions to read the file,
- *                      /testfile, were granted to the PrincipalExpansionError.
- *                      the policy entry for PrincipalExpansionErrorAction
- *                      running as SolarisPrincipal("TestPrincipal")
- *                      was also granted the file permission,
- *                      but it has a bogus second SolarisPrincipal with
- *                      a name that can't be property-expanded.
- *
- *                      the old behavior of the code would ignore the
- *                      bogus entry and incorrectly grants the file permission
- *                      to SolarisPrincipal("TestPrincipal").
- *                      the new behavior correctly ignores the entire
- *                      policy entry.
- *                      Please note that the jtreg needs to be granted
- *                      allpermissions for this test to succeed. If the codebase
- *                      for jtreg changes, the PrincipalExpansionError.policy
- *                      needs to be updated.
- *
- *              f) original @ tags:
- *                      compile PrincipalExpansionErrorAction.java
- *                      run shell PrincipalExpansionError.sh
- *                      run main/othervm/policy=PrincipalExpansionError.policy
- *                              -Djava.security.debug=access,domain,failure
- *                              PrincipalExpansionError
- *
- * @ignore unable to rely on location or javatest.jar
- *              (so we can grant it AllPermission)
+ *                 the old behavior of the code would ignore the
+ *                 bogus entry and incorrectly grants the file permission
+ *                 to SolarisPrincipal("TestPrincipal").
+ *                 the new behavior correctly ignores the entire
+ *                 policy entry.
+ *                 Please note that the jtreg needs to be granted
+ *                 allpermissions for this test to succeed. If the codebase
+ *                 for jtreg changes, the PrincipalExpansionError.policy
+ *                 needs to be updated.
+ *         f) original @ tags:
+ *                 compile PrincipalExpansionErrorAction.java
+ *                 run shell PrincipalExpansionError.sh
+ *                 run main/othervm/policy=PrincipalExpansionError.policy
+ *                         -Djava.security.debug=access,domain,failure
+ *                         PrincipalExpansionError
  */
 
 import javax.security.auth.*;
--- a/jdk/test/sun/security/provider/X509Factory/BigCRL.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/provider/X509Factory/BigCRL.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,7 +45,7 @@
     public static void main(String[] args) throws Exception {
         int n = 500000;
         String ks = System.getProperty("test.src", ".")
-                + "/../../ssl/etc/keystore";
+                + "/../../../../javax/net/ssl/etc/keystore";
         String pass = "passphrase";
         String alias = "dummy";
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/provider/certpath/PKIXCertPathValidator/Validity.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,134 @@
+/*
+ * 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 8021804
+ * @summary CertPath should validate even if the validity period of the
+ *          root cert does not include the validity period of a subordinate
+ *          cert.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.security.cert.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+public class Validity {
+
+    /*
+     * Subject: OU=TestOrg, CN=TestCA
+     * Issuer: OU=TestOrg, CN=TestCA
+     * Validity
+     *     Not Before: Feb 26 21:33:55 2014 GMT
+           Not After : Feb 26 21:33:55 2024 GMT
+     * Version 1
+     */
+    static String CACertStr =
+        "-----BEGIN CERTIFICATE-----\n" +
+        "MIIBvTCCASYCCQCQRiTo4lBCFjANBgkqhkiG9w0BAQUFADAjMRAwDgYDVQQLDAdU\n" +
+        "ZXN0T3JnMQ8wDQYDVQQDDAZUZXN0Q0EwHhcNMTQwMjI2MjEzMzU1WhcNMjQwMjI2\n" +
+        "MjEzMzU1WjAjMRAwDgYDVQQLDAdUZXN0T3JnMQ8wDQYDVQQDDAZUZXN0Q0EwgZ8w\n" +
+        "DQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOtKS4ZrsM3ansd61ZxitcrN0w184I+A\n" +
+        "z0kyrSP1eMtlam+cC2U91NpTz11FYV4XUfBhqqxaXW043AWTUer8pS90Pt4sCrUX\n" +
+        "COx1+QA1M3ZhbZ4sTM7XQ90JbGaBJ/sEza9mlQP7hQ2yQO/hATKbP6J5qvgG2sT2\n" +
+        "S2WYjEgwNwmFAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAQ/CXEpnx2WY4LJtv4jwE\n" +
+        "4jIVirur3pdzV5oBhPyqqHMsyhQBkukCfX7uD7L5wN1+xuM81DfANpIxlnUfybp5\n" +
+        "CpjcmktLpmyK4kJ6XnSd2blbLOIpsr9x6FqxPxpVDlyw/ySHYrIG/GZdsLHgmzGn\n" +
+        "B06jeYzH8OLf879VxAxSsPc=\n" +
+        "-----END CERTIFICATE-----";
+
+    /*
+     * Subject: OU=TestOrg, CN=TestEE0
+     * Issuer: OU=TestOrg, CN=TestCA
+     * Validity
+     *     Not Before: Feb 26 22:55:12 2014 GMT
+     *     Not After : Feb 25 22:55:12 2025 GMT
+     * Version 1
+     */
+    static String EECertStr =
+        "-----BEGIN CERTIFICATE-----\n" +
+        "MIIBtjCCAR8CAQQwDQYJKoZIhvcNAQEFBQAwIzEQMA4GA1UECwwHVGVzdE9yZzEP\n" +
+        "MA0GA1UEAwwGVGVzdENBMB4XDTE0MDIyNjIyNTUxMloXDTI1MDIyNTIyNTUxMlow\n" +
+        "JDEQMA4GA1UECwwHVGVzdE9yZzEQMA4GA1UEAwwHVGVzdEVFMDCBnzANBgkqhkiG\n" +
+        "9w0BAQEFAAOBjQAwgYkCgYEAt8xz9W3ruCTHjSOtTX6cxsUZ0nRP6EavEfzgcOYh\n" +
+        "CXGA0gr+viSHq3c2vQBxiRny2hm5rLcqpPo+2OxZtw/ajxfyrV6d/r8YyQLBvyl3\n" +
+        "xdCZdOkG1DCM1oFAQDaSRt9wN5Zm5kyg7uMig5Y4L45fP9Yee4x6Xyh36qYbsR89\n" +
+        "rFMCAwEAATANBgkqhkiG9w0BAQUFAAOBgQDZrPqSo08va1m9TOWOztTuWilGdjK/\n" +
+        "2Ed2WXg8utIpy6uAV+NaOYtHQ7ULQBVRNmwg9nKghbVbh+E/xpoihjl1x7OXass4\n" +
+        "TbwXA5GKFIFpNtDvATQ/QQZoCuCzw1FW/mH0Q7UEQ/9/iJdDad6ebkapeMwtj/8B\n" +
+        "s2IZV7s85CEOXw==\n" +
+        "-----END CERTIFICATE-----";
+
+    public static void main(String[] args) throws Exception {
+
+        String[] certStrs = {EECertStr};
+        String[] trustedCertStrs = {CACertStr};
+        runTest(certStrs, trustedCertStrs);
+
+        System.out.println("Test passed.");
+    }
+
+    private static void runTest(String[] certStrs,
+                                String[] trustedCertStrs)
+            throws Exception {
+
+        CertificateFactory cf = CertificateFactory.getInstance("X509");
+
+        // Generate the CertPath from the certs named in certStrs
+        ArrayList<X509Certificate> certs = new ArrayList<>();
+        for (String certStr : certStrs) {
+            certs.add(generateCert(certStr, cf));
+        }
+        CertPath cp = cf.generateCertPath(certs);
+
+        // Generate the set of Trust Anchors from the certs named in
+        // trustedCertStrs
+        Set<TrustAnchor> trustAnchors = new HashSet<>();
+        for (String trustedCertStr : trustedCertStrs) {
+            TrustAnchor ta = new TrustAnchor(generateCert(trustedCertStr, cf),
+                                             null);
+            trustAnchors.add(ta);
+        }
+        PKIXParameters params = new PKIXParameters(trustAnchors);
+        params.setDate(new Date(114, 3, 1));   // 2014-03-01
+        params.setRevocationEnabled(false);
+
+        // Attempt to validate the CertPath. If no exception thrown, successful.
+        CertPathValidator cpv = CertPathValidator.getInstance("PKIX");
+        cpv.validate(cp, params);
+        System.out.println("CertPath validation successful.");
+    }
+
+    private static X509Certificate generateCert(String certStr,
+                                                CertificateFactory cf)
+            throws Exception {
+        ByteArrayInputStream stream
+                = new ByteArrayInputStream(certStr.getBytes());
+        return (X509Certificate) cf.generateCertificate(stream);
+
+    }
+}
--- a/jdk/test/sun/security/smartcardio/TestChannel.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/smartcardio/TestChannel.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -26,10 +26,11 @@
  * @bug 6239117
  * @summary test logical channels work
  * @author Andreas Sterbenz
- * @ignore requires special hardware
- * @run main/manual TestExclusive
+ * @run main/manual TestChannel
  */
 
+// This test requires special hardware.
+
 import java.io.*;
 import java.util.*;
 
--- a/jdk/test/sun/security/smartcardio/TestConnect.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/smartcardio/TestConnect.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -26,10 +26,11 @@
  * @bug 6293769 6294527 6309280
  * @summary test connect() works
  * @author Andreas Sterbenz
- * @ignore requires special hardware
  * @run main/manual TestConnect
  */
 
+// This test requires special hardware.
+
 import java.io.*;
 import java.util.*;
 
--- a/jdk/test/sun/security/smartcardio/TestConnectAgain.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/smartcardio/TestConnectAgain.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -26,10 +26,11 @@
  * @bug 6239117
  * @summary test connect works correctly if called multiple times/card removed
  * @author Andreas Sterbenz
- * @ignore requires special hardware
- * @run main/manual TestTransmit
+ * @run main/manual TestConnectAgain
  */
 
+// This test requires special hardware.
+
 import java.io.*;
 import java.util.*;
 
--- a/jdk/test/sun/security/smartcardio/TestControl.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/smartcardio/TestControl.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -26,10 +26,11 @@
  * @bug 6239117 6470320
  * @summary test if transmitControlCommand() works
  * @author Andreas Sterbenz
- * @ignore requires special hardware
  * @run main/manual TestControl
  */
 
+// This test requires special hardware.
+
 import java.io.*;
 import java.util.*;
 
--- a/jdk/test/sun/security/smartcardio/TestDefault.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/smartcardio/TestDefault.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -26,10 +26,11 @@
  * @bug 6327047
  * @summary verify that TerminalFactory.getDefault() works
  * @author Andreas Sterbenz
- * @ignore requires special hardware
  * @run main/manual TestDefault
  */
 
+// This test requires special hardware.
+
 import java.io.*;
 import java.util.*;
 
--- a/jdk/test/sun/security/smartcardio/TestExclusive.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/smartcardio/TestExclusive.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -26,10 +26,11 @@
  * @bug 6239117
  * @summary verify that beginExclusive()/endExclusive() works
  * @author Andreas Sterbenz
- * @ignore requires special hardware
  * @run main/manual TestExclusive
  */
 
+// This test requires special hardware.
+
 import java.io.*;
 import java.util.*;
 
--- a/jdk/test/sun/security/smartcardio/TestMultiplePresent.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/smartcardio/TestMultiplePresent.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -26,10 +26,11 @@
  * @bug 6239117 6445367
  * @summary test that CardTerminals.waitForCard() works
  * @author Andreas Sterbenz
- * @ignore requires special hardware
- * @run main/manual TestPresent
+ * @run main/manual TestMultiplePresent
  */
 
+// This test requires special hardware.
+
 import java.io.*;
 import java.util.*;
 
--- a/jdk/test/sun/security/smartcardio/TestPresent.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/smartcardio/TestPresent.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -26,10 +26,11 @@
  * @bug 6293769 6294527
  * @summary test that the isCardPresent()/waitForX() APIs work correctly
  * @author Andreas Sterbenz
- * @ignore requires special hardware
  * @run main/manual TestPresent
  */
 
+// This test requires special hardware.
+
 import java.io.*;
 import java.util.*;
 
--- a/jdk/test/sun/security/smartcardio/TestTransmit.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/smartcardio/TestTransmit.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -26,10 +26,11 @@
  * @bug 6293769 6294527
  * @summary test transmit() works
  * @author Andreas Sterbenz
- * @ignore requires special hardware
  * @run main/manual TestTransmit
  */
 
+// This test requires special hardware.
+
 import java.io.*;
 import java.util.*;
 
--- a/jdk/test/sun/security/ssl/SSLSocketImpl/NotifyHandshakeTest.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/ssl/SSLSocketImpl/NotifyHandshakeTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2005, 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
@@ -88,6 +88,7 @@
          */
         SSLServerSocket sslss =
             (SSLServerSocket)sslssf.createServerSocket(serverPort);
+        sslss.setSoTimeout(30000);  // 30 seconds
         serverPort = sslss.getLocalPort();
         Server server = new Server(sslss);
         server.start();
--- a/jdk/test/sun/security/ssl/X509TrustManagerImpl/ClientServer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/ssl/X509TrustManagerImpl/ClientServer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -24,14 +24,17 @@
 /*
  * @test
  * @bug 4717766
+ * @author Brad Wetmore
  * @summary 1.0.3 JsseX509TrustManager erroneously calls isClientTrusted()
- * @run main/othervm ClientServer
+ * @run main/manual ClientServer
+ */
+
+/*
+ * SunJSSE does not support dynamic system properties, no way to re-use
+ * system properties in samevm/agentvm mode.
  *
- *     SunJSSE does not support dynamic system properties, no way to re-use
- *     system properties in samevm/agentvm mode.
- * @ignore JSSE supports algorithm constraints with CR 6916074,
- *     need to update this test case in JDK 7 soon
- * @author Brad Wetmore
+ * JSSE supports algorithm constraints with CR 6916074, need to update
+ * this test case in JDK 7 soon.
  *
  * This problem didn't exist in JSSE 1.4, only JSSE 1.0.3.  However,
  * this is a useful test, so I decided to include it in 1.4.2.
--- a/jdk/test/sun/security/tools/keytool/PrintSSL.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/tools/keytool/PrintSSL.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,8 @@
     public static void main(String[] args) throws Exception {
         System.setProperty("javax.net.ssl.keyStorePassword", "passphrase");
         System.setProperty("javax.net.ssl.keyStore",
-                System.getProperty("test.src", "./") + "/../../ssl/etc/keystore");
+                           System.getProperty("test.src", "./")
+                               + "/../../../../javax/net/ssl/etc/keystore");
         SSLServerSocketFactory sslssf =
                 (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
         final ServerSocket server = sslssf.createServerSocket(0);
--- a/jdk/test/sun/security/tools/keytool/console.sh	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/tools/keytool/console.sh	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,6 @@
 # @bug 6418647 8005527
 # @summary Doc bug 5035358 shows sun.security.util.Password.readPassword() is buggy.
 # @author Weijun Wang
-# @ignore unable to test manual tools that have input from stdin,
-#               and output to stderr and stdout
 # @run shell/manual console.sh
 
 if [ "$ALT_PASS" = "" ]; then
--- a/jdk/test/sun/security/tools/keytool/i18n.sh	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/tools/keytool/i18n.sh	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,7 @@
 # @bug 4348369
 # @summary keytool not i18n compliant
 # @author charlie lai
-#
-# @ignore unable to test manual tools that have input from stdin,
-#		and output to stderr and stdout
+# @run shell/manual i18n.sh
 
 # set a few environment variables so that the shell-script can run stand-alone
 # in the source directory
--- a/jdk/test/sun/security/tools/keytool/printssl.sh	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/security/tools/keytool/printssl.sh	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -56,7 +56,15 @@
 esac
 
 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . ${TESTSRC}${FS}PrintSSL.java || exit 10
-${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Dtest.src=$TESTSRC PrintSSL | ( read PORT; ${TESTJAVA}${FS}bin${FS}keytool -printcert -sslserver localhost:$PORT )
+${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Dtest.src=$TESTSRC PrintSSL | (
+      read PORT
+      if [ "$PORT" = "" ]; then
+          echo "Server not started"
+          exit 2
+      else
+          ${TESTJAVA}${FS}bin${FS}keytool -printcert -sslserver localhost:$PORT
+      fi
+)
 status=$?
 
 rm PrintSSL*.class
--- a/jdk/test/sun/util/calendar/zi/Zoneinfo.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/util/calendar/zi/Zoneinfo.java	Tue Apr 01 15:37:15 2014 +0200
@@ -372,6 +372,7 @@
         ZoneRec zrec = zone.get(zone.size()-1);
         tz.getOffsetIndex(zrec.getGmtOffset());
 
+        int lastGmtOffsetValue = -1;
         int currentSave = 0;
         boolean usedZone;
         for (int zindex = 0; zindex < zone.size(); zindex++) {
@@ -380,9 +381,12 @@
             gmtOffset = zrec.getGmtOffset();
             int stdOffset = zrec.getDirectSave();
 
+            if (gmtOffset != lastGmtOffsetValue) {
+                tz.setRawOffset(gmtOffset, fromTime);
+                lastGmtOffsetValue = gmtOffset;
+            }
             // If this is the last zone record, take the last rule info.
             if (!zrec.hasUntil()) {
-                tz.setRawOffset(gmtOffset, fromTime);
                 if (zrec.hasRuleReference()) {
                     tz.setLastRules(zrec.getRuleRef().getLastRules());
                 } else if (stdOffset != 0) {
--- a/jdk/test/sun/util/calendar/zi/tzdata/VERSION	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/util/calendar/zi/tzdata/VERSION	Tue Apr 01 15:37:15 2014 +0200
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2013i
+tzdata2014a
--- a/jdk/test/sun/util/calendar/zi/tzdata/asia	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/util/calendar/zi/tzdata/asia	Tue Apr 01 15:37:15 2014 +0200
@@ -1113,8 +1113,13 @@
 Rule	Zion	1986	only	-	Sep	 7	0:00	0	S
 Rule	Zion	1987	only	-	Apr	15	0:00	1:00	D
 Rule	Zion	1987	only	-	Sep	13	0:00	0	S
-Rule	Zion	1988	only	-	Apr	 9	0:00	1:00	D
-Rule	Zion	1988	only	-	Sep	 3	0:00	0	S
+
+# From Avigdor Finkelstein (2014-03-05):
+# I check the Parliament (Knesset) records and there it's stated that the
+# [1988] transition should take place on Saturday night, when the Sabbath
+# ends and changes to Sunday.
+Rule	Zion	1988	only	-	Apr	10	0:00	1:00	D
+Rule	Zion	1988	only	-	Sep	 4	0:00	0	S
 
 # From Ephraim Silverberg
 # (1997-03-04, 1998-03-16, 1998-12-28, 2000-01-17, 2000-07-25, 2004-12-22,
--- a/jdk/test/sun/util/calendar/zi/tzdata/australasia	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/util/calendar/zi/tzdata/australasia	Tue Apr 01 15:37:15 2014 +0200
@@ -377,16 +377,18 @@
 # http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=6702&catid=71&Itemid=155
 
 # From the Fijian Government Media Center (2013-08-30) via David Wheeler:
-# Fiji will start daylight savings on Sunday 27th October, 2013 and end at 3am
-# on Sunday 19th January, 2014....  move clocks forward by one hour from 2am
+# Fiji will start daylight savings on Sunday 27th October, 2013 ...
+# move clocks forward by one hour from 2am
 # http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVING-STARTS-ON-SUNDAY,-27th-OCTOBER-201.aspx
-#
-# From Paul Eggert (2013-09-09):
+
+# From Steffen Thorsen (2013-01-10):
+# Fiji will end DST on 2014-01-19 02:00:
+# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVINGS-TO-END-THIS-MONTH-%281%29.aspx
+
+# From Paul Eggert (2014-01-10):
 # For now, guess that Fiji springs forward the Sunday before the fourth
-# Monday in October.  This matches both recent practice and
-# timeanddate.com's current spring-forward prediction.
-# For the January 2014 transition we guessed right while timeanddate.com
-# guessed wrong, so leave the fall-back prediction alone.
+# Monday in October, and springs back the penultimate Sunday in January.
+# This is ad hoc, but matches recent practice.
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Fiji	1998	1999	-	Nov	Sun>=1	2:00	1:00	S
@@ -395,7 +397,8 @@
 Rule	Fiji	2010	only	-	Mar	lastSun	3:00	0	-
 Rule	Fiji	2010	max	-	Oct	Sun>=21	2:00	1:00	S
 Rule	Fiji	2011	only	-	Mar	Sun>=1	3:00	0	-
-Rule	Fiji	2012	max	-	Jan	Sun>=18	3:00	0	-
+Rule	Fiji	2012	2013	-	Jan	Sun>=18	3:00	0	-
+Rule	Fiji	2014	max	-	Jan	Sun>=18	2:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Pacific/Fiji	11:55:44 -	LMT	1915 Oct 26	# Suva
 			12:00	Fiji	FJ%sT	# Fiji Time
--- a/jdk/test/sun/util/calendar/zi/tzdata/europe	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/util/calendar/zi/tzdata/europe	Tue Apr 01 15:37:15 2014 +0200
@@ -2768,14 +2768,18 @@
 # According to the articles linked below, Turkey will change into summer
 # time zone (GMT+3) on March 28, 2011 at 3:00 a.m. instead of March 27.
 # This change is due to a nationwide exam on 27th.
-#
-# <a href="http://www.worldbulletin.net/?aType=haber&ArticleID=70872">
 # http://www.worldbulletin.net/?aType=haber&ArticleID=70872
-# </a>
 # Turkish:
-# <a href="http://www.hurriyet.com.tr/ekonomi/17230464.asp?gid=373">
 # http://www.hurriyet.com.tr/ekonomi/17230464.asp?gid=373
-# </a>
+
+# From Faruk Pasin (2014-02-14):
+# The DST for Turkey has been changed for this year because of the
+# Turkish Local election....
+# http://www.sabah.com.tr/Ekonomi/2014/02/12/yaz-saatinde-onemli-degisiklik
+# ... so Turkey will move clocks forward one hour on March 31 at 3:00 a.m.
+# From Paul Eggert (2014-02-17):
+# Here is an English-language source:
+# http://www.worldbulletin.net/turkey/129016/turkey-switches-to-daylight-saving-time-march-31
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Turkey	1916	only	-	May	 1	0:00	1:00	S
@@ -2844,6 +2848,8 @@
 			2:00	Turkey	EE%sT	2007
 			2:00	EU	EE%sT	2011 Mar 27 1:00u
 			2:00	-	EET	2011 Mar 28 1:00u
+			2:00	EU	EE%sT	2014 Mar 30 1:00u
+			2:00	-	EET	2014 Mar 31 1:00u
 			2:00	EU	EE%sT
 Link	Europe/Istanbul	Asia/Istanbul	# Istanbul is in both continents.
 
@@ -2865,19 +2871,13 @@
 # approval from 266 deputies.
 #
 # Ukraine abolishes transter back to the winter time (in Russian)
-# <a href="http://news.mail.ru/politics/6861560/">
 # http://news.mail.ru/politics/6861560/
-# </a>
 #
 # The Ukrainians will no longer change the clock (in Russian)
-# <a href="http://www.segodnya.ua/news/14290482.html">
 # http://www.segodnya.ua/news/14290482.html
-# </a>
 #
 # Deputies cancelled the winter time (in Russian)
-# <a href="http://www.pravda.com.ua/rus/news/2011/09/20/6600616/">
 # http://www.pravda.com.ua/rus/news/2011/09/20/6600616/
-# </a>
 #
 # From Philip Pizzey (2011-10-18):
 # Today my Ukrainian colleagues have informed me that the
@@ -2888,18 +2888,39 @@
 # As far as I understand, the recent change to the Ukrainian time zone
 # (Europe/Kiev) to introduce permanent daylight saving time (similar
 # to Russia) was reverted today:
-#
-# <a href="http://portal.rada.gov.ua/rada/control/en/publish/article/info_left?art_id=287324&cat_id=105995">
 # http://portal.rada.gov.ua/rada/control/en/publish/article/info_left?art_id=287324&cat_id=105995
-# </a>
 #
 # Also reported by Alexander Bokovoy (2011-10-18) who also noted:
 # The law documents themselves are at
+# http://w1.c1.rada.gov.ua/pls/zweb_n/webproc4_1?id=&pf3511=41484
+
+# From Vladimir in Moscow via Alois Treindl re Kiev time 1991/2 (2014-02-28):
+# First in Ukraine they changed Time zone from UTC+3 to UTC+2 with DST:
+#       03 25 1990 02:00 -03.00 1       Time Zone 3 with DST
+#       07 01 1990 02:00 -02.00 1       Time Zone 2 with DST
+# * Ukrainian Government's Resolution of 18.06.1990, No. 134.
+# http://search.ligazakon.ua/l_doc2.nsf/link1/T001500.html
 #
-# <a href="http://w1.c1.rada.gov.ua/pls/zweb_n/webproc4_1?id=&pf3511=41484">
-# http://w1.c1.rada.gov.ua/pls/zweb_n/webproc4_1?id=&pf3511=41484
-# </a>
-
+# They did not end DST in September, 1990 (according to the law,
+# "summer time" was still in action):
+#       09 30 1990 03:00 -02.00 1       Time Zone 2 with DST
+# * Ukrainian Government's Resolution of 21.09.1990, No. 272.
+# http://search.ligazakon.ua/l_doc2.nsf/link1/KP900272.html
+#
+# Again no change in March, 1991 ("summer time" in action):
+#       03 31 1991 02:00 -02.00 1       Time Zone 2 with DST
+#
+# DST ended in September 1991 ("summer time" ended):
+#       09 29 1991 03:00 -02.00 0       Time Zone 2, no DST
+# * Ukrainian Government's Resolution of 25.09.1991, No. 225.
+# http://www.uazakon.com/documents/date_21/pg_iwgdoc.htm
+# This is an answer.
+#
+# Since 1992 they had normal DST procedure:
+#       03 29 1992 02:00 -02.00 1       DST started
+#       09 27 1992 03:00 -02.00 0       DST ended
+# * Ukrainian Government's Resolution of 20.03.1992, No. 139.
+# http://www.uazakon.com/documents/date_8u/pg_grcasa.htm
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 # Most of Ukraine since 1970 has been like Kiev.
@@ -2910,9 +2931,8 @@
 			2:00	-	EET	1930 Jun 21
 			3:00	-	MSK	1941 Sep 20
 			1:00	C-Eur	CE%sT	1943 Nov  6
-			3:00	Russia	MSK/MSD	1990
-			3:00	-	MSK	1990 Jul  1 2:00
-			2:00	-	EET	1992
+			3:00	Russia	MSK/MSD	1990 Jul  1 2:00
+			2:00	1:00	EEST	1991 Sep 29 3:00
 			2:00	E-Eur	EE%sT	1995
 			2:00	EU	EE%sT
 # Ruthenia used CET 1990/1991.
--- a/jdk/test/sun/util/calendar/zi/tzdata/northamerica	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/util/calendar/zi/tzdata/northamerica	Tue Apr 01 15:37:15 2014 +0200
@@ -414,9 +414,10 @@
 # US Pacific time, represented by Los Angeles
 #
 # California, northern Idaho (Benewah, Bonner, Boundary, Clearwater,
-# Idaho, Kootenai, Latah, Lewis, Nez Perce, and Shoshone counties,
-# and the northern three-quarters of Idaho county),
-# most of Nevada, most of Oregon, and Washington
+# Kootenai, Latah, Lewis, Nez Perce, and Shoshone counties, Idaho county
+# north of the Salmon River, and the towns of Burgdorf and Warren),
+# Nevada (except West Wendover), Oregon (except the northern 3/4 of
+# Malheur county), and Washington
 #
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
 Rule	CA	1948	only	-	Mar	14	2:00	1:00	D
--- a/jdk/test/sun/util/calendar/zi/tzdata/southamerica	Tue Apr 01 07:46:51 2014 +0200
+++ b/jdk/test/sun/util/calendar/zi/tzdata/southamerica	Tue Apr 01 15:37:15 2014 +0200
@@ -1298,6 +1298,13 @@
 # start date is 2013-09-08 00:00....
 # http://www.gob.cl/informa/2013/02/15/gobierno-anuncia-fechas-de-cambio-de-hora-para-el-ano-2013.htm
 
+# From Jose Miguel Garrido (2014-02-19):
+# Today appeared in the Diario Oficial a decree amending the time change
+# dates to 2014.
+# DST End: last Saturday of April 2014 (Sun 27 Apr 2014 03:00 UTC)
+# DST Start: first Saturday of September 2014 (Sun 07 Sep 2014 04:00 UTC)
+# http://www.diariooficial.interior.gob.cl//media/2014/02/19/do-20140219.pdf
+
 # NOTE: ChileAQ rules for Antarctic bases are stored separately in the
 # 'antarctica' file.
 
@@ -1631,6 +1638,9 @@
 # From Carlos Raul Perasso (2013-03-15):
 # The change in Paraguay is now final.  Decree number 10780
 # http://www.presidencia.gov.py/uploads/pdf/presidencia-3b86ff4b691c79d4f5927ca964922ec74772ce857c02ca054a52a37b49afc7fb.pdf
+# From Carlos Raul Perasso (2014-02-28):
+# Decree 1264 can be found at:
+# http://www.presidencia.gov.py/archivos/documentos/DECRETO1264_ey9r8zai.pdf
 Rule	Para	2013	max	-	Mar	Sun>=22	0:00	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -1689,18 +1699,19 @@
 Zone America/Port_of_Spain -4:06:04 -	LMT	1912 Mar 2
 			-4:00	-	AST
 
+# These all agree with Trinidad and Tobago since 1970.
 Link America/Port_of_Spain America/Anguilla
 Link America/Port_of_Spain America/Dominica
 Link America/Port_of_Spain America/Grenada
 Link America/Port_of_Spain America/Guadeloupe
-Link America/Port_of_Spain America/Marigot
+Link America/Port_of_Spain America/Marigot	# St Martin (French part)
 Link America/Port_of_Spain America/Montserrat
 Link America/Port_of_Spain America/St_Barthelemy
-Link America/Port_of_Spain America/St_Kitts
+Link America/Port_of_Spain America/St_Kitts	# St Kitts & Nevis
 Link America/Port_of_Spain America/St_Lucia
-Link America/Port_of_Spain America/St_Thomas
+Link America/Port_of_Spain America/St_Thomas	# Virgin Islands (US)
 Link America/Port_of_Spain America/St_Vincent
-Link America/Port_of_Spain America/Tortola
+Link America/Port_of_Spain America/Tortola	# Virgin Islands (UK)
 
 # Uruguay
 # From Paul Eggert (1993-11-18):
--- a/langtools/.hgtags	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/.hgtags	Tue Apr 01 15:37:15 2014 +0200
@@ -246,3 +246,5 @@
 077c12d527fb5531c59666c1f84000fc1245a260 jdk9-b01
 f2c58a337c8aaa1ce84dfa8a8e8c5d4c8c1e12fa jdk9-b02
 151222468d1d04ce6613d33efa3d45bfaf53e3e5 jdk9-b03
+fa2ec6b6b1697ae4a78b03b609664dc6b47dee86 jdk9-b04
+1d5e6fc88a4cca287090c16b0530a0d5849a5603 jdk9-b05
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -467,11 +467,24 @@
 
     private boolean hiddenIn(ClassSymbol clazz, Types types) {
         Symbol sym = hiddenInInternal(clazz, types);
-        return sym != null && sym != this;
+        Assert.check(sym != null, "the result of hiddenInInternal() can't be null");
+        /* If we find the current symbol then there is no symbol hiding it
+         */
+        return sym != this;
     }
 
-    private Symbol hiddenInInternal(ClassSymbol c, Types types) {
-        Scope.Entry e = c.members().lookup(name);
+    /** This method looks in the supertypes graph that has the current class as the
+     * initial node, till it finds the current symbol or another symbol that hides it.
+     * If the current class has more than one supertype (extends one class and
+     * implements one or more interfaces) then null can be returned, meaning that
+     * a wrong path in the supertypes graph was selected. Null can only be returned
+     * as a temporary value, as a result of the recursive call.
+     */
+    private Symbol hiddenInInternal(ClassSymbol currentClass, Types types) {
+        if (currentClass == owner) {
+            return this;
+        }
+        Scope.Entry e = currentClass.members().lookup(name);
         while (e.scope != null) {
             if (e.sym.kind == kind &&
                     (kind != MTH ||
@@ -481,18 +494,19 @@
             }
             e = e.next();
         }
-        List<Symbol> hiddenSyms = List.nil();
-        for (Type st : types.interfaces(c.type).prepend(types.supertype(c.type))) {
+        Symbol hiddenSym = null;
+        for (Type st : types.interfaces(currentClass.type)
+                .prepend(types.supertype(currentClass.type))) {
             if (st != null && (st.hasTag(CLASS))) {
                 Symbol sym = hiddenInInternal((ClassSymbol)st.tsym, types);
-                if (sym != null) {
-                    hiddenSyms = hiddenSyms.prepend(hiddenInInternal((ClassSymbol)st.tsym, types));
+                if (sym == this) {
+                    return this;
+                } else if (sym != null) {
+                    hiddenSym = sym;
                 }
             }
         }
-        return hiddenSyms.contains(this) ?
-                this :
-                (hiddenSyms.isEmpty() ? null : hiddenSyms.head);
+        return hiddenSym;
     }
 
     /** Is this symbol inherited into a given class?
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1481,8 +1481,21 @@
         }
 
         public String toString() {
-            if (inst != null) return inst.toString();
-            else return qtype + "?";
+            return (inst == null) ? qtype + "?" : inst.toString();
+        }
+
+        public String debugString() {
+            String result = "inference var = " + qtype + "\n";
+            if (inst != null) {
+                result += "inst = " + inst + '\n';
+            }
+            for (InferenceBound bound: InferenceBound.values()) {
+                List<Type> aboundList = bounds.get(bound);
+                if (aboundList.size() > 0) {
+                    result += bound + " = " + aboundList + '\n';
+                }
+            }
+            return result;
         }
 
         @Override
@@ -1492,8 +1505,7 @@
 
         @Override
         public Type baseType() {
-            if (inst != null) return inst.baseType();
-            else return this;
+            return (inst == null) ? this : inst.baseType();
         }
 
         /** get all bounds of a given kind */
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Tue Apr 01 15:37:15 2014 +0200
@@ -3208,6 +3208,7 @@
             return tvar.rank_field;
         }
         case ERROR:
+        case NONE:
             return 0;
         default:
             throw new AssertionError();
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Tue Apr 01 15:37:15 2014 +0200
@@ -808,9 +808,7 @@
                 Attribute.TypeCompound tc =
                     enterTypeAnnotation(a, syms.annotationType, env);
 
-                if (tc == null) {
-                    continue;
-                }
+                Assert.checkNonNull(tc, "Failed to create type annotation");
 
                 if (annotated.containsKey(a.type.tsym)) {
                     if (!allowRepeatedAnnos) {
@@ -827,10 +825,9 @@
                 }
             }
 
-            if (s != null) {
-                s.appendTypeAttributesWithCompletion(
-                    new AnnotateRepeatedContext<>(env, annotated, pos, log, true));
-            }
+            Assert.checkNonNull(s, "Symbol argument to actualEnterTypeAnnotations is null");
+            s.appendTypeAttributesWithCompletion(
+                new AnnotateRepeatedContext<>(env, annotated, pos, log, true));
         } finally {
             if (prevLintPos != null)
                 deferredLintHandler.setPos(prevLintPos);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -2173,6 +2173,12 @@
             //back-door to infer
             return Infer.this;
         }
+
+        @Override
+        public String toString() {
+            return "Inference vars: " + inferencevars + '\n' +
+                   "Undet vars: " + undetvars;
+        }
     }
 
     final InferenceContext emptyContext = new InferenceContext(List.<Type>nil());
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1037,7 +1037,7 @@
             }
             databuf.appendChar(pool.get(inner));
             databuf.appendChar(
-                inner.owner.kind == TYP ? pool.get(inner.owner) : 0);
+                inner.owner.kind == TYP && !inner.name.isEmpty() ? pool.get(inner.owner) : 0);
             databuf.appendChar(
                 !inner.name.isEmpty() ? pool.get(inner.name) : 0);
             databuf.appendChar(flags);
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1910,6 +1910,7 @@
         if (!c.isFalse()) {
             code.resolve(c.trueJumps);
             int startpc = genCrt ? code.curCP() : 0;
+            code.statBegin(tree.truepart.pos);
             genExpr(tree.truepart, pt).load();
             code.state.forceStackTop(tree.type);
             if (genCrt) code.crt.put(tree.truepart, CRT_FLOW_TARGET,
@@ -1919,6 +1920,7 @@
         if (elseChain != null) {
             code.resolve(elseChain);
             int startpc = genCrt ? code.curCP() : 0;
+            code.statBegin(tree.falsepart.pos);
             genExpr(tree.falsepart, pt).load();
             code.state.forceStackTop(tree.type);
             if (genCrt) code.crt.put(tree.falsepart, CRT_FLOW_TARGET,
--- a/langtools/src/share/classes/javax/lang/model/type/MirroredTypeException.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/src/share/classes/javax/lang/model/type/MirroredTypeException.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -70,6 +70,10 @@
 
     /**
      * Explicitly set all transient fields.
+     * @param s the serial stream
+     * @throws ClassNotFoundException for a missing class during
+     * deserialization
+     * @throws IOException for an IO problem during deserialization
      */
     private void readObject(ObjectInputStream s)
         throws IOException, ClassNotFoundException {
--- a/langtools/src/share/classes/javax/lang/model/type/MirroredTypesException.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/src/share/classes/javax/lang/model/type/MirroredTypesException.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -85,6 +85,10 @@
 
     /**
      * Explicitly set all transient fields.
+     * @param s the serial stream
+     * @throws ClassNotFoundException for a missing class during
+     * deserialization
+     * @throws IOException for an IO problem during deserialization
      */
     private void readObject(ObjectInputStream s)
         throws IOException, ClassNotFoundException {
--- a/langtools/test/tools/javac/6464451/BigFinally.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,245 +0,0 @@
-/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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     6464451
- * @summary javac in 5.0ux can not compile try-finally block which has a lot of "return"
- * @author  Wei Tao
- * @compile -source 5 -target 5 BigFinally.java
- * @clean BigFinally
- * @compile/fail BigFinally.java
- */
-
-public class BigFinally {
-    static public int func(int i) {
-        try {
-            if(i == 1) return 1;
-        } finally {
-            try {
-                if(i == 2) return 2;
-                if(i == 3 ) return 3;
-                if(i == 4 ) return 4;
-                if(i == 5 ) return 5;
-                if(i == 6 ) return 6;
-                if(i == 7 ) return 7;
-                if(i == 8 ) return 8;
-                if(i == 9 ) return 9;
-                if(i == 10 ) return 10;
-                if(i == 11 ) return 11;
-                if(i == 12 ) return 12;
-                if(i == 13 ) return 13;
-                if(i == 14 ) return 14;
-                if(i == 15 ) return 15;
-                if(i == 16 ) return 16;
-                if(i == 17 ) return 17;
-                if(i == 18 ) return 18;
-                if(i == 19 ) return 19;
-                if(i == 20 ) return 20;
-                if(i == 21 ) return 21;
-                if(i == 22 ) return 22;
-                if(i == 23 ) return 23;
-                if(i == 24 ) return 24;
-                if(i == 25 ) return 25;
-                if(i == 26 ) return 26;
-                if(i == 27 ) return 27;
-                if(i == 28 ) return 28;
-                if(i == 29 ) return 29;
-                if(i == 30 ) return 30;
-                if(i == 31 ) return 31;
-                if(i == 32 ) return 32;
-                if(i == 33 ) return 33;
-                if(i == 34 ) return 34;
-                if(i == 35 ) return 35;
-                if(i == 36 ) return 36;
-                if(i == 37 ) return 37;
-                if(i == 38 ) return 38;
-                if(i == 39 ) return 39;
-                if(i == 40 ) return 40;
-                if(i == 41 ) return 41;
-                if(i == 42 ) return 42;
-                if(i == 43 ) return 43;
-                if(i == 44 ) return 44;
-                if(i == 45 ) return 45;
-                if(i == 46 ) return 46;
-                if(i == 47 ) return 47;
-                if(i == 48 ) return 48;
-                if(i == 49 ) return 49;
-                if(i == 50 ) return 50;
-                if(i == 51 ) return 51;
-                if(i == 52 ) return 52;
-                if(i == 53 ) return 53;
-                if(i == 54 ) return 54;
-                if(i == 55 ) return 55;
-                if(i == 56 ) return 56;
-                if(i == 57 ) return 57;
-                if(i == 58 ) return 58;
-                if(i == 59 ) return 59;
-                if(i == 60 ) return 60;
-                if(i == 61 ) return 61;
-                if(i == 62 ) return 62;
-                if(i == 63 ) return 63;
-                if(i == 64 ) return 64;
-                if(i == 65 ) return 65;
-                if(i == 66 ) return 66;
-                if(i == 67 ) return 67;
-                if(i == 68 ) return 68;
-                if(i == 69 ) return 69;
-                if(i == 70 ) return 70;
-                if(i == 71 ) return 71;
-                if(i == 72 ) return 72;
-                if(i == 73 ) return 73;
-                if(i == 74 ) return 74;
-                if(i == 75 ) return 75;
-                if(i == 76 ) return 76;
-                if(i == 77 ) return 77;
-                if(i == 78 ) return 78;
-                if(i == 79 ) return 79;
-                if(i == 80 ) return 80;
-                if(i == 81 ) return 81;
-                if(i == 82 ) return 82;
-                if(i == 83 ) return 83;
-                if(i == 84 ) return 84;
-                if(i == 85 ) return 85;
-                if(i == 86 ) return 86;
-                if(i == 87 ) return 87;
-                if(i == 88 ) return 88;
-                if(i == 89 ) return 89;
-                if(i == 90 ) return 90;
-                if(i == 91 ) return 91;
-                if(i == 92 ) return 92;
-                if(i == 93 ) return 93;
-                if(i == 94 ) return 94;
-                if(i == 95 ) return 95;
-                if(i == 96 ) return 96;
-                if(i == 97 ) return 97;
-                if(i == 98 ) return 98;
-                if(i == 99 ) return 99;
-                if(i == 100 ) return 100;
-            } finally {
-                int x = 0;
-                x += 1;
-                x += 2;
-                x += 3;
-                x += 4;
-                x += 5;
-                x += 6;
-                x += 7;
-                x += 8;
-                x += 9;
-                x += 10;
-                x += 11;
-                x += 12;
-                x += 13;
-                x += 14;
-                x += 15;
-                x += 16;
-                x += 17;
-                x += 18;
-                x += 19;
-                x += 20;
-                x += 21;
-                x += 22;
-                x += 23;
-                x += 24;
-                x += 25;
-                x += 26;
-                x += 27;
-                x += 28;
-                x += 29;
-                x += 30;
-                x += 31;
-                x += 32;
-                x += 33;
-                x += 34;
-                x += 35;
-                x += 36;
-                x += 37;
-                x += 38;
-                x += 39;
-                x += 40;
-                x += 41;
-                x += 42;
-                x += 43;
-                x += 44;
-                x += 45;
-                x += 46;
-                x += 47;
-                x += 48;
-                x += 49;
-                x += 50;
-                x += 51;
-                x += 52;
-                x += 53;
-                x += 54;
-                x += 55;
-                x += 56;
-                x += 57;
-                x += 58;
-                x += 59;
-                x += 60;
-                x += 61;
-                x += 62;
-                x += 63;
-                x += 64;
-                x += 65;
-                x += 66;
-                x += 67;
-                x += 68;
-                x += 69;
-                x += 70;
-                x += 71;
-                x += 72;
-                x += 73;
-                x += 74;
-                x += 75;
-                x += 76;
-                x += 77;
-                x += 78;
-                x += 79;
-                x += 80;
-                x += 81;
-                x += 82;
-                x += 83;
-                x += 84;
-                x += 85;
-                x += 86;
-                x += 87;
-                x += 88;
-                x += 89;
-                x += 90;
-                x += 91;
-                x += 92;
-                x += 93;
-                x += 94;
-                x += 95;
-                x += 96;
-                x += 97;
-                x += 98;
-                x += 99;
-                x += 100;
-            }
-        }
-        return 0;
-    }
-}
--- a/langtools/test/tools/javac/6464451/DeepNestedFinally.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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     6464451
- * @summary javac in 5.0ux can not compile try-finally block which has a lot of "return"
- * @author  Wei Tao
- * @compile -source 5 -target 5 DeepNestedFinally.java
- * @clean DeepNestedFinally
- * @compile/fail DeepNestedFinally.java
- */
-
-public class DeepNestedFinally {
-   static public int func(int i) {
-    try {
-        if(i == 1) return 1;
-    } finally {
-        try {
-            if(i == 2) return 2;
-        } finally {
-            try {
-                if(i == 3) return 3;
-            } finally {
-                try {
-                    if(i == 4) return 4;
-                } finally {
-                    try {
-                        if(i == 5) return 5;
-                    } finally {
-                        try {
-                            if(i == 6) return 6;
-                        } finally {
-                            try {
-                                if (i == 7) return 7;
-                            } finally {
-                                int x = 0;
-                                x += 1;
-                                x += 2;
-                                x += 3;
-                                x += 4;
-                                x += 5;
-                                x += 6;
-                                x += 7;
-                                x += 8;
-                                x += 9;
-                            }
-                        }
-                    }
-                }
-             }
-         }
-      }
-      return 0;
-   }
-}
--- a/langtools/test/tools/javac/6464451/ManyExitsInTry.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2051 +0,0 @@
-/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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     6464451
- * @summary javac in 5.0ux can not compile try-finally block which has a lot of "return"
- * @author  Wei Tao
- * @compile -source 5 -target 5 ManyExitsInTry.java
- * @clean ManyExitsInTry
- * @compile/fail ManyExitsInTry.java
- */
-
-public class ManyExitsInTry {
-   static public int func(int i) {
-      try {
-         if(i == 0 ) return 0;
-         if(i == 1 ) return 1;
-         if(i == 2 ) return 2;
-         if(i == 3 ) return 3;
-         if(i == 4 ) return 4;
-         if(i == 5 ) return 5;
-         if(i == 6 ) return 6;
-         if(i == 7 ) return 7;
-         if(i == 8 ) return 8;
-         if(i == 9 ) return 9;
-         if(i == 10 ) return 10;
-         if(i == 11 ) return 11;
-         if(i == 12 ) return 12;
-         if(i == 13 ) return 13;
-         if(i == 14 ) return 14;
-         if(i == 15 ) return 15;
-         if(i == 16 ) return 16;
-         if(i == 17 ) return 17;
-         if(i == 18 ) return 18;
-         if(i == 19 ) return 19;
-         if(i == 20 ) return 20;
-         if(i == 21 ) return 21;
-         if(i == 22 ) return 22;
-         if(i == 23 ) return 23;
-         if(i == 24 ) return 24;
-         if(i == 25 ) return 25;
-         if(i == 26 ) return 26;
-         if(i == 27 ) return 27;
-         if(i == 28 ) return 28;
-         if(i == 29 ) return 29;
-         if(i == 30 ) return 30;
-         if(i == 31 ) return 31;
-         if(i == 32 ) return 32;
-         if(i == 33 ) return 33;
-         if(i == 34 ) return 34;
-         if(i == 35 ) return 35;
-         if(i == 36 ) return 36;
-         if(i == 37 ) return 37;
-         if(i == 38 ) return 38;
-         if(i == 39 ) return 39;
-         if(i == 40 ) return 40;
-         if(i == 41 ) return 41;
-         if(i == 42 ) return 42;
-         if(i == 43 ) return 43;
-         if(i == 44 ) return 44;
-         if(i == 45 ) return 45;
-         if(i == 46 ) return 46;
-         if(i == 47 ) return 47;
-         if(i == 48 ) return 48;
-         if(i == 49 ) return 49;
-         if(i == 50 ) return 50;
-         if(i == 51 ) return 51;
-         if(i == 52 ) return 52;
-         if(i == 53 ) return 53;
-         if(i == 54 ) return 54;
-         if(i == 55 ) return 55;
-         if(i == 56 ) return 56;
-         if(i == 57 ) return 57;
-         if(i == 58 ) return 58;
-         if(i == 59 ) return 59;
-         if(i == 60 ) return 60;
-         if(i == 61 ) return 61;
-         if(i == 62 ) return 62;
-         if(i == 63 ) return 63;
-         if(i == 64 ) return 64;
-         if(i == 65 ) return 65;
-         if(i == 66 ) return 66;
-         if(i == 67 ) return 67;
-         if(i == 68 ) return 68;
-         if(i == 69 ) return 69;
-         if(i == 70 ) return 70;
-         if(i == 71 ) return 71;
-         if(i == 72 ) return 72;
-         if(i == 73 ) return 73;
-         if(i == 74 ) return 74;
-         if(i == 75 ) return 75;
-         if(i == 76 ) return 76;
-         if(i == 77 ) return 77;
-         if(i == 78 ) return 78;
-         if(i == 79 ) return 79;
-         if(i == 80 ) return 80;
-         if(i == 81 ) return 81;
-         if(i == 82 ) return 82;
-         if(i == 83 ) return 83;
-         if(i == 84 ) return 84;
-         if(i == 85 ) return 85;
-         if(i == 86 ) return 86;
-         if(i == 87 ) return 87;
-         if(i == 88 ) return 88;
-         if(i == 89 ) return 89;
-         if(i == 90 ) return 90;
-         if(i == 91 ) return 91;
-         if(i == 92 ) return 92;
-         if(i == 93 ) return 93;
-         if(i == 94 ) return 94;
-         if(i == 95 ) return 95;
-         if(i == 96 ) return 96;
-         if(i == 97 ) return 97;
-         if(i == 98 ) return 98;
-         if(i == 99 ) return 99;
-         if(i == 100 ) return 100;
-         if(i == 101 ) return 101;
-         if(i == 102 ) return 102;
-         if(i == 103 ) return 103;
-         if(i == 104 ) return 104;
-         if(i == 105 ) return 105;
-         if(i == 106 ) return 106;
-         if(i == 107 ) return 107;
-         if(i == 108 ) return 108;
-         if(i == 109 ) return 109;
-         if(i == 110 ) return 110;
-         if(i == 111 ) return 111;
-         if(i == 112 ) return 112;
-         if(i == 113 ) return 113;
-         if(i == 114 ) return 114;
-         if(i == 115 ) return 115;
-         if(i == 116 ) return 116;
-         if(i == 117 ) return 117;
-         if(i == 118 ) return 118;
-         if(i == 119 ) return 119;
-         if(i == 120 ) return 120;
-         if(i == 121 ) return 121;
-         if(i == 122 ) return 122;
-         if(i == 123 ) return 123;
-         if(i == 124 ) return 124;
-         if(i == 125 ) return 125;
-         if(i == 126 ) return 126;
-         if(i == 127 ) return 127;
-         if(i == 128 ) return 128;
-         if(i == 129 ) return 129;
-         if(i == 130 ) return 130;
-         if(i == 131 ) return 131;
-         if(i == 132 ) return 132;
-         if(i == 133 ) return 133;
-         if(i == 134 ) return 134;
-         if(i == 135 ) return 135;
-         if(i == 136 ) return 136;
-         if(i == 137 ) return 137;
-         if(i == 138 ) return 138;
-         if(i == 139 ) return 139;
-         if(i == 140 ) return 140;
-         if(i == 141 ) return 141;
-         if(i == 142 ) return 142;
-         if(i == 143 ) return 143;
-         if(i == 144 ) return 144;
-         if(i == 145 ) return 145;
-         if(i == 146 ) return 146;
-         if(i == 147 ) return 147;
-         if(i == 148 ) return 148;
-         if(i == 149 ) return 149;
-         if(i == 150 ) return 150;
-         if(i == 151 ) return 151;
-         if(i == 152 ) return 152;
-         if(i == 153 ) return 153;
-         if(i == 154 ) return 154;
-         if(i == 155 ) return 155;
-         if(i == 156 ) return 156;
-         if(i == 157 ) return 157;
-         if(i == 158 ) return 158;
-         if(i == 159 ) return 159;
-         if(i == 160 ) return 160;
-         if(i == 161 ) return 161;
-         if(i == 162 ) return 162;
-         if(i == 163 ) return 163;
-         if(i == 164 ) return 164;
-         if(i == 165 ) return 165;
-         if(i == 166 ) return 166;
-         if(i == 167 ) return 167;
-         if(i == 168 ) return 168;
-         if(i == 169 ) return 169;
-         if(i == 170 ) return 170;
-         if(i == 171 ) return 171;
-         if(i == 172 ) return 172;
-         if(i == 173 ) return 173;
-         if(i == 174 ) return 174;
-         if(i == 175 ) return 175;
-         if(i == 176 ) return 176;
-         if(i == 177 ) return 177;
-         if(i == 178 ) return 178;
-         if(i == 179 ) return 179;
-         if(i == 180 ) return 180;
-         if(i == 181 ) return 181;
-         if(i == 182 ) return 182;
-         if(i == 183 ) return 183;
-         if(i == 184 ) return 184;
-         if(i == 185 ) return 185;
-         if(i == 186 ) return 186;
-         if(i == 187 ) return 187;
-         if(i == 188 ) return 188;
-         if(i == 189 ) return 189;
-         if(i == 190 ) return 190;
-         if(i == 191 ) return 191;
-         if(i == 192 ) return 192;
-         if(i == 193 ) return 193;
-         if(i == 194 ) return 194;
-         if(i == 195 ) return 195;
-         if(i == 196 ) return 196;
-         if(i == 197 ) return 197;
-         if(i == 198 ) return 198;
-         if(i == 199 ) return 199;
-         if(i == 200 ) return 200;
-         if(i == 201 ) return 201;
-         if(i == 202 ) return 202;
-         if(i == 203 ) return 203;
-         if(i == 204 ) return 204;
-         if(i == 205 ) return 205;
-         if(i == 206 ) return 206;
-         if(i == 207 ) return 207;
-         if(i == 208 ) return 208;
-         if(i == 209 ) return 209;
-         if(i == 210 ) return 210;
-         if(i == 211 ) return 211;
-         if(i == 212 ) return 212;
-         if(i == 213 ) return 213;
-         if(i == 214 ) return 214;
-         if(i == 215 ) return 215;
-         if(i == 216 ) return 216;
-         if(i == 217 ) return 217;
-         if(i == 218 ) return 218;
-         if(i == 219 ) return 219;
-         if(i == 220 ) return 220;
-         if(i == 221 ) return 221;
-         if(i == 222 ) return 222;
-         if(i == 223 ) return 223;
-         if(i == 224 ) return 224;
-         if(i == 225 ) return 225;
-         if(i == 226 ) return 226;
-         if(i == 227 ) return 227;
-         if(i == 228 ) return 228;
-         if(i == 229 ) return 229;
-         if(i == 230 ) return 230;
-         if(i == 231 ) return 231;
-         if(i == 232 ) return 232;
-         if(i == 233 ) return 233;
-         if(i == 234 ) return 234;
-         if(i == 235 ) return 235;
-         if(i == 236 ) return 236;
-         if(i == 237 ) return 237;
-         if(i == 238 ) return 238;
-         if(i == 239 ) return 239;
-         if(i == 240 ) return 240;
-         if(i == 241 ) return 241;
-         if(i == 242 ) return 242;
-         if(i == 243 ) return 243;
-         if(i == 244 ) return 244;
-         if(i == 245 ) return 245;
-         if(i == 246 ) return 246;
-         if(i == 247 ) return 247;
-         if(i == 248 ) return 248;
-         if(i == 249 ) return 249;
-         if(i == 250 ) return 250;
-         if(i == 251 ) return 251;
-         if(i == 252 ) return 252;
-         if(i == 253 ) return 253;
-         if(i == 254 ) return 254;
-         if(i == 255 ) return 255;
-         if(i == 256 ) return 256;
-         if(i == 257 ) return 257;
-         if(i == 258 ) return 258;
-         if(i == 259 ) return 259;
-         if(i == 260 ) return 260;
-         if(i == 261 ) return 261;
-         if(i == 262 ) return 262;
-         if(i == 263 ) return 263;
-         if(i == 264 ) return 264;
-         if(i == 265 ) return 265;
-         if(i == 266 ) return 266;
-         if(i == 267 ) return 267;
-         if(i == 268 ) return 268;
-         if(i == 269 ) return 269;
-         if(i == 270 ) return 270;
-         if(i == 271 ) return 271;
-         if(i == 272 ) return 272;
-         if(i == 273 ) return 273;
-         if(i == 274 ) return 274;
-         if(i == 275 ) return 275;
-         if(i == 276 ) return 276;
-         if(i == 277 ) return 277;
-         if(i == 278 ) return 278;
-         if(i == 279 ) return 279;
-         if(i == 280 ) return 280;
-         if(i == 281 ) return 281;
-         if(i == 282 ) return 282;
-         if(i == 283 ) return 283;
-         if(i == 284 ) return 284;
-         if(i == 285 ) return 285;
-         if(i == 286 ) return 286;
-         if(i == 287 ) return 287;
-         if(i == 288 ) return 288;
-         if(i == 289 ) return 289;
-         if(i == 290 ) return 290;
-         if(i == 291 ) return 291;
-         if(i == 292 ) return 292;
-         if(i == 293 ) return 293;
-         if(i == 294 ) return 294;
-         if(i == 295 ) return 295;
-         if(i == 296 ) return 296;
-         if(i == 297 ) return 297;
-         if(i == 298 ) return 298;
-         if(i == 299 ) return 299;
-         if(i == 300 ) return 300;
-         if(i == 301 ) return 301;
-         if(i == 302 ) return 302;
-         if(i == 303 ) return 303;
-         if(i == 304 ) return 304;
-         if(i == 305 ) return 305;
-         if(i == 306 ) return 306;
-         if(i == 307 ) return 307;
-         if(i == 308 ) return 308;
-         if(i == 309 ) return 309;
-         if(i == 310 ) return 310;
-         if(i == 311 ) return 311;
-         if(i == 312 ) return 312;
-         if(i == 313 ) return 313;
-         if(i == 314 ) return 314;
-         if(i == 315 ) return 315;
-         if(i == 316 ) return 316;
-         if(i == 317 ) return 317;
-         if(i == 318 ) return 318;
-         if(i == 319 ) return 319;
-         if(i == 320 ) return 320;
-         if(i == 321 ) return 321;
-         if(i == 322 ) return 322;
-         if(i == 323 ) return 323;
-         if(i == 324 ) return 324;
-         if(i == 325 ) return 325;
-         if(i == 326 ) return 326;
-         if(i == 327 ) return 327;
-         if(i == 328 ) return 328;
-         if(i == 329 ) return 329;
-         if(i == 330 ) return 330;
-         if(i == 331 ) return 331;
-         if(i == 332 ) return 332;
-         if(i == 333 ) return 333;
-         if(i == 334 ) return 334;
-         if(i == 335 ) return 335;
-         if(i == 336 ) return 336;
-         if(i == 337 ) return 337;
-         if(i == 338 ) return 338;
-         if(i == 339 ) return 339;
-         if(i == 340 ) return 340;
-         if(i == 341 ) return 341;
-         if(i == 342 ) return 342;
-         if(i == 343 ) return 343;
-         if(i == 344 ) return 344;
-         if(i == 345 ) return 345;
-         if(i == 346 ) return 346;
-         if(i == 347 ) return 347;
-         if(i == 348 ) return 348;
-         if(i == 349 ) return 349;
-         if(i == 350 ) return 350;
-         if(i == 351 ) return 351;
-         if(i == 352 ) return 352;
-         if(i == 353 ) return 353;
-         if(i == 354 ) return 354;
-         if(i == 355 ) return 355;
-         if(i == 356 ) return 356;
-         if(i == 357 ) return 357;
-         if(i == 358 ) return 358;
-         if(i == 359 ) return 359;
-         if(i == 360 ) return 360;
-         if(i == 361 ) return 361;
-         if(i == 362 ) return 362;
-         if(i == 363 ) return 363;
-         if(i == 364 ) return 364;
-         if(i == 365 ) return 365;
-         if(i == 366 ) return 366;
-         if(i == 367 ) return 367;
-         if(i == 368 ) return 368;
-         if(i == 369 ) return 369;
-         if(i == 370 ) return 370;
-         if(i == 371 ) return 371;
-         if(i == 372 ) return 372;
-         if(i == 373 ) return 373;
-         if(i == 374 ) return 374;
-         if(i == 375 ) return 375;
-         if(i == 376 ) return 376;
-         if(i == 377 ) return 377;
-         if(i == 378 ) return 378;
-         if(i == 379 ) return 379;
-         if(i == 380 ) return 380;
-         if(i == 381 ) return 381;
-         if(i == 382 ) return 382;
-         if(i == 383 ) return 383;
-         if(i == 384 ) return 384;
-         if(i == 385 ) return 385;
-         if(i == 386 ) return 386;
-         if(i == 387 ) return 387;
-         if(i == 388 ) return 388;
-         if(i == 389 ) return 389;
-         if(i == 390 ) return 390;
-         if(i == 391 ) return 391;
-         if(i == 392 ) return 392;
-         if(i == 393 ) return 393;
-         if(i == 394 ) return 394;
-         if(i == 395 ) return 395;
-         if(i == 396 ) return 396;
-         if(i == 397 ) return 397;
-         if(i == 398 ) return 398;
-         if(i == 399 ) return 399;
-         if(i == 400 ) return 400;
-         if(i == 401 ) return 401;
-         if(i == 402 ) return 402;
-         if(i == 403 ) return 403;
-         if(i == 404 ) return 404;
-         if(i == 405 ) return 405;
-         if(i == 406 ) return 406;
-         if(i == 407 ) return 407;
-         if(i == 408 ) return 408;
-         if(i == 409 ) return 409;
-         if(i == 410 ) return 410;
-         if(i == 411 ) return 411;
-         if(i == 412 ) return 412;
-         if(i == 413 ) return 413;
-         if(i == 414 ) return 414;
-         if(i == 415 ) return 415;
-         if(i == 416 ) return 416;
-         if(i == 417 ) return 417;
-         if(i == 418 ) return 418;
-         if(i == 419 ) return 419;
-         if(i == 420 ) return 420;
-         if(i == 421 ) return 421;
-         if(i == 422 ) return 422;
-         if(i == 423 ) return 423;
-         if(i == 424 ) return 424;
-         if(i == 425 ) return 425;
-         if(i == 426 ) return 426;
-         if(i == 427 ) return 427;
-         if(i == 428 ) return 428;
-         if(i == 429 ) return 429;
-         if(i == 430 ) return 430;
-         if(i == 431 ) return 431;
-         if(i == 432 ) return 432;
-         if(i == 433 ) return 433;
-         if(i == 434 ) return 434;
-         if(i == 435 ) return 435;
-         if(i == 436 ) return 436;
-         if(i == 437 ) return 437;
-         if(i == 438 ) return 438;
-         if(i == 439 ) return 439;
-         if(i == 440 ) return 440;
-         if(i == 441 ) return 441;
-         if(i == 442 ) return 442;
-         if(i == 443 ) return 443;
-         if(i == 444 ) return 444;
-         if(i == 445 ) return 445;
-         if(i == 446 ) return 446;
-         if(i == 447 ) return 447;
-         if(i == 448 ) return 448;
-         if(i == 449 ) return 449;
-         if(i == 450 ) return 450;
-         if(i == 451 ) return 451;
-         if(i == 452 ) return 452;
-         if(i == 453 ) return 453;
-         if(i == 454 ) return 454;
-         if(i == 455 ) return 455;
-         if(i == 456 ) return 456;
-         if(i == 457 ) return 457;
-         if(i == 458 ) return 458;
-         if(i == 459 ) return 459;
-         if(i == 460 ) return 460;
-         if(i == 461 ) return 461;
-         if(i == 462 ) return 462;
-         if(i == 463 ) return 463;
-         if(i == 464 ) return 464;
-         if(i == 465 ) return 465;
-         if(i == 466 ) return 466;
-         if(i == 467 ) return 467;
-         if(i == 468 ) return 468;
-         if(i == 469 ) return 469;
-         if(i == 470 ) return 470;
-         if(i == 471 ) return 471;
-         if(i == 472 ) return 472;
-         if(i == 473 ) return 473;
-         if(i == 474 ) return 474;
-         if(i == 475 ) return 475;
-         if(i == 476 ) return 476;
-         if(i == 477 ) return 477;
-         if(i == 478 ) return 478;
-         if(i == 479 ) return 479;
-         if(i == 480 ) return 480;
-         if(i == 481 ) return 481;
-         if(i == 482 ) return 482;
-         if(i == 483 ) return 483;
-         if(i == 484 ) return 484;
-         if(i == 485 ) return 485;
-         if(i == 486 ) return 486;
-         if(i == 487 ) return 487;
-         if(i == 488 ) return 488;
-         if(i == 489 ) return 489;
-         if(i == 490 ) return 490;
-         if(i == 491 ) return 491;
-         if(i == 492 ) return 492;
-         if(i == 493 ) return 493;
-         if(i == 494 ) return 494;
-         if(i == 495 ) return 495;
-         if(i == 496 ) return 496;
-         if(i == 497 ) return 497;
-         if(i == 498 ) return 498;
-         if(i == 499 ) return 499;
-         if(i == 500 ) return 500;
-         if(i == 501 ) return 501;
-         if(i == 502 ) return 502;
-         if(i == 503 ) return 503;
-         if(i == 504 ) return 504;
-         if(i == 505 ) return 505;
-         if(i == 506 ) return 506;
-         if(i == 507 ) return 507;
-         if(i == 508 ) return 508;
-         if(i == 509 ) return 509;
-         if(i == 510 ) return 510;
-         if(i == 511 ) return 511;
-         if(i == 512 ) return 512;
-         if(i == 513 ) return 513;
-         if(i == 514 ) return 514;
-         if(i == 515 ) return 515;
-         if(i == 516 ) return 516;
-         if(i == 517 ) return 517;
-         if(i == 518 ) return 518;
-         if(i == 519 ) return 519;
-         if(i == 520 ) return 520;
-         if(i == 521 ) return 521;
-         if(i == 522 ) return 522;
-         if(i == 523 ) return 523;
-         if(i == 524 ) return 524;
-         if(i == 525 ) return 525;
-         if(i == 526 ) return 526;
-         if(i == 527 ) return 527;
-         if(i == 528 ) return 528;
-         if(i == 529 ) return 529;
-         if(i == 530 ) return 530;
-         if(i == 531 ) return 531;
-         if(i == 532 ) return 532;
-         if(i == 533 ) return 533;
-         if(i == 534 ) return 534;
-         if(i == 535 ) return 535;
-         if(i == 536 ) return 536;
-         if(i == 537 ) return 537;
-         if(i == 538 ) return 538;
-         if(i == 539 ) return 539;
-         if(i == 540 ) return 540;
-         if(i == 541 ) return 541;
-         if(i == 542 ) return 542;
-         if(i == 543 ) return 543;
-         if(i == 544 ) return 544;
-         if(i == 545 ) return 545;
-         if(i == 546 ) return 546;
-         if(i == 547 ) return 547;
-         if(i == 548 ) return 548;
-         if(i == 549 ) return 549;
-         if(i == 550 ) return 550;
-         if(i == 551 ) return 551;
-         if(i == 552 ) return 552;
-         if(i == 553 ) return 553;
-         if(i == 554 ) return 554;
-         if(i == 555 ) return 555;
-         if(i == 556 ) return 556;
-         if(i == 557 ) return 557;
-         if(i == 558 ) return 558;
-         if(i == 559 ) return 559;
-         if(i == 560 ) return 560;
-         if(i == 561 ) return 561;
-         if(i == 562 ) return 562;
-         if(i == 563 ) return 563;
-         if(i == 564 ) return 564;
-         if(i == 565 ) return 565;
-         if(i == 566 ) return 566;
-         if(i == 567 ) return 567;
-         if(i == 568 ) return 568;
-         if(i == 569 ) return 569;
-         if(i == 570 ) return 570;
-         if(i == 571 ) return 571;
-         if(i == 572 ) return 572;
-         if(i == 573 ) return 573;
-         if(i == 574 ) return 574;
-         if(i == 575 ) return 575;
-         if(i == 576 ) return 576;
-         if(i == 577 ) return 577;
-         if(i == 578 ) return 578;
-         if(i == 579 ) return 579;
-         if(i == 580 ) return 580;
-         if(i == 581 ) return 581;
-         if(i == 582 ) return 582;
-         if(i == 583 ) return 583;
-         if(i == 584 ) return 584;
-         if(i == 585 ) return 585;
-         if(i == 586 ) return 586;
-         if(i == 587 ) return 587;
-         if(i == 588 ) return 588;
-         if(i == 589 ) return 589;
-         if(i == 590 ) return 590;
-         if(i == 591 ) return 591;
-         if(i == 592 ) return 592;
-         if(i == 593 ) return 593;
-         if(i == 594 ) return 594;
-         if(i == 595 ) return 595;
-         if(i == 596 ) return 596;
-         if(i == 597 ) return 597;
-         if(i == 598 ) return 598;
-         if(i == 599 ) return 599;
-         if(i == 600 ) return 600;
-         if(i == 601 ) return 601;
-         if(i == 602 ) return 602;
-         if(i == 603 ) return 603;
-         if(i == 604 ) return 604;
-         if(i == 605 ) return 605;
-         if(i == 606 ) return 606;
-         if(i == 607 ) return 607;
-         if(i == 608 ) return 608;
-         if(i == 609 ) return 609;
-         if(i == 610 ) return 610;
-         if(i == 611 ) return 611;
-         if(i == 612 ) return 612;
-         if(i == 613 ) return 613;
-         if(i == 614 ) return 614;
-         if(i == 615 ) return 615;
-         if(i == 616 ) return 616;
-         if(i == 617 ) return 617;
-         if(i == 618 ) return 618;
-         if(i == 619 ) return 619;
-         if(i == 620 ) return 620;
-         if(i == 621 ) return 621;
-         if(i == 622 ) return 622;
-         if(i == 623 ) return 623;
-         if(i == 624 ) return 624;
-         if(i == 625 ) return 625;
-         if(i == 626 ) return 626;
-         if(i == 627 ) return 627;
-         if(i == 628 ) return 628;
-         if(i == 629 ) return 629;
-         if(i == 630 ) return 630;
-         if(i == 631 ) return 631;
-         if(i == 632 ) return 632;
-         if(i == 633 ) return 633;
-         if(i == 634 ) return 634;
-         if(i == 635 ) return 635;
-         if(i == 636 ) return 636;
-         if(i == 637 ) return 637;
-         if(i == 638 ) return 638;
-         if(i == 639 ) return 639;
-         if(i == 640 ) return 640;
-         if(i == 641 ) return 641;
-         if(i == 642 ) return 642;
-         if(i == 643 ) return 643;
-         if(i == 644 ) return 644;
-         if(i == 645 ) return 645;
-         if(i == 646 ) return 646;
-         if(i == 647 ) return 647;
-         if(i == 648 ) return 648;
-         if(i == 649 ) return 649;
-         if(i == 650 ) return 650;
-         if(i == 651 ) return 651;
-         if(i == 652 ) return 652;
-         if(i == 653 ) return 653;
-         if(i == 654 ) return 654;
-         if(i == 655 ) return 655;
-         if(i == 656 ) return 656;
-         if(i == 657 ) return 657;
-         if(i == 658 ) return 658;
-         if(i == 659 ) return 659;
-         if(i == 660 ) return 660;
-         if(i == 661 ) return 661;
-         if(i == 662 ) return 662;
-         if(i == 663 ) return 663;
-         if(i == 664 ) return 664;
-         if(i == 665 ) return 665;
-         if(i == 666 ) return 666;
-         if(i == 667 ) return 667;
-         if(i == 668 ) return 668;
-         if(i == 669 ) return 669;
-         if(i == 670 ) return 670;
-         if(i == 671 ) return 671;
-         if(i == 672 ) return 672;
-         if(i == 673 ) return 673;
-         if(i == 674 ) return 674;
-         if(i == 675 ) return 675;
-         if(i == 676 ) return 676;
-         if(i == 677 ) return 677;
-         if(i == 678 ) return 678;
-         if(i == 679 ) return 679;
-         if(i == 680 ) return 680;
-         if(i == 681 ) return 681;
-         if(i == 682 ) return 682;
-         if(i == 683 ) return 683;
-         if(i == 684 ) return 684;
-         if(i == 685 ) return 685;
-         if(i == 686 ) return 686;
-         if(i == 687 ) return 687;
-         if(i == 688 ) return 688;
-         if(i == 689 ) return 689;
-         if(i == 690 ) return 690;
-         if(i == 691 ) return 691;
-         if(i == 692 ) return 692;
-         if(i == 693 ) return 693;
-         if(i == 694 ) return 694;
-         if(i == 695 ) return 695;
-         if(i == 696 ) return 696;
-         if(i == 697 ) return 697;
-         if(i == 698 ) return 698;
-         if(i == 699 ) return 699;
-         if(i == 700 ) return 700;
-         if(i == 701 ) return 701;
-         if(i == 702 ) return 702;
-         if(i == 703 ) return 703;
-         if(i == 704 ) return 704;
-         if(i == 705 ) return 705;
-         if(i == 706 ) return 706;
-         if(i == 707 ) return 707;
-         if(i == 708 ) return 708;
-         if(i == 709 ) return 709;
-         if(i == 710 ) return 710;
-         if(i == 711 ) return 711;
-         if(i == 712 ) return 712;
-         if(i == 713 ) return 713;
-         if(i == 714 ) return 714;
-         if(i == 715 ) return 715;
-         if(i == 716 ) return 716;
-         if(i == 717 ) return 717;
-         if(i == 718 ) return 718;
-         if(i == 719 ) return 719;
-         if(i == 720 ) return 720;
-         if(i == 721 ) return 721;
-         if(i == 722 ) return 722;
-         if(i == 723 ) return 723;
-         if(i == 724 ) return 724;
-         if(i == 725 ) return 725;
-         if(i == 726 ) return 726;
-         if(i == 727 ) return 727;
-         if(i == 728 ) return 728;
-         if(i == 729 ) return 729;
-         if(i == 730 ) return 730;
-         if(i == 731 ) return 731;
-         if(i == 732 ) return 732;
-         if(i == 733 ) return 733;
-         if(i == 734 ) return 734;
-         if(i == 735 ) return 735;
-         if(i == 736 ) return 736;
-         if(i == 737 ) return 737;
-         if(i == 738 ) return 738;
-         if(i == 739 ) return 739;
-         if(i == 740 ) return 740;
-         if(i == 741 ) return 741;
-         if(i == 742 ) return 742;
-         if(i == 743 ) return 743;
-         if(i == 744 ) return 744;
-         if(i == 745 ) return 745;
-         if(i == 746 ) return 746;
-         if(i == 747 ) return 747;
-         if(i == 748 ) return 748;
-         if(i == 749 ) return 749;
-         if(i == 750 ) return 750;
-         if(i == 751 ) return 751;
-         if(i == 752 ) return 752;
-         if(i == 753 ) return 753;
-         if(i == 754 ) return 754;
-         if(i == 755 ) return 755;
-         if(i == 756 ) return 756;
-         if(i == 757 ) return 757;
-         if(i == 758 ) return 758;
-         if(i == 759 ) return 759;
-         if(i == 760 ) return 760;
-         if(i == 761 ) return 761;
-         if(i == 762 ) return 762;
-         if(i == 763 ) return 763;
-         if(i == 764 ) return 764;
-         if(i == 765 ) return 765;
-         if(i == 766 ) return 766;
-         if(i == 767 ) return 767;
-         if(i == 768 ) return 768;
-         if(i == 769 ) return 769;
-         if(i == 770 ) return 770;
-         if(i == 771 ) return 771;
-         if(i == 772 ) return 772;
-         if(i == 773 ) return 773;
-         if(i == 774 ) return 774;
-         if(i == 775 ) return 775;
-         if(i == 776 ) return 776;
-         if(i == 777 ) return 777;
-         if(i == 778 ) return 778;
-         if(i == 779 ) return 779;
-         if(i == 780 ) return 780;
-         if(i == 781 ) return 781;
-         if(i == 782 ) return 782;
-         if(i == 783 ) return 783;
-         if(i == 784 ) return 784;
-         if(i == 785 ) return 785;
-         if(i == 786 ) return 786;
-         if(i == 787 ) return 787;
-         if(i == 788 ) return 788;
-         if(i == 789 ) return 789;
-         if(i == 790 ) return 790;
-         if(i == 791 ) return 791;
-         if(i == 792 ) return 792;
-         if(i == 793 ) return 793;
-         if(i == 794 ) return 794;
-         if(i == 795 ) return 795;
-         if(i == 796 ) return 796;
-         if(i == 797 ) return 797;
-         if(i == 798 ) return 798;
-         if(i == 799 ) return 799;
-         if(i == 800 ) return 800;
-         if(i == 801 ) return 801;
-         if(i == 802 ) return 802;
-         if(i == 803 ) return 803;
-         if(i == 804 ) return 804;
-         if(i == 805 ) return 805;
-         if(i == 806 ) return 806;
-         if(i == 807 ) return 807;
-         if(i == 808 ) return 808;
-         if(i == 809 ) return 809;
-         if(i == 810 ) return 810;
-         if(i == 811 ) return 811;
-         if(i == 812 ) return 812;
-         if(i == 813 ) return 813;
-         if(i == 814 ) return 814;
-         if(i == 815 ) return 815;
-         if(i == 816 ) return 816;
-         if(i == 817 ) return 817;
-         if(i == 818 ) return 818;
-         if(i == 819 ) return 819;
-         if(i == 820 ) return 820;
-         if(i == 821 ) return 821;
-         if(i == 822 ) return 822;
-         if(i == 823 ) return 823;
-         if(i == 824 ) return 824;
-         if(i == 825 ) return 825;
-         if(i == 826 ) return 826;
-         if(i == 827 ) return 827;
-         if(i == 828 ) return 828;
-         if(i == 829 ) return 829;
-         if(i == 830 ) return 830;
-         if(i == 831 ) return 831;
-         if(i == 832 ) return 832;
-         if(i == 833 ) return 833;
-         if(i == 834 ) return 834;
-         if(i == 835 ) return 835;
-         if(i == 836 ) return 836;
-         if(i == 837 ) return 837;
-         if(i == 838 ) return 838;
-         if(i == 839 ) return 839;
-         if(i == 840 ) return 840;
-         if(i == 841 ) return 841;
-         if(i == 842 ) return 842;
-         if(i == 843 ) return 843;
-         if(i == 844 ) return 844;
-         if(i == 845 ) return 845;
-         if(i == 846 ) return 846;
-         if(i == 847 ) return 847;
-         if(i == 848 ) return 848;
-         if(i == 849 ) return 849;
-         if(i == 850 ) return 850;
-         if(i == 851 ) return 851;
-         if(i == 852 ) return 852;
-         if(i == 853 ) return 853;
-         if(i == 854 ) return 854;
-         if(i == 855 ) return 855;
-         if(i == 856 ) return 856;
-         if(i == 857 ) return 857;
-         if(i == 858 ) return 858;
-         if(i == 859 ) return 859;
-         if(i == 860 ) return 860;
-         if(i == 861 ) return 861;
-         if(i == 862 ) return 862;
-         if(i == 863 ) return 863;
-         if(i == 864 ) return 864;
-         if(i == 865 ) return 865;
-         if(i == 866 ) return 866;
-         if(i == 867 ) return 867;
-         if(i == 868 ) return 868;
-         if(i == 869 ) return 869;
-         if(i == 870 ) return 870;
-         if(i == 871 ) return 871;
-         if(i == 872 ) return 872;
-         if(i == 873 ) return 873;
-         if(i == 874 ) return 874;
-         if(i == 875 ) return 875;
-         if(i == 876 ) return 876;
-         if(i == 877 ) return 877;
-         if(i == 878 ) return 878;
-         if(i == 879 ) return 879;
-         if(i == 880 ) return 880;
-         if(i == 881 ) return 881;
-         if(i == 882 ) return 882;
-         if(i == 883 ) return 883;
-         if(i == 884 ) return 884;
-         if(i == 885 ) return 885;
-         if(i == 886 ) return 886;
-         if(i == 887 ) return 887;
-         if(i == 888 ) return 888;
-         if(i == 889 ) return 889;
-         if(i == 890 ) return 890;
-         if(i == 891 ) return 891;
-         if(i == 892 ) return 892;
-         if(i == 893 ) return 893;
-         if(i == 894 ) return 894;
-         if(i == 895 ) return 895;
-         if(i == 896 ) return 896;
-         if(i == 897 ) return 897;
-         if(i == 898 ) return 898;
-         if(i == 899 ) return 899;
-         if(i == 900 ) return 900;
-         if(i == 901 ) return 901;
-         if(i == 902 ) return 902;
-         if(i == 903 ) return 903;
-         if(i == 904 ) return 904;
-         if(i == 905 ) return 905;
-         if(i == 906 ) return 906;
-         if(i == 907 ) return 907;
-         if(i == 908 ) return 908;
-         if(i == 909 ) return 909;
-         if(i == 910 ) return 910;
-         if(i == 911 ) return 911;
-         if(i == 912 ) return 912;
-         if(i == 913 ) return 913;
-         if(i == 914 ) return 914;
-         if(i == 915 ) return 915;
-         if(i == 916 ) return 916;
-         if(i == 917 ) return 917;
-         if(i == 918 ) return 918;
-         if(i == 919 ) return 919;
-         if(i == 920 ) return 920;
-         if(i == 921 ) return 921;
-         if(i == 922 ) return 922;
-         if(i == 923 ) return 923;
-         if(i == 924 ) return 924;
-         if(i == 925 ) return 925;
-         if(i == 926 ) return 926;
-         if(i == 927 ) return 927;
-         if(i == 928 ) return 928;
-         if(i == 929 ) return 929;
-         if(i == 930 ) return 930;
-         if(i == 931 ) return 931;
-         if(i == 932 ) return 932;
-         if(i == 933 ) return 933;
-         if(i == 934 ) return 934;
-         if(i == 935 ) return 935;
-         if(i == 936 ) return 936;
-         if(i == 937 ) return 937;
-         if(i == 938 ) return 938;
-         if(i == 939 ) return 939;
-         if(i == 940 ) return 940;
-         if(i == 941 ) return 941;
-         if(i == 942 ) return 942;
-         if(i == 943 ) return 943;
-         if(i == 944 ) return 944;
-         if(i == 945 ) return 945;
-         if(i == 946 ) return 946;
-         if(i == 947 ) return 947;
-         if(i == 948 ) return 948;
-         if(i == 949 ) return 949;
-         if(i == 950 ) return 950;
-         if(i == 951 ) return 951;
-         if(i == 952 ) return 952;
-         if(i == 953 ) return 953;
-         if(i == 954 ) return 954;
-         if(i == 955 ) return 955;
-         if(i == 956 ) return 956;
-         if(i == 957 ) return 957;
-         if(i == 958 ) return 958;
-         if(i == 959 ) return 959;
-         if(i == 960 ) return 960;
-         if(i == 961 ) return 961;
-         if(i == 962 ) return 962;
-         if(i == 963 ) return 963;
-         if(i == 964 ) return 964;
-         if(i == 965 ) return 965;
-         if(i == 966 ) return 966;
-         if(i == 967 ) return 967;
-         if(i == 968 ) return 968;
-         if(i == 969 ) return 969;
-         if(i == 970 ) return 970;
-         if(i == 971 ) return 971;
-         if(i == 972 ) return 972;
-         if(i == 973 ) return 973;
-         if(i == 974 ) return 974;
-         if(i == 975 ) return 975;
-         if(i == 976 ) return 976;
-         if(i == 977 ) return 977;
-         if(i == 978 ) return 978;
-         if(i == 979 ) return 979;
-         if(i == 980 ) return 980;
-         if(i == 981 ) return 981;
-         if(i == 982 ) return 982;
-         if(i == 983 ) return 983;
-         if(i == 984 ) return 984;
-         if(i == 985 ) return 985;
-         if(i == 986 ) return 986;
-         if(i == 987 ) return 987;
-         if(i == 988 ) return 988;
-         if(i == 989 ) return 989;
-         if(i == 990 ) return 990;
-         if(i == 991 ) return 991;
-         if(i == 992 ) return 992;
-         if(i == 993 ) return 993;
-         if(i == 994 ) return 994;
-         if(i == 995 ) return 995;
-         if(i == 996 ) return 996;
-         if(i == 997 ) return 997;
-         if(i == 998 ) return 998;
-         if(i == 999 ) return 999;
-         if(i == 1000 ) return 1000;
-         if(i == 1001 ) return 1001;
-         if(i == 1002 ) return 1002;
-         if(i == 1003 ) return 1003;
-         if(i == 1004 ) return 1004;
-         if(i == 1005 ) return 1005;
-         if(i == 1006 ) return 1006;
-         if(i == 1007 ) return 1007;
-         if(i == 1008 ) return 1008;
-         if(i == 1009 ) return 1009;
-         if(i == 1010 ) return 1010;
-         if(i == 1011 ) return 1011;
-         if(i == 1012 ) return 1012;
-         if(i == 1013 ) return 1013;
-         if(i == 1014 ) return 1014;
-         if(i == 1015 ) return 1015;
-         if(i == 1016 ) return 1016;
-         if(i == 1017 ) return 1017;
-         if(i == 1018 ) return 1018;
-         if(i == 1019 ) return 1019;
-         if(i == 1020 ) return 1020;
-         if(i == 1021 ) return 1021;
-         if(i == 1022 ) return 1022;
-         if(i == 1023 ) return 1023;
-         if(i == 1024 ) return 1024;
-         if(i == 1025 ) return 1025;
-         if(i == 1026 ) return 1026;
-         if(i == 1027 ) return 1027;
-         if(i == 1028 ) return 1028;
-         if(i == 1029 ) return 1029;
-         if(i == 1030 ) return 1030;
-         if(i == 1031 ) return 1031;
-         if(i == 1032 ) return 1032;
-         if(i == 1033 ) return 1033;
-         if(i == 1034 ) return 1034;
-         if(i == 1035 ) return 1035;
-         if(i == 1036 ) return 1036;
-         if(i == 1037 ) return 1037;
-         if(i == 1038 ) return 1038;
-         if(i == 1039 ) return 1039;
-         if(i == 1040 ) return 1040;
-         if(i == 1041 ) return 1041;
-         if(i == 1042 ) return 1042;
-         if(i == 1043 ) return 1043;
-         if(i == 1044 ) return 1044;
-         if(i == 1045 ) return 1045;
-         if(i == 1046 ) return 1046;
-         if(i == 1047 ) return 1047;
-         if(i == 1048 ) return 1048;
-         if(i == 1049 ) return 1049;
-         if(i == 1050 ) return 1050;
-         if(i == 1051 ) return 1051;
-         if(i == 1052 ) return 1052;
-         if(i == 1053 ) return 1053;
-         if(i == 1054 ) return 1054;
-         if(i == 1055 ) return 1055;
-         if(i == 1056 ) return 1056;
-         if(i == 1057 ) return 1057;
-         if(i == 1058 ) return 1058;
-         if(i == 1059 ) return 1059;
-         if(i == 1060 ) return 1060;
-         if(i == 1061 ) return 1061;
-         if(i == 1062 ) return 1062;
-         if(i == 1063 ) return 1063;
-         if(i == 1064 ) return 1064;
-         if(i == 1065 ) return 1065;
-         if(i == 1066 ) return 1066;
-         if(i == 1067 ) return 1067;
-         if(i == 1068 ) return 1068;
-         if(i == 1069 ) return 1069;
-         if(i == 1070 ) return 1070;
-         if(i == 1071 ) return 1071;
-         if(i == 1072 ) return 1072;
-         if(i == 1073 ) return 1073;
-         if(i == 1074 ) return 1074;
-         if(i == 1075 ) return 1075;
-         if(i == 1076 ) return 1076;
-         if(i == 1077 ) return 1077;
-         if(i == 1078 ) return 1078;
-         if(i == 1079 ) return 1079;
-         if(i == 1080 ) return 1080;
-         if(i == 1081 ) return 1081;
-         if(i == 1082 ) return 1082;
-         if(i == 1083 ) return 1083;
-         if(i == 1084 ) return 1084;
-         if(i == 1085 ) return 1085;
-         if(i == 1086 ) return 1086;
-         if(i == 1087 ) return 1087;
-         if(i == 1088 ) return 1088;
-         if(i == 1089 ) return 1089;
-         if(i == 1090 ) return 1090;
-         if(i == 1091 ) return 1091;
-         if(i == 1092 ) return 1092;
-         if(i == 1093 ) return 1093;
-         if(i == 1094 ) return 1094;
-         if(i == 1095 ) return 1095;
-         if(i == 1096 ) return 1096;
-         if(i == 1097 ) return 1097;
-         if(i == 1098 ) return 1098;
-         if(i == 1099 ) return 1099;
-         if(i == 1100 ) return 1100;
-         if(i == 1101 ) return 1101;
-         if(i == 1102 ) return 1102;
-         if(i == 1103 ) return 1103;
-         if(i == 1104 ) return 1104;
-         if(i == 1105 ) return 1105;
-         if(i == 1106 ) return 1106;
-         if(i == 1107 ) return 1107;
-         if(i == 1108 ) return 1108;
-         if(i == 1109 ) return 1109;
-         if(i == 1110 ) return 1110;
-         if(i == 1111 ) return 1111;
-         if(i == 1112 ) return 1112;
-         if(i == 1113 ) return 1113;
-         if(i == 1114 ) return 1114;
-         if(i == 1115 ) return 1115;
-         if(i == 1116 ) return 1116;
-         if(i == 1117 ) return 1117;
-         if(i == 1118 ) return 1118;
-         if(i == 1119 ) return 1119;
-         if(i == 1120 ) return 1120;
-         if(i == 1121 ) return 1121;
-         if(i == 1122 ) return 1122;
-         if(i == 1123 ) return 1123;
-         if(i == 1124 ) return 1124;
-         if(i == 1125 ) return 1125;
-         if(i == 1126 ) return 1126;
-         if(i == 1127 ) return 1127;
-         if(i == 1128 ) return 1128;
-         if(i == 1129 ) return 1129;
-         if(i == 1130 ) return 1130;
-         if(i == 1131 ) return 1131;
-         if(i == 1132 ) return 1132;
-         if(i == 1133 ) return 1133;
-         if(i == 1134 ) return 1134;
-         if(i == 1135 ) return 1135;
-         if(i == 1136 ) return 1136;
-         if(i == 1137 ) return 1137;
-         if(i == 1138 ) return 1138;
-         if(i == 1139 ) return 1139;
-         if(i == 1140 ) return 1140;
-         if(i == 1141 ) return 1141;
-         if(i == 1142 ) return 1142;
-         if(i == 1143 ) return 1143;
-         if(i == 1144 ) return 1144;
-         if(i == 1145 ) return 1145;
-         if(i == 1146 ) return 1146;
-         if(i == 1147 ) return 1147;
-         if(i == 1148 ) return 1148;
-         if(i == 1149 ) return 1149;
-         if(i == 1150 ) return 1150;
-         if(i == 1151 ) return 1151;
-         if(i == 1152 ) return 1152;
-         if(i == 1153 ) return 1153;
-         if(i == 1154 ) return 1154;
-         if(i == 1155 ) return 1155;
-         if(i == 1156 ) return 1156;
-         if(i == 1157 ) return 1157;
-         if(i == 1158 ) return 1158;
-         if(i == 1159 ) return 1159;
-         if(i == 1160 ) return 1160;
-         if(i == 1161 ) return 1161;
-         if(i == 1162 ) return 1162;
-         if(i == 1163 ) return 1163;
-         if(i == 1164 ) return 1164;
-         if(i == 1165 ) return 1165;
-         if(i == 1166 ) return 1166;
-         if(i == 1167 ) return 1167;
-         if(i == 1168 ) return 1168;
-         if(i == 1169 ) return 1169;
-         if(i == 1170 ) return 1170;
-         if(i == 1171 ) return 1171;
-         if(i == 1172 ) return 1172;
-         if(i == 1173 ) return 1173;
-         if(i == 1174 ) return 1174;
-         if(i == 1175 ) return 1175;
-         if(i == 1176 ) return 1176;
-         if(i == 1177 ) return 1177;
-         if(i == 1178 ) return 1178;
-         if(i == 1179 ) return 1179;
-         if(i == 1180 ) return 1180;
-         if(i == 1181 ) return 1181;
-         if(i == 1182 ) return 1182;
-         if(i == 1183 ) return 1183;
-         if(i == 1184 ) return 1184;
-         if(i == 1185 ) return 1185;
-         if(i == 1186 ) return 1186;
-         if(i == 1187 ) return 1187;
-         if(i == 1188 ) return 1188;
-         if(i == 1189 ) return 1189;
-         if(i == 1190 ) return 1190;
-         if(i == 1191 ) return 1191;
-         if(i == 1192 ) return 1192;
-         if(i == 1193 ) return 1193;
-         if(i == 1194 ) return 1194;
-         if(i == 1195 ) return 1195;
-         if(i == 1196 ) return 1196;
-         if(i == 1197 ) return 1197;
-         if(i == 1198 ) return 1198;
-         if(i == 1199 ) return 1199;
-         if(i == 1200 ) return 1200;
-         if(i == 1201 ) return 1201;
-         if(i == 1202 ) return 1202;
-         if(i == 1203 ) return 1203;
-         if(i == 1204 ) return 1204;
-         if(i == 1205 ) return 1205;
-         if(i == 1206 ) return 1206;
-         if(i == 1207 ) return 1207;
-         if(i == 1208 ) return 1208;
-         if(i == 1209 ) return 1209;
-         if(i == 1210 ) return 1210;
-         if(i == 1211 ) return 1211;
-         if(i == 1212 ) return 1212;
-         if(i == 1213 ) return 1213;
-         if(i == 1214 ) return 1214;
-         if(i == 1215 ) return 1215;
-         if(i == 1216 ) return 1216;
-         if(i == 1217 ) return 1217;
-         if(i == 1218 ) return 1218;
-         if(i == 1219 ) return 1219;
-         if(i == 1220 ) return 1220;
-         if(i == 1221 ) return 1221;
-         if(i == 1222 ) return 1222;
-         if(i == 1223 ) return 1223;
-         if(i == 1224 ) return 1224;
-         if(i == 1225 ) return 1225;
-         if(i == 1226 ) return 1226;
-         if(i == 1227 ) return 1227;
-         if(i == 1228 ) return 1228;
-         if(i == 1229 ) return 1229;
-         if(i == 1230 ) return 1230;
-         if(i == 1231 ) return 1231;
-         if(i == 1232 ) return 1232;
-         if(i == 1233 ) return 1233;
-         if(i == 1234 ) return 1234;
-         if(i == 1235 ) return 1235;
-         if(i == 1236 ) return 1236;
-         if(i == 1237 ) return 1237;
-         if(i == 1238 ) return 1238;
-         if(i == 1239 ) return 1239;
-         if(i == 1240 ) return 1240;
-         if(i == 1241 ) return 1241;
-         if(i == 1242 ) return 1242;
-         if(i == 1243 ) return 1243;
-         if(i == 1244 ) return 1244;
-         if(i == 1245 ) return 1245;
-         if(i == 1246 ) return 1246;
-         if(i == 1247 ) return 1247;
-         if(i == 1248 ) return 1248;
-         if(i == 1249 ) return 1249;
-         if(i == 1250 ) return 1250;
-         if(i == 1251 ) return 1251;
-         if(i == 1252 ) return 1252;
-         if(i == 1253 ) return 1253;
-         if(i == 1254 ) return 1254;
-         if(i == 1255 ) return 1255;
-         if(i == 1256 ) return 1256;
-         if(i == 1257 ) return 1257;
-         if(i == 1258 ) return 1258;
-         if(i == 1259 ) return 1259;
-         if(i == 1260 ) return 1260;
-         if(i == 1261 ) return 1261;
-         if(i == 1262 ) return 1262;
-         if(i == 1263 ) return 1263;
-         if(i == 1264 ) return 1264;
-         if(i == 1265 ) return 1265;
-         if(i == 1266 ) return 1266;
-         if(i == 1267 ) return 1267;
-         if(i == 1268 ) return 1268;
-         if(i == 1269 ) return 1269;
-         if(i == 1270 ) return 1270;
-         if(i == 1271 ) return 1271;
-         if(i == 1272 ) return 1272;
-         if(i == 1273 ) return 1273;
-         if(i == 1274 ) return 1274;
-         if(i == 1275 ) return 1275;
-         if(i == 1276 ) return 1276;
-         if(i == 1277 ) return 1277;
-         if(i == 1278 ) return 1278;
-         if(i == 1279 ) return 1279;
-         if(i == 1280 ) return 1280;
-         if(i == 1281 ) return 1281;
-         if(i == 1282 ) return 1282;
-         if(i == 1283 ) return 1283;
-         if(i == 1284 ) return 1284;
-         if(i == 1285 ) return 1285;
-         if(i == 1286 ) return 1286;
-         if(i == 1287 ) return 1287;
-         if(i == 1288 ) return 1288;
-         if(i == 1289 ) return 1289;
-         if(i == 1290 ) return 1290;
-         if(i == 1291 ) return 1291;
-         if(i == 1292 ) return 1292;
-         if(i == 1293 ) return 1293;
-         if(i == 1294 ) return 1294;
-         if(i == 1295 ) return 1295;
-         if(i == 1296 ) return 1296;
-         if(i == 1297 ) return 1297;
-         if(i == 1298 ) return 1298;
-         if(i == 1299 ) return 1299;
-         if(i == 1300 ) return 1300;
-         if(i == 1301 ) return 1301;
-         if(i == 1302 ) return 1302;
-         if(i == 1303 ) return 1303;
-         if(i == 1304 ) return 1304;
-         if(i == 1305 ) return 1305;
-         if(i == 1306 ) return 1306;
-         if(i == 1307 ) return 1307;
-         if(i == 1308 ) return 1308;
-         if(i == 1309 ) return 1309;
-         if(i == 1310 ) return 1310;
-         if(i == 1311 ) return 1311;
-         if(i == 1312 ) return 1312;
-         if(i == 1313 ) return 1313;
-         if(i == 1314 ) return 1314;
-         if(i == 1315 ) return 1315;
-         if(i == 1316 ) return 1316;
-         if(i == 1317 ) return 1317;
-         if(i == 1318 ) return 1318;
-         if(i == 1319 ) return 1319;
-         if(i == 1320 ) return 1320;
-         if(i == 1321 ) return 1321;
-         if(i == 1322 ) return 1322;
-         if(i == 1323 ) return 1323;
-         if(i == 1324 ) return 1324;
-         if(i == 1325 ) return 1325;
-         if(i == 1326 ) return 1326;
-         if(i == 1327 ) return 1327;
-         if(i == 1328 ) return 1328;
-         if(i == 1329 ) return 1329;
-         if(i == 1330 ) return 1330;
-         if(i == 1331 ) return 1331;
-         if(i == 1332 ) return 1332;
-         if(i == 1333 ) return 1333;
-         if(i == 1334 ) return 1334;
-         if(i == 1335 ) return 1335;
-         if(i == 1336 ) return 1336;
-         if(i == 1337 ) return 1337;
-         if(i == 1338 ) return 1338;
-         if(i == 1339 ) return 1339;
-         if(i == 1340 ) return 1340;
-         if(i == 1341 ) return 1341;
-         if(i == 1342 ) return 1342;
-         if(i == 1343 ) return 1343;
-         if(i == 1344 ) return 1344;
-         if(i == 1345 ) return 1345;
-         if(i == 1346 ) return 1346;
-         if(i == 1347 ) return 1347;
-         if(i == 1348 ) return 1348;
-         if(i == 1349 ) return 1349;
-         if(i == 1350 ) return 1350;
-         if(i == 1351 ) return 1351;
-         if(i == 1352 ) return 1352;
-         if(i == 1353 ) return 1353;
-         if(i == 1354 ) return 1354;
-         if(i == 1355 ) return 1355;
-         if(i == 1356 ) return 1356;
-         if(i == 1357 ) return 1357;
-         if(i == 1358 ) return 1358;
-         if(i == 1359 ) return 1359;
-         if(i == 1360 ) return 1360;
-         if(i == 1361 ) return 1361;
-         if(i == 1362 ) return 1362;
-         if(i == 1363 ) return 1363;
-         if(i == 1364 ) return 1364;
-         if(i == 1365 ) return 1365;
-         if(i == 1366 ) return 1366;
-         if(i == 1367 ) return 1367;
-         if(i == 1368 ) return 1368;
-         if(i == 1369 ) return 1369;
-         if(i == 1370 ) return 1370;
-         if(i == 1371 ) return 1371;
-         if(i == 1372 ) return 1372;
-         if(i == 1373 ) return 1373;
-         if(i == 1374 ) return 1374;
-         if(i == 1375 ) return 1375;
-         if(i == 1376 ) return 1376;
-         if(i == 1377 ) return 1377;
-         if(i == 1378 ) return 1378;
-         if(i == 1379 ) return 1379;
-         if(i == 1380 ) return 1380;
-         if(i == 1381 ) return 1381;
-         if(i == 1382 ) return 1382;
-         if(i == 1383 ) return 1383;
-         if(i == 1384 ) return 1384;
-         if(i == 1385 ) return 1385;
-         if(i == 1386 ) return 1386;
-         if(i == 1387 ) return 1387;
-         if(i == 1388 ) return 1388;
-         if(i == 1389 ) return 1389;
-         if(i == 1390 ) return 1390;
-         if(i == 1391 ) return 1391;
-         if(i == 1392 ) return 1392;
-         if(i == 1393 ) return 1393;
-         if(i == 1394 ) return 1394;
-         if(i == 1395 ) return 1395;
-         if(i == 1396 ) return 1396;
-         if(i == 1397 ) return 1397;
-         if(i == 1398 ) return 1398;
-         if(i == 1399 ) return 1399;
-         if(i == 1400 ) return 1400;
-         if(i == 1401 ) return 1401;
-         if(i == 1402 ) return 1402;
-         if(i == 1403 ) return 1403;
-         if(i == 1404 ) return 1404;
-         if(i == 1405 ) return 1405;
-         if(i == 1406 ) return 1406;
-         if(i == 1407 ) return 1407;
-         if(i == 1408 ) return 1408;
-         if(i == 1409 ) return 1409;
-         if(i == 1410 ) return 1410;
-         if(i == 1411 ) return 1411;
-         if(i == 1412 ) return 1412;
-         if(i == 1413 ) return 1413;
-         if(i == 1414 ) return 1414;
-         if(i == 1415 ) return 1415;
-         if(i == 1416 ) return 1416;
-         if(i == 1417 ) return 1417;
-         if(i == 1418 ) return 1418;
-         if(i == 1419 ) return 1419;
-         if(i == 1420 ) return 1420;
-         if(i == 1421 ) return 1421;
-         if(i == 1422 ) return 1422;
-         if(i == 1423 ) return 1423;
-         if(i == 1424 ) return 1424;
-         if(i == 1425 ) return 1425;
-         if(i == 1426 ) return 1426;
-         if(i == 1427 ) return 1427;
-         if(i == 1428 ) return 1428;
-         if(i == 1429 ) return 1429;
-         if(i == 1430 ) return 1430;
-         if(i == 1431 ) return 1431;
-         if(i == 1432 ) return 1432;
-         if(i == 1433 ) return 1433;
-         if(i == 1434 ) return 1434;
-         if(i == 1435 ) return 1435;
-         if(i == 1436 ) return 1436;
-         if(i == 1437 ) return 1437;
-         if(i == 1438 ) return 1438;
-         if(i == 1439 ) return 1439;
-         if(i == 1440 ) return 1440;
-         if(i == 1441 ) return 1441;
-         if(i == 1442 ) return 1442;
-         if(i == 1443 ) return 1443;
-         if(i == 1444 ) return 1444;
-         if(i == 1445 ) return 1445;
-         if(i == 1446 ) return 1446;
-         if(i == 1447 ) return 1447;
-         if(i == 1448 ) return 1448;
-         if(i == 1449 ) return 1449;
-         if(i == 1450 ) return 1450;
-         if(i == 1451 ) return 1451;
-         if(i == 1452 ) return 1452;
-         if(i == 1453 ) return 1453;
-         if(i == 1454 ) return 1454;
-         if(i == 1455 ) return 1455;
-         if(i == 1456 ) return 1456;
-         if(i == 1457 ) return 1457;
-         if(i == 1458 ) return 1458;
-         if(i == 1459 ) return 1459;
-         if(i == 1460 ) return 1460;
-         if(i == 1461 ) return 1461;
-         if(i == 1462 ) return 1462;
-         if(i == 1463 ) return 1463;
-         if(i == 1464 ) return 1464;
-         if(i == 1465 ) return 1465;
-         if(i == 1466 ) return 1466;
-         if(i == 1467 ) return 1467;
-         if(i == 1468 ) return 1468;
-         if(i == 1469 ) return 1469;
-         if(i == 1470 ) return 1470;
-         if(i == 1471 ) return 1471;
-         if(i == 1472 ) return 1472;
-         if(i == 1473 ) return 1473;
-         if(i == 1474 ) return 1474;
-         if(i == 1475 ) return 1475;
-         if(i == 1476 ) return 1476;
-         if(i == 1477 ) return 1477;
-         if(i == 1478 ) return 1478;
-         if(i == 1479 ) return 1479;
-         if(i == 1480 ) return 1480;
-         if(i == 1481 ) return 1481;
-         if(i == 1482 ) return 1482;
-         if(i == 1483 ) return 1483;
-         if(i == 1484 ) return 1484;
-         if(i == 1485 ) return 1485;
-         if(i == 1486 ) return 1486;
-         if(i == 1487 ) return 1487;
-         if(i == 1488 ) return 1488;
-         if(i == 1489 ) return 1489;
-         if(i == 1490 ) return 1490;
-         if(i == 1491 ) return 1491;
-         if(i == 1492 ) return 1492;
-         if(i == 1493 ) return 1493;
-         if(i == 1494 ) return 1494;
-         if(i == 1495 ) return 1495;
-         if(i == 1496 ) return 1496;
-         if(i == 1497 ) return 1497;
-         if(i == 1498 ) return 1498;
-         if(i == 1499 ) return 1499;
-         if(i == 1500 ) return 1500;
-         if(i == 1501 ) return 1501;
-         if(i == 1502 ) return 1502;
-         if(i == 1503 ) return 1503;
-         if(i == 1504 ) return 1504;
-         if(i == 1505 ) return 1505;
-         if(i == 1506 ) return 1506;
-         if(i == 1507 ) return 1507;
-         if(i == 1508 ) return 1508;
-         if(i == 1509 ) return 1509;
-         if(i == 1510 ) return 1510;
-         if(i == 1511 ) return 1511;
-         if(i == 1512 ) return 1512;
-         if(i == 1513 ) return 1513;
-         if(i == 1514 ) return 1514;
-         if(i == 1515 ) return 1515;
-         if(i == 1516 ) return 1516;
-         if(i == 1517 ) return 1517;
-         if(i == 1518 ) return 1518;
-         if(i == 1519 ) return 1519;
-         if(i == 1520 ) return 1520;
-         if(i == 1521 ) return 1521;
-         if(i == 1522 ) return 1522;
-         if(i == 1523 ) return 1523;
-         if(i == 1524 ) return 1524;
-         if(i == 1525 ) return 1525;
-         if(i == 1526 ) return 1526;
-         if(i == 1527 ) return 1527;
-         if(i == 1528 ) return 1528;
-         if(i == 1529 ) return 1529;
-         if(i == 1530 ) return 1530;
-         if(i == 1531 ) return 1531;
-         if(i == 1532 ) return 1532;
-         if(i == 1533 ) return 1533;
-         if(i == 1534 ) return 1534;
-         if(i == 1535 ) return 1535;
-         if(i == 1536 ) return 1536;
-         if(i == 1537 ) return 1537;
-         if(i == 1538 ) return 1538;
-         if(i == 1539 ) return 1539;
-         if(i == 1540 ) return 1540;
-         if(i == 1541 ) return 1541;
-         if(i == 1542 ) return 1542;
-         if(i == 1543 ) return 1543;
-         if(i == 1544 ) return 1544;
-         if(i == 1545 ) return 1545;
-         if(i == 1546 ) return 1546;
-         if(i == 1547 ) return 1547;
-         if(i == 1548 ) return 1548;
-         if(i == 1549 ) return 1549;
-         if(i == 1550 ) return 1550;
-         if(i == 1551 ) return 1551;
-         if(i == 1552 ) return 1552;
-         if(i == 1553 ) return 1553;
-         if(i == 1554 ) return 1554;
-         if(i == 1555 ) return 1555;
-         if(i == 1556 ) return 1556;
-         if(i == 1557 ) return 1557;
-         if(i == 1558 ) return 1558;
-         if(i == 1559 ) return 1559;
-         if(i == 1560 ) return 1560;
-         if(i == 1561 ) return 1561;
-         if(i == 1562 ) return 1562;
-         if(i == 1563 ) return 1563;
-         if(i == 1564 ) return 1564;
-         if(i == 1565 ) return 1565;
-         if(i == 1566 ) return 1566;
-         if(i == 1567 ) return 1567;
-         if(i == 1568 ) return 1568;
-         if(i == 1569 ) return 1569;
-         if(i == 1570 ) return 1570;
-         if(i == 1571 ) return 1571;
-         if(i == 1572 ) return 1572;
-         if(i == 1573 ) return 1573;
-         if(i == 1574 ) return 1574;
-         if(i == 1575 ) return 1575;
-         if(i == 1576 ) return 1576;
-         if(i == 1577 ) return 1577;
-         if(i == 1578 ) return 1578;
-         if(i == 1579 ) return 1579;
-         if(i == 1580 ) return 1580;
-         if(i == 1581 ) return 1581;
-         if(i == 1582 ) return 1582;
-         if(i == 1583 ) return 1583;
-         if(i == 1584 ) return 1584;
-         if(i == 1585 ) return 1585;
-         if(i == 1586 ) return 1586;
-         if(i == 1587 ) return 1587;
-         if(i == 1588 ) return 1588;
-         if(i == 1589 ) return 1589;
-         if(i == 1590 ) return 1590;
-         if(i == 1591 ) return 1591;
-         if(i == 1592 ) return 1592;
-         if(i == 1593 ) return 1593;
-         if(i == 1594 ) return 1594;
-         if(i == 1595 ) return 1595;
-         if(i == 1596 ) return 1596;
-         if(i == 1597 ) return 1597;
-         if(i == 1598 ) return 1598;
-         if(i == 1599 ) return 1599;
-         if(i == 1600 ) return 1600;
-         if(i == 1601 ) return 1601;
-         if(i == 1602 ) return 1602;
-         if(i == 1603 ) return 1603;
-         if(i == 1604 ) return 1604;
-         if(i == 1605 ) return 1605;
-         if(i == 1606 ) return 1606;
-         if(i == 1607 ) return 1607;
-         if(i == 1608 ) return 1608;
-         if(i == 1609 ) return 1609;
-         if(i == 1610 ) return 1610;
-         if(i == 1611 ) return 1611;
-         if(i == 1612 ) return 1612;
-         if(i == 1613 ) return 1613;
-         if(i == 1614 ) return 1614;
-         if(i == 1615 ) return 1615;
-         if(i == 1616 ) return 1616;
-         if(i == 1617 ) return 1617;
-         if(i == 1618 ) return 1618;
-         if(i == 1619 ) return 1619;
-         if(i == 1620 ) return 1620;
-         if(i == 1621 ) return 1621;
-         if(i == 1622 ) return 1622;
-         if(i == 1623 ) return 1623;
-         if(i == 1624 ) return 1624;
-         if(i == 1625 ) return 1625;
-         if(i == 1626 ) return 1626;
-         if(i == 1627 ) return 1627;
-         if(i == 1628 ) return 1628;
-         if(i == 1629 ) return 1629;
-         if(i == 1630 ) return 1630;
-         if(i == 1631 ) return 1631;
-         if(i == 1632 ) return 1632;
-         if(i == 1633 ) return 1633;
-         if(i == 1634 ) return 1634;
-         if(i == 1635 ) return 1635;
-         if(i == 1636 ) return 1636;
-         if(i == 1637 ) return 1637;
-         if(i == 1638 ) return 1638;
-         if(i == 1639 ) return 1639;
-         if(i == 1640 ) return 1640;
-         if(i == 1641 ) return 1641;
-         if(i == 1642 ) return 1642;
-         if(i == 1643 ) return 1643;
-         if(i == 1644 ) return 1644;
-         if(i == 1645 ) return 1645;
-         if(i == 1646 ) return 1646;
-         if(i == 1647 ) return 1647;
-         if(i == 1648 ) return 1648;
-         if(i == 1649 ) return 1649;
-         if(i == 1650 ) return 1650;
-         if(i == 1651 ) return 1651;
-         if(i == 1652 ) return 1652;
-         if(i == 1653 ) return 1653;
-         if(i == 1654 ) return 1654;
-         if(i == 1655 ) return 1655;
-         if(i == 1656 ) return 1656;
-         if(i == 1657 ) return 1657;
-         if(i == 1658 ) return 1658;
-         if(i == 1659 ) return 1659;
-         if(i == 1660 ) return 1660;
-         if(i == 1661 ) return 1661;
-         if(i == 1662 ) return 1662;
-         if(i == 1663 ) return 1663;
-         if(i == 1664 ) return 1664;
-         if(i == 1665 ) return 1665;
-         if(i == 1666 ) return 1666;
-         if(i == 1667 ) return 1667;
-         if(i == 1668 ) return 1668;
-         if(i == 1669 ) return 1669;
-         if(i == 1670 ) return 1670;
-         if(i == 1671 ) return 1671;
-         if(i == 1672 ) return 1672;
-         if(i == 1673 ) return 1673;
-         if(i == 1674 ) return 1674;
-         if(i == 1675 ) return 1675;
-         if(i == 1676 ) return 1676;
-         if(i == 1677 ) return 1677;
-         if(i == 1678 ) return 1678;
-         if(i == 1679 ) return 1679;
-         if(i == 1680 ) return 1680;
-         if(i == 1681 ) return 1681;
-         if(i == 1682 ) return 1682;
-         if(i == 1683 ) return 1683;
-         if(i == 1684 ) return 1684;
-         if(i == 1685 ) return 1685;
-         if(i == 1686 ) return 1686;
-         if(i == 1687 ) return 1687;
-         if(i == 1688 ) return 1688;
-         if(i == 1689 ) return 1689;
-         if(i == 1690 ) return 1690;
-         if(i == 1691 ) return 1691;
-         if(i == 1692 ) return 1692;
-         if(i == 1693 ) return 1693;
-         if(i == 1694 ) return 1694;
-         if(i == 1695 ) return 1695;
-         if(i == 1696 ) return 1696;
-         if(i == 1697 ) return 1697;
-         if(i == 1698 ) return 1698;
-         if(i == 1699 ) return 1699;
-         if(i == 1700 ) return 1700;
-         if(i == 1701 ) return 1701;
-         if(i == 1702 ) return 1702;
-         if(i == 1703 ) return 1703;
-         if(i == 1704 ) return 1704;
-         if(i == 1705 ) return 1705;
-         if(i == 1706 ) return 1706;
-         if(i == 1707 ) return 1707;
-         if(i == 1708 ) return 1708;
-         if(i == 1709 ) return 1709;
-         if(i == 1710 ) return 1710;
-         if(i == 1711 ) return 1711;
-         if(i == 1712 ) return 1712;
-         if(i == 1713 ) return 1713;
-         if(i == 1714 ) return 1714;
-         if(i == 1715 ) return 1715;
-         if(i == 1716 ) return 1716;
-         if(i == 1717 ) return 1717;
-         if(i == 1718 ) return 1718;
-         if(i == 1719 ) return 1719;
-         if(i == 1720 ) return 1720;
-         if(i == 1721 ) return 1721;
-         if(i == 1722 ) return 1722;
-         if(i == 1723 ) return 1723;
-         if(i == 1724 ) return 1724;
-         if(i == 1725 ) return 1725;
-         if(i == 1726 ) return 1726;
-         if(i == 1727 ) return 1727;
-         if(i == 1728 ) return 1728;
-         if(i == 1729 ) return 1729;
-         if(i == 1730 ) return 1730;
-         if(i == 1731 ) return 1731;
-         if(i == 1732 ) return 1732;
-         if(i == 1733 ) return 1733;
-         if(i == 1734 ) return 1734;
-         if(i == 1735 ) return 1735;
-         if(i == 1736 ) return 1736;
-         if(i == 1737 ) return 1737;
-         if(i == 1738 ) return 1738;
-         if(i == 1739 ) return 1739;
-         if(i == 1740 ) return 1740;
-         if(i == 1741 ) return 1741;
-         if(i == 1742 ) return 1742;
-         if(i == 1743 ) return 1743;
-         if(i == 1744 ) return 1744;
-         if(i == 1745 ) return 1745;
-         if(i == 1746 ) return 1746;
-         if(i == 1747 ) return 1747;
-         if(i == 1748 ) return 1748;
-         if(i == 1749 ) return 1749;
-         if(i == 1750 ) return 1750;
-         if(i == 1751 ) return 1751;
-         if(i == 1752 ) return 1752;
-         if(i == 1753 ) return 1753;
-         if(i == 1754 ) return 1754;
-         if(i == 1755 ) return 1755;
-         if(i == 1756 ) return 1756;
-         if(i == 1757 ) return 1757;
-         if(i == 1758 ) return 1758;
-         if(i == 1759 ) return 1759;
-         if(i == 1760 ) return 1760;
-         if(i == 1761 ) return 1761;
-         if(i == 1762 ) return 1762;
-         if(i == 1763 ) return 1763;
-         if(i == 1764 ) return 1764;
-         if(i == 1765 ) return 1765;
-         if(i == 1766 ) return 1766;
-         if(i == 1767 ) return 1767;
-         if(i == 1768 ) return 1768;
-         if(i == 1769 ) return 1769;
-         if(i == 1770 ) return 1770;
-         if(i == 1771 ) return 1771;
-         if(i == 1772 ) return 1772;
-         if(i == 1773 ) return 1773;
-         if(i == 1774 ) return 1774;
-         if(i == 1775 ) return 1775;
-         if(i == 1776 ) return 1776;
-         if(i == 1777 ) return 1777;
-         if(i == 1778 ) return 1778;
-         if(i == 1779 ) return 1779;
-         if(i == 1780 ) return 1780;
-         if(i == 1781 ) return 1781;
-         if(i == 1782 ) return 1782;
-         if(i == 1783 ) return 1783;
-         if(i == 1784 ) return 1784;
-         if(i == 1785 ) return 1785;
-         if(i == 1786 ) return 1786;
-         if(i == 1787 ) return 1787;
-         if(i == 1788 ) return 1788;
-         if(i == 1789 ) return 1789;
-         if(i == 1790 ) return 1790;
-         if(i == 1791 ) return 1791;
-         if(i == 1792 ) return 1792;
-         if(i == 1793 ) return 1793;
-         if(i == 1794 ) return 1794;
-         if(i == 1795 ) return 1795;
-         if(i == 1796 ) return 1796;
-         if(i == 1797 ) return 1797;
-         if(i == 1798 ) return 1798;
-         if(i == 1799 ) return 1799;
-         if(i == 1800 ) return 1800;
-         if(i == 1801 ) return 1801;
-         if(i == 1802 ) return 1802;
-         if(i == 1803 ) return 1803;
-         if(i == 1804 ) return 1804;
-         if(i == 1805 ) return 1805;
-         if(i == 1806 ) return 1806;
-         if(i == 1807 ) return 1807;
-         if(i == 1808 ) return 1808;
-         if(i == 1809 ) return 1809;
-         if(i == 1810 ) return 1810;
-         if(i == 1811 ) return 1811;
-         if(i == 1812 ) return 1812;
-         if(i == 1813 ) return 1813;
-         if(i == 1814 ) return 1814;
-         if(i == 1815 ) return 1815;
-         if(i == 1816 ) return 1816;
-         if(i == 1817 ) return 1817;
-         if(i == 1818 ) return 1818;
-         if(i == 1819 ) return 1819;
-         if(i == 1820 ) return 1820;
-         if(i == 1821 ) return 1821;
-         if(i == 1822 ) return 1822;
-         if(i == 1823 ) return 1823;
-         if(i == 1824 ) return 1824;
-         if(i == 1825 ) return 1825;
-         if(i == 1826 ) return 1826;
-         if(i == 1827 ) return 1827;
-         if(i == 1828 ) return 1828;
-         if(i == 1829 ) return 1829;
-         if(i == 1830 ) return 1830;
-         if(i == 1831 ) return 1831;
-         if(i == 1832 ) return 1832;
-         if(i == 1833 ) return 1833;
-         if(i == 1834 ) return 1834;
-         if(i == 1835 ) return 1835;
-         if(i == 1836 ) return 1836;
-         if(i == 1837 ) return 1837;
-         if(i == 1838 ) return 1838;
-         if(i == 1839 ) return 1839;
-         if(i == 1840 ) return 1840;
-         if(i == 1841 ) return 1841;
-         if(i == 1842 ) return 1842;
-         if(i == 1843 ) return 1843;
-         if(i == 1844 ) return 1844;
-         if(i == 1845 ) return 1845;
-         if(i == 1846 ) return 1846;
-         if(i == 1847 ) return 1847;
-         if(i == 1848 ) return 1848;
-         if(i == 1849 ) return 1849;
-         if(i == 1850 ) return 1850;
-         if(i == 1851 ) return 1851;
-         if(i == 1852 ) return 1852;
-         if(i == 1853 ) return 1853;
-         if(i == 1854 ) return 1854;
-         if(i == 1855 ) return 1855;
-         if(i == 1856 ) return 1856;
-         if(i == 1857 ) return 1857;
-         if(i == 1858 ) return 1858;
-         if(i == 1859 ) return 1859;
-         if(i == 1860 ) return 1860;
-         if(i == 1861 ) return 1861;
-         if(i == 1862 ) return 1862;
-         if(i == 1863 ) return 1863;
-         if(i == 1864 ) return 1864;
-         if(i == 1865 ) return 1865;
-         if(i == 1866 ) return 1866;
-         if(i == 1867 ) return 1867;
-         if(i == 1868 ) return 1868;
-         if(i == 1869 ) return 1869;
-         if(i == 1870 ) return 1870;
-         if(i == 1871 ) return 1871;
-         if(i == 1872 ) return 1872;
-         if(i == 1873 ) return 1873;
-         if(i == 1874 ) return 1874;
-         if(i == 1875 ) return 1875;
-         if(i == 1876 ) return 1876;
-         if(i == 1877 ) return 1877;
-         if(i == 1878 ) return 1878;
-         if(i == 1879 ) return 1879;
-         if(i == 1880 ) return 1880;
-         if(i == 1881 ) return 1881;
-         if(i == 1882 ) return 1882;
-         if(i == 1883 ) return 1883;
-         if(i == 1884 ) return 1884;
-         if(i == 1885 ) return 1885;
-         if(i == 1886 ) return 1886;
-         if(i == 1887 ) return 1887;
-         if(i == 1888 ) return 1888;
-         if(i == 1889 ) return 1889;
-         if(i == 1890 ) return 1890;
-         if(i == 1891 ) return 1891;
-         if(i == 1892 ) return 1892;
-         if(i == 1893 ) return 1893;
-         if(i == 1894 ) return 1894;
-         if(i == 1895 ) return 1895;
-         if(i == 1896 ) return 1896;
-         if(i == 1897 ) return 1897;
-         if(i == 1898 ) return 1898;
-         if(i == 1899 ) return 1899;
-         if(i == 1900 ) return 1900;
-         if(i == 1901 ) return 1901;
-         if(i == 1902 ) return 1902;
-         if(i == 1903 ) return 1903;
-         if(i == 1904 ) return 1904;
-         if(i == 1905 ) return 1905;
-         if(i == 1906 ) return 1906;
-         if(i == 1907 ) return 1907;
-         if(i == 1908 ) return 1908;
-         if(i == 1909 ) return 1909;
-         if(i == 1910 ) return 1910;
-         if(i == 1911 ) return 1911;
-         if(i == 1912 ) return 1912;
-         if(i == 1913 ) return 1913;
-         if(i == 1914 ) return 1914;
-         if(i == 1915 ) return 1915;
-         if(i == 1916 ) return 1916;
-         if(i == 1917 ) return 1917;
-         if(i == 1918 ) return 1918;
-         if(i == 1919 ) return 1919;
-         if(i == 1920 ) return 1920;
-         if(i == 1921 ) return 1921;
-         if(i == 1922 ) return 1922;
-         if(i == 1923 ) return 1923;
-         if(i == 1924 ) return 1924;
-         if(i == 1925 ) return 1925;
-         if(i == 1926 ) return 1926;
-         if(i == 1927 ) return 1927;
-         if(i == 1928 ) return 1928;
-         if(i == 1929 ) return 1929;
-         if(i == 1930 ) return 1930;
-         if(i == 1931 ) return 1931;
-         if(i == 1932 ) return 1932;
-         if(i == 1933 ) return 1933;
-         if(i == 1934 ) return 1934;
-         if(i == 1935 ) return 1935;
-         if(i == 1936 ) return 1936;
-         if(i == 1937 ) return 1937;
-         if(i == 1938 ) return 1938;
-         if(i == 1939 ) return 1939;
-         if(i == 1940 ) return 1940;
-         if(i == 1941 ) return 1941;
-         if(i == 1942 ) return 1942;
-         if(i == 1943 ) return 1943;
-         if(i == 1944 ) return 1944;
-         if(i == 1945 ) return 1945;
-         if(i == 1946 ) return 1946;
-         if(i == 1947 ) return 1947;
-         if(i == 1948 ) return 1948;
-         if(i == 1949 ) return 1949;
-         if(i == 1950 ) return 1950;
-         if(i == 1951 ) return 1951;
-         if(i == 1952 ) return 1952;
-         if(i == 1953 ) return 1953;
-         if(i == 1954 ) return 1954;
-         if(i == 1955 ) return 1955;
-         if(i == 1956 ) return 1956;
-         if(i == 1957 ) return 1957;
-         if(i == 1958 ) return 1958;
-         if(i == 1959 ) return 1959;
-         if(i == 1960 ) return 1960;
-         if(i == 1961 ) return 1961;
-         if(i == 1962 ) return 1962;
-         if(i == 1963 ) return 1963;
-         if(i == 1964 ) return 1964;
-         if(i == 1965 ) return 1965;
-         if(i == 1966 ) return 1966;
-         if(i == 1967 ) return 1967;
-         if(i == 1968 ) return 1968;
-         if(i == 1969 ) return 1969;
-         if(i == 1970 ) return 1970;
-         if(i == 1971 ) return 1971;
-         if(i == 1972 ) return 1972;
-         if(i == 1973 ) return 1973;
-         if(i == 1974 ) return 1974;
-         if(i == 1975 ) return 1975;
-         if(i == 1976 ) return 1976;
-         if(i == 1977 ) return 1977;
-         if(i == 1978 ) return 1978;
-         if(i == 1979 ) return 1979;
-         if(i == 1980 ) return 1980;
-         if(i == 1981 ) return 1981;
-         if(i == 1982 ) return 1982;
-         if(i == 1983 ) return 1983;
-         if(i == 1984 ) return 1984;
-         if(i == 1985 ) return 1985;
-         if(i == 1986 ) return 1986;
-         if(i == 1987 ) return 1987;
-         if(i == 1988 ) return 1988;
-         if(i == 1989 ) return 1989;
-         if(i == 1990 ) return 1990;
-         if(i == 1991 ) return 1991;
-         if(i == 1992 ) return 1992;
-         if(i == 1993 ) return 1993;
-         if(i == 1994 ) return 1994;
-         if(i == 1995 ) return 1995;
-         if(i == 1996 ) return 1996;
-         if(i == 1997 ) return 1997;
-         if(i == 1998 ) return 1998;
-         if(i == 1999 ) return 1999;
-      } finally {
-         int x = 0;
-         x += 1;
-         x += 2;
-         x += 3;
-         x += 4;
-         x += 5;
-         x += 6;
-         x += 7;
-         x += 8;
-         x += 9;
-      }
-      return 0;
-   }
-}
--- a/langtools/test/tools/javac/ArrayCloneCodeGen.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 4267335
- * @summary Verify that code generated for Array.clone() with -target 1.2 passes verifier.
- * @author maddox
- *
- * @run compile -source 1.3 -target 1.2 ArrayCloneCodeGen.java
- * @run main/othervm -Xverify:all ArrayCloneCodeGen
- */
-
-public class ArrayCloneCodeGen {
-
-    public static void main(String[] args) {}
-
-    private String[] args = null;
-
-    public String[] getArgs() {
-        return (String []) (args.clone());
-    }
-}
--- a/langtools/test/tools/javac/ClassLit.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/ClassLit.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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
@@ -26,9 +26,6 @@
  * @bug 4884387
  * @summary Use ldc instruction for class literals
  * @author gafter
- *
- * @compile -source 1.5 -target 1.5 ClassLit.java
- * @run main ClassLit
  */
 
 public class ClassLit {
--- a/langtools/test/tools/javac/ConditionalArgTypes_2.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/ConditionalArgTypes_2.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, 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
@@ -27,7 +27,6 @@
  * @summary Verify that both branches of a conditional expression must agree in type.
  * @author maddox
  *
- * @compile/fail -source 1.4 ConditionalArgTypes_2.java
  * @compile                  ConditionalArgTypes_2.java
  */
 
--- a/langtools/test/tools/javac/ConditionalClass.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 4949627
- * @summary javac crashes on code for new rule for semantics of ? without -source 1.5
- * @author gafter
- *
- * @compile -source 1.4 ConditionalClass.java
- */
-
-package conditional.clazz;
-
-class A{}
-class B{}
-
-public class ConditionalClass {
-    void foo(){
-        boolean b = false;
-        Class a =  b ? A.class : B.class;
-        System.out.println("a is " + a.getName());
-    }
-
-    public static void main(String[] args)
-    {
-        new ConditionalClass().foo();
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/IncorrectInheritance/IncorrectInheritanceTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug 8034924
+ * @summary Incorrect inheritance of inaccessible static method
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main IncorrectInheritanceTest
+ */
+
+public class IncorrectInheritanceTest {
+    private static final String ASrc =
+            "package pkg;\n" +
+            "\n" +
+            "public class A {\n" +
+            "    static void foo(Object o) {}\n" +
+            "    private static void bar(Object o) {}\n" +
+            "}";
+
+    private static final String BSrc =
+            "import pkg.A;\n" +
+            "class B extends A {\n" +
+            "    public void foo(Object o) {}\n" +
+            "    public void bar(Object o) {}\n" +
+            "}";
+
+    private static final String CSrc =
+            "class C extends B {\n" +
+            "    public void m(Object o) {\n" +
+            "        foo(o);\n" +
+            "        bar(o);\n" +
+            "    }\n" +
+            "}";
+
+    public static void main(String[] args) throws Exception {
+        new IncorrectInheritanceTest().test();
+    }
+
+    public void test() throws Exception {
+        ToolBox.JavaToolArgs javacParams =
+                new ToolBox.JavaToolArgs()
+                .setSources(ASrc, BSrc, CSrc);
+        ToolBox.javac(javacParams);
+    }
+
+}
--- a/langtools/test/tools/javac/JsrRet.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/JsrRet.java	Tue Apr 01 15:37:15 2014 +0200
@@ -27,7 +27,7 @@
  * @summary StackOverflowError from javac
  * @author gafter
  *
- * @compile -source 1.5 -target 1.5 JsrRet.java
+ * @compile JsrRet.java
  */
 
 package jsr.ret;
--- a/langtools/test/tools/javac/NoNoClassDefFoundErrorError.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 4313429
- * @summary Compiling <Classname>.class on CLDC crashed the compiler.
- *
- * @compile/fail -source 1.4 -target 1.4 -XDfailcomplete=java.lang.NoClassDefFoundError NoNoClassDefFoundErrorError.java
- */
-
-class NoNoClassDefFoundErrorError {
-    public static void main() {
-        Class self = NoNoClassDefFoundErrorError.class;
-    }
-}
--- a/langtools/test/tools/javac/T6266772.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/T6266772.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -26,9 +26,6 @@
  * @bug     6266772
  * @summary javac crashes, assertion failure in Lower.java
  * @author  Peter von der Ah\u00e9
- * @compile/fail -source 1.4 T6266772.java
- * @compile T6266772.java
- * @run main T6266772
  */
 
 public class T6266772 {
--- a/langtools/test/tools/javac/T6557865.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 6557865
- * @summary -source 5 -target 5 should not put ACC_SYNTHETIC on package-info
- * @author Wei Tao
- * @compile T6557865.java
- * @compile -source 5 -target 5 T6232928/package-info.java
- * @run main T6557865
- */
-
-import java.io.*;
-import java.lang.reflect.Modifier;
-
-public class T6557865 {
-  public static void main(String... args) throws Exception {
-    Class pkginfo_cls = Class.forName("T6232928.package-info");
-    int mod = pkginfo_cls.getModifiers();
-    if ((mod & 0x1000) != 0) {
-      throw new AssertionError("Test failed: interface package-info shouldn't be synthetic in -target 5.");
-    }
-  }
-}
--- a/langtools/test/tools/javac/UplevelFromAnonInSuperCall.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/UplevelFromAnonInSuperCall.java	Tue Apr 01 15:37:15 2014 +0200
@@ -29,7 +29,6 @@
  * @author maddox (cribbed from bracha/lillibridge) gafter
  *
  * @compile UplevelFromAnonInSuperCall.java
- * @compile/fail -source 1.4 UplevelFromAnonInSuperCall.java
  */
 
 class UplevelFromAnonInSuperCall {
--- a/langtools/test/tools/javac/annotations/neg/Dep.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/annotations/neg/Dep.java	Tue Apr 01 15:37:15 2014 +0200
@@ -27,7 +27,6 @@
  * @summary Please add annotation <at>Deprecated to supplant the javadoc tag
  * @author gafter
  *
- * @compile      -source 1.4 -Xlint:-options -Xlint:dep-ann -Werror Dep.java
  * @compile/fail                             -Xlint:dep-ann -Werror Dep.java
  * @compile                                  -Xlint:dep-ann         Dep.java
  */
--- a/langtools/test/tools/javac/annotations/neg/MixedSource.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 5036565
- * @summary Annotations definitions are allowed using -source 1.4 but not annotations
- * @author gafter
- *
- * @compile/fail -source 1.4 MixedSource.java
- */
-
-package mixed.source;
-
-@interface foo {}
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/ClassfileTestHelper.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/ClassfileTestHelper.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,7 +49,7 @@
 
     File compile(File f) {
         int rc = com.sun.tools.javac.Main.compile(new String[] {
-                "-source", "1.8", "-g", f.getPath() });
+                "-g", f.getPath() });
         if (rc != 0)
             throw new Error("compilation failed. rc=" + rc);
         String path = f.getPath();
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/NoTargetAnnotations.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/NoTargetAnnotations.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -146,7 +146,7 @@
     }
 
     File compileTestFile(File f) {
-        int rc = com.sun.tools.javac.Main.compile(new String[] { "-XDTA:writer", "-source", "1.8", "-g", f.getPath() });
+        int rc = com.sun.tools.javac.Main.compile(new String[] { "-XDTA:writer", "-g", f.getPath() });
         if (rc != 0)
             throw new Error("compilation failed. rc=" + rc);
         String path = f.getPath();
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Driver.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Driver.java	Tue Apr 01 15:37:15 2014 +0200
@@ -180,7 +180,6 @@
 
     protected File compileTestFile(File f, String testClass, String... extraParams) {
         List<String> options = new ArrayList<>();
-        options.addAll(Arrays.asList("-source", "1.8"));
         options.addAll(Arrays.asList(extraParams));
         options.add(f.getPath());
         int rc = com.sun.tools.javac.Main.compile(options.toArray(new String[options.size()]));
--- a/langtools/test/tools/javac/api/T6265137.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/api/T6265137.java	Tue Apr 01 15:37:15 2014 +0200
@@ -49,6 +49,6 @@
         String srcdir = System.getProperty("test.src");
         Iterable<? extends JavaFileObject> files =
             fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(srcdir, "T6265137a.java")));
-        javac.getTask(null, fm, dl, Arrays.asList("-target","1.5"), null, files).call();
+        javac.getTask(null, fm, dl, Arrays.asList("-target","9"), null, files).call();
     }
 }
--- a/langtools/test/tools/javac/boxing/NoBoxingBool.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 6177400
- * @summary Boxing allowed with -source 1.4
- * @author Peter von der Ah\u00e9
- * @compile/fail -source 1.4 NoBoxingBool.java
- */
-
-public class NoBoxingBool {
-    Boolean b = false;
-}
--- a/langtools/test/tools/javac/boxing/NoBoxingByte.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 6177400
- * @summary Boxing allowed with -source 1.4
- * @author Peter von der Ah\u00e9
- * @compile/fail -source 1.4 NoBoxingByte.java
- */
-
-public class NoBoxingByte {
-    Byte b = 0;
-}
--- a/langtools/test/tools/javac/boxing/NoBoxingChar.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 6177400
- * @summary Boxing allowed with -source 1.4
- * @author Peter von der Ah\u00e9
- * @compile/fail -source 1.4 NoBoxingChar.java
- */
-
-public class NoBoxingChar {
-    Character c = '\u0000';
-}
--- a/langtools/test/tools/javac/boxing/NoBoxingDouble.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 6177400
- * @summary Boxing allowed with -source 1.4
- * @author Peter von der Ah\u00e9
- * @compile/fail -source 1.4 NoBoxingDouble.java
- */
-
-public class NoBoxingDouble {
-    Double d = 0D;
-}
--- a/langtools/test/tools/javac/boxing/NoBoxingFloat.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 6177400
- * @summary Boxing allowed with -source 1.4
- * @author Peter von der Ah\u00e9
- * @compile/fail -source 1.4 NoBoxingFloat.java
- */
-
-public class NoBoxingFloat {
-    Float f = 0F;
-}
--- a/langtools/test/tools/javac/boxing/NoBoxingInt.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 6177400
- * @summary Boxing allowed with -source 1.4
- * @author Peter von der Ah\u00e9
- * @compile/fail -source 1.4 NoBoxingInt.java
- */
-
-public class NoBoxingInt {
-    Integer i = 0;
-}
--- a/langtools/test/tools/javac/boxing/NoBoxingLong.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 6177400
- * @summary Boxing allowed with -source 1.4
- * @author Peter von der Ah\u00e9
- * @compile/fail -source 1.4 NoBoxingLong.java
- */
-
-public class NoBoxingLong {
-    Long l = 0L;
-}
--- a/langtools/test/tools/javac/boxing/NoBoxingShort.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 6177400
- * @summary Boxing allowed with -source 1.4
- * @author Peter von der Ah\u00e9
- * @compile/fail -source 1.4 NoBoxingShort.java
- */
-
-public class NoBoxingShort {
-    Short s = 0;
-}
--- a/langtools/test/tools/javac/classfiles/ClassVersionChecker.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/classfiles/ClassVersionChecker.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
 public class ClassVersionChecker {
 
     int errors;
-    String[] jdk = {"","1.2","1.3","1.4","1.5","1.6","1.7","1.8"};
+    String[] jdk = {"","1.6","1.7","1.8"};
     File javaFile = null;
 
     public static void main(String[] args) throws Throwable {
@@ -47,7 +47,7 @@
     void run() throws Exception {
         writeTestFile();
         /* Rules applicable for -source and -target combinations
-         * 1. If both empty, version num is for 1.7
+         * 1. If both empty, version num is for the current release
          * 2. If source is not empty and target is empty, version is based on source
          * 3. If both non-empty, version is based on target
          */
@@ -57,14 +57,10 @@
          * -1 => invalid combinations
          */
         int[][] ver =
-                {{52, -1, -1, -1, -1, -1, -1, -1},
-                 {48, 46, 47, 48, 49, 50, 51, 52},
-                 {48, 46, 47, 48, 49, 50, 51, 52},
-                 {48, -1, -1, 48, 49, 50, 51, 52},
-                 {52, -1, -1, -1, 49, 50, 51, 52},
-                 {52, -1, -1, -1, -1, 50, 51, 52},
-                 {52, -1, -1, -1, -1, -1, 51, 52},
-                 {52, -1, -1, -1, -1, -1, -1, 52}};
+                {{52, -1, -1, -1},
+                 {52, 50, 51, 52},
+                 {52, -1, 51, 52},
+                 {52, -1, -1, 52}};
 
         // Loop to run all possible combinations of source/target values
         for (int i = 0; i< ver.length; i++) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/InnerClasses/SyntheticClasses.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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.
+ */
+
+/** @test
+ *  @bug 8034854
+ *  @summary Verify that the InnerClasses attribute has outer_class_info_index zero if it has
+ *           inner_name_index zero (for synthetic classes)
+ *  @compile SyntheticClasses.java
+ *  @run main SyntheticClasses
+ */
+
+import java.io.*;
+import java.util.*;
+import com.sun.tools.classfile.*;
+
+public class SyntheticClasses {
+
+    public static void main(String[] args) throws IOException, ConstantPoolException {
+        new SyntheticClasses().run();
+    }
+
+    private void run() throws IOException, ConstantPoolException {
+        File testClasses = new File(System.getProperty("test.classes"));
+        for (File classFile : testClasses.listFiles()) {
+            ClassFile cf = ClassFile.read(classFile);
+            if (cf.getName().matches(".*\\$[0-9]+")) {
+                EnclosingMethod_attribute encl =
+                        (EnclosingMethod_attribute) cf.getAttribute(Attribute.EnclosingMethod);
+                if (encl != null) {
+                    if (encl.method_index != 0)
+                        throw new IllegalStateException("Invalid EnclosingMethod.method_index: " +
+                                                        encl.method_index + ".");
+                }
+            }
+            InnerClasses_attribute attr =
+                    (InnerClasses_attribute) cf.getAttribute(Attribute.InnerClasses);
+            if (attr != null) {
+                for (InnerClasses_attribute.Info info : attr.classes) {
+                    if (cf.major_version < 51)
+                        throw new IllegalStateException();
+                    if (info.inner_name_index == 0 && info.outer_class_info_index != 0)
+                        throw new IllegalStateException("Invalid outer_class_info_index=" +
+                                                        info.outer_class_info_index +
+                                                        "; inner_name_index=" +
+                                                        info.inner_name_index + ".");
+                }
+            }
+        }
+    }
+}
+
+class SyntheticConstructorAccessTag {
+
+    private static class A {
+        private A(){}
+    }
+
+    public void test() {
+        new A();
+    }
+}
+
+class SyntheticEnumMapping {
+    private int convert(E e) {
+        switch (e) {
+            case A: return 0;
+            default: return -1;
+        }
+    }
+    enum E { A }
+}
+
+interface SyntheticAssertionsDisabled {
+    public default void test() {
+        assert false;
+    }
+}
--- a/langtools/test/tools/javac/enum/6384542/T6384542.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/**
- * @test  /nodynamiccopyright/
- * @bug     6384542
- * @summary crash: test/tools/javac/versions/check.sh
- * @author  Peter von der Ah\u00e9
- * @compile/fail -source 1.4 -Xlint:-options T6384542.java
- * @compile/fail/ref=T6384542.out -source 1.4 -Xlint:-options -XDrawDiagnostics T6384542.java
- */
-
-import static java.lang.Math.sin;
-
-public enum A { }
-class B {
-    int i = 0xCafe.BabeP1;
-    List<X> l;
-    public static void main(String... args) {
-        for (String arg : args) {
-            System.out.println(arg);
-        }
-    }
-    @Override
-    public String toString() { return null; }
-}
-public klass C { }
--- a/langtools/test/tools/javac/enum/6384542/T6384542.out	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-T6384542.java:10:8: compiler.err.static.import.not.supported.in.source: 1.4
-T6384542.java:12:8: compiler.err.enums.not.supported.in.source: 1.4
-T6384542.java:14:13: compiler.err.unsupported.fp.lit: 1.4
-T6384542.java:15:9: compiler.err.generics.not.supported.in.source: 1.4
-T6384542.java:16:35: compiler.err.varargs.not.supported.in.source: 1.4
-T6384542.java:17:25: compiler.err.foreach.not.supported.in.source: 1.4
-T6384542.java:21:6: compiler.err.annotations.not.supported.in.source: 1.4
-T6384542.java:24:8: compiler.err.expected3: class, interface, enum
-8 errors
--- a/langtools/test/tools/javac/enum/6384542/T6384542a.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-/**
- * @test  /nodynamiccopyright/
- * @bug     6384542
- * @summary crash: test/tools/javac/versions/check.sh
- * @author  Peter von der Ah\u00e9
- * @compile/fail -source 5   T6384542a.java
- * @compile      -source 1.4 T6384542a.java
- * @compile/fail/ref=T6384542a_5.out -source 5   -Xlint:-options -XDrawDiagnostics T6384542a.java
- * @compile/ref=T6384542a_1_4.out    -source 1.4 -Xlint:-options -XDrawDiagnostics T6384542a.java
- */
-
-public class T6384542a {
-    T6384542a enum = null;
-}
--- a/langtools/test/tools/javac/enum/6384542/T6384542a_1_4.out	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-T6384542a.java:13:15: compiler.warn.enum.as.identifier
-1 warning
--- a/langtools/test/tools/javac/enum/6384542/T6384542a_5.out	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-T6384542a.java:13:15: compiler.err.enum.as.identifier
-1 error
--- a/langtools/test/tools/javac/enum/EnumAsIdentifier.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/enum/EnumAsIdentifier.java	Tue Apr 01 15:37:15 2014 +0200
@@ -3,8 +3,6 @@
  * @bug     8025537
  * @author  sogoel
  * @summary enum keyword used as an identifier
- * @compile/ref=EnumAsIdentifier4.out -XDrawDiagnostics -source 1.4 EnumAsIdentifier.java
- * @compile/fail/ref=EnumAsIdentifier5.out -XDrawDiagnostics -source 1.5 EnumAsIdentifier.java
  * @compile/fail/ref=EnumAsIdentifier.out -XDrawDiagnostics EnumAsIdentifier.java
  */
 
--- a/langtools/test/tools/javac/enum/EnumAsIdentifier.out	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/enum/EnumAsIdentifier.out	Tue Apr 01 15:37:15 2014 +0200
@@ -1,2 +1,2 @@
-EnumAsIdentifier.java:13:9: compiler.err.enum.as.identifier
+EnumAsIdentifier.java:11:9: compiler.err.enum.as.identifier
 1 error
--- a/langtools/test/tools/javac/enum/EnumAsIdentifier4.out	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-- compiler.warn.source.no.bootclasspath: 1.4
-- compiler.warn.option.obsolete.source: 1.4
-- compiler.warn.option.obsolete.target: 1.4
-- compiler.warn.option.obsolete.suppression
-EnumAsIdentifier.java:13:9: compiler.warn.enum.as.identifier
-5 warnings
--- a/langtools/test/tools/javac/enum/EnumAsIdentifier5.out	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-- compiler.warn.source.no.bootclasspath: 1.5
-- compiler.warn.option.obsolete.source: 1.5
-- compiler.warn.option.obsolete.suppression
-EnumAsIdentifier.java:13:9: compiler.err.enum.as.identifier
-1 error
-3 warnings
--- a/langtools/test/tools/javac/enum/FauxEnum2.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 5009574
- * @summary verify java.lang.Enum can't be directly subclassed
- * @author Joseph D. Darcy
- *
- * @compile/fail -source 1.4 FauxEnum2.java
- */
-
-public class FauxEnum2 extends java.lang.Enum {
-    FauxEnum2() {
-        super("", 0);
-    }
-}
--- a/langtools/test/tools/javac/foreach/T6682380.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 6682380 6679509
- * @summary Foreach loop with generics inside finally block crashes javac with -target 1.5
- * @author Jan Lahoda, Maurizio Cimadamore
- * @compile -source 1.5 -target 1.5 T6682380.java
- */
-
-import java.util.List;
-
-public class T6682380<X> {
-
-    public static void main(String[] args) {
-        try {
-        } finally {
-            List<T6682380<?>> l = null;
-            T6682380<?>[] a = null;
-            for (T6682380<?> e1 : l);
-            for (T6682380<?> e2 : a);
-        }
-    }
-}
--- a/langtools/test/tools/javac/generics/BridgeRestype.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 4902704
- * @summary javac generates inappropriate bridge methods in -source 1.4
- * @author gafter
- *
- * @compile -source 1.4 -target 1.4 BridgeRestype.java
- * @run main BridgeRestype
- */
-
-import java.util.*;
-
-public class BridgeRestype extends Vector {
-    public static void main(String[] args) {
-        BridgeRestype t = new BridgeRestype();
-        for (int i=0; i<args.length; i++) t.add(args[i]);
-        Iterator i = t.iterator();
-    }
-}
--- a/langtools/test/tools/javac/generics/RefEqual.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/generics/RefEqual.java	Tue Apr 01 15:37:15 2014 +0200
@@ -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,7 +27,6 @@
  * @summary casting conversion checks changed for covariant returns
  * @author gafter
  *
- * @compile -source 1.4 RefEqual.java
  * @compile/fail  RefEqual.java
  */
 
--- a/langtools/test/tools/javac/generics/T5094318.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/generics/T5094318.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,8 +26,6 @@
  * @bug 5094318
  * @summary REGRESSION: Array cloning is not backwards compatible
  *
- * @compile -source 1.4 T5094318.java
- * @run main T5094318
  * @compile  T5094318.java
  * @run main/fail T5094318
  */
--- a/langtools/test/tools/javac/generics/compat/CovariantCompat1.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 4836051
- * @summary generics: non-generic code should be able to call covariant method
- * @author gafter
- *
- * @compile  CovariantCompat1.java
- * @compile -source 1.4 CovariantCompat2.java
- */
-
-class CovariantCompat1 {
-    static class A {
-        public A foo() { return this; }
-    }
-    static class B extends A {
-        public B foo() { return this; }
-    }
-}
--- a/langtools/test/tools/javac/generics/compat/CovariantCompat2.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-class CovariantCompat2 {
-    static {
-        CovariantCompat1.B x = new CovariantCompat1.B();
-        CovariantCompat1.B o = x.foo();
-    }
-}
--- a/langtools/test/tools/javac/generics/compat/OverrideBridge1.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 4836048 4868021 5030040 5052968 5056864
- * @summary generics: compiler allows 1.4 code to override a bridge method
- * @author gafter
- *
- * @compile  OverrideBridge1.java
- * @compile/fail -Werror -source 1.4 OverrideBridge2.java
- * @compile -source 1.4 OverrideBridge2.java
- * @compile  OverrideBridge3.java
- */
-
-// ALLOW users to override bridge methods.
-
-// Note the long list of bug numbers on this regression test.  They
-// indicate the number of times we've flip-flopped on this issue.
-// 5030040 shows why we must give a diagnostic.  5052968 shows why it
-// must be a warning.
-
-class OverrideBridge1 {
-    static class A<T> {
-        public void foo(T t) { }
-    }
-    static class B extends A<String> {
-        public void foo(String t) { }
-    }
-}
--- a/langtools/test/tools/javac/generics/compat/OverrideBridge2.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-class OverrideBridge2 {
-    static class B extends OverrideBridge1.B {
-        public void foo(Object o) { }
-    }
-}
--- a/langtools/test/tools/javac/generics/compat/OverrideBridge3.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-class OverrideBridge3 {
-    static class C extends OverrideBridge2.B {
-    }
-}
--- a/langtools/test/tools/javac/generics/compat/VisibleBridge.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 4830291
- * @summary javac makes String non-backward compatible
- * @author gafter
- *
- * @compile -source 1.4 VisibleBridge.java
- */
-
-// Ensure that bridge methods are visible for maximum
-// backward compatibility.
-
-class VisibleBridge {
-    static {
-        Object o = "b";
-        if ("a".compareTo(o) > 0) {}
-    }
-}
--- a/langtools/test/tools/javac/limits/FinallyNesting.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 4739388
- * @summary regression: javac generates too much bytecode for deply nested try-finally
- * @author gafter
- *
- * @compile -source 1.4 -target 1.4 FinallyNesting.java
- */
-// Source and target 1.4 are needed for the test to pass with default memory sizes.
-class FinallyNesting {
-    public static void main(String[] args) {
-        int x;
-        try { x = 1; } finally {
-        try { x = 1; } finally {
-        try { x = 1; } finally {
-        try { x = 1; } finally {
-        try { x = 1; } finally {
-        try { x = 1; } finally {
-        try { x = 1; } finally {
-        try { x = 1; } finally {
-        try { x = 1; } finally {
-        try { x = 1; } finally {
-        try { x = 1; } finally {
-        try { x = 1; } finally {
-        try { x = 1; } finally {
-        try { x = 1; } finally {
-        try { x = 1; } finally {
-            x = 2;
-        }
-        }
-        }
-        }
-        }
-        }
-        }
-        }
-        }
-        }
-        }
-        }
-        }
-        }
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/linenumbers/ConditionalLineNumberTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,80 @@
+/*
+ * 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 8034091
+ * @summary Add LineNumberTable attributes for conditional operator (?:) split across several lines.
+ */
+
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Method;
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.LineNumberTable_attribute;
+import com.sun.tools.classfile.LineNumberTable_attribute.Entry;
+
+import java.io.File;
+import java.io.IOException;
+
+public class ConditionalLineNumberTest {
+    public static void main(String[] args) throws Exception {
+        // check that we have 5 consecutive entries for method()
+        Entry[] lines = findEntries();
+        if (lines == null || lines.length != 5)
+            throw new Exception("conditional line number table incorrect");
+
+        int current = lines[0].line_number;
+        for (Entry e : lines) {
+            if (e.line_number != current)
+                throw new Exception("conditional line number table incorrect");
+            current++;
+        }
+   }
+
+    static Entry[] findEntries() throws IOException, ConstantPoolException {
+        ClassFile self = ClassFile.read(ConditionalLineNumberTest.class.getResourceAsStream("ConditionalLineNumberTest.class"));
+        for (Method m : self.methods) {
+            if ("method".equals(m.getName(self.constant_pool))) {
+                Code_attribute code_attribute = (Code_attribute)m.attributes.get(Attribute.Code);
+                for (Attribute at : code_attribute.attributes) {
+                    if (Attribute.LineNumberTable.equals(at.getName(self.constant_pool))) {
+                        return ((LineNumberTable_attribute)at).line_number_table;
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
+    // This method should get one LineNumberTable entry per line
+    // in the method body.
+    public static String method(int field) {
+        String s = field % 2 == 0 ?
+            (field == 0 ? "false"
+             : "true" + field) : //Breakpoint
+            "false" + field; //Breakpoint
+        return s;
+    }
+}
--- a/langtools/test/tools/javac/meth/InvokeMH.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/meth/InvokeMH.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
  * @summary Generate call sites for method handle
  * @author jrose
  *
- * @compile -source 7 -target 7 -XDallowTransitionalJSR292=no InvokeMH.java
+ * @compile InvokeMH.java
  */
 
 /*
--- a/langtools/test/tools/javac/miranda/T4711325.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/miranda/T4711325.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2004, 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
@@ -28,7 +28,6 @@
  * @author gafter
  *
  * @compile                  T4711325.java
- * @compile/fail -source 1.4 T4711325.java
  */
 
 interface A {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/missingSuperRecovery/MissingInterfaceTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,15 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8036007
+ * @summary javac crashes when encountering an unresolvable interface
+ * @build MissingInterfaceTestDep
+ * @clean Closeable
+ * @compile/fail/ref=MissingInterfaceTest.out -XDrawDiagnostics MissingInterfaceTest.java
+ */
+
+public class MissingInterfaceTest {
+    void test(MissingInterfaceTestDep s) {
+        s.call();
+        s.another();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/missingSuperRecovery/MissingInterfaceTest.out	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,3 @@
+MissingInterfaceTest.java:12:10: compiler.err.cant.access: Closeable, (compiler.misc.class.file.not.found: Closeable)
+MissingInterfaceTest.java:13:10: compiler.err.cant.resolve.location.args: kindname.method, another, , , (compiler.misc.location.1: kindname.variable, s, MissingInterfaceTestDep)
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/missingSuperRecovery/MissingInterfaceTestDep.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public class MissingInterfaceTestDep implements Intermediate {}
+interface Intermediate extends Closeable { }
+interface Closeable {}
--- a/langtools/test/tools/javac/parser/T4910483.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/parser/T4910483.java	Tue Apr 01 15:37:15 2014 +0200
@@ -21,10 +21,10 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug     4910483
- * @summary javac shouldn't throw NPE while compiling invalid RuntimeInvisibleParameterAnnotations
+ * @summary Javadoc renders the string ".*\\.pdf" as ".\*\.pdf"
  * @run main T4910483
  */
 
--- a/langtools/test/tools/javac/proprietary/WarnClass.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/proprietary/WarnClass.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,6 @@
  * @author  Peter von der Ah\u00e9
  * @compile WarnClass.java
  * @compile/fail -Werror WarnClass.java
- * @compile/fail -Werror -source 1.4 -nowarn WarnClass.java
  * @compile/fail -Werror -nowarn WarnClass.java
  * @compile/fail -Werror -Xlint:none WarnClass.java
  */
--- a/langtools/test/tools/javac/proprietary/WarnImport.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/proprietary/WarnImport.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,6 @@
  * @author  Peter von der Ah\u00e9
  * @compile WarnImport.java
  * @compile/fail -Werror WarnImport.java
- * @compile/fail -Werror -source 1.4 -nowarn WarnImport.java
  * @compile/fail -Werror -nowarn WarnImport.java
  * @compile/fail -Werror -Xlint:none WarnImport.java
  */
--- a/langtools/test/tools/javac/proprietary/WarnMethod.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/proprietary/WarnMethod.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,6 @@
  * @author  Peter von der Ah\u00e9
  * @compile WarnMethod.java
  * @compile/fail -Werror WarnMethod.java
- * @compile/fail -Werror -source 1.4 -nowarn WarnMethod.java
  * @compile/fail -Werror -nowarn WarnMethod.java
  * @compile/fail -Werror -Xlint:none WarnMethod.java
  */
--- a/langtools/test/tools/javac/proprietary/WarnStaticImport.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/proprietary/WarnStaticImport.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,6 @@
  * @author  Peter von der Ah\u00e9
  * @compile WarnStaticImport.java
  * @compile/fail -Werror WarnStaticImport.java
- * @compile/fail -Werror -source 1.4 -nowarn WarnStaticImport.java
  * @compile/fail -Werror -nowarn WarnStaticImport.java
  * @compile/fail -Werror -Xlint:none WarnStaticImport.java
  */
--- a/langtools/test/tools/javac/proprietary/WarnVariable.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/proprietary/WarnVariable.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,6 @@
  * @author  Peter von der Ah\u00e9
  * @compile WarnVariable.java
  * @compile/fail -Werror WarnVariable.java
- * @compile/fail -Werror -source 1.4 -nowarn WarnVariable.java
  * @compile/fail -Werror -nowarn WarnVariable.java
  * @compile/fail -Werror -Xlint:none WarnVariable.java
  */
--- a/langtools/test/tools/javac/proprietary/WarnWildcard.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/proprietary/WarnWildcard.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,6 @@
  * @author  Peter von der Ah\u00e9
  * @compile WarnWildcard.java
  * @compile/fail -Werror WarnWildcard.java
- * @compile/fail -Werror -source 1.4 -nowarn WarnWildcard.java
  * @compile/fail -Werror -nowarn WarnWildcard.java
  * @compile/fail -Werror -Xlint:none WarnWildcard.java
  */
--- a/langtools/test/tools/javac/types/CastObjectToPrimitiveTest.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/types/CastObjectToPrimitiveTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -25,7 +25,6 @@
  * @test
  * @bug 7038363
  * @summary cast from object to primitive should be for source >= 1.7
- * @compile/fail/ref=CastObjectToPrimitiveTest.out -XDrawDiagnostics -Xlint:-options -source 5 CastObjectToPrimitiveTest.java
  * @compile/fail/ref=CastObjectToPrimitiveTest.out -XDrawDiagnostics -Xlint:-options -source 6 CastObjectToPrimitiveTest.java
  * @compile CastObjectToPrimitiveTest.java
  */
--- a/langtools/test/tools/javac/types/CastObjectToPrimitiveTest.out	Tue Apr 01 07:46:51 2014 +0200
+++ b/langtools/test/tools/javac/types/CastObjectToPrimitiveTest.out	Tue Apr 01 15:37:15 2014 +0200
@@ -1,2 +1,2 @@
-CastObjectToPrimitiveTest.java:36:23: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Object, int)
+CastObjectToPrimitiveTest.java:35:23: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Object, int)
 1 error
--- a/make/common/JavaCompilation.gmk	Tue Apr 01 07:46:51 2014 +0200
+++ b/make/common/JavaCompilation.gmk	Tue Apr 01 15:37:15 2014 +0200
@@ -143,6 +143,9 @@
   ifneq (,$2)
     $1_DEPS:=$2
   else
+    # Add all source roots to the find cache since we are likely going to run find 
+    # on these more than once. The cache will only be updated if necessary.
+    $$(eval $$(call FillCacheFind, $$($1_FIND_LIST)))
     $1_DEPS:=$$(filter $$(addprefix %,$$($1_SUFFIXES)), \
         $$(call CacheFind,$$($1_SRCS)))
     ifneq (,$$($1_GREP_INCLUDE_PATTERNS))
@@ -158,6 +161,10 @@
       $1_DEPS+=$$(call CacheFind,$$(wildcard $$(addsuffix /META-INF,$$($1_SRCS))))
     endif
   endif
+  # The dependency list should never be empty
+  ifeq ($$(strip $$($1_DEPS)), )
+    $$(warning No dependencies found for $1)
+  endif
 
   # Utility macros, to make the shell script receipt somewhat easier to decipher.
 
@@ -336,7 +343,20 @@
 # Previously this was inconsistently done in different repositories.
 # This is the new clean standard. Though it is to be superseded by
 # a standard annotation processor from with sjavac.
-define add_file_to_copy_and_clean
+#
+# The sed expression does this:
+# 1. Add a backslash before any :, = or ! that do not have a backslash already.
+# 2. Apply the file unicode2x.sed which does a whole bunch of \u00XX to \xXX 
+#    conversions.
+# 3. Delete all lines starting with #.
+# 4. Delete empty lines.
+# 5. Append lines ending with \ with the next line.
+# 6. Remove leading and trailing white space.
+# 7. Replace the first \= with just =.
+# 8. Finally it's all sorted to create a stable output.
+# 
+# It is assumed that = is the character used for separating names and values.
+define add_file_to_clean
   # param 1 = BUILD_MYPACKAGE
   # parma 2 = The source file to copy and clean.
   $2_TARGET:=$2
@@ -345,12 +365,13 @@
   # Now we can setup the depency that will trigger the copying.
   $$($1_BIN)$$($2_TARGET) : $2
 	$(MKDIR) -p $$(@D)
-	$(CAT) $$< | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
+	$(CAT) $$< | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' \
+	        -e 's/\([^\\]\)!/\1\\!/g' -e 's/#.*/#/g' \
 	    | $(SED) -f "$(SRC_ROOT)/make/common/support/unicode2x.sed" \
 	    | $(SED) -e '/^#/d' -e '/^$$$$/d' \
 	        -e :a -e '/\\$$$$/N; s/\\\n//; ta' \
 	        -e 's/^[ \t]*//;s/[ \t]*$$$$//' \
-	        -e 's/\\=/=/' | LANG=C $(SORT) > $$@
+	        -e 's/\\=/=/' | LC_ALL=C $(SORT) > $$@
 	$(CHMOD) -f ug+w $$@
 
   # And do not forget this target
@@ -376,8 +397,9 @@
   #   INCLUDES:=myapp.foo means will only compile java files in myapp.foo or any of its sub-packages.
   #   EXCLUDES:=myapp.foo means will do not compile java files in myapp.foo or any of its sub-packages.
   #   COPY:=.prp means copy all prp files to the corresponding package in BIN.
+  #   COPY_FILES:=myapp/foo/setting.txt means copy this file over to the package myapp/foo
   #   CLEAN:=.properties means copy and clean all properties file to the corresponding package in BIN.
-  #   COPY_FILES:=myapp/foo/setting.txt means copy this file over to the package myapp/foo
+  #   CLEAN_FILES:=myapp/foo/setting.txt means clean this file over to the package myapp/foo
   #   SRCZIP:=Create a src.zip based on the found sources and copied files.
   #   INCLUDE_FILES:="com/sun/SolarisFoobar.java" means only compile this file!
   #   EXCLUDE_FILES:="com/sun/SolarisFoobar.java" means do not compile this particular file!
@@ -405,6 +427,9 @@
   # Make sure the dirs exist.
   $$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupJavaCompilation $1 contains missing directory $$d)))
   $$(eval $$(call MakeDir,$$($1_BIN)))
+  # Add all source roots to the find cache since we are likely going to run find 
+  # on these more than once. The cache will only be updated if necessary.
+  $$(eval $$(call FillCacheFind,$$($1_SRC)))
   # Find all files in the source trees.
   $1_ALL_SRCS += $$(filter-out $(OVR_SRCS),$$(call CacheFind,$$($1_SRC)))
   # Extract the java files.
@@ -437,7 +462,7 @@
   endif
 
   # Find all files to be copied from source to bin.
-  ifneq (,$$($1_COPY))
+  ifneq (,$$($1_COPY)$$($1_COPY_FILES))
     # Search for all files to be copied.
     $1_ALL_COPIES := $$(filter $$(addprefix %,$$($1_COPY)),$$($1_ALL_SRCS))
     # Copy these explicitly
@@ -452,20 +477,22 @@
     ifneq (,$$($1_EXCLUDE_FILES))
       $1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_COPIES))
     endif
-    # All files below META-INF are always copied.
-    $1_ALL_COPIES += $$(filter $$(addsuffix /META-INF%,$$($1_SRC)),$$($1_ALL_SRCS))
-    ifneq (,$$($1_ALL_COPIES))
-      # Yep, there are files to be copied!
-      $1_ALL_COPY_TARGETS:=
-          $$(foreach i,$$($1_ALL_COPIES),$$(eval $$(call add_file_to_copy,$1,$$i)))
-      # Now we can depend on $$($1_ALL_COPY_TARGETS) to copy all files!
-    endif
+  endif
+  # All files below META-INF are always copied.
+  $1_ALL_COPIES += $$(filter $$(addsuffix /META-INF%,$$($1_SRC)),$$($1_ALL_SRCS))
+  ifneq (,$$($1_ALL_COPIES))
+    # Yep, there are files to be copied!
+    $1_ALL_COPY_TARGETS:=
+        $$(foreach i,$$($1_ALL_COPIES),$$(eval $$(call add_file_to_copy,$1,$$i)))
+    # Now we can depend on $$($1_ALL_COPY_TARGETS) to copy all files!
   endif
 
   # Find all property files to be copied and cleaned from source to bin.
-  ifneq (,$$($1_CLEAN))
+  ifneq (,$$($1_CLEAN)$$($1_CLEAN_FILES))
     # Search for all files to be copied.
     $1_ALL_CLEANS := $$(filter $$(addprefix %,$$($1_CLEAN)),$$($1_ALL_SRCS))
+    # Clean these explicitly
+    $1_ALL_CLEANS += $$($1_CLEAN_FILES)
     # Copy and clean must also respect filters.
     ifneq (,$$($1_INCLUDES))
       $1_ALL_CLEANS := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_CLEANS))
@@ -479,7 +506,7 @@
     ifneq (,$$($1_ALL_CLEANS))
       # Yep, there are files to be copied and cleaned!
       $1_ALL_COPY_CLEAN_TARGETS:=
-          $$(foreach i,$$($1_ALL_CLEANS),$$(eval $$(call add_file_to_copy_and_clean,$1,$$i)))
+          $$(foreach i,$$($1_ALL_CLEANS),$$(eval $$(call add_file_to_clean,$1,$$i)))
       # Now we can depend on $$($1_ALL_COPY_CLEAN_TARGETS) to copy all files!
     endif
   endif
--- a/make/common/MakeBase.gmk	Tue Apr 01 07:46:51 2014 +0200
+++ b/make/common/MakeBase.gmk	Tue Apr 01 15:37:15 2014 +0200
@@ -380,11 +380,23 @@
   # On Solaris, if the target is a symlink and exists, cp won't overwrite.
   # Cp has to operate in recursive mode to allow for -P flag, to preserve soft links. If the
   # name of the target file differs from the source file, rename after copy.
+  # If the source and target parent directories are the same, recursive copy doesn't work
+  # so we fall back on regular copy, which isn't preserving symlinks.
   define install-file
 	$(MKDIR) -p $(@D)
 	$(RM) '$@'
-	$(CP) -f -r -P '$<' '$(@D)'
-	if [ "$(@F)" != "$(<F)" ]; then $(MV) '$(@D)/$(<F)' '$@'; fi
+	if [ "$(@D)" != "$(<D)" ]; then \
+	  $(CP) -f -r -P '$<' '$(@D)'; \
+	  if [ "$(@F)" != "$(<F)" ]; then \
+	    $(MV) '$(@D)/$(<F)' '$@'; \
+	  fi; \
+	else \
+	  if [ -L '$<' ]; then \
+	    $(ECHO) "Source file is a symlink and target is in the same directory: $< $@" ; \
+	    exit 1; \
+	  fi; \
+	  $(CP) -f '$<' '$@'; \
+	fi
   endef
 else ifeq ($(OPENJDK_TARGET_OS),macosx)
   # On mac, extended attributes sometimes creep into the source files, which may later
@@ -408,6 +420,7 @@
 containing = $(foreach v,$2,$(if $(findstring $1,$v),$v))
 not-containing = $(foreach v,$2,$(if $(findstring $1,$v),,$v))
 
+ifneq ($(DISABLE_CACHE_FIND), true)
 ################################################################################
 # In Cygwin, finds are very costly, both because of expensive forks and because
 # of bad file system caching. Find is used extensively in $(shell) commands to
@@ -421,16 +434,23 @@
 #
 # Needs to be called with $(eval )
 #
+  # Even if the performance benifit is negligible on other platforms, keep the
+  # functionality active unless explicitly disabled to exercise it more.
+  #
+  # Initialize FIND_CACHE_DIRS with := to make it a non recursively-expanded variable
+  FIND_CACHE_DIRS :=
 # Param 1 - Dir to find in
-ifeq ($(OPENJDK_BUILD_OS),windows)
   define FillCacheFind
-    FIND_CACHE_DIR += $1
-    FIND_CACHE := $$(sort $$(FIND_CACHE) $$(shell $(FIND) $1 -type f -o -type l))
+    # Filter out already cached dirs. The - is needed when FIND_CACHE_DIR is empty
+    # since filter out will then return empty.
+    FIND_CACHE_NEW_DIRS := $$(filter-out $$(addsuffix /%,\
+        - $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS), $1)
+    ifneq ($$(FIND_CACHE_NEW_DIRS), )
+      # Remove any trailing slash from dirs in the cache dir list
+      FIND_CACHE_DIRS += $$(patsubst %/,%, $$(FIND_CACHE_NEW_DIRS))
+      FIND_CACHE := $$(sort $$(FIND_CACHE) $$(shell $(FIND) $$(FIND_CACHE_NEW_DIRS) -type f -o -type l))
+    endif
   endef
-else
-  define FillCacheFind
-  endef
-endif
 
 # Mimics find by looking in the cache if all of the directories have been cached.
 # Otherwise reverts to shell find. This is safe to call on all platforms, even if
@@ -439,10 +459,16 @@
 # The extra - is needed when FIND_CACHE_DIR is empty but should be harmless.
 # Param 1 - Dirs to find in
 define CacheFind
-  $(if $(filter-out $(addsuffix %,- $(FIND_CACHE_DIR)),$1), \
+    $(if $(filter-out $(addsuffix /%,- $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS),$1), \
     $(shell $(FIND) $1 -type f -o -type l), \
     $(filter $(addsuffix %,$1),$(FIND_CACHE)))
 endef
+else
+  # If CacheFind is disabled, just run the find command.
+  define CacheFind
+    $(shell $(FIND) $1 -type f -o -type l)
+  endef
+endif
 
 ################################################################################
 
--- a/nashorn/.hgtags	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/.hgtags	Tue Apr 01 15:37:15 2014 +0200
@@ -237,3 +237,5 @@
 65347535840f045f2cd4341d7466c51009b1b06f jdk9-b01
 b3517e51f40477f10db8bc30a557aa0ea712c274 jdk9-b02
 832f89ff25d903c45cfc994553f1ade8821a4398 jdk9-b03
+3f6ef92cd7823372c45e79125adba4cbf1c9f7b2 jdk9-b04
+2a1cac93c33317d828d4a5b81239204a9927cc4a jdk9-b05
--- a/nashorn/make/BuildNashorn.gmk	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/make/BuildNashorn.gmk	Tue Apr 01 15:37:15 2014 +0200
@@ -77,7 +77,7 @@
 	$(RM) -rf $(@D)/jdk $(@D)/netscape
 	$(CP) -R -p $(NASHORN_OUTPUTDIR)/nashorn_classes/* $(@D)/
 	$(FIXPATH) $(JAVA) \
-	    -cp "$(NASHORN_OUTPUTDIR)/nasgen_classes$(PATH_SEP)$(NASHORN_OUTPUTDIR)/nashorn_classes" \
+	    -Xbootclasspath/p:"$(NASHORN_OUTPUTDIR)/nasgen_classes$(PATH_SEP)$(NASHORN_OUTPUTDIR)/nashorn_classes" \
 	    jdk.nashorn.internal.tools.nasgen.Main $(@D) jdk.nashorn.internal.objects $(@D)
 	$(TOUCH) $@
 
--- a/nashorn/make/build.xml	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/make/build.xml	Tue Apr 01 15:37:15 2014 +0200
@@ -125,6 +125,7 @@
       <compilerarg value="-Xlint:unchecked"/>
       <compilerarg value="-Xlint:deprecation"/>
       <compilerarg value="-XDignore.symbol.file"/>
+      <compilerarg value="-Xdiags:verbose"/>
     </javac>
     <copy todir="${build.classes.dir}/META-INF/services">
        <fileset dir="${meta.inf.dir}/services/"/>
@@ -243,6 +244,7 @@
         <compilerarg value="-J-Djava.ext.dirs="/>
         <compilerarg value="-Xlint:unchecked"/>
         <compilerarg value="-Xlint:deprecation"/>
+        <compilerarg value="-Xdiags:verbose"/>
     </javac>
 
     <copy todir="${build.test.classes.dir}/META-INF/services">
@@ -253,6 +255,10 @@
        <fileset dir="${test.src.dir}/jdk/nashorn/internal/runtime/resources"/>
     </copy>
 
+    <copy todir="${build.test.classes.dir}/jdk/nashorn/api/scripting/resources">
+       <fileset dir="${test.src.dir}/jdk/nashorn/api/scripting/resources"/>
+    </copy>
+
     <!-- tests that check nashorn internals and internal API -->
     <jar jarfile="${nashorn.internal.tests.jar}">
       <fileset dir="${build.test.classes.dir}" excludes="**/api/**"/>
--- a/nashorn/make/project.properties	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/make/project.properties	Tue Apr 01 15:37:15 2014 +0200
@@ -206,7 +206,7 @@
 
 # test262 test frameworks
 test262-test-sys-prop.test.js.framework=\
-    --class-cache-size=0 \
+    --class-cache-size=10 \
     --no-java \
     --no-typed-arrays \
     -timezone=PST \
--- a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Tue Apr 01 15:37:15 2014 +0200
@@ -57,9 +57,9 @@
 import javax.script.ScriptEngineFactory;
 import javax.script.ScriptException;
 import javax.script.SimpleBindings;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ErrorManager;
-import jdk.nashorn.internal.runtime.GlobalObject;
 import jdk.nashorn.internal.runtime.Property;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
@@ -99,7 +99,7 @@
     private final boolean             _global_per_engine;
     // This is the initial default Nashorn global object.
     // This is used as "shared" global if above option is true.
-    private final ScriptObject        global;
+    private final Global              global;
     // initialized bit late to be made 'final'.
     // Property object for "context" property of global object.
     private volatile Property         contextProperty;
@@ -264,7 +264,7 @@
     public Object __noSuchProperty__(final Object self, final ScriptContext ctxt, final String name) {
         if (ctxt != null) {
             final int scope = ctxt.getAttributesScope(name);
-            final ScriptObject ctxtGlobal = getNashornGlobalFrom(ctxt);
+            final Global ctxtGlobal = getNashornGlobalFrom(ctxt);
             if (scope != -1) {
                 return ScriptObjectMirror.unwrap(ctxt.getAttribute(name, scope), ctxtGlobal);
             }
@@ -317,7 +317,7 @@
         }
 
         ScriptObject realSelf = null;
-        ScriptObject realGlobal = null;
+        Global realGlobal = null;
         if(thiz == null) {
             // making interface out of global functions
             realSelf = realGlobal = getNashornGlobalFrom(context);
@@ -346,7 +346,7 @@
         }
 
         try {
-            final ScriptObject oldGlobal = Context.getGlobal();
+            final Global oldGlobal = Context.getGlobal();
             final boolean globalChanged = (oldGlobal != realGlobal);
             try {
                 if (globalChanged) {
@@ -371,7 +371,7 @@
     }
 
     // Retrieve nashorn Global object for a given ScriptContext object
-    private ScriptObject getNashornGlobalFrom(final ScriptContext ctxt) {
+    private Global getNashornGlobalFrom(final ScriptContext ctxt) {
         if (_global_per_engine) {
             // shared single global object for all ENGINE_SCOPE Bindings
             return global;
@@ -380,18 +380,18 @@
         final Bindings bindings = ctxt.getBindings(ScriptContext.ENGINE_SCOPE);
         // is this Nashorn's own Bindings implementation?
         if (bindings instanceof ScriptObjectMirror) {
-            final ScriptObject sobj = globalFromMirror((ScriptObjectMirror)bindings);
-            if (sobj != null) {
-                return sobj;
+            final Global glob = globalFromMirror((ScriptObjectMirror)bindings);
+            if (glob != null) {
+                return glob;
             }
         }
 
         // Arbitrary user Bindings implementation. Look for NASHORN_GLOBAL in it!
         Object scope = bindings.get(NASHORN_GLOBAL);
         if (scope instanceof ScriptObjectMirror) {
-            final ScriptObject sobj = globalFromMirror((ScriptObjectMirror)scope);
-            if (sobj != null) {
-                return sobj;
+            final Global glob = globalFromMirror((ScriptObjectMirror)scope);
+            if (glob != null) {
+                return glob;
             }
         }
 
@@ -399,14 +399,14 @@
         // Create new global instance mirror and associate with the Bindings.
         final ScriptObjectMirror mirror = createGlobalMirror(ctxt);
         bindings.put(NASHORN_GLOBAL, mirror);
-        return mirror.getScriptObject();
+        return mirror.getHomeGlobal();
     }
 
     // Retrieve nashorn Global object from a given ScriptObjectMirror
-    private ScriptObject globalFromMirror(final ScriptObjectMirror mirror) {
+    private Global globalFromMirror(final ScriptObjectMirror mirror) {
         ScriptObject sobj = mirror.getScriptObject();
-        if (sobj instanceof GlobalObject && isOfContext(sobj, nashornContext)) {
-            return sobj;
+        if (sobj instanceof Global && isOfContext((Global)sobj, nashornContext)) {
+            return (Global)sobj;
         }
 
         return null;
@@ -414,15 +414,15 @@
 
     // Create a new ScriptObjectMirror wrapping a newly created Nashorn Global object
     private ScriptObjectMirror createGlobalMirror(final ScriptContext ctxt) {
-        final ScriptObject newGlobal = createNashornGlobal(ctxt);
+        final Global newGlobal = createNashornGlobal(ctxt);
         return new ScriptObjectMirror(newGlobal, newGlobal);
     }
 
     // Create a new Nashorn Global object
-    private ScriptObject createNashornGlobal(final ScriptContext ctxt) {
-        final ScriptObject newGlobal = AccessController.doPrivileged(new PrivilegedAction<ScriptObject>() {
+    private Global createNashornGlobal(final ScriptContext ctxt) {
+        final Global newGlobal = AccessController.doPrivileged(new PrivilegedAction<Global>() {
             @Override
-            public ScriptObject run() {
+            public Global run() {
                 try {
                     return nashornContext.newGlobal();
                 } catch (final RuntimeException e) {
@@ -460,7 +460,7 @@
     }
 
     // scripts should see "context" and "engine" as variables in the given global object
-    private void setContextVariables(final ScriptObject ctxtGlobal, final ScriptContext ctxt) {
+    private void setContextVariables(final Global ctxtGlobal, final ScriptContext ctxt) {
         // set "context" global variable via contextProperty - because this
         // property is non-writable
         contextProperty.setObjectValue(ctxtGlobal, ctxtGlobal, ctxt, false);
@@ -470,7 +470,7 @@
         }
         // if no arguments passed, expose it
         if (! (args instanceof ScriptObject)) {
-            args = ((GlobalObject)ctxtGlobal).wrapAsObject(args);
+            args = ctxtGlobal.wrapAsObject(args);
             ctxtGlobal.set("arguments", args, false);
         }
     }
@@ -478,7 +478,7 @@
     private Object invokeImpl(final Object selfObject, final String name, final Object... args) throws ScriptException, NoSuchMethodException {
         name.getClass(); // null check
 
-        ScriptObject invokeGlobal = null;
+        Global invokeGlobal = null;
         ScriptObjectMirror selfMirror = null;
         if (selfObject instanceof ScriptObjectMirror) {
             selfMirror = (ScriptObjectMirror)selfObject;
@@ -489,7 +489,7 @@
         } else if (selfObject instanceof ScriptObject) {
             // invokeMethod called from script code - in which case we may get 'naked' ScriptObject
             // Wrap it with oldGlobal to make a ScriptObjectMirror for the same.
-            final ScriptObject oldGlobal = Context.getGlobal();
+            final Global oldGlobal = Context.getGlobal();
             invokeGlobal = oldGlobal;
             if (oldGlobal == null) {
                 throw new IllegalArgumentException(getMessage("no.current.nashorn.global"));
@@ -502,7 +502,7 @@
             selfMirror = (ScriptObjectMirror)ScriptObjectMirror.wrap(selfObject, oldGlobal);
         } else if (selfObject == null) {
             // selfObject is null => global function call
-            final ScriptObject ctxtGlobal = getNashornGlobalFrom(context);
+            final Global ctxtGlobal = getNashornGlobalFrom(context);
             invokeGlobal = ctxtGlobal;
             selfMirror = (ScriptObjectMirror)ScriptObjectMirror.wrap(ctxtGlobal, ctxtGlobal);
         }
@@ -532,11 +532,11 @@
         return evalImpl(script, ctxt, getNashornGlobalFrom(ctxt));
     }
 
-    private Object evalImpl(final ScriptFunction script, final ScriptContext ctxt, final ScriptObject ctxtGlobal) throws ScriptException {
+    private Object evalImpl(final ScriptFunction script, final ScriptContext ctxt, final Global ctxtGlobal) throws ScriptException {
         if (script == null) {
             return null;
         }
-        final ScriptObject oldGlobal = Context.getGlobal();
+        final Global oldGlobal = Context.getGlobal();
         final boolean globalChanged = (oldGlobal != ctxtGlobal);
         try {
             if (globalChanged) {
@@ -558,7 +558,7 @@
         }
     }
 
-    private static void throwAsScriptException(final Exception e, final ScriptObject global) throws ScriptException {
+    private static void throwAsScriptException(final Exception e, final Global global) throws ScriptException {
         if (e instanceof ScriptException) {
             throw (ScriptException)e;
         } else if (e instanceof NashornException) {
@@ -582,7 +582,7 @@
         return new CompiledScript() {
             @Override
             public Object eval(final ScriptContext ctxt) throws ScriptException {
-                final ScriptObject globalObject = getNashornGlobalFrom(ctxt);
+                final Global globalObject = getNashornGlobalFrom(ctxt);
                 // Are we running the script in the correct global?
                 if (func.getScope() == globalObject) {
                     return evalImpl(func, ctxt, globalObject);
@@ -602,8 +602,8 @@
         return compileImpl(source, getNashornGlobalFrom(ctxt));
     }
 
-    private ScriptFunction compileImpl(final Source source, final ScriptObject newGlobal) throws ScriptException {
-        final ScriptObject oldGlobal = Context.getGlobal();
+    private ScriptFunction compileImpl(final Source source, final Global newGlobal) throws ScriptException {
+        final Global oldGlobal = Context.getGlobal();
         final boolean globalChanged = (oldGlobal != newGlobal);
         try {
             if (globalChanged) {
@@ -641,8 +641,7 @@
         return true;
     }
 
-    private static boolean isOfContext(final ScriptObject global, final Context context) {
-        assert global instanceof GlobalObject: "Not a Global object";
-        return ((GlobalObject)global).isOfContext(context);
+    private static boolean isOfContext(final Global global, final Context context) {
+        return global.isOfContext(context);
     }
 }
--- a/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Tue Apr 01 15:37:15 2014 +0200
@@ -42,10 +42,10 @@
 import java.util.Set;
 import java.util.concurrent.Callable;
 import javax.script.Bindings;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 import jdk.nashorn.internal.runtime.ConsString;
 import jdk.nashorn.internal.runtime.Context;
-import jdk.nashorn.internal.runtime.GlobalObject;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
@@ -64,7 +64,7 @@
     private static final AccessControlContext GET_CONTEXT_ACC_CTXT = getContextAccCtxt();
 
     private final ScriptObject sobj;
-    private final ScriptObject global;
+    private final Global  global;
     private final boolean strict;
 
     @Override
@@ -95,7 +95,7 @@
 
     @Override
     public Object call(final Object thiz, final Object... args) {
-        final ScriptObject oldGlobal = Context.getGlobal();
+        final Global oldGlobal = Context.getGlobal();
         final boolean globalChanged = (oldGlobal != global);
 
         try {
@@ -125,7 +125,7 @@
 
     @Override
     public Object newObject(final Object... args) {
-        final ScriptObject oldGlobal = Context.getGlobal();
+        final Global oldGlobal = Context.getGlobal();
         final boolean globalChanged = (oldGlobal != global);
 
         try {
@@ -171,7 +171,7 @@
 
     public Object callMember(final String functionName, final Object... args) {
         functionName.getClass(); // null check
-        final ScriptObject oldGlobal = Context.getGlobal();
+        final Global oldGlobal = Context.getGlobal();
         final boolean globalChanged = (oldGlobal != global);
 
         try {
@@ -642,7 +642,7 @@
      */
     public static Object wrap(final Object obj, final Object homeGlobal) {
         if(obj instanceof ScriptObject) {
-            return homeGlobal instanceof ScriptObject ? new ScriptObjectMirror((ScriptObject)obj, (ScriptObject)homeGlobal) : obj;
+            return homeGlobal instanceof Global ? new ScriptObjectMirror((ScriptObject)obj, (Global)homeGlobal) : obj;
         }
         if(obj instanceof ConsString) {
             return obj.toString();
@@ -710,13 +710,13 @@
 
     // package-privates below this.
 
-    ScriptObjectMirror(final ScriptObject sobj, final ScriptObject global) {
+    ScriptObjectMirror(final ScriptObject sobj, final Global global) {
         assert sobj != null : "ScriptObjectMirror on null!";
-        assert global instanceof GlobalObject : "global is not a GlobalObject";
+        assert global != null : "home Global is null";
 
         this.sobj = sobj;
         this.global = global;
-        this.strict = ((GlobalObject)global).isStrictContext();
+        this.strict = global.isStrictContext();
     }
 
     // accessors for script engine
@@ -724,7 +724,7 @@
         return sobj;
     }
 
-    ScriptObject getHomeGlobal() {
+    Global getHomeGlobal() {
         return global;
     }
 
@@ -734,7 +734,7 @@
 
     // internals only below this.
     private <V> V inGlobal(final Callable<V> callable) {
-        final ScriptObject oldGlobal = Context.getGlobal();
+        final Global oldGlobal = Context.getGlobal();
         final boolean globalChanged = (oldGlobal != global);
         if (globalChanged) {
             Context.setGlobal(global);
--- a/nashorn/src/jdk/nashorn/internal/codegen/Attr.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Attr.java	Tue Apr 01 15:37:15 2014 +0200
@@ -375,10 +375,11 @@
      * @return Symbol for given name or null for redefinition.
      */
     private Symbol defineSymbol(final Block block, final String name, final int symbolFlags) {
-        int    flags  = symbolFlags;
-        Symbol symbol = findSymbol(block, name); // Locate symbol.
+        int     flags    = symbolFlags;
+        Symbol  symbol   = findSymbol(block, name); // Locate symbol.
+        boolean isGlobal = (flags & KINDMASK) == IS_GLOBAL;
 
-        if ((flags & KINDMASK) == IS_GLOBAL) {
+        if (isGlobal) {
             flags |= IS_SCOPE;
         }
 
@@ -414,6 +415,8 @@
             // Determine where to create it.
             if ((flags & Symbol.KINDMASK) == IS_VAR && ((flags & IS_INTERNAL) == IS_INTERNAL || (flags & IS_LET) == IS_LET)) {
                 symbolBlock = block; //internal vars are always defined in the block closest to them
+            } else if (isGlobal) {
+                symbolBlock = lc.getOutermostFunction().getBody();
             } else {
                 symbolBlock = lc.getFunctionBody(function);
             }
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Tue Apr 01 15:37:15 2014 +0200
@@ -685,7 +685,7 @@
             private void scopeCall(final IdentNode node, final int flags) {
                 load(node, Type.OBJECT); // Type.OBJECT as foo() makes no sense if foo == 3
                 // ScriptFunction will see CALLSITE_SCOPE and will bind scope accordingly.
-                method.loadNull(); //the 'this'
+                method.loadUndefined(Type.OBJECT); //the 'this' object
                 method.dynamicCall(callNodeType, 2 + loadArgs(args), flags);
             }
 
@@ -818,7 +818,7 @@
             protected boolean enterDefault(final Node node) {
                 // Load up function.
                 load(function, Type.OBJECT); //TODO, e.g. booleans can be used as functions
-                method.loadNull(); // ScriptFunction will figure out the correct this when it sees CALLSITE_SCOPE
+                method.loadUndefined(Type.OBJECT); // ScriptFunction will figure out the correct this when it sees CALLSITE_SCOPE
                 method.dynamicCall(callNodeType, 2 + loadArgs(args), getCallSiteFlags() | CALLSITE_SCOPE);
 
                 return false;
--- a/nashorn/src/jdk/nashorn/internal/codegen/SharedScopeCall.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/codegen/SharedScopeCall.java	Tue Apr 01 15:37:15 2014 +0200
@@ -156,7 +156,7 @@
         if (isCall) {
             method.convert(Type.OBJECT);
             // ScriptFunction will see CALLSITE_SCOPE and will bind scope accordingly.
-            method.loadNull();
+            method.loadUndefined(Type.OBJECT);
             int slot = 2;
             for (final Type type : paramTypes) {
                 method.load(type, slot++);
--- a/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java	Tue Apr 01 15:37:15 2014 +0200
@@ -164,11 +164,11 @@
     public static final int HAS_EVAL                    = 1 << 5;
 
     /** Does a nested function contain eval? If it does, then all variables in this function might be get/set by it. */
-    public static final int HAS_NESTED_EVAL = 1 << 6;
+    public static final int HAS_NESTED_EVAL             = 1 << 6;
 
     /** Does this function have any blocks that create a scope? This is used to determine if the function needs to
      * have a local variable slot for the scope symbol. */
-    public static final int HAS_SCOPE_BLOCK = 1 << 7;
+    public static final int HAS_SCOPE_BLOCK             = 1 << 7;
 
     /**
      * Flag this function as one that defines the identifier "arguments" as a function parameter or nested function
@@ -197,6 +197,9 @@
     /** Can this function be specialized? */
     public static final int CAN_SPECIALIZE              = 1 << 14;
 
+    /** Does this function use the "this" keyword? */
+    public static final int USES_THIS                   = 1 << 15;
+
     /** Does this function or any nested functions contain an eval? */
     private static final int HAS_DEEP_EVAL = HAS_EVAL | HAS_NESTED_EVAL;
 
@@ -591,6 +594,15 @@
     }
 
     /**
+     * Return {@code true} if this function makes use of the {@code this} object.
+     *
+     * @return true if function uses {@code this} object
+     */
+    public boolean usesThis() {
+        return getFlag(USES_THIS);
+    }
+
+    /**
      * Get the identifier for this function, this is its symbol.
      * @return the identifier as an IdentityNode
      */
--- a/nashorn/src/jdk/nashorn/internal/objects/AccessorPropertyDescriptor.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/AccessorPropertyDescriptor.java	Tue Apr 01 15:37:15 2014 +0200
@@ -67,12 +67,8 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     AccessorPropertyDescriptor(final boolean configurable, final boolean enumerable, final Object get, final Object set, final Global global) {
-        super(global.getObjectPrototype(), getInitialMap());
+        super(global.getObjectPrototype(), $nasgenmap$);
         this.configurable = configurable;
         this.enumerable   = enumerable;
         this.get          = get;
--- a/nashorn/src/jdk/nashorn/internal/objects/ArrayBufferView.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/ArrayBufferView.java	Tue Apr 01 15:37:15 2014 +0200
@@ -42,12 +42,8 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     private ArrayBufferView(final NativeArrayBuffer buffer, final int byteOffset, final int elementLength, final Global global) {
-        super(getInitialMap());
+        super($nasgenmap$);
         checkConstructorArgs(buffer, byteOffset, elementLength);
         this.setProto(getPrototype(global));
         this.setArray(factory().createArrayData(buffer, byteOffset, elementLength));
--- a/nashorn/src/jdk/nashorn/internal/objects/DataPropertyDescriptor.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/DataPropertyDescriptor.java	Tue Apr 01 15:37:15 2014 +0200
@@ -64,12 +64,8 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     DataPropertyDescriptor(final boolean configurable, final boolean enumerable, final boolean writable, final Object value, final Global global) {
-        super(global.getObjectPrototype(), getInitialMap());
+        super(global.getObjectPrototype(), $nasgenmap$);
         this.configurable = configurable;
         this.enumerable   = enumerable;
         this.writable     = writable;
--- a/nashorn/src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java	Tue Apr 01 15:37:15 2014 +0200
@@ -55,12 +55,8 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     GenericPropertyDescriptor(final boolean configurable, final boolean enumerable, final Global global) {
-        super(global.getObjectPrototype(), getInitialMap());
+        super(global.getObjectPrototype(), $nasgenmap$);
         this.configurable = configurable;
         this.enumerable   = enumerable;
     }
--- a/nashorn/src/jdk/nashorn/internal/objects/Global.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/Global.java	Tue Apr 01 15:37:15 2014 +0200
@@ -33,11 +33,8 @@
 import java.io.PrintWriter;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
-import java.lang.ref.ReferenceQueue;
-import java.lang.ref.SoftReference;
 import java.lang.reflect.Field;
 import java.util.Arrays;
-import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Callable;
@@ -51,7 +48,6 @@
 import jdk.nashorn.internal.runtime.ConsString;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.GlobalFunctions;
-import jdk.nashorn.internal.runtime.GlobalObject;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.NativeJavaPackage;
 import jdk.nashorn.internal.runtime.PropertyDescriptor;
@@ -59,10 +55,10 @@
 import jdk.nashorn.internal.runtime.Scope;
 import jdk.nashorn.internal.runtime.ScriptEnvironment;
 import jdk.nashorn.internal.runtime.ScriptFunction;
+import jdk.nashorn.internal.runtime.ScriptFunctionData;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.ScriptingFunctions;
-import jdk.nashorn.internal.runtime.Source;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
 import jdk.nashorn.internal.runtime.linker.InvokeByName;
@@ -73,7 +69,7 @@
  * Representation of global scope.
  */
 @ScriptClass("Global")
-public final class Global extends ScriptObject implements GlobalObject, Scope {
+public final class Global extends ScriptObject implements Scope {
     private final InvokeByName TO_STRING = new InvokeByName("toString", ScriptObject.class);
     private final InvokeByName VALUE_OF  = new InvokeByName("valueOf",  ScriptObject.class);
 
@@ -229,6 +225,10 @@
     @Property(name = "ArrayBuffer", attributes = Attribute.NOT_ENUMERABLE)
     public volatile Object arrayBuffer;
 
+    /** DataView object */
+    @Property(name = "DataView", attributes = Attribute.NOT_ENUMERABLE)
+    public volatile Object dataView;
+
     /** TypedArray (int8) */
     @Property(name = "Int8Array", attributes = Attribute.NOT_ENUMERABLE)
     public volatile Object int8Array;
@@ -355,6 +355,7 @@
     private ScriptObject   builtinJavaImporter;
     private ScriptObject   builtinJavaApi;
     private ScriptObject   builtinArrayBuffer;
+    private ScriptObject   builtinDataView;
     private ScriptObject   builtinInt8Array;
     private ScriptObject   builtinUint8Array;
     private ScriptObject   builtinUint8ClampedArray;
@@ -373,9 +374,6 @@
     // Flag to indicate that a split method issued a return statement
     private int splitState = -1;
 
-    // class cache
-    private ClassCache classCache;
-
     // Used to store the last RegExp result to support deprecated RegExp constructor properties
     private RegExpResult lastRegExpResult;
 
@@ -426,11 +424,6 @@
         super(checkAndGetMap(context));
         this.context = context;
         this.setIsScope();
-
-        final int cacheSize = context.getEnv()._class_cache_size;
-        if (cacheSize > 0) {
-            classCache = new ClassCache(cacheSize);
-        }
     }
 
     /**
@@ -439,11 +432,9 @@
      * @return the global singleton
      */
     public static Global instance() {
-        ScriptObject global = Context.getGlobal();
-        if (! (global instanceof Global)) {
-            throw new IllegalStateException("no current global instance");
-        }
-        return (Global)global;
+        Global global = Context.getGlobal();
+        global.getClass(); // null check
+        return global;
     }
 
     /**
@@ -464,19 +455,30 @@
         return instance().getContext();
     }
 
-    // GlobalObject interface implementation
+    // Runtime interface to Global
 
-    @Override
+    /**
+     * Is this global of the given Context?
+     * @param ctxt the context
+     * @return true if this global belongs to the given Context
+     */
     public boolean isOfContext(final Context ctxt) {
         return this.context == ctxt;
     }
 
-    @Override
+    /**
+     * Does this global belong to a strict Context?
+     * @return true if this global belongs to a strict Context
+     */
     public boolean isStrictContext() {
         return context.getEnv()._strict;
     }
 
-    @Override
+    /**
+     * Initialize standard builtin objects like "Object", "Array", "Function" etc.
+     * as well as our extension builtin objects like "Java", "JSAdapter" as properties
+     * of the global scope object.
+     */
     public void initBuiltinObjects() {
         if (this.builtinObject != null) {
             // already initialized, just return
@@ -486,12 +488,26 @@
         init();
     }
 
-    @Override
+    /**
+     * Create a new ScriptFunction object
+     *
+     * @param name   function name
+     * @param handle invocation handle for function
+     * @param scope  the scope
+     * @param strict are we in strict mode
+     *
+     * @return new script function
+     */
     public ScriptFunction newScriptFunction(final String name, final MethodHandle handle, final ScriptObject scope, final boolean strict) {
-        return new ScriptFunctionImpl(name, handle, scope, null, strict, false, true);
+        return new ScriptFunctionImpl(name, handle, scope, null, strict ? ScriptFunctionData.IS_STRICT_CONSTRUCTOR : ScriptFunctionData.IS_CONSTRUCTOR);
     }
 
-    @Override
+    /**
+     * Wrap a Java object as corresponding script object
+     *
+     * @param obj object to wrap
+     * @return    wrapped object
+     */
     public Object wrapAsObject(final Object obj) {
         if (obj instanceof Boolean) {
             return new NativeBoolean((Boolean)obj, this);
@@ -513,7 +529,14 @@
         }
     }
 
-    @Override
+    /**
+     * Lookup helper for JS primitive types
+     *
+     * @param request the link request for the dynamic call site.
+     * @param self     self reference
+     *
+     * @return guarded invocation
+     */
     public GuardedInvocation primitiveLookup(final LinkRequest request, final Object self) {
         if (self instanceof String || self instanceof ConsString) {
             return NativeString.lookupPrimitive(request, self);
@@ -525,12 +548,23 @@
         throw new IllegalArgumentException("Unsupported primitive: " + self);
     }
 
-    @Override
+    /**
+     * Create a new empty script object
+     *
+     * @return the new ScriptObject
+     */
     public ScriptObject newObject() {
         return new JO(getObjectPrototype(), JO.getInitialMap());
     }
 
-    @Override
+    /**
+     * Default value of given type
+     *
+     * @param sobj     script object
+     * @param typeHint type hint
+     *
+     * @return default value
+     */
     public Object getDefaultValue(final ScriptObject sobj, final Class<?> typeHint) {
         // When the [[DefaultValue]] internal method of O is called with no hint,
         // then it behaves as if the hint were Number, unless O is a Date object
@@ -590,7 +624,12 @@
         return UNDEFINED;
     }
 
-    @Override
+    /**
+     * Is the given ScriptObject an ECMAScript Error object?
+     *
+     * @param sobj the object being checked
+     * @return true if sobj is an Error object
+     */
     public boolean isError(final ScriptObject sobj) {
         final ScriptObject errorProto = getErrorPrototype();
         ScriptObject proto = sobj.getProto();
@@ -603,52 +642,108 @@
         return false;
     }
 
-    @Override
+    /**
+     * Create a new ECMAScript Error object.
+     *
+     * @param msg error message
+     * @return newly created Error object
+     */
     public ScriptObject newError(final String msg) {
         return new NativeError(msg, this);
     }
 
-    @Override
+    /**
+     * Create a new ECMAScript EvalError object.
+     *
+     * @param msg error message
+     * @return newly created EvalError object
+     */
     public ScriptObject newEvalError(final String msg) {
         return new NativeEvalError(msg, this);
     }
 
-    @Override
+    /**
+     * Create a new ECMAScript RangeError object.
+     *
+     * @param msg error message
+     * @return newly created RangeError object
+     */
     public ScriptObject newRangeError(final String msg) {
         return new NativeRangeError(msg, this);
     }
 
-    @Override
+    /**
+     * Create a new ECMAScript ReferenceError object.
+     *
+     * @param msg error message
+     * @return newly created ReferenceError object
+     */
     public ScriptObject newReferenceError(final String msg) {
         return new NativeReferenceError(msg, this);
     }
 
-    @Override
+    /**
+     * Create a new ECMAScript SyntaxError object.
+     *
+     * @param msg error message
+     * @return newly created SyntaxError object
+     */
     public ScriptObject newSyntaxError(final String msg) {
         return new NativeSyntaxError(msg, this);
     }
 
-    @Override
+    /**
+     * Create a new ECMAScript TypeError object.
+     *
+     * @param msg error message
+     * @return newly created TypeError object
+     */
     public ScriptObject newTypeError(final String msg) {
         return new NativeTypeError(msg, this);
     }
 
-    @Override
+    /**
+     * Create a new ECMAScript URIError object.
+     *
+     * @param msg error message
+     * @return newly created URIError object
+     */
     public ScriptObject newURIError(final String msg) {
         return new NativeURIError(msg, this);
     }
 
-    @Override
+    /**
+     * Create a new ECMAScript GenericDescriptor object.
+     *
+     * @param configurable is the property configurable?
+     * @param enumerable is the property enumerable?
+     * @return newly created GenericDescriptor object
+     */
     public PropertyDescriptor newGenericDescriptor(final boolean configurable, final boolean enumerable) {
         return new GenericPropertyDescriptor(configurable, enumerable, this);
     }
 
-    @Override
+    /**
+     * Create a new ECMAScript DatePropertyDescriptor object.
+     *
+     * @param value of the data property
+     * @param configurable is the property configurable?
+     * @param enumerable is the property enumerable?
+     * @return newly created DataPropertyDescriptor object
+     */
     public PropertyDescriptor newDataDescriptor(final Object value, final boolean configurable, final boolean enumerable, final boolean writable) {
         return new DataPropertyDescriptor(configurable, enumerable, writable, value, this);
     }
 
-    @Override
+    /**
+     * Create a new ECMAScript AccessorPropertyDescriptor object.
+     *
+     * @param get getter function of the user accessor property
+     * @param set setter function of the user accessor property
+     * @param configurable is the property configurable?
+     * @param enumerable is the property enumerable?
+     * @return newly created AccessorPropertyDescriptor object
+     */
     public PropertyDescriptor newAccessorDescriptor(final Object get, final Object set, final boolean configurable, final boolean enumerable) {
         final AccessorPropertyDescriptor desc = new AccessorPropertyDescriptor(configurable, enumerable, get == null ? UNDEFINED : get, set == null ? UNDEFINED : set, this);
 
@@ -664,62 +759,6 @@
     }
 
 
-    /**
-     * Cache for compiled script classes.
-     */
-    @SuppressWarnings("serial")
-    private static class ClassCache extends LinkedHashMap<Source, ClassReference> {
-        private final int size;
-        private final ReferenceQueue<Class<?>> queue;
-
-        ClassCache(int size) {
-            super(size, 0.75f, true);
-            this.size = size;
-            this.queue = new ReferenceQueue<>();
-        }
-
-        void cache(final Source source, final Class<?> clazz) {
-            put(source, new ClassReference(clazz, queue, source));
-        }
-
-        @Override
-        protected boolean removeEldestEntry(final Map.Entry<Source, ClassReference> eldest) {
-            return size() > size;
-        }
-
-        @Override
-        public ClassReference get(Object key) {
-            for (ClassReference ref; (ref = (ClassReference)queue.poll()) != null; ) {
-                remove(ref.source);
-            }
-            return super.get(key);
-        }
-
-    }
-
-    private static class ClassReference extends SoftReference<Class<?>> {
-        private final Source source;
-
-        ClassReference(final Class<?> clazz, final ReferenceQueue<Class<?>> queue, final Source source) {
-            super(clazz, queue);
-            this.source = source;
-        }
-    }
-
-    // Class cache management
-    @Override
-    public Class<?> findCachedClass(final Source source) {
-        assert classCache != null : "Class cache used without being initialized";
-        ClassReference ref = classCache.get(source);
-        return ref != null ? ref.get() : null;
-    }
-
-    @Override
-    public void cacheClass(final Source source, final Class<?> clazz) {
-        assert classCache != null : "Class cache used without being initialized";
-        classCache.cache(source, clazz);
-    }
-
     private static <T> T getLazilyCreatedValue(final Object key, final Callable<T> creator, final Map<Object, T> map) {
         final T obj = map.get(key);
         if (obj != null) {
@@ -737,14 +776,25 @@
 
     private final Map<Object, InvokeByName> namedInvokers = new ConcurrentHashMap<>();
 
-    @Override
+
+    /**
+     * Get cached InvokeByName object for the given key
+     * @param key key to be associated with InvokeByName object
+     * @param creator if InvokeByName is absent 'creator' is called to make one (lazy init)
+     * @return InvokeByName object associated with the key.
+     */
     public InvokeByName getInvokeByName(final Object key, final Callable<InvokeByName> creator) {
         return getLazilyCreatedValue(key, creator, namedInvokers);
     }
 
     private final Map<Object, MethodHandle> dynamicInvokers = new ConcurrentHashMap<>();
 
-    @Override
+    /**
+     * Get cached dynamic method handle for the given key
+     * @param key key to be associated with dynamic method handle
+     * @param creator if method handle is absent 'creator' is called to make one (lazy init)
+     * @return dynamic method handle associated with the key.
+     */
     public MethodHandle getDynamicInvoker(final Object key, final Callable<MethodHandle> creator) {
         return getLazilyCreatedValue(key, creator, dynamicInvokers);
     }
@@ -933,6 +983,10 @@
         return ScriptFunction.getPrototype(builtinArrayBuffer);
     }
 
+    ScriptObject getDataViewPrototype() {
+        return ScriptFunction.getPrototype(builtinDataView);
+    }
+
     ScriptObject getInt8ArrayPrototype() {
         return ScriptFunction.getPrototype(builtinInt8Array);
     }
@@ -1701,6 +1755,7 @@
 
     private void initTypedArray() {
         this.builtinArrayBuffer       = initConstructor("ArrayBuffer");
+        this.builtinDataView          = initConstructor("DataView");
         this.builtinInt8Array         = initConstructor("Int8Array");
         this.builtinUint8Array        = initConstructor("Uint8Array");
         this.builtinUint8ClampedArray = initConstructor("Uint8ClampedArray");
@@ -1741,6 +1796,7 @@
         this.typeError         = this.builtinTypeError;
         this.uriError          = this.builtinURIError;
         this.arrayBuffer       = this.builtinArrayBuffer;
+        this.dataView          = this.builtinDataView;
         this.int8Array         = this.builtinInt8Array;
         this.uint8Array        = this.builtinUint8Array;
         this.uint8ClampedArray = this.builtinUint8ClampedArray;
@@ -1838,7 +1894,7 @@
         anon.deleteOwnProperty(anon.getMap().findProperty("prototype"));
 
         // use "getter" so that [[ThrowTypeError]] function's arity is 0 - as specified in step 10 of section 13.2.3
-        this.typeErrorThrower = new ScriptFunctionImpl("TypeErrorThrower", Lookup.TYPE_ERROR_THROWER_GETTER, null, null, false, false, false);
+        this.typeErrorThrower = new ScriptFunctionImpl("TypeErrorThrower", Lookup.TYPE_ERROR_THROWER_GETTER, null, null, 0);
         typeErrorThrower.setPrototype(UNDEFINED);
         // Non-constructor built-in functions do not have "prototype" property
         typeErrorThrower.deleteOwnProperty(typeErrorThrower.getMap().findProperty("prototype"));
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java	Tue Apr 01 15:37:15 2014 +0200
@@ -156,10 +156,6 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     /*
      * Constructors.
      */
@@ -208,7 +204,7 @@
     }
 
     NativeArray(final ArrayData arrayData, final Global global) {
-        super(global.getArrayPrototype(), getInitialMap());
+        super(global.getArrayPrototype(), $nasgenmap$);
         this.setArray(arrayData);
         this.setIsArray();
     }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeArrayBuffer.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeArrayBuffer.java	Tue Apr 01 15:37:15 2014 +0200
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.internal.objects;
 
+import java.nio.ByteBuffer;
 import java.util.Arrays;
 import jdk.nashorn.internal.objects.annotations.Attribute;
 import jdk.nashorn.internal.objects.annotations.Constructor;
@@ -43,10 +44,6 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     @Constructor(arity = 1)
     public static Object constructor(final boolean newObj, final Object self, final Object... args) {
         if (args.length == 0) {
@@ -57,7 +54,7 @@
     }
 
     protected NativeArrayBuffer(final byte[] byteArray, final Global global) {
-        super(global.getArrayBufferPrototype(), getInitialMap());
+        super(global.getArrayBufferPrototype(), $nasgenmap$);
         this.buffer = byteArray;
     }
 
@@ -128,4 +125,16 @@
     public int getByteLength() {
         return buffer.length;
     }
+
+    ByteBuffer getBuffer() {
+       return ByteBuffer.wrap(buffer);
+    }
+
+    ByteBuffer getBuffer(final int offset) {
+        return ByteBuffer.wrap(buffer, offset, buffer.length - offset);
+    }
+
+    ByteBuffer getBuffer(final int offset, final int length) {
+        return ByteBuffer.wrap(buffer, offset, length);
+    }
 }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeBoolean.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeBoolean.java	Tue Apr 01 15:37:15 2014 +0200
@@ -30,6 +30,7 @@
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.LinkRequest;
 import jdk.nashorn.internal.objects.annotations.Attribute;
@@ -50,22 +51,21 @@
 public final class NativeBoolean extends ScriptObject {
     private final boolean value;
 
-    final static MethodHandle WRAPFILTER = findWrapFilter();
+    // Method handle to create an object wrapper for a primitive boolean
+    private static final MethodHandle WRAPFILTER = findOwnMH("wrapFilter", MH.type(NativeBoolean.class, Object.class));
+    // Method handle to retrieve the Boolean prototype object
+    private static final MethodHandle PROTOFILTER = findOwnMH("protoFilter", MH.type(Object.class, Object.class));
 
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     private NativeBoolean(final boolean value, final ScriptObject proto, final PropertyMap map) {
         super(proto, map);
         this.value = value;
     }
 
     NativeBoolean(final boolean flag, final Global global) {
-        this(flag, global.getBooleanPrototype(), getInitialMap());
+        this(flag, global.getBooleanPrototype(), $nasgenmap$);
     }
 
     NativeBoolean(final boolean flag) {
@@ -164,7 +164,7 @@
      * @return Link to be invoked at call site.
      */
     public static GuardedInvocation lookupPrimitive(final LinkRequest request, final Object receiver) {
-        return PrimitiveLookup.lookupPrimitive(request, Boolean.class, new NativeBoolean((Boolean)receiver), WRAPFILTER);
+        return PrimitiveLookup.lookupPrimitive(request, Boolean.class, new NativeBoolean((Boolean)receiver), WRAPFILTER, PROTOFILTER);
     }
 
     /**
@@ -178,7 +178,12 @@
         return new NativeBoolean((Boolean)receiver);
     }
 
-    private static MethodHandle findWrapFilter() {
-        return MH.findStatic(MethodHandles.lookup(), NativeBoolean.class, "wrapFilter", MH.type(NativeBoolean.class, Object.class));
+    @SuppressWarnings("unused")
+    private static Object protoFilter(final Object object) {
+        return Global.instance().getBooleanPrototype();
+    }
+
+    private static MethodHandle findOwnMH(final String name, final MethodType type) {
+        return MH.findStatic(MethodHandles.lookup(), NativeBoolean.class, name, type);
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeDataView.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,1015 @@
+/*
+ * 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 jdk.nashorn.internal.objects;
+
+import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
+import static jdk.nashorn.internal.runtime.ECMAErrors.rangeError;
+import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import jdk.nashorn.internal.objects.annotations.Attribute;
+import jdk.nashorn.internal.objects.annotations.Constructor;
+import jdk.nashorn.internal.objects.annotations.Function;
+import jdk.nashorn.internal.objects.annotations.Property;
+import jdk.nashorn.internal.objects.annotations.ScriptClass;
+import jdk.nashorn.internal.objects.annotations.SpecializedConstructor;
+import jdk.nashorn.internal.objects.annotations.SpecializedFunction;
+import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.PropertyMap;
+import jdk.nashorn.internal.runtime.ScriptObject;
+import jdk.nashorn.internal.runtime.ScriptRuntime;
+
+/**
+ * <p>
+ * DataView builtin constructor. Based on the specification here:
+ * http://www.khronos.org/registry/typedarray/specs/latest/#8
+ * </p>
+ * <p>
+ * An ArrayBuffer is a useful object for representing an arbitrary chunk of data.
+ * In many cases, such data will be read from disk or from the network, and will
+ * not follow the alignment restrictions that are imposed on the typed array views
+ * described earlier. In addition, the data will often be heterogeneous in nature
+ * and have a defined byte order. The DataView view provides a low-level interface
+ * for reading such data from and writing it to an ArrayBuffer.
+ * </p>
+ * <p>
+ * Regardless of the host computer's endianness, DataView reads or writes values
+ * to or from main memory with a specified endianness: big or little.
+ * </p>
+ */
+@ScriptClass("DataView")
+public class NativeDataView extends ScriptObject {
+    // initialized by nasgen
+    private static PropertyMap $nasgenmap$;
+
+    // inherited ArrayBufferView properties
+
+    /**
+     * Underlying ArrayBuffer storage object
+     */
+    @Property(attributes = Attribute.NON_ENUMERABLE_CONSTANT)
+    public final Object buffer;
+
+    /**
+     * The offset in bytes from the start of the ArrayBuffer
+     */
+    @Property(attributes = Attribute.NON_ENUMERABLE_CONSTANT)
+    public final int byteOffset;
+
+    /**
+     * The number of bytes from the offset that this DataView will reference
+     */
+    @Property(attributes = Attribute.NON_ENUMERABLE_CONSTANT)
+    public final int byteLength;
+
+    // underlying ByteBuffer
+    private final ByteBuffer buf;
+
+    private NativeDataView(NativeArrayBuffer arrBuf) {
+        this(arrBuf, arrBuf.getBuffer(), 0);
+    }
+
+    private NativeDataView(NativeArrayBuffer arrBuf, int offset) {
+        this(arrBuf, bufferFrom(arrBuf, offset), offset);
+    }
+
+    private NativeDataView(NativeArrayBuffer arrBuf, int offset, int length) {
+        this(arrBuf, bufferFrom(arrBuf, offset, length), offset, length);
+    }
+
+    private NativeDataView(final NativeArrayBuffer arrBuf, final ByteBuffer buf, final int offset) {
+       this(arrBuf, buf, offset, buf.capacity() - offset);
+    }
+
+    private NativeDataView(final NativeArrayBuffer arrBuf, final ByteBuffer buf, final int offset, final int length) {
+        super(Global.instance().getDataViewPrototype(), $nasgenmap$);
+        this.buffer = arrBuf;
+        this.byteOffset = offset;
+        this.byteLength = length;
+        this.buf = buf;
+    }
+
+    /**
+     * Create a new DataView object using the passed ArrayBuffer for its
+     * storage. Optional byteOffset and byteLength can be used to limit the
+     * section of the buffer referenced. The byteOffset indicates the offset in
+     * bytes from the start of the ArrayBuffer, and the byteLength is the number
+     * of bytes from the offset that this DataView will reference. If both
+     * byteOffset and byteLength are omitted, the DataView spans the entire
+     * ArrayBuffer range. If the byteLength is omitted, the DataView extends from
+     * the given byteOffset until the end of the ArrayBuffer.
+     *
+     * If the given byteOffset and byteLength references an area beyond the end
+     * of the ArrayBuffer an exception is raised.
+
+     * @param newObj if this constructor was invoked with 'new' or not
+     * @param self   constructor function object
+     * @param args   arguments to the constructor
+     * @return newly constructed DataView object
+     */
+    @Constructor(arity = 1)
+    public static Object constructor(final boolean newObj, final Object self, final Object... args) {
+        if (args.length == 0 || !(args[0] instanceof NativeArrayBuffer)) {
+            throw typeError("not.an.arraybuffer.in.dataview");
+        }
+
+        final NativeArrayBuffer arrBuf = (NativeArrayBuffer) args[0];
+        switch (args.length) {
+            case 1:
+                return new NativeDataView(arrBuf);
+            case 2:
+                return new NativeDataView(arrBuf, JSType.toInt32(args[1]));
+            default:
+                return new NativeDataView(arrBuf, JSType.toInt32(args[1]), JSType.toInt32(args[2]));
+        }
+    }
+
+    /**
+     * Specialized version of DataView constructor
+     *
+     * @param newObj if this constructor was invoked with 'new' or not
+     * @param self   constructor function object
+     * @param arrBuf underlying ArrayBuffer storage object
+     * @param offset offset in bytes from the start of the ArrayBuffer
+     * @return newly constructed DataView object
+     */
+    @SpecializedConstructor
+    public static Object constructor(final boolean newObj, final Object self, final Object arrBuf, final int offset) {
+        if (!(arrBuf instanceof NativeArrayBuffer)) {
+            throw typeError("not.an.arraybuffer.in.dataview");
+        }
+        return new NativeDataView((NativeArrayBuffer) arrBuf, offset);
+    }
+
+    /**
+     * Specialized version of DataView constructor
+     *
+     * @param newObj if this constructor was invoked with 'new' or not
+     * @param self   constructor function object
+     * @param arrBuf underlying ArrayBuffer storage object
+     * @param offset in bytes from the start of the ArrayBuffer
+     * @param length is the number of bytes from the offset that this DataView will reference
+     * @return newly constructed DataView object
+     */
+    @SpecializedConstructor
+    public static Object constructor(final boolean newObj, final Object self, final Object arrBuf, final int offset, final int length) {
+        if (!(arrBuf instanceof NativeArrayBuffer)) {
+            throw typeError("not.an.arraybuffer.in.dataview");
+        }
+        return new NativeDataView((NativeArrayBuffer) arrBuf, offset, length);
+    }
+
+    // Gets the value of the given type at the specified byte offset
+    // from the start of the view. There is no alignment constraint;
+    // multi-byte values may be fetched from any offset.
+    //
+    // For multi-byte values, the optional littleEndian argument
+    // indicates whether a big-endian or little-endian value should be
+    // read. If false or undefined, a big-endian value is read.
+    //
+    // These methods raise an exception if they would read
+    // beyond the end of the view.
+
+    /**
+     * Get 8-bit signed int from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @return 8-bit signed int value at the byteOffset
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE)
+    public static int getInt8(final Object self, final Object byteOffset) {
+        try {
+            return getBuffer(self).get(JSType.toInt32(byteOffset));
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 8-bit signed int from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @return 8-bit signed int value at the byteOffset
+     */
+    @SpecializedFunction
+    public static int getInt8(final Object self, final int byteOffset) {
+        try {
+            return getBuffer(self).get(byteOffset);
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 8-bit unsigned int from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @return 8-bit unsigned int value at the byteOffset
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE)
+    public static int getUint8(final Object self, final Object byteOffset) {
+        try {
+            return (0xFF & getBuffer(self).get(JSType.toInt32(byteOffset)));
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 8-bit unsigned int from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @return 8-bit unsigned int value at the byteOffset
+     */
+    @SpecializedFunction
+    public static int getUint8(final Object self, final int byteOffset) {
+        try {
+            return (0xFF & getBuffer(self).get(byteOffset));
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 16-bit signed int from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @param littleEndian (optional) flag indicating whether to read in little endian order
+     * @return 16-bit signed int value at the byteOffset
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
+    public static int getInt16(final Object self, final Object byteOffset, final Object littleEndian) {
+        try {
+            return getBuffer(self, littleEndian).getShort(JSType.toInt32(byteOffset));
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 16-bit signed int from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @return 16-bit signed int value at the byteOffset
+     */
+    @SpecializedFunction
+    public static int getInt16(final Object self, final int byteOffset) {
+        try {
+            return getBuffer(self, false).getShort(byteOffset);
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 16-bit signed int from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @param littleEndian (optional) flag indicating whether to read in little endian order
+     * @return 16-bit signed int value at the byteOffset
+     */
+    @SpecializedFunction
+    public static int getInt16(final Object self, final int byteOffset, final boolean littleEndian) {
+        try {
+            return getBuffer(self, littleEndian).getShort(byteOffset);
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 16-bit unsigned int from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @param littleEndian (optional) flag indicating whether to read in little endian order
+     * @return 16-bit unsigned int value at the byteOffset
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
+    public static int getUint16(final Object self, final Object byteOffset, final Object littleEndian) {
+        try {
+            return (int) (0xFFFF & getBuffer(self, littleEndian).getShort(JSType.toInt32(byteOffset)));
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 16-bit unsigned int from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @return 16-bit unsigned int value at the byteOffset
+     */
+    @SpecializedFunction
+    public static int getUint16(final Object self, final int byteOffset) {
+        try {
+            return (int) (0xFFFF & getBuffer(self, false).getShort(byteOffset));
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 16-bit unsigned int from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @param littleEndian (optional) flag indicating whether to read in little endian order
+     * @return 16-bit unsigned int value at the byteOffset
+     */
+    @SpecializedFunction
+    public static int getUint16(final Object self, final int byteOffset, final boolean littleEndian) {
+        try {
+            return (int) (0xFFFF & getBuffer(self, littleEndian).getShort(byteOffset));
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 32-bit signed int from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @param littleEndian (optional) flag indicating whether to read in little endian order
+     * @return 32-bit signed int value at the byteOffset
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
+    public static int getInt32(final Object self, final Object byteOffset, final Object littleEndian) {
+        try {
+            return getBuffer(self, littleEndian).getInt(JSType.toInt32(byteOffset));
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 32-bit signed int from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @return 32-bit signed int value at the byteOffset
+     */
+    @SpecializedFunction
+    public static int getInt32(final Object self, final int byteOffset) {
+        try {
+            return getBuffer(self, false).getInt(byteOffset);
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 32-bit signed int from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @param littleEndian (optional) flag indicating whether to read in little endian order
+     * @return 32-bit signed int value at the byteOffset
+     */
+    @SpecializedFunction
+    public static int getInt32(final Object self, final int byteOffset, final boolean littleEndian) {
+        try {
+            return getBuffer(self, littleEndian).getInt(byteOffset);
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 32-bit unsigned int from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @param littleEndian (optional) flag indicating whether to read in little endian order
+     * @return 32-bit unsigned int value at the byteOffset
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
+    public static long getUint32(final Object self, final Object byteOffset, final Object littleEndian) {
+        try {
+            return (long) (0xFFFFFFFFL & getBuffer(self, littleEndian).getInt(JSType.toInt32(byteOffset)));
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 32-bit unsigned int from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @return 32-bit unsigned int value at the byteOffset
+     */
+    @SpecializedFunction
+    public static long getUint32(final Object self, final int byteOffset) {
+        try {
+            return (long) (0xFFFFFFFFL & getBuffer(self, false).getInt(JSType.toInt32(byteOffset)));
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 32-bit unsigned int from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @param littleEndian (optional) flag indicating whether to read in little endian order
+     * @return 32-bit unsigned int value at the byteOffset
+     */
+    @SpecializedFunction
+    public static long getUint32(final Object self, final int byteOffset, final boolean littleEndian) {
+        try {
+            return (long) (0xFFFFFFFFL & getBuffer(self, littleEndian).getInt(JSType.toInt32(byteOffset)));
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 32-bit float value from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @param littleEndian (optional) flag indicating whether to read in little endian order
+     * @return 32-bit float value at the byteOffset
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
+    public static double getFloat32(final Object self, final Object byteOffset, final Object littleEndian) {
+        try {
+            return getBuffer(self, littleEndian).getFloat(JSType.toInt32(byteOffset));
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 32-bit float value from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @return 32-bit float value at the byteOffset
+     */
+    @SpecializedFunction
+    public static double getFloat32(final Object self, final int byteOffset) {
+        try {
+            return getBuffer(self, false).getFloat(byteOffset);
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 32-bit float value from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @param littleEndian (optional) flag indicating whether to read in little endian order
+     * @return 32-bit float value at the byteOffset
+     */
+    @SpecializedFunction
+    public static double getFloat32(final Object self, final int byteOffset, final boolean littleEndian) {
+        try {
+            return getBuffer(self, littleEndian).getFloat(byteOffset);
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 64-bit float value from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @param littleEndian (optional) flag indicating whether to read in little endian order
+     * @return 64-bit float value at the byteOffset
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
+    public static double getFloat64(final Object self, final Object byteOffset, final Object littleEndian) {
+        try {
+            return getBuffer(self, littleEndian).getDouble(JSType.toInt32(byteOffset));
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 64-bit float value from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @return 64-bit float value at the byteOffset
+     */
+    @SpecializedFunction
+    public static double getFloat64(final Object self, final int byteOffset) {
+        try {
+            return getBuffer(self, false).getDouble(byteOffset);
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Get 64-bit float value from given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @param littleEndian (optional) flag indicating whether to read in little endian order
+     * @return 64-bit float value at the byteOffset
+     */
+    @SpecializedFunction
+    public static double getFloat64(final Object self, final int byteOffset, final boolean littleEndian) {
+        try {
+            return getBuffer(self, littleEndian).getDouble(byteOffset);
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    // Stores a value of the given type at the specified byte offset
+    // from the start of the view. There is no alignment constraint;
+    // multi-byte values may be stored at any offset.
+    //
+    // For multi-byte values, the optional littleEndian argument
+    // indicates whether the value should be stored in big-endian or
+    // little-endian byte order. If false or undefined, the value is
+    // stored in big-endian byte order.
+    //
+    // These methods raise an exception if they would write
+    // beyond the end of the view.
+
+    /**
+     * Set 8-bit signed int at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @param value byte value to set
+     * @return undefined
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 2)
+    public static Object setInt8(final Object self, final Object byteOffset, final Object value) {
+        try {
+            getBuffer(self).put(JSType.toInt32(byteOffset), (byte)JSType.toInt32(value));
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 8-bit signed int at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to read from
+     * @param value byte value to set
+     * @return undefined
+     */
+    @SpecializedFunction
+    public static Object setInt8(final Object self, final int byteOffset, final int value) {
+        try {
+            getBuffer(self).put(byteOffset, (byte)value);
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 8-bit unsigned int at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value byte value to set
+     * @return undefined
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 2)
+    public static Object setUint8(final Object self, final Object byteOffset, final Object value) {
+        try {
+            getBuffer(self).put(JSType.toInt32(byteOffset), (byte)JSType.toInt32(value));
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 8-bit unsigned int at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value byte value to set
+     * @return undefined
+     */
+    @SpecializedFunction
+    public static Object setUint8(final Object self, final int byteOffset, final int value) {
+        try {
+            getBuffer(self).put(byteOffset, (byte)value);
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 16-bit signed int at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value short value to set
+     * @param littleEndian (optional) flag indicating whether to write in little endian order
+     * @return undefined
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 2)
+    public static Object setInt16(final Object self, final Object byteOffset, final Object value, final Object littleEndian) {
+        try {
+            getBuffer(self, littleEndian).putShort(JSType.toInt32(byteOffset), (short)JSType.toInt32(value));
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 16-bit signed int at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value short value to set
+     * @return undefined
+     */
+    @SpecializedFunction
+    public static Object setInt16(final Object self, final int byteOffset, final int value) {
+        try {
+            getBuffer(self, false).putShort(byteOffset, (short)value);
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 16-bit signed int at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value short value to set
+     * @param littleEndian (optional) flag indicating whether to write in little endian order
+     * @return undefined
+     */
+    @SpecializedFunction
+    public static Object setInt16(final Object self, final int byteOffset, final int value, final boolean littleEndian) {
+        try {
+            getBuffer(self, littleEndian).putShort(byteOffset, (short)value);
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 16-bit unsigned int at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value short value to set
+     * @param littleEndian (optional) flag indicating whether to write in little endian order
+     * @return undefined
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 2)
+    public static Object setUint16(final Object self, final Object byteOffset, final Object value, final Object littleEndian) {
+        try {
+            getBuffer(self, littleEndian).putShort(JSType.toInt32(byteOffset), (short)JSType.toInt32(value));
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 16-bit unsigned int at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value short value to set
+     * @return undefined
+     */
+    @SpecializedFunction
+    public static Object setUint16(final Object self, final int byteOffset, final int value) {
+        try {
+            getBuffer(self, false).putShort(byteOffset, (short)value);
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 16-bit unsigned int at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value short value to set
+     * @param littleEndian (optional) flag indicating whether to write in little endian order
+     * @return undefined
+     */
+    @SpecializedFunction
+    public static Object setUint16(final Object self, final int byteOffset, final int value, final boolean littleEndian) {
+        try {
+            getBuffer(self, littleEndian).putShort(byteOffset, (short)value);
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 32-bit signed int at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value int value to set
+     * @param littleEndian (optional) flag indicating whether to write in little endian order
+     * @return undefined
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 2)
+    public static Object setInt32(final Object self, final Object byteOffset, final Object value, final Object littleEndian) {
+        try {
+            getBuffer(self, littleEndian).putInt(JSType.toInt32(byteOffset), (int)JSType.toInt32(value));
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 32-bit signed int at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value int value to set
+     * @return undefined
+     */
+    @SpecializedFunction
+    public static Object setInt32(final Object self, final int byteOffset, final int value) {
+        try {
+            getBuffer(self, false).putInt(byteOffset, value);
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 32-bit signed int at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value int value to set
+     * @param littleEndian (optional) flag indicating whether to write in little endian order
+     * @return undefined
+     */
+    @SpecializedFunction
+    public static Object setInt32(final Object self, final int byteOffset, final int value, final boolean littleEndian) {
+        try {
+            getBuffer(self, littleEndian).putInt(byteOffset, value);
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 32-bit unsigned int at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value int value to set
+     * @param littleEndian (optional) flag indicating whether to write in little endian order
+     * @return undefined
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 2)
+    public static Object setUint32(final Object self, final Object byteOffset, final Object value, final Object littleEndian) {
+        try {
+            getBuffer(self, littleEndian).putInt(JSType.toInt32(byteOffset), (int)JSType.toUint32(value));
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 32-bit unsigned int at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value int value to set
+     * @return undefined
+     */
+    @SpecializedFunction
+    public static Object setUint32(final Object self, final int byteOffset, final long value) {
+        try {
+            getBuffer(self, false).putInt(byteOffset, (int)value);
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 32-bit unsigned int at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value int value to set
+     * @param littleEndian (optional) flag indicating whether to write in little endian order
+     * @return undefined
+     */
+    @SpecializedFunction
+    public static Object setUint32(final Object self, final int byteOffset, final long value, final boolean littleEndian) {
+        try {
+            getBuffer(self, littleEndian).putInt(byteOffset, (int)value);
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 32-bit float at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value float value to set
+     * @param littleEndian (optional) flag indicating whether to write in little endian order
+     * @return undefined
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 2)
+    public static Object setFloat32(final Object self, final Object byteOffset, final Object value, final Object littleEndian) {
+        try {
+            getBuffer(self, littleEndian).putFloat((int)JSType.toUint32(byteOffset), (float)JSType.toNumber(value));
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 32-bit float at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value float value to set
+     * @return undefined
+     */
+    @SpecializedFunction
+    public static Object setFloat32(final Object self, final int byteOffset, final double value) {
+        try {
+            getBuffer(self, false).putFloat(byteOffset, (float)value);
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 32-bit float at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value float value to set
+     * @param littleEndian (optional) flag indicating whether to write in little endian order
+     * @return undefined
+     */
+    @SpecializedFunction
+    public static Object setFloat32(final Object self, final int byteOffset, final double value, final boolean littleEndian) {
+        try {
+            getBuffer(self, littleEndian).putFloat(byteOffset, (float)value);
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 64-bit float at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value double value to set
+     * @param littleEndian (optional) flag indicating whether to write in little endian order
+     * @return undefined
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 2)
+    public static Object setFloat64(final Object self, final Object byteOffset, final Object value, final Object littleEndian) {
+        try {
+            getBuffer(self, littleEndian).putDouble((int)JSType.toUint32(byteOffset), JSType.toNumber(value));
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 64-bit float at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value double value to set
+     * @return undefined
+     */
+    @SpecializedFunction
+    public static Object setFloat64(final Object self, final int byteOffset, final double value) {
+        try {
+            getBuffer(self, false).putDouble(byteOffset, value);
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    /**
+     * Set 64-bit float at the given byteOffset
+     *
+     * @param self DataView object
+     * @param byteOffset byte offset to write at
+     * @param value double value to set
+     * @param littleEndian (optional) flag indicating whether to write in little endian order
+     * @return undefined
+     */
+    @SpecializedFunction
+    public static Object setFloat64(final Object self, final int byteOffset, final double value, final boolean littleEndian) {
+        try {
+            getBuffer(self, littleEndian).putDouble(byteOffset, value);
+            return UNDEFINED;
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.offset");
+        }
+    }
+
+    // internals only below this point
+    private static ByteBuffer bufferFrom(final NativeArrayBuffer nab, final int offset) {
+        try {
+            return nab.getBuffer(offset);
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.constructor.offset");
+        }
+    }
+
+    private static ByteBuffer bufferFrom(final NativeArrayBuffer nab, final int offset, final int length) {
+        try {
+            return nab.getBuffer(offset, length);
+        } catch (final IndexOutOfBoundsException ioe) {
+            throw rangeError(ioe, "dataview.constructor.offset");
+        }
+    }
+
+    private static NativeDataView checkSelf(final Object self) {
+        if (!(self instanceof NativeDataView)) {
+            throw typeError("not.an.arraybuffer", ScriptRuntime.safeToString(self));
+        }
+        return (NativeDataView)self;
+    }
+
+    private static ByteBuffer getBuffer(final Object self) {
+        return checkSelf(self).buf;
+    }
+
+    private static ByteBuffer getBuffer(final Object self, final Object littleEndian) {
+        return getBuffer(self, JSType.toBoolean(littleEndian));
+    }
+
+    private static ByteBuffer getBuffer(final Object self, final boolean littleEndian) {
+        return getBuffer(self).order(littleEndian? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN);
+    }
+}
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java	Tue Apr 01 15:37:15 2014 +0200
@@ -114,10 +114,6 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     private NativeDate(final double time, final ScriptObject proto, final PropertyMap map) {
         super(proto, map);
         final ScriptEnvironment env = Global.getEnv();
@@ -127,7 +123,7 @@
     }
 
     NativeDate(final double time, final Global global) {
-        this(time, global.getDatePrototype(), getInitialMap());
+        this(time, global.getDatePrototype(), $nasgenmap$);
     }
 
     private NativeDate (final double time) {
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeError.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeError.java	Tue Apr 01 15:37:15 2014 +0200
@@ -92,10 +92,6 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     @SuppressWarnings("LeakingThisInConstructor")
     private NativeError(final Object msg, final ScriptObject proto, final PropertyMap map) {
         super(proto, map);
@@ -108,7 +104,7 @@
     }
 
     NativeError(final Object msg, final Global global) {
-        this(msg, global.getErrorPrototype(), getInitialMap());
+        this(msg, global.getErrorPrototype(), $nasgenmap$);
     }
 
     private NativeError(final Object msg) {
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeEvalError.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeEvalError.java	Tue Apr 01 15:37:15 2014 +0200
@@ -62,10 +62,6 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     @SuppressWarnings("LeakingThisInConstructor")
     private NativeEvalError(final Object msg, final ScriptObject proto, final PropertyMap map) {
         super(proto, map);
@@ -78,7 +74,7 @@
     }
 
     NativeEvalError(final Object msg, final Global global) {
-        this(msg, global.getEvalErrorPrototype(), getInitialMap());
+        this(msg, global.getEvalErrorPrototype(), $nasgenmap$);
     }
 
     private NativeEvalError(final Object msg) {
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeJSAdapter.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJSAdapter.java	Tue Apr 01 15:37:15 2014 +0200
@@ -146,10 +146,6 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     NativeJSAdapter(final Object overrides, final ScriptObject adaptee, final ScriptObject proto, final PropertyMap map) {
         super(proto, map);
         this.adaptee = wrapAdaptee(adaptee);
@@ -577,7 +573,7 @@
             proto = global.getJSAdapterPrototype();
         }
 
-        return new NativeJSAdapter(overrides, (ScriptObject)adaptee, (ScriptObject)proto, getInitialMap());
+        return new NativeJSAdapter(overrides, (ScriptObject)adaptee, (ScriptObject)proto, $nasgenmap$);
     }
 
     @Override
@@ -622,7 +618,7 @@
         case "getMethod":
             final FindProperty find = adaptee.findProperty(__call__, true);
             if (find != null) {
-                final Object value = getObjectValue(find);
+                final Object value = find.getObjectValue();
                 if (value instanceof ScriptFunction) {
                     final ScriptFunctionImpl func = (ScriptFunctionImpl)value;
                     // TODO: It's a shame we need to produce a function bound to this and name, when we'd only need it bound
@@ -691,7 +687,7 @@
         final MethodType type = desc.getMethodType();
         if (findData != null) {
             final String name = desc.getNameTokenCount() > 2 ? desc.getNameToken(2) : null;
-            final Object value = getObjectValue(findData);
+            final Object value = findData.getObjectValue();
             if (value instanceof ScriptFunction) {
                 final ScriptFunction func = (ScriptFunction)value;
 
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeJavaImporter.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJavaImporter.java	Tue Apr 01 15:37:15 2014 +0200
@@ -60,17 +60,13 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     private NativeJavaImporter(final Object[] args, final ScriptObject proto, final PropertyMap map) {
         super(proto, map);
         this.args = args;
     }
 
     private NativeJavaImporter(final Object[] args, final Global global) {
-        this(args, global.getJavaImporterPrototype(), getInitialMap());
+        this(args, global.getJavaImporterPrototype(), $nasgenmap$);
     }
 
     private NativeJavaImporter(final Object[] args) {
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeNumber.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeNumber.java	Tue Apr 01 15:37:15 2014 +0200
@@ -34,6 +34,7 @@
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
 import java.text.NumberFormat;
 import java.util.Locale;
 import jdk.internal.dynalink.linker.GuardedInvocation;
@@ -57,7 +58,10 @@
 @ScriptClass("Number")
 public final class NativeNumber extends ScriptObject {
 
-    static final MethodHandle WRAPFILTER = findWrapFilter();
+    // Method handle to create an object wrapper for a primitive number
+    private static final MethodHandle WRAPFILTER = findOwnMH("wrapFilter", MH.type(NativeNumber.class, Object.class));
+    // Method handle to retrieve the Number prototype object
+    private static final MethodHandle PROTOFILTER = findOwnMH("protoFilter", MH.type(Object.class, Object.class));
 
     /** ECMA 15.7.3.2 largest positive finite value */
     @Property(attributes = Attribute.NON_ENUMERABLE_CONSTANT, where = Where.CONSTRUCTOR)
@@ -86,10 +90,6 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     private NativeNumber(final double value, final ScriptObject proto, final PropertyMap map) {
         super(proto, map);
         this.value = value;
@@ -98,7 +98,7 @@
     }
 
     NativeNumber(final double value, final Global global) {
-        this(value, global.getNumberPrototype(), getInitialMap());
+        this(value, global.getNumberPrototype(), $nasgenmap$);
     }
 
     private NativeNumber(final double value) {
@@ -322,7 +322,7 @@
      * @return Link to be invoked at call site.
      */
     public static GuardedInvocation lookupPrimitive(final LinkRequest request, final Object receiver) {
-        return PrimitiveLookup.lookupPrimitive(request, Number.class, new NativeNumber(((Number)receiver).doubleValue()), WRAPFILTER);
+        return PrimitiveLookup.lookupPrimitive(request, Number.class, new NativeNumber(((Number)receiver).doubleValue()), WRAPFILTER, PROTOFILTER);
     }
 
     @SuppressWarnings("unused")
@@ -330,6 +330,11 @@
         return new NativeNumber(((Number)receiver).doubleValue());
     }
 
+    @SuppressWarnings("unused")
+    private static Object protoFilter(final Object object) {
+        return Global.instance().getNumberPrototype();
+    }
+
     private static double getNumberValue(final Object self) {
         if (self instanceof Number) {
             return ((Number)self).doubleValue();
@@ -378,7 +383,7 @@
         return str;
     }
 
-    private static MethodHandle findWrapFilter() {
-        return MH.findStatic(MethodHandles.lookup(), NativeNumber.class, "wrapFilter", MH.type(NativeNumber.class, Object.class));
+    private static MethodHandle findOwnMH(final String name, final MethodType type) {
+        return MH.findStatic(MethodHandles.lookup(), NativeNumber.class, name, type);
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeRangeError.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeRangeError.java	Tue Apr 01 15:37:15 2014 +0200
@@ -62,10 +62,6 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     @SuppressWarnings("LeakingThisInConstructor")
     private NativeRangeError(final Object msg, final ScriptObject proto, final PropertyMap map) {
         super(proto, map);
@@ -78,7 +74,7 @@
     }
 
     NativeRangeError(final Object msg, final Global global) {
-        this(msg, global.getRangeErrorPrototype(), getInitialMap());
+        this(msg, global.getRangeErrorPrototype(), $nasgenmap$);
     }
 
     private NativeRangeError(final Object msg) {
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeReferenceError.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeReferenceError.java	Tue Apr 01 15:37:15 2014 +0200
@@ -62,10 +62,6 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     @SuppressWarnings("LeakingThisInConstructor")
     private NativeReferenceError(final Object msg, final ScriptObject proto, final PropertyMap map) {
         super(proto, map);
@@ -78,7 +74,7 @@
     }
 
     NativeReferenceError(final Object msg, final Global global) {
-        this(msg, global.getReferenceErrorPrototype(), getInitialMap());
+        this(msg, global.getReferenceErrorPrototype(), $nasgenmap$);
     }
 
     private NativeReferenceError(final Object msg) {
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeRegExp.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeRegExp.java	Tue Apr 01 15:37:15 2014 +0200
@@ -70,12 +70,8 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     private NativeRegExp(final Global global) {
-        super(global.getRegExpPrototype(), getInitialMap());
+        super(global.getRegExpPrototype(), $nasgenmap$);
         this.globalObject = global;
     }
 
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java	Tue Apr 01 15:37:15 2014 +0200
@@ -53,12 +53,8 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     NativeRegExpExecResult(final RegExpResult result, final Global global) {
-        super(global.getArrayPrototype(), getInitialMap());
+        super(global.getArrayPrototype(), $nasgenmap$);
         setIsArray();
         this.setArray(ArrayData.allocate(result.getGroups().clone()));
         this.index = result.getIndex();
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeString.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeString.java	Tue Apr 01 15:37:15 2014 +0200
@@ -32,6 +32,7 @@
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
 import java.text.Collator;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -69,21 +70,20 @@
 
     private final CharSequence value;
 
-    static final MethodHandle WRAPFILTER = findWrapFilter();
+    // Method handle to create an object wrapper for a primitive string
+    private static final MethodHandle WRAPFILTER = findOwnMH("wrapFilter", MH.type(NativeString.class, Object.class));
+    // Method handle to retrieve the String prototype object
+    private static final MethodHandle PROTOFILTER = findOwnMH("protoFilter", MH.type(Object.class, Object.class));
 
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     private NativeString(final CharSequence value) {
         this(value, Global.instance());
     }
 
     NativeString(final CharSequence value, final Global global) {
-        this(value, global.getStringPrototype(), getInitialMap());
+        this(value, global.getStringPrototype(), $nasgenmap$);
     }
 
     private NativeString(final CharSequence value, final ScriptObject proto, final PropertyMap map) {
@@ -1199,7 +1199,7 @@
      */
     public static GuardedInvocation lookupPrimitive(final LinkRequest request, final Object receiver) {
         final MethodHandle guard = NashornGuards.getInstanceOf2Guard(String.class, ConsString.class);
-        return PrimitiveLookup.lookupPrimitive(request, guard, new NativeString((CharSequence)receiver), WRAPFILTER);
+        return PrimitiveLookup.lookupPrimitive(request, guard, new NativeString((CharSequence)receiver), WRAPFILTER, PROTOFILTER);
     }
 
     @SuppressWarnings("unused")
@@ -1207,6 +1207,11 @@
         return new NativeString((CharSequence)receiver);
     }
 
+    @SuppressWarnings("unused")
+    private static Object protoFilter(final Object object) {
+        return Global.instance().getStringPrototype();
+    }
+
     private static CharSequence getCharSequence(final Object self) {
         if (self instanceof String || self instanceof ConsString) {
             return (CharSequence)self;
@@ -1254,7 +1259,7 @@
         return key >= 0 && key < value.length();
     }
 
-    private static MethodHandle findWrapFilter() {
-        return MH.findStatic(MethodHandles.lookup(), NativeString.class, "wrapFilter", MH.type(NativeString.class, Object.class));
+    private static MethodHandle findOwnMH(final String name, final MethodType type) {
+        return MH.findStatic(MethodHandles.lookup(), NativeString.class, name, type);
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeSyntaxError.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeSyntaxError.java	Tue Apr 01 15:37:15 2014 +0200
@@ -62,13 +62,9 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     @SuppressWarnings("LeakingThisInConstructor")
     NativeSyntaxError(final Object msg, final Global global) {
-        super(global.getSyntaxErrorPrototype(), getInitialMap());
+        super(global.getSyntaxErrorPrototype(), $nasgenmap$);
         if (msg != UNDEFINED) {
             this.instMessage = JSType.toString(msg);
         } else {
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeTypeError.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeTypeError.java	Tue Apr 01 15:37:15 2014 +0200
@@ -62,13 +62,9 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     @SuppressWarnings("LeakingThisInConstructor")
     NativeTypeError(final Object msg, final Global global) {
-        super(global.getTypeErrorPrototype(), getInitialMap());
+        super(global.getTypeErrorPrototype(), $nasgenmap$);
         if (msg != UNDEFINED) {
             this.instMessage = JSType.toString(msg);
         } else {
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeURIError.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeURIError.java	Tue Apr 01 15:37:15 2014 +0200
@@ -61,13 +61,9 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
-    static PropertyMap getInitialMap() {
-        return $nasgenmap$;
-    }
-
     @SuppressWarnings("LeakingThisInConstructor")
     NativeURIError(final Object msg, final Global global) {
-        super(global.getURIErrorPrototype(), getInitialMap());
+        super(global.getURIErrorPrototype(), $nasgenmap$);
         if (msg != UNDEFINED) {
             this.instMessage = JSType.toString(msg);
         } else {
--- a/nashorn/src/jdk/nashorn/internal/objects/PrototypeObject.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/PrototypeObject.java	Tue Apr 01 15:37:15 2014 +0200
@@ -57,10 +57,6 @@
         map$ = PropertyMap.newMap(properties);
     }
 
-    static PropertyMap getInitialMap() {
-        return map$;
-    }
-
     private PrototypeObject(final Global global, final PropertyMap map) {
         super(global.getObjectPrototype(), map != map$? map.addAll(map$) : map$);
     }
--- a/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java	Tue Apr 01 15:37:15 2014 +0200
@@ -55,27 +55,11 @@
     // property map for non-strict, non-bound functions.
     private static final PropertyMap map$;
 
-    static PropertyMap getInitialMap() {
-        return map$;
-    }
-
-    static PropertyMap getInitialAnonymousMap() {
-        return AnonymousFunction.getInitialMap();
-    }
-
-    static PropertyMap getInitialStrictMap() {
-        return strictmodemap$;
-    }
-
-    static PropertyMap getInitialBoundMap() {
-        return boundfunctionmap$;
-    }
-
     // Marker object for lazily initialized prototype object
     private static final Object LAZY_PROTOTYPE = new Object();
 
     private ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final MethodHandle[] specs, final Global global) {
-        super(name, invokeHandle, getInitialMap(), null, specs, false, true, true);
+        super(name, invokeHandle, map$, null, specs, ScriptFunctionData.IS_BUILTIN_CONSTRUCTOR);
         init(global);
     }
 
@@ -92,7 +76,7 @@
     }
 
     private ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final PropertyMap map, final MethodHandle[] specs, final Global global) {
-        super(name, invokeHandle, map.addAll(getInitialMap()), null, specs, false, true, true);
+        super(name, invokeHandle, map.addAll(map$), null, specs, ScriptFunctionData.IS_BUILTIN_CONSTRUCTOR);
         init(global);
     }
 
@@ -109,8 +93,8 @@
         this(name, invokeHandle, map, specs, Global.instance());
     }
 
-    private ScriptFunctionImpl(final String name, final MethodHandle methodHandle, final ScriptObject scope, final MethodHandle[] specs, final boolean isStrict, final boolean isBuiltin, final boolean isConstructor, final Global global) {
-        super(name, methodHandle, getMap(global, isStrict), scope, specs, isStrict, isBuiltin, isConstructor);
+    private ScriptFunctionImpl(final String name, final MethodHandle methodHandle, final ScriptObject scope, final MethodHandle[] specs, final int flags, final Global global) {
+        super(name, methodHandle, getMap(isStrict(flags)), scope, specs, flags);
         init(global);
     }
 
@@ -121,16 +105,14 @@
      * @param methodHandle handle for invocation
      * @param scope scope object
      * @param specs specialized versions of this method, if available, null otherwise
-     * @param isStrict are we in strict mode
-     * @param isBuiltin is this a built-in function
-     * @param isConstructor can the function be used as a constructor (most can; some built-ins are restricted).
+     * @param flags {@link ScriptFunctionData} flags
      */
-    ScriptFunctionImpl(final String name, final MethodHandle methodHandle, final ScriptObject scope, final MethodHandle[] specs, final boolean isStrict, final boolean isBuiltin, final boolean isConstructor) {
-        this(name, methodHandle, scope, specs, isStrict, isBuiltin, isConstructor, Global.instance());
+    ScriptFunctionImpl(final String name, final MethodHandle methodHandle, final ScriptObject scope, final MethodHandle[] specs, final int flags) {
+        this(name, methodHandle, scope, specs, flags, Global.instance());
     }
 
     private ScriptFunctionImpl(final RecompilableScriptFunctionData data, final ScriptObject scope, final Global global) {
-        super(data, getMap(global, data.isStrict()), scope);
+        super(data, getMap(data.isStrict()), scope);
         init(global);
     }
 
@@ -150,7 +132,7 @@
      * @param global the global object
      */
     ScriptFunctionImpl(final ScriptFunctionData data, final Global global) {
-        super(data, getInitialBoundMap(), null);
+        super(data, boundfunctionmap$, null);
         init(global);
     }
 
@@ -173,9 +155,13 @@
         return newMap;
     }
 
+    private static boolean isStrict(final int flags) {
+        return (flags & ScriptFunctionData.IS_STRICT) != 0;
+    }
+
     // Choose the map based on strict mode!
-    private static PropertyMap getMap(final Global global, final boolean strict) {
-        return strict ? getInitialStrictMap() : getInitialMap();
+    private static PropertyMap getMap(final boolean strict) {
+        return strict ? strictmodemap$ : map$;
     }
 
     private static PropertyMap createBoundFunctionMap(final PropertyMap strictModeMap) {
@@ -189,12 +175,8 @@
     private static class AnonymousFunction extends ScriptFunctionImpl {
         private static final PropertyMap anonmap$ = PropertyMap.newMap();
 
-        static PropertyMap getInitialMap() {
-            return anonmap$;
-        }
-
         AnonymousFunction(final Global global) {
-            super("", GlobalFunctions.ANONYMOUS, getInitialAnonymousMap(), null);
+            super("", GlobalFunctions.ANONYMOUS, anonmap$, null);
         }
     }
 
@@ -211,7 +193,7 @@
      * @return new ScriptFunction
      */
     static ScriptFunction makeFunction(final String name, final MethodHandle methodHandle, final MethodHandle[] specs) {
-        final ScriptFunctionImpl func = new ScriptFunctionImpl(name, methodHandle, null, specs, false, true, false);
+        final ScriptFunctionImpl func = new ScriptFunctionImpl(name, methodHandle, null, specs, ScriptFunctionData.IS_BUILTIN);
         func.setPrototype(UNDEFINED);
         // Non-constructor built-in functions do not have "prototype" property
         func.deleteOwnProperty(func.getMap().findProperty("prototype"));
--- a/nashorn/src/jdk/nashorn/internal/parser/Parser.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/parser/Parser.java	Tue Apr 01 15:37:15 2014 +0200
@@ -1799,6 +1799,7 @@
         case THIS:
             final String name = type.getName();
             next();
+            lc.setFlag(lc.getCurrentFunction(), FunctionNode.USES_THIS);
             return new IdentNode(primaryToken, finish, name);
         case IDENT:
             final IdentNode ident = getIdent();
--- a/nashorn/src/jdk/nashorn/internal/runtime/AccessorProperty.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/AccessorProperty.java	Tue Apr 01 15:37:15 2014 +0200
@@ -141,10 +141,12 @@
     private Class<?> currentType;
 
     /**
-     * Delegate constructor. This is used when adding properties to the Global scope, which
-     * is necessary for outermost levels in a script (the ScriptObject is represented by
-     * a JO-prefixed ScriptObject class, but the properties need to be in the Global scope
-     * and are thus rebound with that as receiver
+     * Delegate constructor for bound properties. This is used for properties created by
+     * {@link ScriptRuntime#mergeScope} and the Nashorn {@code Object.bindProperties} method.
+     * The former is used to add a script's defined globals to the current global scope while
+     * still storing them in a JO-prefixed ScriptObject class.
+     *
+     * <p>All properties created by this constructor have the {@link #IS_BOUND} flag set.</p>
      *
      * @param property  accessor property to rebind
      * @param delegate  delegate object to rebind receiver to
@@ -157,6 +159,8 @@
         this.objectGetter    = bindTo(property.ensureObjectGetter(), delegate);
         this.objectSetter    = bindTo(property.ensureObjectSetter(), delegate);
 
+        // Properties created this way are bound to a delegate
+        this.flags |= IS_BOUND;
         setCurrentType(property.getCurrentType());
     }
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Tue Apr 01 15:37:15 2014 +0200
@@ -36,6 +36,8 @@
 import java.io.PrintWriter;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.SoftReference;
 import java.lang.reflect.Modifier;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -46,6 +48,7 @@
 import java.security.Permissions;
 import java.security.PrivilegedAction;
 import java.security.ProtectionDomain;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicLong;
 import jdk.internal.org.objectweb.asm.ClassReader;
@@ -153,16 +156,19 @@
     /** Is Context global debug mode enabled ? */
     public static final boolean DEBUG = Options.getBooleanProperty("nashorn.debug");
 
-    private static final ThreadLocal<ScriptObject> currentGlobal = new ThreadLocal<>();
+    private static final ThreadLocal<Global> currentGlobal = new ThreadLocal<>();
+
+    // class cache
+    private ClassCache classCache;
 
     /**
      * Get the current global scope
      * @return the current global scope
      */
-    public static ScriptObject getGlobal() {
+    public static Global getGlobal() {
         // This class in a package.access protected package.
         // Trusted code only can call this method.
-        return getGlobalTrusted();
+        return currentGlobal.get();
     }
 
     /**
@@ -171,10 +177,19 @@
      */
     public static void setGlobal(final ScriptObject global) {
         if (global != null && !(global instanceof Global)) {
-            throw new IllegalArgumentException("global is not an instance of Global!");
+            throw new IllegalArgumentException("not a global!");
         }
+        setGlobal((Global)global);
+    }
 
-        setGlobalTrusted(global);
+    /**
+     * Set the current global scope
+     * @param global the global scope
+     */
+    public static void setGlobal(final Global global) {
+        // This class in a package.access protected package.
+        // Trusted code only can call this method.
+        currentGlobal.set(global);
     }
 
     /**
@@ -195,7 +210,7 @@
      * @return error writer of the current context
      */
     public static PrintWriter getCurrentErr() {
-        final ScriptObject global = getGlobalTrusted();
+        final ScriptObject global = getGlobal();
         return (global != null)? global.getContext().getErr() : new PrintWriter(System.err);
     }
 
@@ -348,6 +363,11 @@
             this.classPathLoader = null;
         }
 
+        final int cacheSize = env._class_cache_size;
+        if (cacheSize > 0) {
+            classCache = new ClassCache(cacheSize);
+        }
+
         // print version info if asked.
         if (env._version) {
             getErr().println("nashorn " + Version.version());
@@ -395,7 +415,7 @@
      * @return the property map of the current global scope
      */
     public static PropertyMap getGlobalMap() {
-        return Context.getGlobalTrusted().getMap();
+        return Context.getGlobal().getMap();
     }
 
     /**
@@ -425,7 +445,7 @@
         final String  file       = (location == UNDEFINED || location == null) ? "<eval>" : location.toString();
         final Source  source     = new Source(file, string);
         final boolean directEval = location != UNDEFINED; // is this direct 'eval' call or indirectly invoked eval?
-        final ScriptObject global = Context.getGlobalTrusted();
+        final Global  global = Context.getGlobal();
 
         ScriptObject scope = initialScope;
 
@@ -457,7 +477,7 @@
         // in the caller's environment. A new environment is created!
         if (strictFlag) {
             // Create a new scope object
-            final ScriptObject strictEvalScope = ((GlobalObject)global).newObject();
+            final ScriptObject strictEvalScope = global.newObject();
 
             // bless it as a "scope"
             strictEvalScope.setIsScope();
@@ -582,10 +602,10 @@
      * @throws IOException if source cannot be found or loaded
      */
     public Object loadWithNewGlobal(final Object from, final Object...args) throws IOException {
-        final ScriptObject oldGlobal = getGlobalTrusted();
-        final ScriptObject newGlobal = AccessController.doPrivileged(new PrivilegedAction<ScriptObject>() {
+        final Global oldGlobal = getGlobal();
+        final Global newGlobal = AccessController.doPrivileged(new PrivilegedAction<Global>() {
            @Override
-           public ScriptObject run() {
+           public Global run() {
                try {
                    return newGlobal();
                } catch (final RuntimeException e) {
@@ -598,17 +618,17 @@
         }, CREATE_GLOBAL_ACC_CTXT);
         // initialize newly created Global instance
         initGlobal(newGlobal);
-        setGlobalTrusted(newGlobal);
+        setGlobal(newGlobal);
 
         final Object[] wrapped = args == null? ScriptRuntime.EMPTY_ARRAY :  ScriptObjectMirror.wrapArray(args, oldGlobal);
-        newGlobal.put("arguments", ((GlobalObject)newGlobal).wrapAsObject(wrapped), env._strict);
+        newGlobal.put("arguments", newGlobal.wrapAsObject(wrapped), env._strict);
 
         try {
             // wrap objects from newGlobal's world as mirrors - but if result
             // is from oldGlobal's world, unwrap it!
             return ScriptObjectMirror.unwrap(ScriptObjectMirror.wrap(load(newGlobal, from), newGlobal), oldGlobal);
         } finally {
-            setGlobalTrusted(oldGlobal);
+            setGlobal(oldGlobal);
         }
     }
 
@@ -637,7 +657,7 @@
      * Checks that the given Class can be accessed from no permissions context.
      *
      * @param clazz Class object
-     * @throw SecurityException if not accessible
+     * @throws SecurityException if not accessible
      */
     public static void checkPackageAccess(final Class<?> clazz) {
         final SecurityManager sm = System.getSecurityManager();
@@ -654,12 +674,12 @@
      * Checks that the given package name can be accessed from no permissions context.
      *
      * @param pkgName package name
-     * @throw SecurityException if not accessible
+     * @throws SecurityException if not accessible
      */
     public static void checkPackageAccess(final String pkgName) {
         final SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
-            checkPackageAccess(sm, pkgName.endsWith(".")? pkgName : pkgName + ".");
+            checkPackageAccess(sm, pkgName.endsWith(".") ? pkgName : pkgName + ".");
         }
     }
 
@@ -783,7 +803,7 @@
      *
      * @return the initialized global scope object.
      */
-    public ScriptObject createGlobal() {
+    public Global createGlobal() {
         return initGlobal(newGlobal());
     }
 
@@ -791,7 +811,7 @@
      * Create a new uninitialized global scope object
      * @return the global script object
      */
-    public ScriptObject newGlobal() {
+    public Global newGlobal() {
         return new Global(this);
     }
 
@@ -801,20 +821,16 @@
      * @param global the global
      * @return the initialized global scope object.
      */
-    public ScriptObject initGlobal(final ScriptObject global) {
-        if (! (global instanceof GlobalObject)) {
-            throw new IllegalArgumentException("not a global object!");
-        }
-
+    public Global initGlobal(final Global global) {
         // Need only minimal global object, if we are just compiling.
         if (!env._compile_only) {
-            final ScriptObject oldGlobal = Context.getGlobalTrusted();
+            final Global oldGlobal = Context.getGlobal();
             try {
-                Context.setGlobalTrusted(global);
+                Context.setGlobal(global);
                 // initialize global scope with builtin global objects
-                ((GlobalObject)global).initBuiltinObjects();
+                global.initBuiltinObjects();
             } finally {
-                Context.setGlobalTrusted(oldGlobal);
+                Context.setGlobal(oldGlobal);
             }
         }
 
@@ -822,30 +838,15 @@
     }
 
     /**
-     * Trusted variants - package-private
-     */
-
-    /**
-     * Return the current global scope
-     * @return current global scope
+     * Trusted variant - package-private
      */
-    static ScriptObject getGlobalTrusted() {
-        return currentGlobal.get();
-    }
-
-    /**
-     * Set the current global scope
-     */
-    static void setGlobalTrusted(ScriptObject global) {
-         currentGlobal.set(global);
-    }
 
     /**
      * Return the current global's context
      * @return current global's context
      */
     static Context getContextTrusted() {
-        return Context.getGlobalTrusted().getContext();
+        return ((ScriptObject)Context.getGlobal()).getContext();
     }
 
     /**
@@ -914,7 +915,7 @@
         }
 
         // Package as a JavaScript function and pass function back to shell.
-        return ((GlobalObject)Context.getGlobalTrusted()).newScriptFunction(RUN_SCRIPT.symbolName(), runMethodHandle, scope, strict);
+        return Context.getGlobal().newScriptFunction(RUN_SCRIPT.symbolName(), runMethodHandle, scope, strict);
     }
 
     private ScriptFunction compileScript(final Source source, final ScriptObject scope, final ErrorManager errMan) {
@@ -925,16 +926,10 @@
         // start with no errors, no warnings.
         errMan.reset();
 
-        GlobalObject global = null;
-        Class<?> script;
-
-        if (env._class_cache_size > 0) {
-            global = (GlobalObject)Context.getGlobalTrusted();
-            script = global.findCachedClass(source);
-            if (script != null) {
-                Compiler.LOG.fine("Code cache hit for ", source, " avoiding recompile.");
-                return script;
-            }
+        Class<?> script = findCachedClass(source);
+        if (script != null) {
+            Compiler.LOG.fine("Code cache hit for ", source, " avoiding recompile.");
+            return script;
         }
 
         final FunctionNode functionNode = new Parser(env, source, errMan, strict).parse();
@@ -963,10 +958,7 @@
 
         final FunctionNode newFunctionNode = compiler.compile(functionNode);
         script = compiler.install(newFunctionNode);
-
-        if (global != null) {
-            global.cacheClass(source, script);
-        }
+        cacheClass(source, script);
 
         return script;
     }
@@ -988,4 +980,60 @@
     private long getUniqueScriptId() {
         return uniqueScriptId.getAndIncrement();
     }
+
+    /**
+     * Cache for compiled script classes.
+     */
+    @SuppressWarnings("serial")
+    private static class ClassCache extends LinkedHashMap<Source, ClassReference> {
+        private final int size;
+        private final ReferenceQueue<Class<?>> queue;
+
+        ClassCache(int size) {
+            super(size, 0.75f, true);
+            this.size = size;
+            this.queue = new ReferenceQueue<>();
+        }
+
+        void cache(final Source source, final Class<?> clazz) {
+            put(source, new ClassReference(clazz, queue, source));
+        }
+
+        @Override
+        protected boolean removeEldestEntry(final Map.Entry<Source, ClassReference> eldest) {
+            return size() > size;
+        }
+
+        @Override
+        public ClassReference get(Object key) {
+            for (ClassReference ref; (ref = (ClassReference)queue.poll()) != null; ) {
+                remove(ref.source);
+            }
+            return super.get(key);
+        }
+
+    }
+
+    private static class ClassReference extends SoftReference<Class<?>> {
+        private final Source source;
+
+        ClassReference(final Class<?> clazz, final ReferenceQueue<Class<?>> queue, final Source source) {
+            super(clazz, queue);
+            this.source = source;
+        }
+    }
+
+    // Class cache management
+    private Class<?> findCachedClass(final Source source) {
+        ClassReference ref = classCache == null ? null : classCache.get(source);
+        return ref != null ? ref.get() : null;
+    }
+
+    private void cacheClass(final Source source, final Class<?> clazz) {
+        if (classCache != null) {
+            classCache.cache(source, clazz);
+        }
+    }
+
+
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/DebuggerSupport.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/DebuggerSupport.java	Tue Apr 01 15:37:15 2014 +0200
@@ -75,7 +75,7 @@
      * @return context global.
      */
     static Object getGlobal() {
-        return Context.getGlobalTrusted();
+        return Context.getGlobal();
     }
 
     /**
@@ -87,7 +87,7 @@
      * @return Result of eval as string, or, an exception or null depending on returnException.
      */
     static Object eval(final ScriptObject scope, final Object self, final String string, final boolean returnException) {
-        final ScriptObject global = Context.getGlobalTrusted();
+        final ScriptObject global = Context.getGlobal();
         final ScriptObject initialScope = scope != null ? scope : global;
         final Object callThis = self != null ? self : global;
         final Context context = global.getContext();
--- a/nashorn/src/jdk/nashorn/internal/runtime/ECMAErrors.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ECMAErrors.java	Tue Apr 01 15:37:15 2014 +0200
@@ -31,6 +31,7 @@
 import jdk.nashorn.api.scripting.NashornException;
 import jdk.nashorn.internal.scripts.JS;
 import jdk.nashorn.internal.codegen.CompilerConstants;
+import jdk.nashorn.internal.objects.Global;
 
 /**
  * Helper class to throw various standard "ECMA error" exceptions such as Error, ReferenceError, TypeError etc.
@@ -66,7 +67,7 @@
      * @return the resulting {@link ECMAException}
      */
     public static ECMAException asEcmaException(final ParserException e) {
-        return asEcmaException(Context.getGlobalTrusted(), e);
+        return asEcmaException(Context.getGlobal(), e);
     }
 
     /**
@@ -78,11 +79,11 @@
      *
      * @return the resulting {@link ECMAException}
      */
-    public static ECMAException asEcmaException(final ScriptObject global, final ParserException e) {
+    public static ECMAException asEcmaException(final Global global, final ParserException e) {
         final JSErrorType errorType = e.getErrorType();
         assert errorType != null : "error type for " + e + " was null";
 
-        final GlobalObject globalObj = (GlobalObject)global;
+        final Global globalObj    = global;
         final String       msg    = e.getMessage();
 
         // translate to ECMAScript Error object using error type
@@ -116,7 +117,7 @@
      * @return the resulting {@link ECMAException}
      */
     public static ECMAException syntaxError(final String msgId, final String... args) {
-        return syntaxError(Context.getGlobalTrusted(), msgId, args);
+        return syntaxError(Context.getGlobal(), msgId, args);
     }
 
     /**
@@ -128,7 +129,7 @@
      *
      * @return the resulting {@link ECMAException}
      */
-    public static ECMAException syntaxError(final ScriptObject global, final String msgId, final String... args) {
+    public static ECMAException syntaxError(final Global global, final String msgId, final String... args) {
         return syntaxError(global, null, msgId, args);
     }
 
@@ -142,7 +143,7 @@
      * @return the resulting {@link ECMAException}
      */
     public static ECMAException syntaxError(final Throwable cause, final String msgId, final String... args) {
-        return syntaxError(Context.getGlobalTrusted(), cause, msgId, args);
+        return syntaxError(Context.getGlobal(), cause, msgId, args);
     }
 
     /**
@@ -155,9 +156,9 @@
      *
      * @return the resulting {@link ECMAException}
      */
-    public static ECMAException syntaxError(final ScriptObject global, final Throwable cause, final String msgId, final String... args) {
+    public static ECMAException syntaxError(final Global global, final Throwable cause, final String msgId, final String... args) {
         final String msg = getMessage("syntax.error." + msgId, args);
-        return error(((GlobalObject)global).newSyntaxError(msg), cause);
+        return error(global.newSyntaxError(msg), cause);
     }
 
     /**
@@ -169,7 +170,7 @@
      * @return the resulting {@link ECMAException}
      */
     public static ECMAException typeError(final String msgId, final String... args) {
-        return typeError(Context.getGlobalTrusted(), msgId, args);
+        return typeError(Context.getGlobal(), msgId, args);
     }
 
     /**
@@ -181,7 +182,7 @@
      *
      * @return the resulting {@link ECMAException}
      */
-    public static ECMAException typeError(final ScriptObject global, final String msgId, final String... args) {
+    public static ECMAException typeError(final Global global, final String msgId, final String... args) {
         return typeError(global, null, msgId, args);
     }
 
@@ -195,7 +196,7 @@
      * @return the resulting {@link ECMAException}
      */
     public static ECMAException typeError(final Throwable cause, final String msgId, final String... args) {
-        return typeError(Context.getGlobalTrusted(), cause, msgId, args);
+        return typeError(Context.getGlobal(), cause, msgId, args);
     }
 
     /**
@@ -208,9 +209,9 @@
      *
      * @return the resulting {@link ECMAException}
      */
-    public static ECMAException typeError(final ScriptObject global, final Throwable cause, final String msgId, final String... args) {
+    public static ECMAException typeError(final Global global, final Throwable cause, final String msgId, final String... args) {
         final String msg = getMessage("type.error." + msgId, args);
-        return error(((GlobalObject)global).newTypeError(msg), cause);
+        return error(global.newTypeError(msg), cause);
     }
 
     /**
@@ -222,7 +223,7 @@
      * @return the resulting {@link ECMAException}
      */
     public static ECMAException rangeError(final String msgId, final String... args) {
-        return rangeError(Context.getGlobalTrusted(), msgId, args);
+        return rangeError(Context.getGlobal(), msgId, args);
     }
 
     /**
@@ -234,7 +235,7 @@
      *
      * @return the resulting {@link ECMAException}
      */
-    public static ECMAException rangeError(final ScriptObject global, final String msgId, final String... args) {
+    public static ECMAException rangeError(final Global global, final String msgId, final String... args) {
         return rangeError(global, null, msgId, args);
     }
 
@@ -248,7 +249,7 @@
      * @return the resulting {@link ECMAException}
      */
     public static ECMAException rangeError(final Throwable cause, final String msgId, final String... args) {
-        return rangeError(Context.getGlobalTrusted(), cause, msgId, args);
+        return rangeError(Context.getGlobal(), cause, msgId, args);
     }
 
     /**
@@ -261,9 +262,9 @@
      *
      * @return the resulting {@link ECMAException}
      */
-    public static ECMAException rangeError(final ScriptObject global, final Throwable cause, final String msgId, final String... args) {
+    public static ECMAException rangeError(final Global global, final Throwable cause, final String msgId, final String... args) {
         final String msg = getMessage("range.error." + msgId, args);
-        return error(((GlobalObject)global).newRangeError(msg), cause);
+        return error(global.newRangeError(msg), cause);
     }
 
     /**
@@ -275,7 +276,7 @@
      * @return the resulting {@link ECMAException}
      */
     public static ECMAException referenceError(final String msgId, final String... args) {
-        return referenceError(Context.getGlobalTrusted(), msgId, args);
+        return referenceError(Context.getGlobal(), msgId, args);
     }
 
     /**
@@ -287,7 +288,7 @@
      *
      * @return the resulting {@link ECMAException}
      */
-    public static ECMAException referenceError(final ScriptObject global, final String msgId, final String... args) {
+    public static ECMAException referenceError(final Global global, final String msgId, final String... args) {
         return referenceError(global, null, msgId, args);
     }
 
@@ -301,7 +302,7 @@
      * @return the resulting {@link ECMAException}
      */
     public static ECMAException referenceError(final Throwable cause, final String msgId, final String... args) {
-        return referenceError(Context.getGlobalTrusted(), cause, msgId, args);
+        return referenceError(Context.getGlobal(), cause, msgId, args);
     }
 
     /**
@@ -314,9 +315,9 @@
      *
      * @return the resulting {@link ECMAException}
      */
-    public static ECMAException referenceError(final ScriptObject global, final Throwable cause, final String msgId, final String... args) {
+    public static ECMAException referenceError(final Global global, final Throwable cause, final String msgId, final String... args) {
         final String msg = getMessage("reference.error." + msgId, args);
-        return error(((GlobalObject)global).newReferenceError(msg), cause);
+        return error(global.newReferenceError(msg), cause);
     }
 
     /**
@@ -328,7 +329,7 @@
      * @return the resulting {@link ECMAException}
      */
     public static ECMAException uriError(final String msgId, final String... args) {
-        return uriError(Context.getGlobalTrusted(), msgId, args);
+        return uriError(Context.getGlobal(), msgId, args);
     }
 
     /**
@@ -340,7 +341,7 @@
      *
      * @return the resulting {@link ECMAException}
      */
-    public static ECMAException uriError(final ScriptObject global, final String msgId, final String... args) {
+    public static ECMAException uriError(final Global global, final String msgId, final String... args) {
         return uriError(global, null, msgId, args);
     }
 
@@ -354,7 +355,7 @@
      * @return the resulting {@link ECMAException}
      */
     public static ECMAException uriError(final Throwable cause, final String msgId, final String... args) {
-        return uriError(Context.getGlobalTrusted(), cause, msgId, args);
+        return uriError(Context.getGlobal(), cause, msgId, args);
     }
 
     /**
@@ -367,9 +368,9 @@
      *
      * @return the resulting {@link ECMAException}
      */
-    public static ECMAException uriError(final ScriptObject global, final Throwable cause, final String msgId, final String... args) {
+    public static ECMAException uriError(final Global global, final Throwable cause, final String msgId, final String... args) {
         final String msg = getMessage("uri.error." + msgId, args);
-        return error(((GlobalObject)global).newURIError(msg), cause);
+        return error(global.newURIError(msg), cause);
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/runtime/FinalScriptFunctionData.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/FinalScriptFunctionData.java	Tue Apr 01 15:37:15 2014 +0200
@@ -38,31 +38,27 @@
     /**
      * Constructor - used for bind
      *
-     * @param name          name
-     * @param arity         arity
-     * @param functions     precompiled code
-     * @param isStrict      strict
-     * @param isBuiltin     builtin
-     * @param isConstructor constructor
+     * @param name      name
+     * @param arity     arity
+     * @param functions precompiled code
+     * @param flags     {@link ScriptFunctionData} flags
      */
-    FinalScriptFunctionData(final String name, int arity, CompiledFunctions functions, final boolean isStrict, final boolean isBuiltin, final boolean isConstructor) {
-        super(name, arity, isStrict, isBuiltin, isConstructor);
+    FinalScriptFunctionData(final String name, final int arity, final CompiledFunctions functions, final int flags) {
+        super(name, arity, flags);
         code.addAll(functions);
     }
 
     /**
-     * Constructor - used from ScriptFunction. This assumes that we have code alraedy for the
+     * Constructor - used from ScriptFunction. This assumes that we have code already for the
      * method (typically a native method) and possibly specializations.
      *
-     * @param name           name
-     * @param mh             method handle for generic version of method
-     * @param specs          specializations
-     * @param isStrict       strict
-     * @param isBuiltin      builtin
-     * @param isConstructor  constructor
+     * @param name  name
+     * @param mh    method handle for generic version of method
+     * @param specs specializations
+     * @param flags {@link ScriptFunctionData} flags
      */
-    FinalScriptFunctionData(final String name, final MethodHandle mh, final MethodHandle[] specs, final boolean isStrict, final boolean isBuiltin, final boolean isConstructor) {
-        super(name, arity(mh), isStrict, isBuiltin, isConstructor);
+    FinalScriptFunctionData(final String name, final MethodHandle mh, final MethodHandle[] specs, final int flags) {
+        super(name, arity(mh), flags);
 
         addInvoker(mh);
         if (specs != null) {
--- a/nashorn/src/jdk/nashorn/internal/runtime/GlobalObject.java	Tue Apr 01 07:46:51 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,244 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.runtime;
-
-import java.lang.invoke.MethodHandle;
-import java.util.concurrent.Callable;
-import jdk.internal.dynalink.linker.GuardedInvocation;
-import jdk.internal.dynalink.linker.LinkRequest;
-import jdk.nashorn.internal.runtime.linker.InvokeByName;
-
-/**
- * Runtime interface to the global scope objects.
- */
-
-public interface GlobalObject {
-    /**
-     * Is this global of the given Context?
-     * @param ctxt the context
-     * @return true if this global belongs to the given Context
-     */
-    public boolean isOfContext(final Context ctxt);
-
-    /**
-     * Does this global belong to a strict Context?
-     * @return true if this global belongs to a strict Context
-     */
-    public boolean isStrictContext();
-
-    /**
-     * Initialize standard builtin objects like "Object", "Array", "Function" etc.
-     * as well as our extension builtin objects like "Java", "JSAdapter" as properties
-     * of the global scope object.
-     */
-    public void initBuiltinObjects();
-
-    /**
-     * Wrapper for {@link jdk.nashorn.internal.objects.Global#newScriptFunction(String, MethodHandle, ScriptObject, boolean)}
-     *
-     * @param name   function name
-     * @param handle invocation handle for function
-     * @param scope  the scope
-     * @param strict are we in strict mode
-     *
-     * @return new script function
-     */
-   public ScriptFunction newScriptFunction(String name, MethodHandle handle, ScriptObject scope, boolean strict);
-
-    /**
-     * Wrapper for {@link jdk.nashorn.internal.objects.Global#wrapAsObject(Object)}
-     *
-     * @param obj object to wrap
-     * @return    wrapped object
-     */
-   public Object wrapAsObject(Object obj);
-
-
-    /**
-     * Wrapper for {@link jdk.nashorn.internal.objects.Global#primitiveLookup(LinkRequest, Object)}
-     *
-     * @param request the link request for the dynamic call site.
-     * @param self     self reference
-     *
-     * @return guarded invocation
-     */
-   public GuardedInvocation primitiveLookup(LinkRequest request, Object self);
-
-
-    /**
-     * Wrapper for {@link jdk.nashorn.internal.objects.Global#newObject()}
-     *
-     * @return the new ScriptObject
-     */
-   public ScriptObject newObject();
-
-    /**
-     * Wrapper for {@link jdk.nashorn.internal.objects.Global#isError(ScriptObject)}
-     *
-     * @param sobj to check if it is an error object
-     * @return true if error object
-     */
-   public boolean isError(ScriptObject sobj);
-
-    /**
-     * Wrapper for {@link jdk.nashorn.internal.objects.Global#newError(String)}
-     *
-     * @param msg the error message
-     *
-     * @return the new ScriptObject representing the error
-     */
-   public ScriptObject newError(String msg);
-
-    /**
-     * Wrapper for {@link jdk.nashorn.internal.objects.Global#newEvalError(String)}
-     *
-     * @param msg the error message
-     *
-     * @return the new ScriptObject representing the eval error
-     */
-   public ScriptObject newEvalError(String msg);
-
-    /**
-     * Wrapper for {@link jdk.nashorn.internal.objects.Global#newRangeError(String)}
-     *
-     * @param msg the error message
-     *
-     * @return the new ScriptObject representing the range error
-     */
-   public ScriptObject newRangeError(String msg);
-
-    /**
-     * Wrapper for {@link jdk.nashorn.internal.objects.Global#newReferenceError(String)}
-     *
-     * @param msg the error message
-     *
-     * @return the new ScriptObject representing the reference error
-     */
-   public ScriptObject newReferenceError(String msg);
-
-    /**
-     * Wrapper for {@link jdk.nashorn.internal.objects.Global#newSyntaxError(String)}
-     *
-     * @param msg the error message
-     *
-     * @return the new ScriptObject representing the syntax error
-     */
-   public ScriptObject newSyntaxError(String msg);
-
-    /**
-     * Wrapper for {@link jdk.nashorn.internal.objects.Global#newTypeError(String)}
-     *
-     * @param msg the error message
-     *
-     * @return the new ScriptObject representing the type error
-     */
-   public ScriptObject newTypeError(String msg);
-
-    /**
-     * Wrapper for {@link jdk.nashorn.internal.objects.Global#newURIError(String)}
-     *
-     * @param msg the error message
-     *
-     * @return the new ScriptObject representing the URI error
-     */
-    public ScriptObject newURIError(String msg);
-
-    /**
-     * Wrapper for {@link jdk.nashorn.internal.objects.Global#newGenericDescriptor(boolean, boolean)}
-     *
-     * @param configurable is the described property configurable
-     * @param enumerable   is the described property enumerable
-     *
-     * @return property descriptor
-     */
-    public PropertyDescriptor newGenericDescriptor(boolean configurable, boolean enumerable);
-
-    /**
-     * Wrapper for {@link jdk.nashorn.internal.objects.Global#newDataDescriptor(Object, boolean, boolean, boolean)}
-     *
-     * @param value        data value
-     * @param configurable is the described property configurable
-     * @param enumerable   is the described property enumerable
-     * @param writable     is the described property writable
-     *
-     * @return property descriptor
-     */
-    public PropertyDescriptor newDataDescriptor(Object value, boolean configurable, boolean enumerable, boolean writable);
-
-    /**
-     * Wrapper for {@link jdk.nashorn.internal.objects.Global#newAccessorDescriptor(Object, Object, boolean, boolean)}
-     *
-     * @param get          property getter, or null if none
-     * @param set          property setter, or null if none
-     * @param configurable is the described property configurable
-     * @param enumerable   is the described property enumerable
-     *
-     * @return property descriptor
-     */
-    public PropertyDescriptor newAccessorDescriptor(Object get, Object set, boolean configurable, boolean enumerable);
-
-    /**
-     * Wrapper for {@link jdk.nashorn.internal.objects.Global#getDefaultValue(ScriptObject, Class)}
-     *
-     * @param sobj     script object
-     * @param typeHint type hint
-     *
-     * @return default value
-     */
-    public Object getDefaultValue(ScriptObject sobj, Class<?> typeHint);
-
-    /**
-     * Find the compiled Class for the given script source, if available
-     *
-     * @param source Source object of the script
-     * @return compiled Class object or null
-     */
-    public Class<?> findCachedClass(Source source);
-
-    /**
-     * Put the Source associated Class object in the Source-to-Class cache
-     *
-     * @param source Source of the script
-     * @param clazz compiled Class object for the source
-     */
-    public void cacheClass(Source source, Class<?> clazz);
-
-    /**
-     * Get cached InvokeByName object for the given key
-     * @param key key to be associated with InvokeByName object
-     * @param creator if InvokeByName is absent 'creator' is called to make one (lazy init)
-     * @return InvokeByName object associated with the key.
-     */
-    public InvokeByName getInvokeByName(final Object key, final Callable<InvokeByName> creator);
-
-    /**
-     * Get cached dynamic method handle for the given key
-     * @param key key to be associated with dynamic method handle
-     * @param creator if method handle is absent 'creator' is called to make one (lazy init)
-     * @return dynamic method handle associated with the key.
-     */
-    public MethodHandle getDynamicInvoker(final Object key, final Callable<MethodHandle> creator);
-}
--- a/nashorn/src/jdk/nashorn/internal/runtime/JSONFunctions.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/JSONFunctions.java	Tue Apr 01 15:37:15 2014 +0200
@@ -33,6 +33,7 @@
 import jdk.nashorn.internal.ir.ObjectNode;
 import jdk.nashorn.internal.ir.PropertyNode;
 import jdk.nashorn.internal.ir.UnaryNode;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.parser.JSONParser;
 import jdk.nashorn.internal.parser.TokenType;
 import jdk.nashorn.internal.runtime.arrays.ArrayIndex;
@@ -47,7 +48,7 @@
     private static final Object REVIVER_INVOKER = new Object();
 
     private static MethodHandle getREVIVER_INVOKER() {
-        return ((GlobalObject)Context.getGlobal()).getDynamicInvoker(REVIVER_INVOKER,
+        return Context.getGlobal().getDynamicInvoker(REVIVER_INVOKER,
                 new Callable<MethodHandle>() {
                     @Override
                     public MethodHandle call() {
@@ -88,7 +89,7 @@
             throw ECMAErrors.syntaxError(e, "invalid.json", e.getMessage());
         }
 
-        final ScriptObject global = Context.getGlobalTrusted();
+        final Global global = Context.getGlobal();
         Object unfiltered = convertNode(global, node);
         return applyReviver(global, unfiltered, reviver);
     }
@@ -98,10 +99,10 @@
     // parse helpers
 
     // apply 'reviver' function if available
-    private static Object applyReviver(final ScriptObject global, final Object unfiltered, final Object reviver) {
+    private static Object applyReviver(final Global global, final Object unfiltered, final Object reviver) {
         if (reviver instanceof ScriptFunction) {
-            assert global instanceof GlobalObject;
-            final ScriptObject root = ((GlobalObject)global).newObject();
+            assert global instanceof Global;
+            final ScriptObject root = global.newObject();
             root.addOwnProperty("", Property.WRITABLE_ENUMERABLE_CONFIGURABLE, unfiltered);
             return walk(root, "", (ScriptFunction)reviver);
         }
@@ -138,8 +139,8 @@
     }
 
     // Converts IR node to runtime value
-    private static Object convertNode(final ScriptObject global, final Node node) {
-        assert global instanceof GlobalObject;
+    private static Object convertNode(final Global global, final Node node) {
+        assert global instanceof Global;
 
         if (node instanceof LiteralNode) {
             // check for array literal
@@ -157,7 +158,7 @@
                     for (final Node elem : elements) {
                         values[index++] = JSType.toNumber(convertNode(global, elem));
                     }
-                    return ((GlobalObject)global).wrapAsObject(values);
+                    return global.wrapAsObject(values);
                 }
 
                 final Object[] values = new Object[elements.length];
@@ -167,14 +168,14 @@
                     values[index++] = convertNode(global, elem);
                 }
 
-                return ((GlobalObject)global).wrapAsObject(values);
+                return global.wrapAsObject(values);
             }
 
             return ((LiteralNode<?>)node).getValue();
 
         } else if (node instanceof ObjectNode) {
             final ObjectNode   objNode  = (ObjectNode) node;
-            final ScriptObject object   = ((GlobalObject)global).newObject();
+            final ScriptObject object   = global.newObject();
 
             for (final PropertyNode pNode: objNode.getElements()) {
                 final Node         valueNode = pNode.getValue();
--- a/nashorn/src/jdk/nashorn/internal/runtime/JSType.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/JSType.java	Tue Apr 01 15:37:15 2014 +0200
@@ -36,6 +36,7 @@
 import jdk.internal.dynalink.beans.StaticClass;
 import jdk.nashorn.api.scripting.JSObject;
 import jdk.nashorn.internal.codegen.CompilerConstants.Call;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.parser.Lexer;
 import jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
@@ -852,7 +853,7 @@
      * @return the wrapped object
      */
     public static Object toScriptObject(final Object obj) {
-        return toScriptObject(Context.getGlobalTrusted(), obj);
+        return toScriptObject(Context.getGlobal(), obj);
     }
 
     /**
@@ -865,7 +866,7 @@
      *
      * @return the wrapped object
      */
-    public static Object toScriptObject(final ScriptObject global, final Object obj) {
+    public static Object toScriptObject(final Global global, final Object obj) {
         if (nullOrUndefined(obj)) {
             throw typeError(global, "not.an.object", ScriptRuntime.safeToString(obj));
         }
@@ -874,7 +875,7 @@
             return obj;
         }
 
-        return ((GlobalObject)global).wrapAsObject(obj);
+        return global.wrapAsObject(obj);
     }
 
     /**
@@ -984,7 +985,7 @@
         if (obj instanceof ScriptObject) {
             if (safe) {
                 final ScriptObject sobj = (ScriptObject)obj;
-                final GlobalObject gobj = (GlobalObject)Context.getGlobalTrusted();
+                final Global gobj = Context.getGlobal();
                 return gobj.isError(sobj) ?
                     ECMAException.safeToString(sobj) :
                     sobj.safeToString();
--- a/nashorn/src/jdk/nashorn/internal/runtime/ListAdapter.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ListAdapter.java	Tue Apr 01 15:37:15 2014 +0200
@@ -34,6 +34,7 @@
 import java.util.concurrent.Callable;
 import jdk.nashorn.api.scripting.JSObject;
 import jdk.nashorn.api.scripting.ScriptObjectMirror;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
 import jdk.nashorn.internal.runtime.linker.InvokeByName;
 
@@ -54,7 +55,7 @@
     // These add to the back and front of the list
     private static final Object PUSH    = new Object();
     private static InvokeByName getPUSH() {
-        return ((GlobalObject)Context.getGlobal()).getInvokeByName(PUSH,
+        return Context.getGlobal().getInvokeByName(PUSH,
                 new Callable<InvokeByName>() {
                     @Override
                     public InvokeByName call() {
@@ -65,7 +66,7 @@
 
     private static final Object UNSHIFT = new Object();
     private static InvokeByName getUNSHIFT() {
-        return ((GlobalObject)Context.getGlobal()).getInvokeByName(UNSHIFT,
+        return Context.getGlobal().getInvokeByName(UNSHIFT,
                 new Callable<InvokeByName>() {
                     @Override
                     public InvokeByName call() {
@@ -77,7 +78,7 @@
     // These remove from the back and front of the list
     private static final Object POP = new Object();
     private static InvokeByName getPOP() {
-        return ((GlobalObject)Context.getGlobal()).getInvokeByName(POP,
+        return Context.getGlobal().getInvokeByName(POP,
                 new Callable<InvokeByName>() {
                     @Override
                     public InvokeByName call() {
@@ -88,7 +89,7 @@
 
     private static final Object SHIFT = new Object();
     private static InvokeByName getSHIFT() {
-        return ((GlobalObject)Context.getGlobal()).getInvokeByName(SHIFT,
+        return Context.getGlobal().getInvokeByName(SHIFT,
                 new Callable<InvokeByName>() {
                     @Override
                     public InvokeByName call() {
@@ -100,7 +101,7 @@
     // These insert and remove in the middle of the list
     private static final Object SPLICE_ADD = new Object();
     private static InvokeByName getSPLICE_ADD() {
-        return ((GlobalObject)Context.getGlobal()).getInvokeByName(SPLICE_ADD,
+        return Context.getGlobal().getInvokeByName(SPLICE_ADD,
                 new Callable<InvokeByName>() {
                     @Override
                     public InvokeByName call() {
@@ -111,7 +112,7 @@
 
     private static final Object SPLICE_REMOVE = new Object();
     private static InvokeByName getSPLICE_REMOVE() {
-        return ((GlobalObject)Context.getGlobal()).getInvokeByName(SPLICE_REMOVE,
+        return  Context.getGlobal().getInvokeByName(SPLICE_REMOVE,
                 new Callable<InvokeByName>() {
                     @Override
                     public InvokeByName call() {
--- a/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java	Tue Apr 01 15:37:15 2014 +0200
@@ -35,7 +35,6 @@
 import jdk.internal.dynalink.support.Guards;
 import jdk.nashorn.internal.lookup.MethodHandleFactory;
 import jdk.nashorn.internal.lookup.MethodHandleFunctionality;
-import jdk.nashorn.internal.objects.NativeJava;
 import jdk.nashorn.internal.objects.annotations.Attribute;
 import jdk.nashorn.internal.objects.annotations.Function;
 
@@ -52,7 +51,7 @@
  * var ArrayList = java.util.ArrayList
  * var list = new ArrayList
  * </pre>
- * You can also use {@link NativeJava#type(Object, Object)} to access Java classes. These two statements are mostly
+ * You can also use {@link jdk.nashorn.internal.objects.NativeJava#type(Object, Object)} to access Java classes. These two statements are mostly
  * equivalent:
  * <pre>
  * var listType1 = java.util.ArrayList
--- a/nashorn/src/jdk/nashorn/internal/runtime/ParserException.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ParserException.java	Tue Apr 01 15:37:15 2014 +0200
@@ -26,6 +26,7 @@
 package jdk.nashorn.internal.runtime;
 
 import jdk.nashorn.api.scripting.NashornException;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.parser.Token;
 
 /**
@@ -110,7 +111,7 @@
      * Throw this {@code ParserException} as one of the 7 native JavaScript errors
      * @param global global scope object
      */
-    public void throwAsEcmaException(final ScriptObject global) {
+    public void throwAsEcmaException(final Global global) {
         throw ECMAErrors.asEcmaException(global, this);
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/Property.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Property.java	Tue Apr 01 15:37:15 2014 +0200
@@ -84,9 +84,13 @@
     /** Can this property be undefined? */
     public static final int CAN_BE_UNDEFINED = 1 << 8;
 
-    /* Is this a function declaration property ? */
+    /** Is this a function declaration property ? */
     public static final int IS_FUNCTION_DECLARATION = 1 << 9;
 
+    /** Is this property bound to a receiver? This means get/set operations will be delegated to
+     *  a statically defined object instead of the object passed as callsite parameter. */
+    public static final int IS_BOUND = 1 << 10;
+
     /** Property key. */
     private final String key;
 
@@ -252,6 +256,16 @@
     }
 
     /**
+     * Is this property bound to a receiver? If this method returns {@code true} get and set operations
+     * will be delegated to a statically bound object instead of the object passed as parameter.
+     *
+     * @return true if this is a bound property
+     */
+    public boolean isBound() {
+        return (flags & IS_BOUND) == IS_BOUND;
+    }
+
+    /**
      * Does this property use any slots in the spill array described in
      * {@link Property#isSpill}? In that case how many. Currently a property
      * only uses max one spill slot, but this may change in future representations
--- a/nashorn/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java	Tue Apr 01 15:37:15 2014 +0200
@@ -103,9 +103,7 @@
     public RecompilableScriptFunctionData(final FunctionNode functionNode, final CodeInstaller<ScriptEnvironment> installer, final String allocatorClassName, final PropertyMap allocatorMap) {
         super(functionName(functionNode),
               functionNode.getParameters().size(),
-              functionNode.isStrict(),
-              false,
-              true);
+              getFlags(functionNode));
 
         this.functionNode       = functionNode;
         this.source             = functionNode.getSource();
@@ -129,10 +127,11 @@
         final StringBuilder sb = new StringBuilder();
 
         if (source != null) {
-            sb.append(source.getName())
-                .append(':')
-                .append(functionNode.getLineNumber())
-                .append(' ');
+            sb.append(source.getName());
+            if (functionNode != null) {
+                sb.append(':').append(functionNode.getLineNumber());
+            }
+            sb.append(' ');
         }
 
         return sb.toString() + super.toString();
@@ -159,6 +158,20 @@
         return Token.toDesc(TokenType.FUNCTION, position, length);
     }
 
+    private static int getFlags(final FunctionNode functionNode) {
+        int flags = IS_CONSTRUCTOR;
+        if (functionNode.isStrict()) {
+            flags |= IS_STRICT;
+        }
+        if (functionNode.needsCallee()) {
+            flags |= NEEDS_CALLEE;
+        }
+        if (functionNode.usesThis() || functionNode.hasEval()) {
+            flags |= USES_THIS;
+        }
+        return flags;
+    }
+
     @Override
     ScriptObject allocate(final PropertyMap map) {
         try {
@@ -182,41 +195,42 @@
         return allocatorMap;
     }
 
+
+    @Override
+    protected void ensureCompiled() {
+        if (functionNode != null && functionNode.isLazy()) {
+            Compiler.LOG.info("Trampoline hit: need to do lazy compilation of '", functionNode.getName(), "'");
+            final Compiler compiler = new Compiler(installer);
+            functionNode = compiler.compile(functionNode);
+            assert !functionNode.isLazy();
+            compiler.install(functionNode);
+            flags = getFlags(functionNode);
+        }
+    }
+
     @Override
     protected synchronized void ensureCodeGenerated() {
-         if (!code.isEmpty()) {
-             return; // nothing to do, we have code, at least some.
-         }
+        if (!code.isEmpty()) {
+            return; // nothing to do, we have code, at least some.
+        }
 
-         if (functionNode.isLazy()) {
-             Compiler.LOG.info("Trampoline hit: need to do lazy compilation of '", functionNode.getName(), "'");
-             final Compiler compiler = new Compiler(installer);
-             functionNode = compiler.compile(functionNode);
-             assert !functionNode.isLazy();
-             compiler.install(functionNode);
+        ensureCompiled();
+
+        /*
+         * We can't get to this program point unless we have bytecode, either from
+         * eager compilation or from running a lazy compile on the lines above
+         */
 
-             /*
-              * We don't need to update any flags - varArgs and needsCallee are instrincic
-              * in the function world we need to get a destination node from the compile instead
-              * and replace it with our function node. TODO
-              */
-         }
+        assert functionNode.hasState(CompilationState.EMITTED) : functionNode.getName() + " " + functionNode.getState() + " " + Debug.id(functionNode);
+
+        // code exists - look it up and add it into the automatically sorted invoker list
+        addCode(functionNode);
 
-         /*
-          * We can't get to this program point unless we have bytecode, either from
-          * eager compilation or from running a lazy compile on the lines above
-          */
-
-         assert functionNode.hasState(CompilationState.EMITTED) : functionNode.getName() + " " + functionNode.getState() + " " + Debug.id(functionNode);
-
-         // code exists - look it up and add it into the automatically sorted invoker list
-         addCode(functionNode);
-
-         if (! functionNode.canSpecialize()) {
-             // allow GC to claim IR stuff that is not needed anymore
-             functionNode = null;
-             installer = null;
-         }
+        if (! functionNode.canSpecialize()) {
+            // allow GC to claim IR stuff that is not needed anymore
+            functionNode = null;
+            installer = null;
+        }
     }
 
     private MethodHandle addCode(final FunctionNode fn) {
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java	Tue Apr 01 15:37:15 2014 +0200
@@ -38,6 +38,7 @@
 import jdk.internal.dynalink.linker.LinkRequest;
 import jdk.nashorn.internal.codegen.CompilerConstants.Call;
 import jdk.nashorn.internal.lookup.MethodHandleFactory;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
 import jdk.nashorn.internal.runtime.linker.NashornGuards;
 
@@ -66,6 +67,8 @@
 
     private static final MethodHandle WRAPFILTER = findOwnMH("wrapFilter", Object.class, Object.class);
 
+    private static final MethodHandle GLOBALFILTER = findOwnMH("globalFilter", Object.class, Object.class);
+
     /** method handle to scope getter for this ScriptFunction */
     public static final Call GET_SCOPE = virtualCallNoLookup(ScriptFunction.class, "getScope", ScriptObject.class);
 
@@ -91,9 +94,7 @@
      * @param map           property map
      * @param scope         scope
      * @param specs         specialized version of this function - other method handles
-     * @param strict        is this a strict mode function?
-     * @param builtin       is this a built in function?
-     * @param isConstructor is this a constructor?
+     * @param flags         {@link ScriptFunctionData} flags
      */
     protected ScriptFunction(
             final String name,
@@ -101,11 +102,9 @@
             final PropertyMap map,
             final ScriptObject scope,
             final MethodHandle[] specs,
-            final boolean strict,
-            final boolean builtin,
-            final boolean isConstructor) {
+            final int flags) {
 
-        this(new FinalScriptFunctionData(name, methodHandle, specs, strict, builtin, isConstructor), map, scope);
+        this(new FinalScriptFunctionData(name, methodHandle, specs, flags), map, scope);
     }
 
     /**
@@ -477,7 +476,14 @@
         if (obj instanceof ScriptObject || !ScriptFunctionData.isPrimitiveThis(obj)) {
             return obj;
         }
-        return ((GlobalObject)Context.getGlobalTrusted()).wrapAsObject(obj);
+        return Context.getGlobal().wrapAsObject(obj);
+    }
+
+
+    @SuppressWarnings("unused")
+    private static Object globalFilter(final Object object) {
+        // replace whatever we get with the current global object
+        return Context.getGlobal();
     }
 
     /**
@@ -495,11 +501,11 @@
     @Override
     protected GuardedInvocation findCallMethod(final CallSiteDescriptor desc, final LinkRequest request) {
         final MethodType type = desc.getMethodType();
+        final boolean scopeCall = NashornCallSiteDescriptor.isScope(desc);
 
         if (request.isCallSiteUnstable()) {
-            // (this, callee, args...) => (this, callee, args[])
-            final MethodHandle collector = MH.asCollector(ScriptRuntime.APPLY.methodHandle(), Object[].class,
-                    type.parameterCount() - 2);
+            // (callee, this, args...) => (callee, this, args[])
+            final MethodHandle collector = MH.asCollector(ScriptRuntime.APPLY.methodHandle(), Object[].class, type.parameterCount() - 2);
 
             // If call site is statically typed to take a ScriptFunction, we don't need a guard, otherwise we need a
             // generic "is this a ScriptFunction?" guard.
@@ -510,17 +516,12 @@
         MethodHandle boundHandle;
         MethodHandle guard = null;
 
-        final boolean scopeCall = NashornCallSiteDescriptor.isScope(desc);
-
         if (data.needsCallee()) {
             final MethodHandle callHandle = getBestInvoker(type, request.getArguments());
-            if (scopeCall) {
+            if (scopeCall && needsWrappedThis()) {
                 // Make a handle that drops the passed "this" argument and substitutes either Global or Undefined
-                // (callee, this, args...) => (callee, args...)
-                boundHandle = MH.insertArguments(callHandle, 1, needsWrappedThis() ? Context.getGlobalTrusted() : ScriptRuntime.UNDEFINED);
-                // (callee, args...) => (callee, [this], args...)
-                boundHandle = MH.dropArguments(boundHandle, 1, Object.class);
-
+                // (callee, this, args...) => (callee, [this], args...)
+                boundHandle = MH.filterArguments(callHandle, 1, GLOBALFILTER);
             } else {
                 // It's already (callee, this, args...), just what we need
                 boundHandle = callHandle;
@@ -531,12 +532,12 @@
                 // NOTE: the only built-in named "extend" is NativeJava.extend. As a special-case we're binding the
                 // current lookup as its "this" so it can do security-sensitive creation of adapter classes.
                 boundHandle = MH.dropArguments(MH.bindTo(callHandle, desc.getLookup()), 0, Object.class, Object.class);
-            } else if (scopeCall) {
+            } else if (scopeCall && needsWrappedThis()) {
                 // Make a handle that drops the passed "this" argument and substitutes either Global or Undefined
-                // (this, args...) => (args...)
-                boundHandle = MH.bindTo(callHandle, needsWrappedThis() ? Context.getGlobalTrusted() : ScriptRuntime.UNDEFINED);
-                // (args...) => ([callee], [this], args...)
-                boundHandle = MH.dropArguments(boundHandle, 0, Object.class, Object.class);
+                // (this, args...) => ([this], args...)
+                boundHandle = MH.filterArguments(callHandle, 0, GLOBALFILTER);
+                // ([this], args...) => ([callee], [this], args...)
+                boundHandle = MH.dropArguments(boundHandle, 0, Object.class);
             } else {
                 // (this, args...) => ([callee], this, args...)
                 boundHandle = MH.dropArguments(callHandle, 0, Object.class);
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java	Tue Apr 01 15:37:15 2014 +0200
@@ -32,6 +32,7 @@
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.linker.JavaAdapterFactory;
 
 /**
@@ -47,33 +48,44 @@
     /** All versions of this function that have been generated to code */
     protected final CompiledFunctions code;
 
-    private int arity;
-
-    private final boolean isStrict;
+    /** Function flags */
+    protected int flags;
 
-    private final boolean isBuiltin;
-
-    private final boolean isConstructor;
+    private int arity;
 
     private static final MethodHandle NEWFILTER     = findOwnMH("newFilter", Object.class, Object.class, Object.class);
     private static final MethodHandle BIND_VAR_ARGS = findOwnMH("bindVarArgs", Object[].class, Object[].class, Object[].class);
 
+    /** Is this a strict mode function? */
+    public static final int IS_STRICT      = 1 << 0;
+    /** Is this a built-in function? */
+    public static final int IS_BUILTIN     = 1 << 1;
+    /** Is this a constructor function? */
+    public static final int IS_CONSTRUCTOR = 1 << 2;
+    /** Does this function expect a callee argument? */
+    public static final int NEEDS_CALLEE   = 1 << 3;
+    /** Does this function make use of the this-object argument? */
+    public static final int USES_THIS      = 1 << 4;
+
+    /** Flag for strict or built-in functions */
+    public static final int IS_STRICT_OR_BUILTIN = IS_STRICT | IS_BUILTIN;
+    /** Flag for built-in constructors */
+    public static final int IS_BUILTIN_CONSTRUCTOR = IS_BUILTIN | IS_CONSTRUCTOR;
+    /** Flag for strict constructors */
+    public static final int IS_STRICT_CONSTRUCTOR = IS_STRICT | IS_CONSTRUCTOR;
+
     /**
      * Constructor
      *
      * @param name          script function name
      * @param arity         arity
-     * @param isStrict      is the function strict
-     * @param isBuiltin     is the function built in
-     * @param isConstructor is the function a constructor
+     * @param flags         the function flags
      */
-    ScriptFunctionData(final String name, final int arity, final boolean isStrict, final boolean isBuiltin, final boolean isConstructor) {
-        this.name          = name;
-        this.arity         = arity;
-        this.code          = new CompiledFunctions();
-        this.isStrict      = isStrict;
-        this.isBuiltin     = isBuiltin;
-        this.isConstructor = isConstructor;
+    ScriptFunctionData(final String name, final int arity, final int flags) {
+        this.name  = name;
+        this.arity = arity;
+        this.code  = new CompiledFunctions();
+        this.flags = flags;
     }
 
     final int getArity() {
@@ -105,21 +117,21 @@
      * @return true if strict, false otherwise
      */
     public boolean isStrict() {
-        return isStrict;
+        return (flags & IS_STRICT) != 0;
     }
 
     boolean isBuiltin() {
-        return isBuiltin;
+        return (flags & IS_BUILTIN) != 0;
     }
 
     boolean isConstructor() {
-        return isConstructor;
+        return (flags & IS_CONSTRUCTOR) != 0;
     }
 
     boolean needsCallee() {
-        // we don't know if we need a callee or not unless we are generated
-        ensureCodeGenerated();
-        return code.needsCallee();
+        // we don't know if we need a callee or not unless code has been compiled
+        ensureCompiled();
+        return (flags & NEEDS_CALLEE) != 0;
     }
 
     /**
@@ -128,7 +140,7 @@
      * @return true if this argument must be an object
      */
     boolean needsWrappedThis() {
-        return !isStrict && !isBuiltin;
+        return (flags & USES_THIS) != 0 && (flags & IS_STRICT_OR_BUILTIN) == 0;
     }
 
     String toSource() {
@@ -202,6 +214,15 @@
     }
 
     /**
+     * If we can have lazy code generation, this is a hook to ensure that the code has been compiled.
+     * This does not guarantee the code been installed in this {@code ScriptFunctionData} instance;
+     * use {@link #ensureCodeGenerated()} to install the actual method handles.
+     */
+    protected void ensureCompiled() {
+        //empty
+    }
+
+    /**
      * Return a generic Object/Object invoker for this method. It will ensure code
      * is generated, get the most generic of all versions of this function and adapt it
      * to Objects.
@@ -259,6 +280,8 @@
 
         final Object[] allArgs = args == null ? ScriptRuntime.EMPTY_ARRAY : args;
         final int length = args == null ? 0 : args.length;
+        // Clear the callee and this flags
+        final int boundFlags = flags & ~NEEDS_CALLEE & ~USES_THIS;
 
         CompiledFunctions boundList = new CompiledFunctions();
         if (code.size() == 1) {
@@ -273,8 +296,7 @@
             boundList.add(bind(inv, fn, self, allArgs));
         }
 
-        ScriptFunctionData boundData = new FinalScriptFunctionData(name, arity == -1 ? -1 : Math.max(0, arity - length), boundList, isStrict(), isBuiltin(), isConstructor());
-        return boundData;
+        return new FinalScriptFunctionData(name, arity == -1 ? -1 : Math.max(0, arity - length), boundList, boundFlags);
     }
 
     /**
@@ -351,11 +373,11 @@
     private Object convertThisObject(final Object thiz) {
         if (!(thiz instanceof ScriptObject) && needsWrappedThis()) {
             if (JSType.nullOrUndefined(thiz)) {
-                return Context.getGlobalTrusted();
+                return Context.getGlobal();
             }
 
             if (isPrimitiveThis(thiz)) {
-                return ((GlobalObject)Context.getGlobalTrusted()).wrapAsObject(thiz);
+                return Context.getGlobal().wrapAsObject(thiz);
             }
         }
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Tue Apr 01 15:37:15 2014 +0200
@@ -66,6 +66,7 @@
 import jdk.nashorn.internal.lookup.MethodHandleFactory;
 import jdk.nashorn.internal.objects.AccessorPropertyDescriptor;
 import jdk.nashorn.internal.objects.DataPropertyDescriptor;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 import jdk.nashorn.internal.runtime.arrays.ArrayIndex;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
@@ -131,7 +132,8 @@
 
     static final MethodHandle GETPROTO           = findOwnMH("getProto", ScriptObject.class);
     static final MethodHandle SETPROTOCHECK      = findOwnMH("setProtoCheck", void.class, Object.class);
-    static final MethodHandle MEGAMORPHIC_GET    = findOwnMH("megamorphicGet", Object.class, String.class, boolean.class);
+    static final MethodHandle MEGAMORPHIC_GET    = findOwnMH("megamorphicGet", Object.class, String.class, boolean.class, boolean.class);
+    static final MethodHandle GLOBALFILTER       = findOwnMH("globalFilter", Object.class, Object.class);
 
     static final MethodHandle SETFIELD           = findOwnMH("setField",         void.class, CallSiteDescriptor.class, PropertyMap.class, PropertyMap.class, MethodHandle.class, Object.class, Object.class);
     static final MethodHandle SETSPILL           = findOwnMH("setSpill",         void.class, CallSiteDescriptor.class, PropertyMap.class, PropertyMap.class, int.class, Object.class, Object.class);
@@ -225,6 +227,7 @@
             final Property oldProp = newMap.findProperty(key);
             if (oldProp == null) {
                 if (property instanceof UserAccessorProperty) {
+                    // Note: we copy accessor functions to this object which is semantically different from binding.
                     final UserAccessorProperty prop = this.newUserAccessors(key, property.getFlags(), property.getGetterFunction(source), property.getSetterFunction(source));
                     newMap = newMap.addPropertyNoHistory(prop);
                 } else {
@@ -322,18 +325,18 @@
       * @return property descriptor
       */
     public final PropertyDescriptor toPropertyDescriptor() {
-        final GlobalObject global = (GlobalObject) Context.getGlobalTrusted();
+        final Global global = Context.getGlobal();
 
         final PropertyDescriptor desc;
         if (isDataDescriptor()) {
             if (has(SET) || has(GET)) {
-                throw typeError((ScriptObject)global, "inconsistent.property.descriptor");
+                throw typeError(global, "inconsistent.property.descriptor");
             }
 
             desc = global.newDataDescriptor(UNDEFINED, false, false, false);
         } else if (isAccessorDescriptor()) {
             if (has(VALUE) || has(WRITABLE)) {
-                throw typeError((ScriptObject)global, "inconsistent.property.descriptor");
+                throw typeError(global, "inconsistent.property.descriptor");
             }
 
             desc = global.newAccessorDescriptor(UNDEFINED, UNDEFINED, false, false);
@@ -352,7 +355,7 @@
      *
      * @return property descriptor
      */
-    public static PropertyDescriptor toPropertyDescriptor(final ScriptObject global, final Object obj) {
+    public static PropertyDescriptor toPropertyDescriptor(final Global global, final Object obj) {
         if (obj instanceof ScriptObject) {
             return ((ScriptObject)obj).toPropertyDescriptor();
         }
@@ -371,7 +374,7 @@
     public Object getOwnPropertyDescriptor(final String key) {
         final Property property = getMap().findProperty(key);
 
-        final GlobalObject global = (GlobalObject)Context.getGlobalTrusted();
+        final Global global = Context.getGlobal();
 
         if (property != null) {
             final ScriptFunction get   = property.getGetterFunction(this);
@@ -436,7 +439,7 @@
      * @return true if property was successfully defined
      */
     public boolean defineOwnProperty(final String key, final Object propertyDesc, final boolean reject) {
-        final ScriptObject       global  = Context.getGlobalTrusted();
+        final Global             global  = Context.getGlobal();
         final PropertyDescriptor desc    = toPropertyDescriptor(global, propertyDesc);
         final Object             current = getOwnPropertyDescriptor(key);
         final String             name    = JSType.toString(key);
@@ -634,7 +637,7 @@
         final int propFlags = Property.toFlags(pdesc);
 
         if (pdesc.type() == PropertyDescriptor.GENERIC) {
-            final GlobalObject global = (GlobalObject) Context.getGlobalTrusted();
+            final Global global = Context.getGlobal();
             final PropertyDescriptor dDesc = global.newDataDescriptor(UNDEFINED, false, false, false);
 
             dDesc.fillFrom((ScriptObject)pdesc);
@@ -975,17 +978,6 @@
     }
 
     /**
-      * Get the object value of a property
-      *
-      * @param find {@link FindProperty} lookup result
-      *
-      * @return the value of the property
-      */
-    protected static Object getObjectValue(final FindProperty find) {
-        return find.getObjectValue();
-    }
-
-    /**
      * Return methodHandle of value function for call.
      *
      * @param find      data from find property.
@@ -995,7 +987,7 @@
      * @return value of property as a MethodHandle or null.
      */
     protected MethodHandle getCallMethodHandle(final FindProperty find, final MethodType type, final String bindName) {
-        return getCallMethodHandle(getObjectValue(find), type, bindName);
+        return getCallMethodHandle(find.getObjectValue(), type, bindName);
     }
 
     /**
@@ -1019,7 +1011,7 @@
      * @return Value of property.
      */
     public final Object getWithProperty(final Property property) {
-        return getObjectValue(new FindProperty(this, this, property));
+        return new FindProperty(this, this, property).getObjectValue();
     }
 
     /**
@@ -1158,7 +1150,7 @@
             }
             setProto((ScriptObject)newProto);
         } else {
-            final ScriptObject global = Context.getGlobalTrusted();
+            final Global global = Context.getGlobal();
             final Object  newProtoObject = JSType.toScriptObject(global, newProto);
 
             if (newProtoObject instanceof ScriptObject) {
@@ -1248,11 +1240,11 @@
      * @return the default value
      */
     public Object getDefaultValue(final Class<?> typeHint) {
-        // We delegate to GlobalObject, as the implementation uses dynamic call sites to invoke object's "toString" and
+        // We delegate to Global, as the implementation uses dynamic call sites to invoke object's "toString" and
         // "valueOf" methods, and in order to avoid those call sites from becoming megamorphic when multiple contexts
         // are being executed in a long-running program, we move the code and their associated dynamic call sites
         // (Global.TO_STRING and Global.VALUE_OF) into per-context code.
-        return ((GlobalObject)Context.getGlobalTrusted()).getDefaultValue(this, typeHint);
+        return Context.getGlobal().getDefaultValue(this, typeHint);
     }
 
     /**
@@ -1740,7 +1732,7 @@
     protected GuardedInvocation findGetMethod(final CallSiteDescriptor desc, final LinkRequest request, final String operator) {
         final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND);
         if (request.isCallSiteUnstable() || hasWithScope()) {
-            return findMegaMorphicGetMethod(desc, name, "getMethod".equals(operator));
+            return findMegaMorphicGetMethod(desc, name, "getMethod".equals(operator), isScope() && NashornCallSiteDescriptor.isScope(desc));
         }
 
         final FindProperty find = findProperty(name, true);
@@ -1765,9 +1757,8 @@
         final Property property = find.getProperty();
         methodHandle = find.getGetter(returnType);
 
-        final boolean noGuard = ObjectClassGenerator.OBJECT_FIELDS_ONLY && NashornCallSiteDescriptor.isFastScope(desc) && !property.canChangeType();
-        // getMap() is fine as we have the prototype switchpoint depending on where the property was found
-        final MethodHandle guard = noGuard ? null : NashornGuards.getMapGuard(getMap());
+        // Get the appropriate guard for this callsite and property.
+        final MethodHandle guard = NashornGuards.getGuard(this, property, desc);
         final ScriptObject owner = find.getOwner();
 
         if (methodHandle != null) {
@@ -1777,31 +1768,32 @@
             }
 
             if (!property.hasGetterFunction(owner)) {
-                // If not a scope bind to actual prototype as changing prototype will change the property map.
-                // For scopes we install a filter that replaces the self object with the prototype owning the property.
-                methodHandle = isScope() ?
-                        addProtoFilter(methodHandle, find.getProtoChainLength()) :
-                        bindTo(methodHandle, owner);
+                // Add a filter that replaces the self object with the prototype owning the property.
+                methodHandle = addProtoFilter(methodHandle, find.getProtoChainLength());
             }
-            return new GuardedInvocation(methodHandle, noGuard ? null : getProtoSwitchPoint(name, owner), guard);
+            return new GuardedInvocation(methodHandle, guard == null ? null : getProtoSwitchPoint(name, owner), guard);
         }
 
         assert !NashornCallSiteDescriptor.isFastScope(desc);
         return new GuardedInvocation(Lookup.emptyGetter(returnType), getProtoSwitchPoint(name, owner), guard);
     }
 
-    private static GuardedInvocation findMegaMorphicGetMethod(final CallSiteDescriptor desc, final String name, final boolean isMethod) {
-        final MethodHandle invoker = MH.insertArguments(MEGAMORPHIC_GET, 1, name, isMethod);
+    private static GuardedInvocation findMegaMorphicGetMethod(final CallSiteDescriptor desc, final String name,
+                                                              final boolean isMethod, final boolean isScope) {
+        final MethodHandle invoker = MH.insertArguments(MEGAMORPHIC_GET, 1, name, isMethod, isScope);
         final MethodHandle guard = getScriptObjectGuard(desc.getMethodType());
         return new GuardedInvocation(invoker, guard);
     }
 
     @SuppressWarnings("unused")
-    private Object megamorphicGet(final String key, final boolean isMethod) {
+    private Object megamorphicGet(final String key, final boolean isMethod, final boolean isScope) {
         final FindProperty find = findProperty(key, true);
 
         if (find != null) {
-            return getObjectValue(find);
+            return find.getObjectValue();
+        }
+        if (isScope) {
+            throw referenceError("not.defined", key);
         }
 
         return isMethod ? getNoSuchMethod(key) : invokeNoSuchProperty(key);
@@ -1996,6 +1988,15 @@
         }
     }
 
+    @SuppressWarnings("unused")
+    private static Object globalFilter(final Object object) {
+        ScriptObject sobj = (ScriptObject) object;
+        while (sobj != null && !(sobj instanceof Global)) {
+            sobj = sobj.getProto();
+        }
+        return sobj;
+    }
+
     private static GuardedInvocation findMegaMorphicSetMethod(final CallSiteDescriptor desc, final String name) {
         final MethodType type = desc.getMethodType().insertParameterTypes(1, Object.class);
         final GuardedInvocation inv = findSetIndexMethod(type, NashornCallSiteDescriptor.isStrict(desc));
@@ -2041,7 +2042,7 @@
             return noSuchProperty(desc, request);
         }
 
-        final Object value = getObjectValue(find);
+        final Object value = find.getObjectValue();
         if (! (value instanceof ScriptFunction)) {
             return createEmptyGetter(desc, name);
         }
@@ -2067,7 +2068,7 @@
         final boolean scopeAccess = isScope() && NashornCallSiteDescriptor.isScope(desc);
 
         if (find != null) {
-            final Object   value        = getObjectValue(find);
+            final Object   value        = find.getObjectValue();
             ScriptFunction func         = null;
             MethodHandle   methodHandle = null;
 
@@ -2102,7 +2103,7 @@
         final FindProperty find = findProperty(NO_SUCH_PROPERTY_NAME, true);
 
         if (find != null) {
-            final Object func = getObjectValue(find);
+            final Object func = find.getObjectValue();
 
             if (func instanceof ScriptFunction) {
                 return ScriptRuntime.apply((ScriptFunction)func, this, name);
@@ -2124,7 +2125,7 @@
             return invokeNoSuchProperty(name);
         }
 
-        final Object value = getObjectValue(find);
+        final Object value = find.getObjectValue();
         if (! (value instanceof ScriptFunction)) {
             return UNDEFINED;
         }
@@ -2664,7 +2665,7 @@
                     final FindProperty find = object.findProperty(key, false, false, this);
 
                     if (find != null) {
-                        return getObjectValue(find);
+                        return find.getObjectValue();
                     }
                 }
 
@@ -2682,7 +2683,7 @@
             final FindProperty find = findProperty(key, true);
 
             if (find != null) {
-                return getObjectValue(find);
+                return find.getObjectValue();
             }
         }
 
@@ -2823,7 +2824,15 @@
                 throw typeError("object.non.extensible", key, ScriptRuntime.safeToString(this));
             }
         } else {
-            spill(key, value);
+            ScriptObject sobj = this;
+            // undefined scope properties are set in the global object.
+            if (isScope()) {
+                while (sobj != null && !(sobj instanceof Global)) {
+                    sobj = sobj.getProto();
+                }
+                assert sobj != null : "no parent global object in scope";
+            }
+            sobj.spill(key, value);
         }
     }
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Tue Apr 01 15:37:15 2014 +0200
@@ -474,7 +474,7 @@
      * @return {@link WithObject} that is the new scope
      */
     public static ScriptObject openWith(final ScriptObject scope, final Object expression) {
-        final ScriptObject global = Context.getGlobalTrusted();
+        final Global global = Context.getGlobal();
         if (expression == UNDEFINED) {
             throw typeError(global, "cant.apply.with.to.undefined");
         } else if (expression == null) {
--- a/nashorn/src/jdk/nashorn/internal/runtime/SetMethodCreator.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/SetMethodCreator.java	Tue Apr 01 15:37:15 2014 +0200
@@ -31,7 +31,6 @@
 import java.lang.invoke.MethodHandle;
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.linker.GuardedInvocation;
-import jdk.nashorn.internal.codegen.ObjectClassGenerator;
 import jdk.nashorn.internal.lookup.Lookup;
 import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
 import jdk.nashorn.internal.runtime.linker.NashornGuards;
@@ -104,21 +103,9 @@
          * @return the composed guarded invocation that represents the dynamic setter method for the property.
          */
         GuardedInvocation createGuardedInvocation() {
-            return new GuardedInvocation(methodHandle, getGuard());
-        }
-
-        private MethodHandle getGuard() {
-            return needsNoGuard() ? null : NashornGuards.getMapGuard(getMap());
+            return new GuardedInvocation(methodHandle, NashornGuards.getGuard(sobj, property, desc));
         }
 
-        private boolean needsNoGuard() {
-            return NashornCallSiteDescriptor.isFastScope(desc) &&
-                    (ObjectClassGenerator.OBJECT_FIELDS_ONLY || isPropertyTypeStable());
-        }
-
-        private boolean isPropertyTypeStable() {
-            return property == null || !property.canChangeType();
-        }
     }
 
     private SetMethod createSetMethod() {
@@ -153,10 +140,7 @@
 
         final MethodHandle boundHandle;
         if (!property.hasSetterFunction(find.getOwner()) && find.isInherited()) {
-            // Bind or add prototype filter depending on whether this is a scope object.
-            boundHandle = sobj.isScope() ?
-                    ScriptObject.addProtoFilter(methodHandle, find.getProtoChainLength()):
-                    ScriptObject.bindTo(methodHandle, find.getOwner());
+            boundHandle = ScriptObject.addProtoFilter(methodHandle, find.getProtoChainLength());
         } else {
             boundHandle = methodHandle;
         }
@@ -164,8 +148,8 @@
     }
 
     private SetMethod createGlobalPropertySetter() {
-        final ScriptObject global = Context.getGlobalTrusted();
-        return new SetMethod(ScriptObject.bindTo(global.addSpill(getName()), global), null);
+        final ScriptObject global = Context.getGlobal();
+        return new SetMethod(MH.filterArguments(global.addSpill(getName()), 0, ScriptObject.GLOBALFILTER), null);
     }
 
     private SetMethod createNewPropertySetter() {
--- a/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java	Tue Apr 01 15:37:15 2014 +0200
@@ -34,6 +34,7 @@
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
 
 import static jdk.nashorn.internal.codegen.CompilerConstants.staticCall;
+import jdk.nashorn.internal.objects.Global;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
 
@@ -73,7 +74,7 @@
 
     private static MethodHandle getINVOKE_UA_GETTER() {
 
-        return ((GlobalObject)Context.getGlobal()).getDynamicInvoker(INVOKE_UA_GETTER,
+        return Context.getGlobal().getDynamicInvoker(INVOKE_UA_GETTER,
                 new Callable<MethodHandle>() {
                     @Override
                     public MethodHandle call() {
@@ -86,7 +87,7 @@
     /** Dynamic invoker for setter */
     private static Object INVOKE_UA_SETTER = new Object();
     private static MethodHandle getINVOKE_UA_SETTER() {
-        return ((GlobalObject)Context.getGlobal()).getDynamicInvoker(INVOKE_UA_SETTER,
+        return Context.getGlobal().getDynamicInvoker(INVOKE_UA_SETTER,
                 new Callable<MethodHandle>() {
                     @Override
                     public MethodHandle call() {
--- a/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java	Tue Apr 01 15:37:15 2014 +0200
@@ -88,6 +88,11 @@
 
     @Override
     public GuardedInvocation lookup(final CallSiteDescriptor desc, final LinkRequest request) {
+        if (request.isCallSiteUnstable()) {
+            // Fall back to megamorphic invocation which performs a complete lookup each time without further relinking.
+            return super.lookup(desc, request);
+        }
+
         // With scopes can never be observed outside of Nashorn code, so all call sites that can address it will of
         // necessity have a Nashorn descriptor - it is safe to cast.
         final NashornCallSiteDescriptor ndesc = (NashornCallSiteDescriptor)desc;
@@ -265,7 +270,7 @@
     }
 
     private static MethodHandle filter(final MethodHandle mh, final MethodHandle filter) {
-        return MH.filterArguments(mh, 0, filter);
+        return MH.filterArguments(mh, 0, filter.asType(filter.type().changeReturnType(mh.type().parameterType(0))));
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Tue Apr 01 15:37:15 2014 +0200
@@ -27,7 +27,7 @@
 
 import java.lang.invoke.MethodHandle;
 import java.nio.ByteBuffer;
-import jdk.nashorn.internal.runtime.GlobalObject;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.PropertyDescriptor;
 
@@ -399,7 +399,7 @@
      *
      * @return property descriptor for element
      */
-    public PropertyDescriptor getDescriptor(final GlobalObject global, final int index) {
+    public PropertyDescriptor getDescriptor(final Global global, final int index) {
         return global.newDataDescriptor(getObject(index), true, true, true);
     }
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ByteBufferArrayData.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ByteBufferArrayData.java	Tue Apr 01 15:37:15 2014 +0200
@@ -27,7 +27,7 @@
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 
 import java.nio.ByteBuffer;
-import jdk.nashorn.internal.runtime.GlobalObject;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.PropertyDescriptor;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 
@@ -60,7 +60,8 @@
      *
      * @return property descriptor for element
      */
-    public PropertyDescriptor getDescriptor(final GlobalObject global, final int index) {
+    @Override
+    public PropertyDescriptor getDescriptor(final Global global, final int index) {
         // make the index properties not configurable
         return global.newDataDescriptor(getObject(index), false, true, true);
     }
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/FrozenArrayFilter.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/FrozenArrayFilter.java	Tue Apr 01 15:37:15 2014 +0200
@@ -25,9 +25,9 @@
 
 package jdk.nashorn.internal.runtime.arrays;
 
+import jdk.nashorn.internal.objects.Global;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 
-import jdk.nashorn.internal.runtime.GlobalObject;
 import jdk.nashorn.internal.runtime.PropertyDescriptor;
 
 /**
@@ -44,7 +44,7 @@
     }
 
     @Override
-    public PropertyDescriptor getDescriptor(final GlobalObject global, final int index) {
+    public PropertyDescriptor getDescriptor(final Global global, final int index) {
         return global.newDataDescriptor(getObject(index), false, true, false);
     }
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/SealedArrayFilter.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/SealedArrayFilter.java	Tue Apr 01 15:37:15 2014 +0200
@@ -25,9 +25,9 @@
 
 package jdk.nashorn.internal.runtime.arrays;
 
+import jdk.nashorn.internal.objects.Global;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 
-import jdk.nashorn.internal.runtime.GlobalObject;
 import jdk.nashorn.internal.runtime.PropertyDescriptor;
 
 /**
@@ -62,7 +62,7 @@
     }
 
     @Override
-    public PropertyDescriptor getDescriptor(final GlobalObject global, final int index) {
+    public PropertyDescriptor getDescriptor(final Global global, final int index) {
         return global.newDataDescriptor(getObject(index), false, true, true);
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Tue Apr 01 15:37:15 2014 +0200
@@ -64,6 +64,7 @@
 import jdk.internal.org.objectweb.asm.Opcodes;
 import jdk.internal.org.objectweb.asm.Type;
 import jdk.internal.org.objectweb.asm.commons.InstructionAdapter;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
@@ -134,6 +135,7 @@
     static final Type CONTEXT_TYPE       = Type.getType(Context.class);
     static final Type OBJECT_TYPE        = Type.getType(Object.class);
     static final Type SCRIPT_OBJECT_TYPE = Type.getType(ScriptObject.class);
+    static final Type GLOBAL_TYPE        = Type.getType(Global.class);
 
     static final String CONTEXT_TYPE_NAME = CONTEXT_TYPE.getInternalName();
     static final String OBJECT_TYPE_NAME  = OBJECT_TYPE.getInternalName();
@@ -143,8 +145,10 @@
     static final String GLOBAL_FIELD_NAME = "global";
 
     static final String SCRIPT_OBJECT_TYPE_DESCRIPTOR = SCRIPT_OBJECT_TYPE.getDescriptor();
+    static final String GLOBAL_TYPE_DESCRIPTOR = GLOBAL_TYPE.getDescriptor();
 
-    static final String SET_GLOBAL_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.VOID_TYPE, SCRIPT_OBJECT_TYPE);
+
+    static final String SET_GLOBAL_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.VOID_TYPE, GLOBAL_TYPE);
     static final String VOID_NOARG_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.VOID_TYPE);
 
     private static final Type SCRIPT_FUNCTION_TYPE = Type.getType(ScriptFunction.class);
@@ -167,7 +171,7 @@
     private static final String UNSUPPORTED_OPERATION_TYPE_NAME = UNSUPPORTED_OPERATION_TYPE.getInternalName();
 
     private static final String METHOD_HANDLE_TYPE_DESCRIPTOR = METHOD_HANDLE_TYPE.getDescriptor();
-    private static final String GET_GLOBAL_METHOD_DESCRIPTOR = Type.getMethodDescriptor(SCRIPT_OBJECT_TYPE);
+    private static final String GET_GLOBAL_METHOD_DESCRIPTOR = Type.getMethodDescriptor(GLOBAL_TYPE);
     private static final String GET_CLASS_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.getType(Class.class));
 
     // Package used when the adapter can't be defined in the adaptee's package (either because it's sealed, or because
@@ -259,7 +263,7 @@
     }
 
     private void generateGlobalFields() {
-        cw.visitField(ACC_PRIVATE | ACC_FINAL | (classOverride ? ACC_STATIC : 0), GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR, null, null).visitEnd();
+        cw.visitField(ACC_PRIVATE | ACC_FINAL | (classOverride ? ACC_STATIC : 0), GLOBAL_FIELD_NAME, GLOBAL_TYPE_DESCRIPTOR, null, null).visitEnd();
         usedFieldNames.add(GLOBAL_FIELD_NAME);
     }
 
@@ -363,7 +367,7 @@
         }
         // Assign "global = Context.getGlobal()"
         invokeGetGlobalWithNullCheck(mv);
-        mv.putstatic(generatedClassName, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
+        mv.putstatic(generatedClassName, GLOBAL_FIELD_NAME, GLOBAL_TYPE_DESCRIPTOR);
 
         endInitMethod(mv);
     }
@@ -508,7 +512,7 @@
         // Assign "this.global = Context.getGlobal()"
         mv.visitVarInsn(ALOAD, 0);
         invokeGetGlobalWithNullCheck(mv);
-        mv.putfield(generatedClassName, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
+        mv.putfield(generatedClassName, GLOBAL_FIELD_NAME, GLOBAL_TYPE_DESCRIPTOR);
 
         endInitMethod(mv);
     }
@@ -652,10 +656,10 @@
         // Load the creatingGlobal object
         if(classOverride) {
             // If class handle is defined, load the static defining global
-            mv.getstatic(generatedClassName, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
+            mv.getstatic(generatedClassName, GLOBAL_FIELD_NAME, GLOBAL_TYPE_DESCRIPTOR);
         } else {
             mv.visitVarInsn(ALOAD, 0);
-            mv.getfield(generatedClassName, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
+            mv.getfield(generatedClassName, GLOBAL_FIELD_NAME, GLOBAL_TYPE_DESCRIPTOR);
         }
         // stack: [creatingGlobal, handle]
         final Label setupGlobal = new Label();
@@ -674,7 +678,7 @@
         // stack: [creatingGlobal, creatingGlobal, handle]
 
         // Emit code for switching to the creating global
-        // ScriptObject currentGlobal = Context.getGlobal();
+        // Global currentGlobal = Context.getGlobal();
         invokeGetGlobal(mv);
         mv.dup();
 
@@ -744,7 +748,7 @@
         final Label methodEnd = new Label();
         mv.visitLabel(methodEnd);
 
-        mv.visitLocalVariable("currentGlobal", SCRIPT_OBJECT_TYPE_DESCRIPTOR, null, setupGlobal, methodEnd, currentGlobalVar);
+        mv.visitLocalVariable("currentGlobal", GLOBAL_TYPE_DESCRIPTOR, null, setupGlobal, methodEnd, currentGlobalVar);
         mv.visitLocalVariable("globalsDiffer", Type.INT_TYPE.getDescriptor(), null, setupGlobal, methodEnd, globalsDifferVar);
 
         if(throwableDeclared) {
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java	Tue Apr 01 15:37:15 2014 +0200
@@ -48,7 +48,6 @@
 import java.util.concurrent.ConcurrentHashMap;
 import jdk.internal.dynalink.beans.StaticClass;
 import jdk.internal.dynalink.support.LinkRequestImpl;
-import jdk.nashorn.internal.objects.NativeJava;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ECMAException;
 import jdk.nashorn.internal.runtime.ScriptFunction;
@@ -68,8 +67,8 @@
  * generate the adapter class itself; see its documentation for details about the generated class.
  * </p><p>
  * You normally don't use this class directly, but rather either create adapters from script using
- * {@link NativeJava#extend(Object, Object...)}, using the {@code new} operator on abstract classes and interfaces (see
- * {@link NativeJava#type(Object, Object)}), or implicitly when passing script functions to Java methods expecting SAM
+ * {@link jdk.nashorn.internal.objects.NativeJava#extend(Object, Object...)}, using the {@code new} operator on abstract classes and interfaces (see
+ * {@link jdk.nashorn.internal.objects.NativeJava#type(Object, Object)}), or implicitly when passing script functions to Java methods expecting SAM
  * types.
  * </p>
  */
@@ -337,6 +336,7 @@
     private static ProtectionDomain createMinimalPermissionDomain() {
         // Generated classes need to have at least the permission to access Nashorn runtime and runtime.linker packages.
         final Permissions permissions = new Permissions();
+        permissions.add(new RuntimePermission("accessClassInPackage.jdk.nashorn.internal.objects"));
         permissions.add(new RuntimePermission("accessClassInPackage.jdk.nashorn.internal.runtime"));
         permissions.add(new RuntimePermission("accessClassInPackage.jdk.nashorn.internal.runtime.linker"));
         return new ProtectionDomain(new CodeSource(null, (CodeSigner[])null), permissions);
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornGuards.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornGuards.java	Tue Apr 01 15:37:15 2014 +0200
@@ -29,6 +29,11 @@
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
+import java.lang.ref.WeakReference;
+import jdk.internal.dynalink.CallSiteDescriptor;
+import jdk.nashorn.internal.codegen.ObjectClassGenerator;
+import jdk.nashorn.internal.objects.Global;
+import jdk.nashorn.internal.runtime.Property;
 import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
@@ -40,6 +45,7 @@
     private static final MethodHandle IS_SCRIPTOBJECT   = findOwnMH("isScriptObject", boolean.class, Object.class);
     private static final MethodHandle IS_SCRIPTFUNCTION = findOwnMH("isScriptFunction", boolean.class, Object.class);
     private static final MethodHandle IS_MAP            = findOwnMH("isMap", boolean.class, Object.class, PropertyMap.class);
+    private static final MethodHandle SAME_OBJECT       = findOwnMH("sameObject", boolean.class, Object.class, WeakReference.class);
     private static final MethodHandle IS_INSTANCEOF_2   = findOwnMH("isInstanceOf2", boolean.class, Object.class, Class.class, Class.class);
 
     // don't create me!
@@ -75,6 +81,55 @@
     }
 
     /**
+     * Determine whether the given callsite needs a guard.
+     * @param property the property, or null
+     * @param desc the callsite descriptor
+     * @return true if a guard should be used for this callsite
+     */
+    static boolean needsGuard(final Property property, final CallSiteDescriptor desc) {
+        return property == null || property.isConfigurable()
+                || property.isBound() || !ObjectClassGenerator.OBJECT_FIELDS_ONLY
+                || !NashornCallSiteDescriptor.isFastScope(desc) || property.canChangeType();
+    }
+
+    /**
+     * Get the guard for a property access. This returns an identity guard for non-configurable global properties
+     * and a map guard for everything else.
+     *
+     * @param sobj the first object in the prototype chain
+     * @param property the property
+     * @param desc the callsite descriptor
+     * @return method handle for guard
+     */
+    public static MethodHandle getGuard(final ScriptObject sobj, final Property property, final CallSiteDescriptor desc) {
+        if (!needsGuard(property, desc)) {
+            return null;
+        }
+        if (NashornCallSiteDescriptor.isScope(desc)) {
+            if (property != null && property.isBound()) {
+                // This is a declared top level variables in main script or eval, use identity guard.
+                return getIdentityGuard(sobj);
+            }
+            if (!(sobj instanceof Global) && (property == null || property.isConfigurable())) {
+                // Undeclared variables in nested evals need stronger guards
+                return combineGuards(getIdentityGuard(sobj), getMapGuard(sobj.getMap()));
+            }
+        }
+        return getMapGuard(sobj.getMap());
+    }
+
+
+    /**
+     * Get a guard that checks referential identity of the current object.
+     *
+     * @param sobj the self object
+     * @return true if same self object instance
+     */
+    public static MethodHandle getIdentityGuard(final ScriptObject sobj) {
+        return MH.insertArguments(SAME_OBJECT, 1, new WeakReference<>(sobj));
+    }
+
+    /**
      * Get a guard that checks if in item is an instance of either of two classes.
      *
      * @param class1 the first class
@@ -112,6 +167,11 @@
     }
 
     @SuppressWarnings("unused")
+    private static boolean sameObject(final Object self, final WeakReference<ScriptObject> ref) {
+        return self == ref.get();
+    }
+
+    @SuppressWarnings("unused")
     private static boolean isInstanceOf2(final Object self, final Class<?> class1, final Class<?> class2) {
         return class1.isInstance(self) || class2.isInstance(self);
     }
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornPrimitiveLinker.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornPrimitiveLinker.java	Tue Apr 01 15:37:15 2014 +0200
@@ -37,9 +37,9 @@
 import jdk.internal.dynalink.linker.LinkerServices;
 import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
 import jdk.internal.dynalink.support.TypeUtilities;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.ConsString;
 import jdk.nashorn.internal.runtime.Context;
-import jdk.nashorn.internal.runtime.GlobalObject;
 
 /**
  * Internal linker for String, Boolean, and Number objects, only ever used by Nashorn engine and not exposed to other
@@ -62,7 +62,7 @@
         final LinkRequest request = origRequest.withoutRuntimeContext(); // Nashorn has no runtime context
 
         final Object self = request.getReceiver();
-        final GlobalObject global = (GlobalObject) Context.getGlobal();
+        final Global global = Context.getGlobal();
         final NashornCallSiteDescriptor desc = (NashornCallSiteDescriptor) request.getCallSiteDescriptor();
 
         return Bootstrap.asType(global.primitiveLookup(request, self), linkerServices, desc);
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java	Tue Apr 01 15:37:15 2014 +0200
@@ -35,6 +35,7 @@
 import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
 import jdk.internal.dynalink.support.Guards;
 import jdk.nashorn.internal.lookup.Lookup;
+import jdk.nashorn.internal.runtime.FindProperty;
 import jdk.nashorn.internal.runtime.ScriptObject;
 
 /**
@@ -61,8 +62,9 @@
      * type {@code receiverClass}.
      */
     public static GuardedInvocation lookupPrimitive(final LinkRequest request, final Class<?> receiverClass,
-                                                    final ScriptObject wrappedReceiver, final MethodHandle wrapFilter) {
-        return lookupPrimitive(request, Guards.getInstanceOfGuard(receiverClass), wrappedReceiver, wrapFilter);
+                                                    final ScriptObject wrappedReceiver, final MethodHandle wrapFilter,
+                                                    final MethodHandle protoFilter) {
+        return lookupPrimitive(request, Guards.getInstanceOfGuard(receiverClass), wrappedReceiver, wrapFilter, protoFilter);
     }
 
     /**
@@ -79,7 +81,8 @@
      * type (that is implied by both {@code guard} and {@code wrappedReceiver}).
      */
     public static GuardedInvocation lookupPrimitive(final LinkRequest request, final MethodHandle guard,
-                                                    final ScriptObject wrappedReceiver, final MethodHandle wrapFilter) {
+                                                    final ScriptObject wrappedReceiver, final MethodHandle wrapFilter,
+                                                    final MethodHandle protoFilter) {
         final CallSiteDescriptor desc = request.getCallSiteDescriptor();
         final String operator = CallSiteDescriptorFactory.tokenizeOperators(desc).get(0);
         if ("setProp".equals(operator) || "setElem".equals(operator)) {
@@ -93,9 +96,23 @@
 
         if(desc.getNameTokenCount() > 2) {
             final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND);
-            if(wrappedReceiver.findProperty(name, true) == null) {
+            final FindProperty find = wrappedReceiver.findProperty(name, true);
+            if(find == null) {
                 // Give up early, give chance to BeanLinker and NashornBottomLinker to deal with it.
                 return null;
+            } else if (find.isInherited() && !find.getProperty().hasGetterFunction(find.getOwner())) {
+                // 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);
+
+                if (link != null) {
+                    final MethodHandle invocation = link.getInvocation();
+                    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));
+                }
             }
         }
         final GuardedInvocation link = wrappedReceiver.lookup(desc, request);
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties	Tue Apr 01 15:37:15 2014 +0200
@@ -79,6 +79,7 @@
 type.error.not.a.constructor={0} is not a constructor function
 type.error.not.a.file={0} is not a File
 type.error.not.a.bytebuffer={0} is not a java.nio.ByteBuffer
+type.error.not.an.arraybuffer.in.dataview=First arg to DataView constructor must be an ArrayBuffer
 
 # operations not permitted on undefined
 type.error.cant.call.undefined=Cannot call undefined
@@ -137,6 +138,9 @@
 type.error.method.not.constructor=Java method {0} can't be used as a constructor.
 type.error.env.not.object=$ENV must be an Object.
 type.error.unsupported.java.to.type=Unsupported Java.to target type {0}.
+
+range.error.dataview.constructor.offset=Wrong offset or length in DataView constructor
+range.error.dataview.offset=Offset is outside the bounds of the DataView
 range.error.inappropriate.array.length=inappropriate array length: {0}
 range.error.inappropriate.array.buffer.length=inappropriate array buffer length: {0}
 range.error.invalid.fraction.digits=fractionDigits argument to {0} must be in [0, 20]
--- a/nashorn/src/jdk/nashorn/tools/Shell.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/src/jdk/nashorn/tools/Shell.java	Tue Apr 01 15:37:15 2014 +0200
@@ -42,6 +42,7 @@
 import jdk.nashorn.internal.ir.FunctionNode;
 import jdk.nashorn.internal.ir.debug.ASTWriter;
 import jdk.nashorn.internal.ir.debug.PrintVisitor;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.parser.Parser;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ErrorManager;
@@ -148,7 +149,7 @@
             return COMMANDLINE_ERROR;
         }
 
-        final ScriptObject global = context.createGlobal();
+        final Global global = context.createGlobal();
         final ScriptEnvironment env = context.getEnv();
         final List<String> files = env.getFiles();
         if (files.isEmpty()) {
@@ -231,8 +232,8 @@
      * @return error code
      * @throws IOException when any script file read results in I/O error
      */
-    private static int compileScripts(final Context context, final ScriptObject global, final List<String> files) throws IOException {
-        final ScriptObject oldGlobal = Context.getGlobal();
+    private static int compileScripts(final Context context, final Global global, final List<String> files) throws IOException {
+        final Global oldGlobal = Context.getGlobal();
         final boolean globalChanged = (oldGlobal != global);
         final ScriptEnvironment env = context.getEnv();
         try {
@@ -281,8 +282,8 @@
      * @return error code
      * @throws IOException when any script file read results in I/O error
      */
-    private int runScripts(final Context context, final ScriptObject global, final List<String> files) throws IOException {
-        final ScriptObject oldGlobal = Context.getGlobal();
+    private int runScripts(final Context context, final Global global, final List<String> files) throws IOException {
+        final Global oldGlobal = Context.getGlobal();
         final boolean globalChanged = (oldGlobal != global);
         try {
             if (globalChanged) {
@@ -339,8 +340,8 @@
      * @return error code
      * @throws IOException when any script file read results in I/O error
      */
-    private static int runFXScripts(final Context context, final ScriptObject global, final List<String> files) throws IOException {
-        final ScriptObject oldGlobal = Context.getGlobal();
+    private static int runFXScripts(final Context context, final Global global, final List<String> files) throws IOException {
+        final Global oldGlobal = Context.getGlobal();
         final boolean globalChanged = (oldGlobal != global);
         try {
             if (globalChanged) {
@@ -389,11 +390,11 @@
      * @return return code
      */
     @SuppressWarnings("resource")
-    private static int readEvalPrint(final Context context, final ScriptObject global) {
+    private static int readEvalPrint(final Context context, final Global global) {
         final String prompt = bundle.getString("shell.prompt");
         final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
         final PrintWriter err = context.getErr();
-        final ScriptObject oldGlobal = Context.getGlobal();
+        final Global oldGlobal = Context.getGlobal();
         final boolean globalChanged = (oldGlobal != global);
         final ScriptEnvironment env = context.getEnv();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8034055.js	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,55 @@
+/*
+ * 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-8034055: delete on global object not properly guarded
+ *
+ * @test
+ * @run
+ */
+
+
+var global = this;
+var x;
+
+function test(defineGlobals) {
+    if (defineGlobals) {
+        global.x = 1;
+        global.y = 2;
+    }
+    try {
+        print(x);
+        print(y);
+    } catch (e) {
+        print(e);
+    } finally {
+        print(delete global.x);
+        print(delete global.y);
+    }
+}
+
+// Repeatedly set and delete global variables
+test(true);
+test(false);
+test(true);
+test(false);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8034055.js.EXPECTED	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,16 @@
+1
+2
+false
+true
+1
+ReferenceError: "y" is not defined
+false
+true
+1
+2
+false
+true
+1
+ReferenceError: "y" is not defined
+false
+true
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/dataview_endian.js	Tue Apr 01 15:37:15 2014 +0200
@@ -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.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please 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-8015958: DataView constructor is not defined
+ *
+ * @test
+ * @run
+ */
+
+// set/get endianess checks
+
+var buffer = new ArrayBuffer(4);
+var dv = new DataView(buffer);
+
+// write (default) big endian, read big/little endian
+dv.setUint16(0, 0xABCD);
+Assert.assertEquals(dv.getUint16(0), 0xABCD);
+Assert.assertEquals(dv.getUint16(0, false), 0xABCD);
+Assert.assertEquals(dv.getUint16(0, true), 0xCDAB);
+
+// write little endian, read big/little endian
+dv.setUint16(0, 0xABCD, true);
+Assert.assertEquals(dv.getUint16(0), 0xCDAB);
+Assert.assertEquals(dv.getUint16(0, false), 0xCDAB);
+Assert.assertEquals(dv.getUint16(0, true), 0xABCD);
+
+// write explicit big endian, read big/little endian
+dv.setUint16(0, 0xABCD, false);
+Assert.assertEquals(dv.getUint16(0), 0xABCD);
+Assert.assertEquals(dv.getUint16(0, false), 0xABCD);
+Assert.assertEquals(dv.getUint16(0, true), 0xCDAB);
+
+// write (default) big endian, read big/little endian
+dv.setUint32(0, 0xABCDEF89);
+Assert.assertEquals(dv.getUint32(0), 0xABCDEF89);
+Assert.assertEquals(dv.getUint32(0, false), 0xABCDEF89);
+Assert.assertEquals(dv.getUint32(0, true), 0x89EFCDAB);
+
+// write little endian, read big/little endian
+dv.setUint32(0, 0xABCDEF89, true);
+Assert.assertEquals(dv.getUint32(0), 0x89EFCDAB);
+Assert.assertEquals(dv.getUint32(0, false), 0x89EFCDAB);
+Assert.assertEquals(dv.getUint32(0, true), 0xABCDEF89);
+
+// write explicit big endian, read big/little endian
+dv.setUint32(0, 0xABCDEF89, false);
+Assert.assertEquals(dv.getUint32(0), 0xABCDEF89);
+Assert.assertEquals(dv.getUint32(0, false), 0xABCDEF89);
+Assert.assertEquals(dv.getUint32(0, true), 0x89EFCDAB);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/dataview_getset.js	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,93 @@
+/*
+ * 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-8015958: DataView constructor is not defined
+ *
+ * @test
+ * @run
+ */
+
+// checking get/set of values of various types
+// Also basic endianess check.
+
+var Float = Java.type("java.lang.Float");
+var Double = Java.type("java.lang.Double");
+
+var DOUBLE_MIN = Double.MIN_VALUE;
+var DOUBLE_MIN_NORMAL = Double.MIN_NORMAL;
+var FLOAT_MIN = Float.MIN_VALUE;
+var FLOAT_MIN_NORMAL = Float.MIN_NORMAL;
+
+var buffer = new ArrayBuffer(12);
+var dv = new DataView(buffer);
+
+dv.setInt8(1, 123);
+Assert.assertEquals(dv.getInt8(1), 123);
+dv.setInt8(1, 123, true);
+Assert.assertEquals(dv.getInt8(1, true), 123);
+
+dv.setUint8(1, 255);
+Assert.assertEquals(dv.getUint8(1), 255);
+dv.setUint8(1, 255, true);
+Assert.assertEquals(dv.getUint8(1, true), 255);
+
+dv.setInt16(1, 1234);
+Assert.assertEquals(dv.getInt16(1), 1234);
+dv.setInt16(1, 1234, true);
+Assert.assertEquals(dv.getInt16(1, true), 1234);
+
+dv.setUint16(1, 65535);
+Assert.assertEquals(dv.getUint16(1), 65535);
+dv.setUint16(1, 65535, true);
+Assert.assertEquals(dv.getUint16(1, true), 65535);
+
+dv.setInt32(1, 1234);
+Assert.assertEquals(dv.getInt32(1), 1234);
+dv.setInt32(1, 1234, true);
+Assert.assertEquals(dv.getInt32(1, true), 1234);
+
+dv.setUint32(1, 4294967295);
+Assert.assertEquals(dv.getUint32(1), 4294967295);
+dv.setUint32(1, 4294967295, true);
+Assert.assertEquals(dv.getUint32(1, true), 4294967295);
+
+dv.setFloat64(1, Math.PI);
+Assert.assertEquals(dv.getFloat64(1), Math.PI, DOUBLE_MIN);
+dv.setFloat64(1, Math.PI, true);
+Assert.assertEquals(dv.getFloat64(1, true), Math.PI, DOUBLE_MIN);
+
+dv.setFloat64(1, DOUBLE_MIN_NORMAL);
+Assert.assertEquals(dv.getFloat64(1), DOUBLE_MIN_NORMAL, DOUBLE_MIN);
+dv.setFloat64(1, DOUBLE_MIN_NORMAL, true);
+Assert.assertEquals(dv.getFloat64(1, true), DOUBLE_MIN_NORMAL, DOUBLE_MIN);
+
+dv.setFloat32(1, 1.414);
+Assert["assertEquals(float, float, float)"](dv.getFloat32(1), 1.414, FLOAT_MIN);
+dv.setFloat32(1, 1.414, true);
+Assert["assertEquals(float, float, float)"](dv.getFloat32(1, true), 1.414, FLOAT_MIN);
+
+dv.setFloat32(1, FLOAT_MIN_NORMAL);
+Assert["assertEquals(float, float, float)"](dv.getFloat32(1), FLOAT_MIN_NORMAL, FLOAT_MIN);
+dv.setFloat32(1, FLOAT_MIN_NORMAL, true);
+Assert["assertEquals(float, float, float)"](dv.getFloat32(1, true), FLOAT_MIN_NORMAL, FLOAT_MIN);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/dataview_new.js	Tue Apr 01 15:37:15 2014 +0200
@@ -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.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please 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-8015958: DataView constructor is not defined
+ *
+ * @test
+ * @run
+ */
+
+// basic DataView constructor checks.
+
+// check ArrayBufferView property values of DataView instance
+function check(dv, buf, offset, length) {
+    if (dv.buffer !== buf) {
+        fail("DataView.buffer is wrong");
+    }
+
+    if (dv.byteOffset != offset) {
+        fail("DataView.byteOffset = " + dv.byteOffset + ", expected " + offset);
+    }
+
+    if (dv.byteLength != length) {
+        fail("DataView.byteLength = " + dv.byteLength + ", expected " + length);
+    }
+}
+
+var buffer = new ArrayBuffer(12);
+check(new DataView(buffer), buffer, 0, 12);
+check(new DataView(buffer, 2), buffer, 2, 10);
+check(new DataView(buffer, 4, 8), buffer, 4, 8);
+
+// make sure expected error is thrown
+function checkError(callback, ErrorType) {
+    try {
+        callback();
+        fail("Should have thrown " + ErrorType.name);
+    } catch (e) {
+        if (! (e instanceof ErrorType)) {
+            fail("Expected " + ErrorType.name + " got " + e);
+        }
+    }
+}
+
+// non ArrayBuffer as first arg
+checkError(function() { new DataView(344) }, TypeError);
+
+// illegal offset/length values
+checkError(function() { new DataView(buffer, -1) }, RangeError);
+checkError(function() { new DataView(buffer, 15) }, RangeError);
+checkError(function() { new DataView(buffer, 1, 32) }, RangeError);
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScopeTest.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScopeTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -245,4 +245,320 @@
         sb.put("x", "newX");
         assertTrue(e.eval("x", ctx).equals("newX"));
     }
+
+    /**
+     * Test multi-threaded access to defined global variables for shared script classes with multiple globals.
+     */
+    @Test
+    public static void multiThreadedVarTest() throws ScriptException, InterruptedException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = e.createBindings();
+        final ScriptContext origContext = e.getContext();
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+        final String sharedScript = "foo";
+
+        assertEquals(e.eval("var foo = 'original context';", origContext), null);
+        assertEquals(e.eval("var foo = 'new context';", newCtxt), null);
+
+        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "new context", 1000));
+        t1.start();
+        t2.start();
+        t1.join();
+        t2.join();
+
+        assertEquals(e.eval("var foo = 'newer context';", newCtxt), null);
+        final Thread t3 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t4 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "newer context", 1000));
+
+        t3.start();
+        t4.start();
+        t3.join();
+        t4.join();
+
+        assertEquals(e.eval(sharedScript), "original context");
+        assertEquals(e.eval(sharedScript, newCtxt), "newer context");
+    }
+
+    /**
+     * Test multi-threaded access to undefined global variables for shared script classes with multiple globals.
+     */
+    @Test
+    public static void multiThreadedGlobalTest() throws ScriptException, InterruptedException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = e.createBindings();
+        final ScriptContext origContext = e.getContext();
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+
+        assertEquals(e.eval("foo = 'original context';", origContext), "original context");
+        assertEquals(e.eval("foo = 'new context';", newCtxt), "new context");
+        final String sharedScript = "foo";
+
+        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "new context", 1000));
+        t1.start();
+        t2.start();
+        t1.join();
+        t2.join();
+
+        Object obj3 = e.eval("delete foo; foo = 'newer context';", newCtxt);
+        assertEquals(obj3, "newer context");
+        final Thread t3 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t4 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "newer context", 1000));
+
+        t3.start();
+        t4.start();
+        t3.join();
+        t4.join();
+
+        Assert.assertEquals(e.eval(sharedScript), "original context");
+        Assert.assertEquals(e.eval(sharedScript, newCtxt), "newer context");
+    }
+
+    /**
+     * Test multi-threaded access using the postfix ++ operator for shared script classes with multiple globals.
+     */
+    @Test
+    public static void multiThreadedIncTest() throws ScriptException, InterruptedException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = e.createBindings();
+        final ScriptContext origContext = e.getContext();
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+
+        assertEquals(e.eval("var x = 0;", origContext), null);
+        assertEquals(e.eval("var x = 2;", newCtxt), null);
+        final String sharedScript = "x++;";
+
+        final Thread t1 = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    for (int i = 0; i < 1000; i++) {
+                        assertEquals(e.eval(sharedScript, origContext), (double)i);
+                    }
+                } catch (ScriptException se) {
+                    fail(se.toString());
+                }
+            }
+        });
+        final Thread t2 = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    for (int i = 2; i < 1000; i++) {
+                        assertEquals(e.eval(sharedScript, newCtxt), (double)i);
+                    }
+                } catch (ScriptException se) {
+                    fail(se.toString());
+                }
+            }
+        });
+        t1.start();
+        t2.start();
+        t1.join();
+        t2.join();
+    }
+
+    /**
+     * Test multi-threaded access to primitive prototype properties for shared script classes with multiple globals.
+     */
+    @Test
+    public static void multiThreadedPrimitiveTest() throws ScriptException, InterruptedException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = e.createBindings();
+        final ScriptContext origContext = e.getContext();
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+
+        Object obj1 = e.eval("String.prototype.foo = 'original context';", origContext);
+        Object obj2 = e.eval("String.prototype.foo = 'new context';", newCtxt);
+        assertEquals(obj1, "original context");
+        assertEquals(obj2, "new context");
+        final String sharedScript = "''.foo";
+
+        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "new context", 1000));
+        t1.start();
+        t2.start();
+        t1.join();
+        t2.join();
+
+        Object obj3 = e.eval("delete String.prototype.foo; Object.prototype.foo = 'newer context';", newCtxt);
+        assertEquals(obj3, "newer context");
+        final Thread t3 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t4 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "newer context", 1000));
+
+        t3.start();
+        t4.start();
+        t3.join();
+        t4.join();
+
+        Assert.assertEquals(e.eval(sharedScript), "original context");
+        Assert.assertEquals(e.eval(sharedScript, newCtxt), "newer context");
+    }
+
+    /**
+     * Test multi-threaded scope function invocation for shared script classes with multiple globals.
+     */
+    @Test
+    public static void multiThreadedFunctionTest() throws ScriptException, InterruptedException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = e.createBindings();
+        final ScriptContext origContext = e.getContext();
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+
+        e.eval(new URLReader(ScopeTest.class.getResource("resources/func.js")), origContext);
+        assertEquals(origContext.getAttribute("scopeVar"), 1);
+        assertEquals(e.eval("scopeTest()"), 1);
+
+        e.eval(new URLReader(ScopeTest.class.getResource("resources/func.js")), newCtxt);
+        assertEquals(newCtxt.getAttribute("scopeVar"), 1);
+        assertEquals(e.eval("scopeTest();", newCtxt), 1);
+
+        assertEquals(e.eval("scopeVar = 3;", newCtxt), 3);
+        assertEquals(newCtxt.getAttribute("scopeVar"), 3);
+
+
+        final Thread t1 = new Thread(new ScriptRunner(e, origContext, "scopeTest()", 1, 1000));
+        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, "scopeTest()", 3, 1000));
+
+        t1.start();
+        t2.start();
+        t1.join();
+        t2.join();
+
+    }
+
+    /**
+     * Test multi-threaded access to global getters and setters for shared script classes with multiple globals.
+     */
+    @Test
+    public static void getterSetterTest() throws ScriptException, InterruptedException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = e.createBindings();
+        final ScriptContext origContext = e.getContext();
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+        final String sharedScript = "accessor1";
+
+        e.eval(new URLReader(ScopeTest.class.getResource("resources/gettersetter.js")), origContext);
+        assertEquals(e.eval("accessor1 = 1;"), 1);
+        assertEquals(e.eval(sharedScript), 1);
+
+        e.eval(new URLReader(ScopeTest.class.getResource("resources/gettersetter.js")), newCtxt);
+        assertEquals(e.eval("accessor1 = 2;", newCtxt), 2);
+        assertEquals(e.eval(sharedScript, newCtxt), 2);
+
+
+        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, 1, 1000));
+        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, 2, 1000));
+
+        t1.start();
+        t2.start();
+        t1.join();
+        t2.join();
+
+        assertEquals(e.eval(sharedScript), 1);
+        assertEquals(e.eval(sharedScript, newCtxt), 2);
+        assertEquals(e.eval("v"), 1);
+        assertEquals(e.eval("v", newCtxt), 2);
+    }
+
+    /**
+     * Test multi-threaded access to global getters and setters for shared script classes with multiple globals.
+     */
+    @Test
+    public static void getterSetter2Test() throws ScriptException, InterruptedException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = e.createBindings();
+        final ScriptContext origContext = e.getContext();
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+        final String sharedScript = "accessor2";
+
+        e.eval(new URLReader(ScopeTest.class.getResource("resources/gettersetter.js")), origContext);
+        assertEquals(e.eval("accessor2 = 1;"), 1);
+        assertEquals(e.eval(sharedScript), 1);
+
+        e.eval(new URLReader(ScopeTest.class.getResource("resources/gettersetter.js")), newCtxt);
+        assertEquals(e.eval("accessor2 = 2;", newCtxt), 2);
+        assertEquals(e.eval(sharedScript, newCtxt), 2);
+
+
+        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, 1, 1000));
+        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, 2, 1000));
+
+        t1.start();
+        t2.start();
+        t1.join();
+        t2.join();
+
+        assertEquals(e.eval(sharedScript), 1);
+        assertEquals(e.eval(sharedScript, newCtxt), 2);
+        assertEquals(e.eval("x"), 1);
+        assertEquals(e.eval("x", newCtxt), 2);
+    }
+
+    /**
+     * Test "slow" scopes involving {@code with} and {@code eval} statements for shared script classes with multiple globals.
+     */
+    @Test
+    public static void testSlowScope() throws ScriptException, InterruptedException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        for (int i = 0; i < 100; i++) {
+            final Bindings b = e.createBindings();
+            final ScriptContext ctxt = new SimpleScriptContext();
+            ctxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+
+            e.eval(new URLReader(ScopeTest.class.getResource("resources/witheval.js")), ctxt);
+            assertEquals(e.eval("a", ctxt), 1);
+            assertEquals(b.get("a"), 1);
+            assertEquals(e.eval("b", ctxt), 3);
+            assertEquals(b.get("b"), 3);
+            assertEquals(e.eval("c", ctxt), 10);
+            assertEquals(b.get("c"), 10);
+        }
+    }
+
+    private static class ScriptRunner implements Runnable {
+
+        final ScriptEngine engine;
+        final ScriptContext context;
+        final String source;
+        final Object expected;
+        final int iterations;
+
+        ScriptRunner(final ScriptEngine engine, final ScriptContext context, final String source, final Object expected, final int iterations) {
+            this.engine = engine;
+            this.context = context;
+            this.source = source;
+            this.expected = expected;
+            this.iterations = iterations;
+        }
+
+        @Override
+        public void run() {
+            try {
+                for (int i = 0; i < iterations; i++) {
+                    assertEquals(engine.eval(source, context), expected);
+                }
+            } catch (ScriptException se) {
+                throw new RuntimeException(se);
+            }
+        }
+    }
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/resources/func.js	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,42 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// This script is loaded from jdk.nashorn.api.scripting.ScopeTest to test script class sharing and reuse.
+
+var scopeVar = 1;
+var global = this;
+undefGlobal = this;
+
+function scopeTest() {
+    if (this !== global) {
+        throw new Error("this !== global");
+    }
+    if (this !== undefGlobal) {
+        throw new Error("this !== undefinedGlobal")
+    }
+    return scopeVar;
+}
+
+scopeTest();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/resources/gettersetter.js	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,38 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// This script is loaded from jdk.nashorn.api.scripting.ScopeTest to test script class sharing and reuse.
+
+var v;
+
+Object.defineProperty(this, "accessor1", {
+    get: function() { return v; },
+    set: function(n) { v = n; }
+});
+
+Object.defineProperty(this, "accessor2", {
+    get: function() { return x; },
+    set: function(n) { x = n; }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/resources/witheval.js	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,60 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// This script is loaded from jdk.nashorn.api.scripting.ScopeTest to test script class sharing and reuse.
+
+var a;
+
+function outer(p, e) {
+    eval(e);
+    with(p) {
+        function inner() {
+            a = 1;
+            c = 10;
+            if (a !== 1) {
+                throw new Error("a !== 1");
+            }
+            if (b !== 3) {
+                throw new Error("b !== 3");
+            }
+            if (c !== 10) {
+                throw new Error("c !== 10");
+            }
+        }
+        inner();
+    }
+}
+
+outer({}, "b = 3;");
+
+if (a !== 1) {
+    throw new Error("a !== 1");
+}
+if (b !== 3) {
+    throw new Error("b !== 3");
+}
+if (c !== 10) {
+    throw new Error("c !== 10");
+}
--- a/nashorn/test/src/jdk/nashorn/internal/codegen/CompilerTest.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/test/src/jdk/nashorn/internal/codegen/CompilerTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -28,6 +28,7 @@
 import java.io.File;
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ErrorManager;
 import jdk.nashorn.internal.runtime.ScriptFunction;
@@ -58,7 +59,7 @@
     }
 
     private Context context;
-    private ScriptObject global;
+    private Global  global;
 
     @BeforeClass
     public void setupTest() {
@@ -146,7 +147,7 @@
             log("Begin compiling " + file.getAbsolutePath());
         }
 
-        final ScriptObject oldGlobal = Context.getGlobal();
+        final Global oldGlobal = Context.getGlobal();
         final boolean globalChanged = (oldGlobal != global);
 
         try {
--- a/nashorn/test/src/jdk/nashorn/internal/performance/PerformanceWrapper.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/test/src/jdk/nashorn/internal/performance/PerformanceWrapper.java	Tue Apr 01 15:37:15 2014 +0200
@@ -31,9 +31,9 @@
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ScriptFunction;
-import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 
 /**
@@ -89,7 +89,7 @@
     @Override
     protected Object apply(final ScriptFunction target, final Object self) {
         if (_runsPerIteration == 0 && _numberOfIterations == 0) {
-            final ScriptObject global = jdk.nashorn.internal.runtime.Context.getGlobal();
+            final Global global = jdk.nashorn.internal.runtime.Context.getGlobal();
             final ScriptFunction _target = target;
             final Object _self = self;
 
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/ContextTest.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/ContextTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -29,6 +29,7 @@
 import static org.testng.Assert.assertTrue;
 
 import java.util.Map;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.options.Options;
 import org.testng.annotations.Test;
 
@@ -45,7 +46,7 @@
         final Options options = new Options("");
         final ErrorManager errors = new ErrorManager();
         final Context cx = new Context(options, errors, Thread.currentThread().getContextClassLoader());
-        final ScriptObject oldGlobal = Context.getGlobal();
+        final Global oldGlobal = Context.getGlobal();
         Context.setGlobal(cx.createGlobal());
         try {
             String code = "22 + 10";
@@ -65,7 +66,7 @@
         final ErrorManager errors = new ErrorManager();
         final Context cx = new Context(options, errors, Thread.currentThread().getContextClassLoader());
         final boolean strict = cx.getEnv()._strict;
-        final ScriptObject oldGlobal = Context.getGlobal();
+        final Global oldGlobal = Context.getGlobal();
         Context.setGlobal(cx.createGlobal());
 
         try {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/NoPersistenceCachingTest.java	Tue Apr 01 15:37:15 2014 +0200
@@ -0,0 +1,133 @@
+/*
+ * 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 jdk.nashorn.internal.runtime;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineFactory;
+import javax.script.ScriptEngineManager;
+import javax.script.SimpleScriptContext;
+import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
+
+/**
+ * @test
+ * @bug 8037378
+ * @summary Sanity tests for no persistence caching
+ * @run testng/othervm jdk.nashorn.internal.runtime.NoPersistenceCachingTest
+ */
+public class NoPersistenceCachingTest {
+
+   private ScriptEngine engine;
+   private ScriptContext context1, context2, context3;
+   private ByteArrayOutputStream stderr;
+   private PrintStream prevStderr;
+   private final String script = "print('Hello')";
+
+   public void setupTest() {
+      stderr = new ByteArrayOutputStream();
+      prevStderr = System.err;
+      System.setErr(new PrintStream(stderr));
+      NashornScriptEngineFactory nashornFactory = null;
+      ScriptEngineManager sm = new ScriptEngineManager();
+      for (ScriptEngineFactory fac : sm.getEngineFactories()) {
+         if (fac instanceof NashornScriptEngineFactory) {
+            nashornFactory = (NashornScriptEngineFactory) fac;
+            break;
+         }
+      }
+      if (nashornFactory == null) {
+         fail("Cannot find nashorn factory!");
+      }
+      String[] options = new String[]{"--log=compiler:finest"};
+      engine = nashornFactory.getScriptEngine(options);
+   }
+
+   public void setErrTest() {
+      System.setErr(prevStderr);
+   }
+
+   public void runTest(int numberOfContext, String expectedOutputPattern,
+                       int expectedPatternOccurrence) {
+      setupTest();
+      try {
+         switch (numberOfContext) {
+         case 2:
+            context1 = engine.getContext();
+            context2 = new SimpleScriptContext();
+            context2.setBindings(engine.createBindings(), ScriptContext.ENGINE_SCOPE);
+            engine.eval(script, context1);
+            engine.eval(script, context2);
+            break;
+         case 3:
+            context1 = engine.getContext();
+            context2 = new SimpleScriptContext();
+            context2.setBindings(engine.createBindings(), ScriptContext.ENGINE_SCOPE);
+            context3 = new SimpleScriptContext();
+            context3.setBindings(engine.createBindings(), ScriptContext.ENGINE_SCOPE);
+            engine.eval(script, context1);
+            engine.eval(script, context2);
+            engine.eval(script, context3);
+            break;
+         }
+      } catch (final Exception se) {
+         se.printStackTrace();
+         fail(se.getMessage());
+      }
+      Pattern deoptimizing = Pattern.compile(expectedOutputPattern);
+      Matcher matcher = deoptimizing.matcher(stderr.toString());
+      int matches = 0;
+      while (matcher.find()) {
+         matches++;
+      }
+      if (matches != expectedPatternOccurrence) {
+         fail("Number of cache hit is not correct, expected: "
+                    + expectedPatternOccurrence + " and found: " + matches + "\n"
+              + stderr);
+      }
+      setErrTest();
+   }
+
+   private static String getCodeCachePattern() {
+      return ("\\[compiler\\]\\sCode\\scache\\shit\\sfor\\s<eval>\\savoiding\\srecompile.");
+   }
+
+    @Test
+    public void twoContextTest() {
+       runTest(2, getCodeCachePattern(), 1);
+
+    }
+
+    @Test
+    public void threeContextTest() {
+       runTest(3, getCodeCachePattern(), 2);
+    }
+}
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/SharedContextEvaluator.java	Tue Apr 01 07:46:51 2014 +0200
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/SharedContextEvaluator.java	Tue Apr 01 15:37:15 2014 +0200
@@ -34,10 +34,10 @@
 import java.io.OutputStream;
 import java.io.PrintWriter;
 import jdk.nashorn.api.scripting.NashornException;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ErrorManager;
 import jdk.nashorn.internal.runtime.ScriptFunction;
-import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.Source;
 import jdk.nashorn.internal.runtime.options.Options;
@@ -110,12 +110,12 @@
 
     @Override
     public int run(final OutputStream out, final OutputStream err, final String[] args) throws IOException {
-        final ScriptObject oldGlobal = Context.getGlobal();
+        final Global oldGlobal = Context.getGlobal();
         try {
             ctxOut.setDelegatee(out);
             ctxErr.setDelegatee(err);
             final ErrorManager errors = context.getErrorManager();
-            final ScriptObject global = context.createGlobal();
+            final Global global = context.createGlobal();
             Context.setGlobal(global);
 
             // For each file on the command line.