changeset 14333:079b369ab849

Merge
author ddehaven
date Tue, 19 Apr 2016 11:13:30 -0700
parents 6e22aca29b0d b4e29994d167
children ea55f52c0ada
files src/java.base/share/classes/jdk/internal/jrtfs/AbstractJrtFileAttributes.java src/java.base/share/classes/jdk/internal/jrtfs/AbstractJrtFileSystem.java src/java.base/share/classes/jdk/internal/jrtfs/AbstractJrtPath.java src/java.base/share/classes/jdk/internal/jrtfs/JrtExplodedFileAttributes.java src/java.base/share/classes/jdk/internal/jrtfs/JrtExplodedFileSystem.java src/java.base/share/classes/jdk/internal/jrtfs/JrtExplodedPath.java src/java.base/share/classes/jdk/internal/jrtfs/SystemImages.java src/java.base/share/classes/sun/reflect/AccessorGenerator.java src/java.base/share/classes/sun/reflect/BootstrapConstructorAccessorImpl.java src/java.base/share/classes/sun/reflect/ByteVector.java src/java.base/share/classes/sun/reflect/ByteVectorFactory.java src/java.base/share/classes/sun/reflect/ByteVectorImpl.java src/java.base/share/classes/sun/reflect/CallerSensitive.java src/java.base/share/classes/sun/reflect/ClassDefiner.java src/java.base/share/classes/sun/reflect/ClassFileAssembler.java src/java.base/share/classes/sun/reflect/ClassFileConstants.java src/java.base/share/classes/sun/reflect/ConstantPool.java src/java.base/share/classes/sun/reflect/ConstructorAccessor.java src/java.base/share/classes/sun/reflect/ConstructorAccessorImpl.java src/java.base/share/classes/sun/reflect/DelegatingConstructorAccessorImpl.java src/java.base/share/classes/sun/reflect/DelegatingMethodAccessorImpl.java src/java.base/share/classes/sun/reflect/FieldAccessor.java src/java.base/share/classes/sun/reflect/FieldAccessorImpl.java src/java.base/share/classes/sun/reflect/FieldInfo.java src/java.base/share/classes/sun/reflect/InstantiationExceptionConstructorAccessorImpl.java src/java.base/share/classes/sun/reflect/Label.java src/java.base/share/classes/sun/reflect/LangReflectAccess.java src/java.base/share/classes/sun/reflect/MagicAccessorImpl.java src/java.base/share/classes/sun/reflect/MethodAccessor.java src/java.base/share/classes/sun/reflect/MethodAccessorGenerator.java src/java.base/share/classes/sun/reflect/MethodAccessorImpl.java src/java.base/share/classes/sun/reflect/NativeConstructorAccessorImpl.java src/java.base/share/classes/sun/reflect/NativeMethodAccessorImpl.java src/java.base/share/classes/sun/reflect/Reflection.java src/java.base/share/classes/sun/reflect/ReflectionFactory.java src/java.base/share/classes/sun/reflect/SerializationConstructorAccessorImpl.java src/java.base/share/classes/sun/reflect/SignatureIterator.java src/java.base/share/classes/sun/reflect/UTF8.java src/java.base/share/classes/sun/reflect/UnsafeBooleanFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeByteFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeCharacterFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeDoubleFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeFieldAccessorFactory.java src/java.base/share/classes/sun/reflect/UnsafeFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeFloatFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeIntegerFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeLongFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeObjectFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedByteFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedLongFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedShortFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeShortFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticBooleanFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticByteFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticCharacterFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticDoubleFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticFloatFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticIntegerFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticLongFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticObjectFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticShortFieldAccessorImpl.java src/jdk.rmic/share/classes/jdk/rmi/rmic/Main.java test/sun/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java test/sun/reflect/CallerSensitive/CallerSensitiveFinder.java test/sun/reflect/CallerSensitive/MissingCallerSensitive.java test/sun/reflect/Reflection/GetCallerClass.java test/sun/reflect/Reflection/GetCallerClassTest.java test/sun/reflect/Reflection/GetCallerClassTest.sh test/sun/reflect/constantPool/ConstantPoolTest.java test/sun/reflect/constantPool/ConstantPoolTestDummy.jasm
diffstat 531 files changed, 27145 insertions(+), 17649 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Tue Apr 19 13:00:00 2016 +0530
+++ b/.hgtags	Tue Apr 19 11:13:30 2016 -0700
@@ -356,3 +356,4 @@
 b2a69d66dc65ad1d3aeb3bd362cf5bb0deba040e jdk-9+111
 1565a0efe6f0ca411a6df277df1e069431c60988 jdk-9+112
 68f8be44b6a6b33dfa841ec671c0ba6e4056b372 jdk-9+113
+bb8379287f3736f38c52b2d1418784e2592461d1 jdk-9+114
--- a/make/Import.gmk	Tue Apr 19 13:00:00 2016 +0530
+++ b/make/Import.gmk	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -83,20 +83,20 @@
   endif
 
   ifneq ($(OPENJDK_TARGET_OS), windows)
-    ifeq ($(JVM_VARIANT_SERVER), true)
+    ifeq ($(call check-jvm-variant, server), true)
       BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/server/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
       ifneq (, $(JSIG_DEBUGINFO))
         BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/server/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
       endif
     endif
-    ifeq ($(JVM_VARIANT_CLIENT), true)
+    ifeq ($(call check-jvm-variant, client), true)
       BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/client/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
       ifneq (, $(JSIG_DEBUGINFO))
         BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/client/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
       endif
     endif
     ifneq ($(OPENJDK_TARGET_OS), macosx)
-      ifeq ($(JVM_VARIANT_MINIMAL1), true)
+      ifeq ($(call check-jvm-variant, minimal), true)
         BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
         ifneq (,$(JSIG_DEBUGINFO))
           BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/minimal/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
--- a/make/copy/Copy-java.base.gmk	Tue Apr 19 13:00:00 2016 +0530
+++ b/make/copy/Copy-java.base.gmk	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -88,7 +88,7 @@
 #
 # How to install jvm.cfg.
 #
-ifeq ($(JVM_VARIANT_ZERO), true)
+ifeq ($(call check-jvm-variant, zero zeroshark), true)
   JVMCFG_ARCH := zero
 else
   JVMCFG_ARCH := $(OPENJDK_TARGET_CPU_LEGACY)
@@ -99,7 +99,7 @@
 else
   JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/$(JVMCFG_ARCH)/jvm.cfg
   # Allow override by ALT_JVMCFG_SRC if it exists
-  JVMCFG_SRC := $(if $(wildcard $(ALT_JVMCFG_SRC)),$(ALT_JVMCFG_SRC),$(JVMCFG_SRC)) 
+  JVMCFG_SRC := $(if $(wildcard $(ALT_JVMCFG_SRC)),$(ALT_JVMCFG_SRC),$(JVMCFG_SRC))
 endif
 JVMCFG_DIR := $(LIB_DST_DIR)$(OPENJDK_TARGET_CPU_LIBDIR)
 JVMCFG := $(JVMCFG_DIR)/jvm.cfg
@@ -117,12 +117,12 @@
   # The main problem is deciding whether to use aliases for the VMs that are not
   # present and the current position is that we add aliases for client and server, but
   # not for minimal.
-  CLIENT_AND_SERVER := $(and $(findstring true, $(JVM_VARIANT_SERVER)), $(findstring true, $(JVM_VARIANT_CLIENT)))
-  ifeq ($(CLIENT_AND_SERVER), true)
+  CLIENT_AND_SERVER := $(call check-jvm-variant, client)+$(call check-jvm-variant, server)
+  ifeq ($(CLIENT_AND_SERVER), true+true)
     COPY_JVM_CFG_FILE := true
   else
     # For zero, the default jvm.cfg file is sufficient
-    ifeq ($(JVM_VARIANT_ZERO), true)
+    ifeq ($(call check-jvm-variant, zero zeroshark), true)
       COPY_JVM_CFG_FILE := true
     endif
   endif
@@ -136,21 +136,21 @@
 	$(MKDIR) -p $(@D)
 	$(RM) $(@)
         # Now check for other permutations
-        ifeq ($(JVM_VARIANT_SERVER), true)
+        ifeq ($(call check-jvm-variant, server), true)
 	  $(PRINTF) "-server KNOWN\n">>$(@)
 	  $(PRINTF) "-client ALIASED_TO -server\n">>$(@)
-          ifeq ($(JVM_VARIANT_MINIMAL1), true)
+          ifeq ($(call check-jvm-variant, minimal), true)
 	    $(PRINTF) "-minimal KNOWN\n">>$(@)
           endif
         else
-          ifeq ($(JVM_VARIANT_CLIENT), true)
+          ifeq ($(call check-jvm-variant, client), true)
 	    $(PRINTF) "-client KNOWN\n">>$(@)
 	    $(PRINTF) "-server ALIASED_TO -client\n">>$(@)
-            ifeq ($(JVM_VARIANT_MINIMAL1), true)
+            ifeq ($(call check-jvm-variant, minimal), true)
 	      $(PRINTF) "-minimal KNOWN\n">>$(@)
             endif
           else
-            ifeq ($(JVM_VARIANT_MINIMAL1), true)
+            ifeq ($(call check-jvm-variant, minimal), true)
 	      $(PRINTF) "-minimal KNOWN\n">>$(@)
 	      $(PRINTF) "-server ALIASED_TO -minimal\n">>$(@)
 	      $(PRINTF) "-client ALIASED_TO -minimal\n">>$(@)
--- a/make/launcher/Launcher-jdk.rmic.gmk	Tue Apr 19 13:00:00 2016 +0530
+++ b/make/launcher/Launcher-jdk.rmic.gmk	Tue Apr 19 11:13:30 2016 -0700
@@ -26,6 +26,6 @@
 include LauncherCommon.gmk
 
 $(eval $(call SetupBuildLauncher, rmic, \
-    MAIN_CLASS := jdk.rmi.rmic.Main, \
+    MAIN_CLASS := sun.rmi.rmic.Main, \
     CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \
 ))
--- a/make/lib/Awt2dLibraries.gmk	Tue Apr 19 13:00:00 2016 +0530
+++ b/make/lib/Awt2dLibraries.gmk	Tue Apr 19 11:13:30 2016 -0700
@@ -375,6 +375,7 @@
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_XAWT_CFLAGS) \
             $(X_CFLAGS), \
+        WARNINGS_AS_ERRORS_xlc := false, \
         DISABLED_WARNINGS_gcc := type-limits pointer-to-int-cast \
             deprecated-declarations unused-result maybe-uninitialized format \
             format-security int-to-pointer-cast parentheses, \
@@ -587,6 +588,7 @@
             $(CUPS_CFLAGS) \
             $(X_CFLAGS) \
             $(LIBAWT_HEADLESS_CFLAGS), \
+        DISABLED_WARNINGS_xlc := 1506-356, \
         DISABLED_WARNINGS_gcc := maybe-uninitialized int-to-pointer-cast, \
         DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
             E_EMPTY_TRANSLATION_UNIT, \
@@ -603,6 +605,10 @@
         OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
     ))
 
+    # AIX warning explanation:
+    # 1506-356 : (W) Compilation unit is empty.
+    #            This happens during the headless build
+
     $(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
 
     TARGETS += $(BUILD_LIBAWT_HEADLESS)
@@ -700,6 +706,7 @@
     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
     OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
     CFLAGS_windows = -DCC_NOEX, \
+    WARNINGS_AS_ERRORS_xlc := false, \
     DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast \
         type-limits missing-field-initializers, \
     DISABLED_WARNINGS_CXX_gcc := reorder delete-non-virtual-dtor strict-overflow \
--- a/make/lib/CoreLibraries.gmk	Tue Apr 19 13:00:00 2016 +0530
+++ b/make/lib/CoreLibraries.gmk	Tue Apr 19 11:13:30 2016 -0700
@@ -146,6 +146,7 @@
         $(LIBJAVA_CFLAGS), \
     System.c_CFLAGS := $(VERSION_CFLAGS), \
     jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \
+    WARNINGS_AS_ERRORS_xlc := false, \
     DISABLED_WARNINGS_gcc := unused-result, \
     DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
     MAPFILE := $(LIBJAVA_MAPFILE), \
@@ -289,7 +290,7 @@
 
 LIBJLI_CFLAGS := $(CFLAGS_JDKLIB)
 
-ifeq ($(JVM_VARIANT_ZERO), true)
+ifeq ($(call check-jvm-variant, zero zeroshark), true)
   ERGO_FAMILY := zero
 else
   ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)
--- a/make/lib/NioLibraries.gmk	Tue Apr 19 13:00:00 2016 +0530
+++ b/make/lib/NioLibraries.gmk	Tue Apr 19 11:13:30 2016 -0700
@@ -70,6 +70,7 @@
     SRC := $(BUILD_LIBNIO_SRC), \
     EXCLUDE_FILES := $(BUILD_LIBNIO_EXFILES), \
     OPTIMIZATION := HIGH, \
+    WARNINGS_AS_ERRORS_xlc := false, \
     CFLAGS := $(CFLAGS_JDKLIB) \
         $(BUILD_LIBNIO_CFLAGS), \
     MAPFILE := $(BUILD_LIBNIO_MAPFILE), \
--- a/make/mapfiles/libjava/mapfile-vers	Tue Apr 19 13:00:00 2016 +0530
+++ b/make/mapfiles/libjava/mapfile-vers	Tue Apr 19 11:13:30 2016 -0700
@@ -139,8 +139,7 @@
 		Java_java_lang_Double_doubleToRawLongBits;
 		Java_java_lang_Float_intBitsToFloat;
 		Java_java_lang_Float_floatToRawIntBits;
-                Java_java_lang_StackFrameInfo_fillInStackFrames;
-                Java_java_lang_StackFrameInfo_setMethodInfo;
+                Java_java_lang_StackFrameInfo_toStackTraceElement0;
                 Java_java_lang_StackStreamFactory_checkStackWalkModes;
                 Java_java_lang_StackStreamFactory_00024AbstractStackWalker_callStackWalk;
                 Java_java_lang_StackStreamFactory_00024AbstractStackWalker_fetchStackFrames;
@@ -224,8 +223,7 @@
 		Java_java_lang_System_setOut0;
 		Java_java_lang_Thread_registerNatives;
 		Java_java_lang_Throwable_fillInStackTrace;
-                Java_java_lang_Throwable_getStackTraceDepth;
-                Java_java_lang_Throwable_getStackTraceElement;
+                Java_java_lang_Throwable_getStackTraceElements;
 		Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2;
 		Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2Ljava_security_AccessControlContext_2;
 		Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2;
@@ -238,32 +236,32 @@
 		Java_jdk_internal_misc_Signal_findSignal0;
 		Java_jdk_internal_misc_Signal_handle0;
 		Java_jdk_internal_misc_Signal_raise0;
-              Java_sun_reflect_ConstantPool_getClassAt0;
-              Java_sun_reflect_ConstantPool_getClassAtIfLoaded0;
-              Java_sun_reflect_ConstantPool_getClassRefIndexAt0;
-              Java_sun_reflect_ConstantPool_getDoubleAt0;
-              Java_sun_reflect_ConstantPool_getFieldAt0;
-              Java_sun_reflect_ConstantPool_getFieldAtIfLoaded0;
-              Java_sun_reflect_ConstantPool_getFloatAt0;
-              Java_sun_reflect_ConstantPool_getIntAt0;
-              Java_sun_reflect_ConstantPool_getLongAt0;
-              Java_sun_reflect_ConstantPool_getMemberRefInfoAt0;
-              Java_sun_reflect_ConstantPool_getMethodAt0;
-              Java_sun_reflect_ConstantPool_getMethodAtIfLoaded0;
-              Java_sun_reflect_ConstantPool_getNameAndTypeRefIndexAt0;
-              Java_sun_reflect_ConstantPool_getNameAndTypeRefInfoAt0;
-              Java_sun_reflect_ConstantPool_getSize0;
-              Java_sun_reflect_ConstantPool_getStringAt0;
-              Java_sun_reflect_ConstantPool_getTagAt0;
-              Java_sun_reflect_ConstantPool_getUTF8At0;
+              Java_jdk_internal_reflect_ConstantPool_getClassAt0;
+              Java_jdk_internal_reflect_ConstantPool_getClassAtIfLoaded0;
+              Java_jdk_internal_reflect_ConstantPool_getClassRefIndexAt0;
+              Java_jdk_internal_reflect_ConstantPool_getDoubleAt0;
+              Java_jdk_internal_reflect_ConstantPool_getFieldAt0;
+              Java_jdk_internal_reflect_ConstantPool_getFieldAtIfLoaded0;
+              Java_jdk_internal_reflect_ConstantPool_getFloatAt0;
+              Java_jdk_internal_reflect_ConstantPool_getIntAt0;
+              Java_jdk_internal_reflect_ConstantPool_getLongAt0;
+              Java_jdk_internal_reflect_ConstantPool_getMemberRefInfoAt0;
+              Java_jdk_internal_reflect_ConstantPool_getMethodAt0;
+              Java_jdk_internal_reflect_ConstantPool_getMethodAtIfLoaded0;
+              Java_jdk_internal_reflect_ConstantPool_getNameAndTypeRefIndexAt0;
+              Java_jdk_internal_reflect_ConstantPool_getNameAndTypeRefInfoAt0;
+              Java_jdk_internal_reflect_ConstantPool_getSize0;
+              Java_jdk_internal_reflect_ConstantPool_getStringAt0;
+              Java_jdk_internal_reflect_ConstantPool_getTagAt0;
+              Java_jdk_internal_reflect_ConstantPool_getUTF8At0;
 		Java_java_io_Console_istty;
 		Java_java_io_Console_encoding;
                 Java_java_io_Console_echo;
-		Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0;
-		Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
-		Java_sun_reflect_Reflection_getCallerClass__;
-		Java_sun_reflect_Reflection_getCallerClass__I;
-		Java_sun_reflect_Reflection_getClassAccessFlags;
+		Java_jdk_internal_reflect_NativeConstructorAccessorImpl_newInstance0;
+		Java_jdk_internal_reflect_NativeMethodAccessorImpl_invoke0;
+		Java_jdk_internal_reflect_Reflection_getCallerClass__;
+		Java_jdk_internal_reflect_Reflection_getCallerClass__I;
+		Java_jdk_internal_reflect_Reflection_getClassAccessFlags;
 		Java_jdk_internal_misc_VM_latestUserDefinedLoader;
                 Java_jdk_internal_misc_VM_getuid;
                 Java_jdk_internal_misc_VM_geteuid;
--- a/make/mapfiles/libjava/reorder-sparc	Tue Apr 19 13:00:00 2016 +0530
+++ b/make/mapfiles/libjava/reorder-sparc	Tue Apr 19 11:13:30 2016 -0700
@@ -78,8 +78,7 @@
 text: .text%JNU_GetEnv;
 text: .text%Java_java_io_UnixFileSystem_checkAccess;
 text: .text%Java_java_lang_reflect_Array_newArray;
-text: .text%Java_java_lang_Throwable_getStackTraceDepth;
-text: .text%Java_java_lang_Throwable_getStackTraceElement;
+text: .text%Java_java_lang_Throwable_getStackTraceElements;
 text: .text%throwFileNotFoundException;
 text: .text%JNU_NotifyAll;
 # Test LoadFrame
--- a/make/mapfiles/libjava/reorder-sparcv9	Tue Apr 19 13:00:00 2016 +0530
+++ b/make/mapfiles/libjava/reorder-sparcv9	Tue Apr 19 11:13:30 2016 -0700
@@ -74,8 +74,7 @@
 text: .text%JNU_GetEnv;
 text: .text%Java_java_io_UnixFileSystem_checkAccess;
 text: .text%Java_java_lang_reflect_Array_newArray;
-text: .text%Java_java_lang_Throwable_getStackTraceDepth;
-text: .text%Java_java_lang_Throwable_getStackTraceElement;
+text: .text%Java_java_lang_Throwable_getStackTraceElements;
 text: .text%throwFileNotFoundException: OUTPUTDIR/io_util.o;
 text: .text%JNU_NotifyAll;
 # Test LoadFrame
--- a/make/mapfiles/libjava/reorder-x86	Tue Apr 19 13:00:00 2016 +0530
+++ b/make/mapfiles/libjava/reorder-x86	Tue Apr 19 11:13:30 2016 -0700
@@ -78,8 +78,7 @@
 text: .text%Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
 text: .text%Java_java_io_FileInputStream_available;
 text: .text%Java_java_lang_reflect_Array_newArray;
-text: .text%Java_java_lang_Throwable_getStackTraceDepth;
-text: .text%Java_java_lang_Throwable_getStackTraceElement;
+text: .text%Java_java_lang_Throwable_getStackTraceElements;
 text: .text%Java_java_lang_System_identityHashCode;
 text: .text%JNU_NotifyAll;
 # Test LoadFrame
--- a/make/mapfiles/libnio/mapfile-linux	Tue Apr 19 13:00:00 2016 +0530
+++ b/make/mapfiles/libnio/mapfile-linux	Tue Apr 19 11:13:30 2016 -0700
@@ -161,7 +161,9 @@
 		Java_sun_nio_fs_UnixNativeDispatcher_strerror;
 		Java_sun_nio_fs_UnixNativeDispatcher_dup;
 		Java_sun_nio_fs_UnixNativeDispatcher_access0;
+		Java_sun_nio_fs_UnixNativeDispatcher_exists0;
 		Java_sun_nio_fs_UnixNativeDispatcher_stat0;
+		Java_sun_nio_fs_UnixNativeDispatcher_stat1;
 		Java_sun_nio_fs_UnixNativeDispatcher_lstat0;
 		Java_sun_nio_fs_UnixNativeDispatcher_fstat;
 		Java_sun_nio_fs_UnixNativeDispatcher_fstatat0;
--- a/make/mapfiles/libnio/mapfile-macosx	Tue Apr 19 13:00:00 2016 +0530
+++ b/make/mapfiles/libnio/mapfile-macosx	Tue Apr 19 11:13:30 2016 -0700
@@ -138,7 +138,9 @@
 		Java_sun_nio_fs_UnixNativeDispatcher_strerror;
 		Java_sun_nio_fs_UnixNativeDispatcher_dup;
 		Java_sun_nio_fs_UnixNativeDispatcher_access0;
+		Java_sun_nio_fs_UnixNativeDispatcher_exists0;
 		Java_sun_nio_fs_UnixNativeDispatcher_stat0;
+                Java_sun_nio_fs_UnixNativeDispatcher_stat1;
 		Java_sun_nio_fs_UnixNativeDispatcher_lstat0;
 		Java_sun_nio_fs_UnixNativeDispatcher_fstat;
 		Java_sun_nio_fs_UnixNativeDispatcher_fstatat0;
--- a/make/mapfiles/libnio/mapfile-solaris	Tue Apr 19 13:00:00 2016 +0530
+++ b/make/mapfiles/libnio/mapfile-solaris	Tue Apr 19 11:13:30 2016 -0700
@@ -138,7 +138,9 @@
 		Java_sun_nio_fs_UnixNativeDispatcher_strerror;
 		Java_sun_nio_fs_UnixNativeDispatcher_dup;
 		Java_sun_nio_fs_UnixNativeDispatcher_access0;
+		Java_sun_nio_fs_UnixNativeDispatcher_exists0;
 		Java_sun_nio_fs_UnixNativeDispatcher_stat0;
+		Java_sun_nio_fs_UnixNativeDispatcher_stat1;
 		Java_sun_nio_fs_UnixNativeDispatcher_lstat0;
 		Java_sun_nio_fs_UnixNativeDispatcher_fstat;
 		Java_sun_nio_fs_UnixNativeDispatcher_fstatat0;
--- a/src/java.base/share/classes/com/sun/crypto/provider/AESCrypt.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/com/sun/crypto/provider/AESCrypt.java	Tue Apr 19 11:13:30 2016 -0700
@@ -56,7 +56,7 @@
     private boolean ROUNDS_14 = false;
 
     /** Session and Sub keys */
-    private Object[] sessionK = null;
+    private int[][] sessionK = null;
     private int[] K = null;
 
     /** Cipher encryption/decryption key */
@@ -99,7 +99,7 @@
         }
 
         // set sub key to the corresponding session Key
-        this.K = (int[]) sessionK[(decrypting? 1:0)];
+        this.K = sessionK[(decrypting? 1:0)];
     }
 
     /**
@@ -680,7 +680,7 @@
         limit = ROUNDS*4;
 
         // store the expanded sub keys into 'sessionK'
-        sessionK = new Object[] { expandedKe, expandedKd };
+        sessionK = new int[][] { expandedKe, expandedKd };
     }
 
 
--- a/src/java.base/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java	Tue Apr 19 11:13:30 2016 -0700
@@ -71,6 +71,17 @@
         initialize(2048, null);
     }
 
+    private static void checkKeySize(int keysize)
+            throws InvalidParameterException {
+
+        if ((keysize < 512) || (keysize > 8192) || ((keysize & 0x3F) != 0)) {
+            throw new InvalidParameterException(
+                    "DH key size must be multiple of 64, and can only range " +
+                    "from 512 to 8192 (inclusive). " +
+                    "The specific key size " + keysize + " is not supported");
+        }
+    }
+
     /**
      * Initializes this key pair generator for a certain keysize and source of
      * randomness.
@@ -80,16 +91,22 @@
      * @param random the source of randomness
      */
     public void initialize(int keysize, SecureRandom random) {
-        if ((keysize < 512) || (keysize > 2048) || (keysize % 64 != 0)) {
-            throw new InvalidParameterException("Keysize must be multiple "
-                                                + "of 64, and can only range "
-                                                + "from 512 to 2048 "
-                                                + "(inclusive)");
+        checkKeySize(keysize);
+
+        // Use the built-in parameters (ranging from 512 to 8192)
+        // when available.
+        this.params = ParameterCache.getCachedDHParameterSpec(keysize);
+
+        // Due to performance issue, only support DH parameters generation
+        // up to 1024 bits.
+        if ((this.params == null) && (keysize > 1024)) {
+            throw new InvalidParameterException(
+                "Unsupported " + keysize + "-bit DH parameter generation");
         }
+
         this.pSize = keysize;
         this.lSize = 0;
         this.random = random;
-        this.params = null;
     }
 
     /**
@@ -115,11 +132,10 @@
 
         params = (DHParameterSpec)algParams;
         pSize = params.getP().bitLength();
-        if ((pSize < 512) || (pSize > 2048) ||
-            (pSize % 64 != 0)) {
-            throw new InvalidAlgorithmParameterException
-                ("Prime size must be multiple of 64, and can only range "
-                 + "from 512 to 2048 (inclusive)");
+        try {
+            checkKeySize(pSize);
+        } catch (InvalidParameterException ipe) {
+            throw new InvalidAlgorithmParameterException(ipe.getMessage());
         }
 
         // exponent size is optional, could be 0
@@ -164,7 +180,7 @@
         }
 
         BigInteger x;
-        BigInteger pMinus2 = p.subtract(BigInteger.valueOf(2));
+        BigInteger pMinus2 = p.subtract(BigInteger.TWO);
 
         //
         // PKCS#3 section 7.1 "Private-value generation"
--- a/src/java.base/share/classes/com/sun/crypto/provider/DHParameterGenerator.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/com/sun/crypto/provider/DHParameterGenerator.java	Tue Apr 19 11:13:30 2016 -0700
@@ -25,6 +25,7 @@
 
 package com.sun.crypto.provider;
 
+import java.math.BigInteger;
 import java.security.*;
 import java.security.spec.*;
 import javax.crypto.spec.DHParameterSpec;
@@ -46,8 +47,7 @@
  * @see java.security.spec.AlgorithmParameterSpec
  * @see DHParameters
  */
-public final class DHParameterGenerator
-extends AlgorithmParameterGeneratorSpi {
+public final class DHParameterGenerator extends AlgorithmParameterGeneratorSpi {
 
     // The size in bits of the prime modulus
     private int primeSize = 2048;
@@ -59,12 +59,16 @@
     private SecureRandom random = null;
 
     private static void checkKeySize(int keysize)
-        throws InvalidAlgorithmParameterException {
-        if ((keysize != 2048) &&
-            ((keysize < 512) || (keysize > 1024) || (keysize % 64 != 0))) {
-            throw new InvalidAlgorithmParameterException(
-                "Keysize must be multiple of 64 ranging from "
-                + "512 to 1024 (inclusive), or 2048");
+            throws InvalidParameterException {
+
+        boolean supported = ((keysize == 2048) || (keysize == 3072) ||
+            ((keysize >= 512) && (keysize <= 1024) && ((keysize & 0x3F) == 0)));
+
+        if (!supported) {
+            throw new InvalidParameterException(
+                    "DH key size must be multiple of 64 and range " +
+                    "from 512 to 1024 (inclusive), or 2048, 3072. " +
+                    "The specific key size " + keysize + " is not supported");
         }
     }
 
@@ -76,13 +80,9 @@
      * @param keysize the keysize (size of prime modulus) in bits
      * @param random the source of randomness
      */
+    @Override
     protected void engineInit(int keysize, SecureRandom random) {
-        // Re-uses DSA parameters and thus have the same range
-        try {
-            checkKeySize(keysize);
-        } catch (InvalidAlgorithmParameterException ex) {
-            throw new InvalidParameterException(ex.getMessage());
-        }
+        checkKeySize(keysize);
         this.primeSize = keysize;
         this.random = random;
     }
@@ -98,32 +98,31 @@
      * @exception InvalidAlgorithmParameterException if the given parameter
      * generation values are inappropriate for this parameter generator
      */
+    @Override
     protected void engineInit(AlgorithmParameterSpec genParamSpec,
-                              SecureRandom random)
-        throws InvalidAlgorithmParameterException {
+            SecureRandom random) throws InvalidAlgorithmParameterException {
+
         if (!(genParamSpec instanceof DHGenParameterSpec)) {
             throw new InvalidAlgorithmParameterException
                 ("Inappropriate parameter type");
         }
 
         DHGenParameterSpec dhParamSpec = (DHGenParameterSpec)genParamSpec;
-
         primeSize = dhParamSpec.getPrimeSize();
-
-        // Re-uses DSA parameters and thus have the same range
-        checkKeySize(primeSize);
-
         exponentSize = dhParamSpec.getExponentSize();
-        if (exponentSize <= 0) {
-            throw new InvalidAlgorithmParameterException
-                ("Exponent size must be greater than zero");
+        if ((exponentSize <= 0) || (exponentSize >= primeSize)) {
+            throw new InvalidAlgorithmParameterException(
+                    "Exponent size (" + exponentSize +
+                    ") must be positive and less than modulus size (" +
+                    primeSize + ")");
+        }
+        try {
+            checkKeySize(primeSize);
+        } catch (InvalidParameterException ipe) {
+            throw new InvalidAlgorithmParameterException(ipe.getMessage());
         }
 
-        // Require exponentSize < primeSize
-        if (exponentSize >= primeSize) {
-            throw new InvalidAlgorithmParameterException
-                ("Exponent size must be less than modulus size");
-        }
+        this.random = random;
     }
 
     /**
@@ -131,24 +130,22 @@
      *
      * @return the new AlgorithmParameters object
      */
+    @Override
     protected AlgorithmParameters engineGenerateParameters() {
-        AlgorithmParameters algParams = null;
 
-        if (this.exponentSize == 0) {
-            this.exponentSize = this.primeSize - 1;
+        if (random == null) {
+            random = SunJCE.getRandom();
         }
 
-        if (this.random == null)
-            this.random = SunJCE.getRandom();
-
+        BigInteger paramP = null;
+        BigInteger paramG = null;
         try {
-            AlgorithmParameterGenerator paramGen;
-            DSAParameterSpec dsaParamSpec;
-
-            paramGen = AlgorithmParameterGenerator.getInstance("DSA");
-            paramGen.init(this.primeSize, random);
-            algParams = paramGen.generateParameters();
-            dsaParamSpec = algParams.getParameterSpec(DSAParameterSpec.class);
+            AlgorithmParameterGenerator dsaParamGen =
+                    AlgorithmParameterGenerator.getInstance("DSA");
+            dsaParamGen.init(primeSize, random);
+            AlgorithmParameters dsaParams = dsaParamGen.generateParameters();
+            DSAParameterSpec dsaParamSpec =
+                    dsaParams.getParameterSpec(DSAParameterSpec.class);
 
             DHParameterSpec dhParamSpec;
             if (this.exponentSize > 0) {
@@ -159,16 +156,13 @@
                 dhParamSpec = new DHParameterSpec(dsaParamSpec.getP(),
                                                   dsaParamSpec.getG());
             }
-            algParams = AlgorithmParameters.getInstance("DH",
-                    SunJCE.getInstance());
+            AlgorithmParameters algParams =
+                    AlgorithmParameters.getInstance("DH", SunJCE.getInstance());
             algParams.init(dhParamSpec);
-        } catch (InvalidParameterSpecException e) {
-            // this should never happen
-            throw new RuntimeException(e.getMessage());
-        } catch (NoSuchAlgorithmException e) {
-            // this should never happen, because we provide it
-            throw new RuntimeException(e.getMessage());
+
+            return algParams;
+        } catch (Exception ex) {
+            throw new ProviderException("Unexpected exception", ex);
         }
-        return algParams;
     }
 }
--- a/src/java.base/share/classes/java/io/ObjectStreamClass.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/io/ObjectStreamClass.java	Tue Apr 19 11:13:30 2016 -0700
@@ -49,9 +49,9 @@
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import jdk.internal.misc.Unsafe;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
-import sun.reflect.ReflectionFactory;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
+import jdk.internal.reflect.ReflectionFactory;
 import sun.reflect.misc.ReflectUtil;
 
 import static java.io.ObjectStreamField.*;
--- a/src/java.base/share/classes/java/io/ObjectStreamField.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/io/ObjectStreamField.java	Tue Apr 19 11:13:30 2016 -0700
@@ -26,8 +26,8 @@
 package java.io;
 
 import java.lang.reflect.Field;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
 import sun.reflect.misc.ReflectUtil;
 
 /**
--- a/src/java.base/share/classes/java/lang/ArrayIndexOutOfBoundsException.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/ArrayIndexOutOfBoundsException.java	Tue Apr 19 11:13:30 2016 -0700
@@ -64,20 +64,4 @@
     public ArrayIndexOutOfBoundsException(int index) {
         super("Array index out of range: " + index);
     }
-
-    /**
-     * Constructs a new {@code ArrayIndexOutOfBoundsException} class with
-     * arguments indicating two out of bound values.
-     *
-     * <p>The out of bound values are included in this exception's detail
-     * message.  The exact presentation format of the detail message is
-     * unspecified.
-     *
-     * @param a the first out of bound value.
-     * @param b the second out of bound value.
-     * @since 9
-     */
-    public ArrayIndexOutOfBoundsException(int a, int b) {
-        super("Array indexed access out of bounds: " + a + ", " + b);
-    }
 }
--- a/src/java.base/share/classes/java/lang/Boolean.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/Boolean.java	Tue Apr 19 11:13:30 2016 -0700
@@ -79,13 +79,16 @@
      * Allocates a {@code Boolean} object representing the
      * {@code value} argument.
      *
-     * <p><b>Note: It is rarely appropriate to use this constructor.
-     * Unless a <i>new</i> instance is required, the static factory
-     * {@link #valueOf(boolean)} is generally a better choice. It is
-     * likely to yield significantly better space and time performance.</b>
+     * @param   value   the value of the {@code Boolean}.
      *
-     * @param   value   the value of the {@code Boolean}.
+     * @deprecated
+     * It is rarely appropriate to use this constructor. The static factory
+     * {@link #valueOf(boolean)} is generally a better choice, as it is
+     * likely to yield significantly better space and time performance.
+     * Also consider using the final fields {@link #TRUE} and {@link #FALSE}
+     * if possible.
      */
+    @Deprecated(since="9")
     public Boolean(boolean value) {
         this.value = value;
     }
@@ -94,15 +97,18 @@
      * Allocates a {@code Boolean} object representing the value
      * {@code true} if the string argument is not {@code null}
      * and is equal, ignoring case, to the string {@code "true"}.
-     * Otherwise, allocate a {@code Boolean} object representing the
-     * value {@code false}. Examples:<p>
-     * {@code new Boolean("True")} produces a {@code Boolean} object
-     * that represents {@code true}.<br>
-     * {@code new Boolean("yes")} produces a {@code Boolean} object
-     * that represents {@code false}.
+     * Otherwise, allocates a {@code Boolean} object representing the
+     * value {@code false}.
      *
      * @param   s   the string to be converted to a {@code Boolean}.
+     *
+     * @deprecated
+     * It is rarely appropriate to use this constructor.
+     * Use {@link #parseBoolean(String)} to convert a string to a
+     * {@code boolean} primitive, or use {@link #valueOf(String)}
+     * to convert a string to a {@code Boolean} object.
      */
+    @Deprecated(since="9")
     public Boolean(String s) {
         this(parseBoolean(s));
     }
--- a/src/java.base/share/classes/java/lang/Byte.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/Byte.java	Tue Apr 19 11:13:30 2016 -0700
@@ -297,7 +297,13 @@
      *
      * @param value     the value to be represented by the
      *                  {@code Byte}.
+     *
+     * @deprecated
+     * It is rarely appropriate to use this constructor. The static factory
+     * {@link #valueOf(byte)} is generally a better choice, as it is
+     * likely to yield significantly better space and time performance.
      */
+    @Deprecated(since="9")
     public Byte(byte value) {
         this.value = value;
     }
@@ -311,10 +317,16 @@
      *
      * @param s         the {@code String} to be converted to a
      *                  {@code Byte}
-     * @throws           NumberFormatException If the {@code String}
+     * @throws          NumberFormatException if the {@code String}
      *                  does not contain a parsable {@code byte}.
-     * @see        java.lang.Byte#parseByte(java.lang.String, int)
+     *
+     * @deprecated
+     * It is rarely appropriate to use this constructor.
+     * Use {@link #parseByte(String)} to convert a string to a
+     * {@code byte} primitive, or use {@link #valueOf(String)}
+     * to convert a string to a {@code Byte} object.
      */
+    @Deprecated(since="9")
     public Byte(String s) throws NumberFormatException {
         this.value = parseByte(s, 10);
     }
--- a/src/java.base/share/classes/java/lang/Character.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/Character.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1256,14 +1256,14 @@
             new UnicodeBlock("SPECIALS");
 
         /**
-         * @deprecated As of J2SE 5, use {@link #HIGH_SURROGATES},
-         *             {@link #HIGH_PRIVATE_USE_SURROGATES}, and
-         *             {@link #LOW_SURROGATES}. These new constants match
-         *             the block definitions of the Unicode Standard.
-         *             The {@link #of(char)} and {@link #of(int)} methods
-         *             return the new constants, not SURROGATES_AREA.
-         */
-        @Deprecated
+         * @deprecated
+         * Instead of {@code SURROGATES_AREA}, use {@link #HIGH_SURROGATES},
+         * {@link #HIGH_PRIVATE_USE_SURROGATES}, and {@link #LOW_SURROGATES}.
+         * These constants match the block definitions of the Unicode Standard.
+         * The {@link #of(char)} and {@link #of(int)} methods return the
+         * standard constants.
+         */
+        @Deprecated(since="1.5")
         public static final UnicodeBlock SURROGATES_AREA =
             new UnicodeBlock("SURROGATES_AREA");
 
@@ -7451,7 +7451,13 @@
      *
      * @param  value   the value to be represented by the
      *                  {@code Character} object.
-     */
+     *
+     * @deprecated
+     * It is rarely appropriate to use this constructor. The static factory
+     * {@link #valueOf(char)} is generally a better choice, as it is
+     * likely to yield significantly better space and time performance.
+     */
+    @Deprecated(since="9")
     public Character(char value) {
         this.value = value;
     }
@@ -8799,7 +8805,7 @@
      * @since   1.0.2
      * @deprecated Replaced by isJavaIdentifierStart(char).
      */
-    @Deprecated
+    @Deprecated(since="1.1")
     public static boolean isJavaLetter(char ch) {
         return isJavaIdentifierStart(ch);
     }
@@ -8835,7 +8841,7 @@
      * @since   1.0.2
      * @deprecated Replaced by isJavaIdentifierPart(char).
      */
-    @Deprecated
+    @Deprecated(since="1.1")
     public static boolean isJavaLetterOrDigit(char ch) {
         return isJavaIdentifierPart(ch);
     }
@@ -9580,7 +9586,7 @@
      * @see        Character#isWhitespace(char)
      * @deprecated Replaced by isWhitespace(char).
      */
-    @Deprecated
+    @Deprecated(since="1.1")
     public static boolean isSpace(char ch) {
         return (ch <= 0x0020) &&
             (((((1L << 0x0009) |
--- a/src/java.base/share/classes/java/lang/Class.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/Class.java	Tue Apr 19 11:13:30 2016 -0700
@@ -66,10 +66,10 @@
 import jdk.internal.loader.BuiltinClassLoader;
 import jdk.internal.misc.Unsafe;
 import jdk.internal.misc.VM;
-import sun.reflect.CallerSensitive;
-import sun.reflect.ConstantPool;
-import sun.reflect.Reflection;
-import sun.reflect.ReflectionFactory;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.ConstantPool;
+import jdk.internal.reflect.Reflection;
+import jdk.internal.reflect.ReflectionFactory;
 import sun.reflect.generics.factory.CoreReflectionFactory;
 import sun.reflect.generics.factory.GenericsFactory;
 import sun.reflect.generics.repository.ClassRepository;
@@ -3473,7 +3473,7 @@
         if (reflectionFactory == null) {
             reflectionFactory =
                 java.security.AccessController.doPrivileged
-                    (new sun.reflect.ReflectionFactory.GetReflectionFactoryAction());
+                    (new ReflectionFactory.GetReflectionFactoryAction());
         }
         return reflectionFactory;
     }
--- a/src/java.base/share/classes/java/lang/ClassLoader.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java	Tue Apr 19 11:13:30 2016 -0700
@@ -60,8 +60,8 @@
 import jdk.internal.misc.SharedSecrets;
 import jdk.internal.misc.Unsafe;
 import jdk.internal.misc.VM;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
 import sun.reflect.misc.ReflectUtil;
 import sun.security.util.SecurityConstants;
 
@@ -727,7 +727,7 @@
      * @deprecated  Replaced by {@link #defineClass(String, byte[], int, int)
      * defineClass(String, byte[], int, int)}
      */
-    @Deprecated
+    @Deprecated(since="1.1")
     protected final Class<?> defineClass(byte[] b, int off, int len)
         throws ClassFormatError
     {
@@ -2012,7 +2012,7 @@
      *
      * @since  1.2
      */
-    @Deprecated
+    @Deprecated(since="9")
     protected Package getPackage(String name) {
         Package pkg = getDefinedPackage(name);
         if (pkg == null) {
--- a/src/java.base/share/classes/java/lang/Deprecated.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/Deprecated.java	Tue Apr 19 11:13:30 2016 -0700
@@ -29,14 +29,44 @@
 import static java.lang.annotation.ElementType.*;
 
 /**
- * A program element annotated &#64;Deprecated is one that programmers
- * are discouraged from using, typically because it is dangerous,
- * or because a better alternative exists.  Compilers warn when a
- * deprecated program element is used or overridden in non-deprecated code.
+ * A program element annotated {@code @Deprecated} is one that programmers
+ * are discouraged from using. An element may be deprecated for any of several
+ * reasons, for example, its usage is likely to lead to errors; it may
+ * be changed incompatibly or removed in a future version; it has been
+ * superseded by a newer, usually preferable alternative; or it is obsolete.
  *
- * <p>Use of the &#64;Deprecated annotation on a local variable
- * declaration or on a parameter declaration or a package declaration
- * has no effect on the warnings issued by a compiler.
+ * <p>Compilers issue warnings when a deprecated program element is used or
+ * overridden in non-deprecated code. Use of the {@code @Deprecated}
+ * annotation on a local variable declaration or on a parameter declaration
+ * or a package declaration has no effect on the warnings issued by a compiler.
+ *
+ * <p>This annotation type has a string-valued element {@code since}. The value
+ * of this element indicates the version in which the annotated program element
+ * was first deprecated.
+ *
+ * <p>This annotation type has a boolean-valued element {@code forRemoval}.
+ * A value of {@code true} indicates intent to remove the annotated program
+ * element in a future version. A value of {@code false} indicates that use of
+ * the annotated program element is discouraged, but at the time the program
+ * element was annotated, there was no specific intent to remove it.
+ *
+ * @apiNote
+ * It is strongly recommended that the reason for deprecating a program element
+ * be explained in the documentation, using the {@code @deprecated}
+ * javadoc tag. The documentation should also suggest and link to a
+ * recommended replacement API, if applicable. A replacement API often
+ * has subtly different semantics, so such issues should be discussed as
+ * well.
+ *
+ * <p>It is recommended that a {@code since} value be provided with all newly
+ * annotated program elements. Note that {@code since} cannot be mandatory,
+ * as there are many existing annotations that lack this element value.
+ *
+ * <p>There is no defined order among annotation elements. As a matter of
+ * style, the {@code since} element should be placed first.
+ *
+ * <p>The {@code @Deprecated} annotation should always be present if
+ * the {@code @deprecated} javadoc tag is present, and vice-versa.
  *
  * @author  Neal Gafter
  * @since 1.5
@@ -46,4 +76,23 @@
 @Retention(RetentionPolicy.RUNTIME)
 @Target(value={CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, TYPE})
 public @interface Deprecated {
+    /**
+     * Returns the version in which the annotated element became deprecated.
+     * The version string is in the same format and namespace as the value of
+     * the {@code &#64;since} javadoc tag. The default value is the empty
+     * string.
+     *
+     * @return the version string
+     * @since 9
+     */
+    String since() default "";
+
+    /**
+     * Indicates whether the annotated element is subject to removal in a
+     * future version. The default value is {@code false}.
+     *
+     * @return whether the element is subject to removal
+     * @since 9
+     */
+    boolean forRemoval() default false;
 }
--- a/src/java.base/share/classes/java/lang/Double.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/Double.java	Tue Apr 19 11:13:30 2016 -0700
@@ -589,7 +589,13 @@
      * represents the primitive {@code double} argument.
      *
      * @param   value   the value to be represented by the {@code Double}.
+     *
+     * @deprecated
+     * It is rarely appropriate to use this constructor. The static factory
+     * {@link #valueOf(double)} is generally a better choice, as it is
+     * likely to yield significantly better space and time performance.
      */
+    @Deprecated(since="9")
     public Double(double value) {
         this.value = value;
     }
@@ -601,10 +607,16 @@
      * {@code double} value as if by the {@code valueOf} method.
      *
      * @param  s  a string to be converted to a {@code Double}.
-     * @throws    NumberFormatException  if the string does not contain a
+     * @throws    NumberFormatException if the string does not contain a
      *            parsable number.
-     * @see       java.lang.Double#valueOf(java.lang.String)
+     *
+     * @deprecated
+     * It is rarely appropriate to use this constructor.
+     * Use {@link #parseDouble(String)} to convert a string to a
+     * {@code double} primitive, or use {@link #valueOf(String)}
+     * to convert a string to a {@code Double} object.
      */
+    @Deprecated(since="9")
     public Double(String s) throws NumberFormatException {
         value = parseDouble(s);
     }
--- a/src/java.base/share/classes/java/lang/Float.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/Float.java	Tue Apr 19 11:13:30 2016 -0700
@@ -502,7 +502,13 @@
      * represents the primitive {@code float} argument.
      *
      * @param   value   the value to be represented by the {@code Float}.
+     *
+     * @deprecated
+     * It is rarely appropriate to use this constructor. The static factory
+     * {@link #valueOf(float)} is generally a better choice, as it is
+     * likely to yield significantly better space and time performance.
      */
+    @Deprecated(since="9")
     public Float(float value) {
         this.value = value;
     }
@@ -512,7 +518,13 @@
      * represents the argument converted to type {@code float}.
      *
      * @param   value   the value to be represented by the {@code Float}.
+     *
+     * @deprecated
+     * It is rarely appropriate to use this constructor. Instead, use the
+     * static factory method {@link #valueOf(float)} method as follows:
+     * {@code Float.valueOf((float)value)}.
      */
+    @Deprecated(since="9")
     public Float(double value) {
         this.value = (float)value;
     }
@@ -523,11 +535,17 @@
      * represented by the string. The string is converted to a
      * {@code float} value as if by the {@code valueOf} method.
      *
-     * @param      s   a string to be converted to a {@code Float}.
-     * @throws  NumberFormatException  if the string does not contain a
-     *               parsable number.
-     * @see        java.lang.Float#valueOf(java.lang.String)
+     * @param   s   a string to be converted to a {@code Float}.
+     * @throws      NumberFormatException if the string does not contain a
+     *              parsable number.
+     *
+     * @deprecated
+     * It is rarely appropriate to use this constructor.
+     * Use {@link #parseFloat(String)} to convert a string to a
+     * {@code float} primitive, or use {@link #valueOf(String)}
+     * to convert a string to a {@code Float} object.
      */
+    @Deprecated(since="9")
     public Float(String s) throws NumberFormatException {
         value = parseFloat(s);
     }
--- a/src/java.base/share/classes/java/lang/IndexOutOfBoundsException.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/IndexOutOfBoundsException.java	Tue Apr 19 11:13:30 2016 -0700
@@ -67,21 +67,4 @@
     public IndexOutOfBoundsException(int index) {
         super("Index out of range: " + index);
     }
-
-    /**
-     * Constructs an {@code IndexOutOfBoundsException} with arguments indicating
-     * two out of bound values.
-     *
-     * <p>The out of bound values are included in this exception's detail
-     * message.  The exact presentation format of the detail message is
-     * unspecified.
-     *
-     * @param a the first out of bound value
-     * @param b the second out of bound value
-     * @since 9
-     */
-    public IndexOutOfBoundsException(int a, int b) {
-        super("Indexed access out of bounds: " + a + ", " + b);
-    }
-
 }
--- a/src/java.base/share/classes/java/lang/Integer.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/Integer.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1106,7 +1106,13 @@
      *
      * @param   value   the value to be represented by the
      *                  {@code Integer} object.
+     *
+     * @deprecated
+     * It is rarely appropriate to use this constructor. The static factory
+     * {@link #valueOf(int)} is generally a better choice, as it is
+     * likely to yield significantly better space and time performance.
      */
+    @Deprecated(since="9")
     public Integer(int value) {
         this.value = value;
     }
@@ -1118,12 +1124,17 @@
      * {@code int} value in exactly the manner used by the
      * {@code parseInt} method for radix 10.
      *
-     * @param      s   the {@code String} to be converted to an
-     *                 {@code Integer}.
-     * @exception  NumberFormatException  if the {@code String} does not
-     *               contain a parsable integer.
-     * @see        java.lang.Integer#parseInt(java.lang.String, int)
+     * @param   s   the {@code String} to be converted to an {@code Integer}.
+     * @throws      NumberFormatException if the {@code String} does not
+     *              contain a parsable integer.
+     *
+     * @deprecated
+     * It is rarely appropriate to use this constructor.
+     * Use {@link #parseInt(String)} to convert a string to a
+     * {@code int} primitive, or use {@link #valueOf(String)}
+     * to convert a string to an {@code Integer} object.
      */
+    @Deprecated(since="9")
     public Integer(String s) throws NumberFormatException {
         this.value = parseInt(s, 10);
     }
--- a/src/java.base/share/classes/java/lang/Long.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/Long.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1340,7 +1340,13 @@
      *
      * @param   value   the value to be represented by the
      *          {@code Long} object.
+     *
+     * @deprecated
+     * It is rarely appropriate to use this constructor. The static factory
+     * {@link #valueOf(long)} is generally a better choice, as it is
+     * likely to yield significantly better space and time performance.
      */
+    @Deprecated(since="9")
     public Long(long value) {
         this.value = value;
     }
@@ -1356,8 +1362,14 @@
      *             {@code Long}.
      * @throws     NumberFormatException  if the {@code String} does not
      *             contain a parsable {@code long}.
-     * @see        java.lang.Long#parseLong(java.lang.String, int)
+     *
+     * @deprecated
+     * It is rarely appropriate to use this constructor.
+     * Use {@link #parseLong(String)} to convert a string to a
+     * {@code long} primitive, or use {@link #valueOf(String)}
+     * to convert a string to a {@code Long} object.
      */
+    @Deprecated(since="9")
     public Long(String s) throws NumberFormatException {
         this.value = parseLong(s, 10);
     }
--- a/src/java.base/share/classes/java/lang/Math.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/Math.java	Tue Apr 19 11:13:30 2016 -0700
@@ -25,6 +25,7 @@
 
 package java.lang;
 
+import java.math.BigDecimal;
 import java.util.Random;
 import jdk.internal.math.FloatConsts;
 import jdk.internal.math.DoubleConsts;
@@ -1450,6 +1451,199 @@
     }
 
     /**
+     * Returns the fused multiply add of the three arguments; that is,
+     * returns the exact product of the first two arguments summed
+     * with the third argument and then rounded once to the nearest
+     * {@code double}.
+     *
+     * The rounding is done using the {@linkplain
+     * java.math.RoundingMode#HALF_EVEN round to nearest even
+     * rounding mode}.
+     *
+     * In contrast, if {@code a * b + c} is evaluated as a regular
+     * floating-point expression, two rounding errors are involved,
+     * the first for the multiply operation, the second for the
+     * addition operation.
+     *
+     * <p>Special cases:
+     * <ul>
+     * <li> If any argument is NaN, the result is NaN.
+     *
+     * <li> If one of the first two arguments is infinite and the
+     * other is zero, the result is NaN.
+     *
+     * <li> If the exact product of the first two arguments is infinite
+     * (in other words, at least one of the arguments is infinite and
+     * the other is neither zero nor NaN) and the third argument is an
+     * infinity of the opposite sign, the result is NaN.
+     *
+     * </ul>
+     *
+     * <p>Note that {@code fma(a, 1.0, c)} returns the same
+     * result as ({@code a + c}).  However,
+     * {@code fma(a, b, +0.0)} does <em>not</em> always return the
+     * same result as ({@code a * b}) since
+     * {@code fma(-0.0, +0.0, +0.0)} is {@code +0.0} while
+     * ({@code -0.0 * +0.0}) is {@code -0.0}; {@code fma(a, b, -0.0)} is
+     * equivalent to ({@code a * b}) however.
+     *
+     * @apiNote This method corresponds to the fusedMultiplyAdd
+     * operation defined in IEEE 754-2008.
+     *
+     * @param a a value
+     * @param b a value
+     * @param c a value
+     *
+     * @return (<i>a</i>&nbsp;&times;&nbsp;<i>b</i>&nbsp;+&nbsp;<i>c</i>)
+     * computed, as if with unlimited range and precision, and rounded
+     * once to the nearest {@code double} value
+     */
+    // @HotSpotIntrinsicCandidate
+    public static double fma(double a, double b, double c) {
+        /*
+         * Infinity and NaN arithmetic is not quite the same with two
+         * roundings as opposed to just one so the simple expression
+         * "a * b + c" cannot always be used to compute the correct
+         * result.  With two roundings, the product can overflow and
+         * if the addend is infinite, a spurious NaN can be produced
+         * if the infinity from the overflow and the infinite addend
+         * have opposite signs.
+         */
+
+        // First, screen for and handle non-finite input values whose
+        // arithmetic is not supported by BigDecimal.
+        if (Double.isNaN(a) || Double.isNaN(b) || Double.isNaN(c)) {
+            return Double.NaN;
+        } else { // All inputs non-NaN
+            boolean infiniteA = Double.isInfinite(a);
+            boolean infiniteB = Double.isInfinite(b);
+            boolean infiniteC = Double.isInfinite(c);
+            double result;
+
+            if (infiniteA || infiniteB || infiniteC) {
+                if (infiniteA && b == 0.0 ||
+                    infiniteB && a == 0.0 ) {
+                    return Double.NaN;
+                }
+                // Store product in a double field to cause an
+                // overflow even if non-strictfp evaluation is being
+                // used.
+                double product = a * b;
+                if (Double.isInfinite(product) && !infiniteA && !infiniteB) {
+                    // Intermediate overflow; might cause a
+                    // spurious NaN if added to infinite c.
+                    assert Double.isInfinite(c);
+                    return c;
+                } else {
+                    result = product + c;
+                    assert !Double.isFinite(result);
+                    return result;
+                }
+            } else { // All inputs finite
+                BigDecimal product = (new BigDecimal(a)).multiply(new BigDecimal(b));
+                if (c == 0.0) { // Positive or negative zero
+                    // If the product is an exact zero, use a
+                    // floating-point expression to compute the sign
+                    // of the zero final result. The product is an
+                    // exact zero if and only if at least one of a and
+                    // b is zero.
+                    if (a == 0.0 || b == 0.0) {
+                        return a * b + c;
+                    } else {
+                        // The sign of a zero addend doesn't matter if
+                        // the product is nonzero. The sign of a zero
+                        // addend is not factored in the result if the
+                        // exact product is nonzero but underflows to
+                        // zero; see IEEE-754 2008 section 6.3 "The
+                        // sign bit".
+                        return product.doubleValue();
+                    }
+                } else {
+                    return product.add(new BigDecimal(c)).doubleValue();
+                }
+            }
+        }
+    }
+
+    /**
+     * Returns the fused multiply add of the three arguments; that is,
+     * returns the exact product of the first two arguments summed
+     * with the third argument and then rounded once to the nearest
+     * {@code float}.
+     *
+     * The rounding is done using the {@linkplain
+     * java.math.RoundingMode#HALF_EVEN round to nearest even
+     * rounding mode}.
+     *
+     * In contrast, if {@code a * b + c} is evaluated as a regular
+     * floating-point expression, two rounding errors are involved,
+     * the first for the multiply operation, the second for the
+     * addition operation.
+     *
+     * <p>Special cases:
+     * <ul>
+     * <li> If any argument is NaN, the result is NaN.
+     *
+     * <li> If one of the first two arguments is infinite and the
+     * other is zero, the result is NaN.
+     *
+     * <li> If the exact product of the first two arguments is infinite
+     * (in other words, at least one of the arguments is infinite and
+     * the other is neither zero nor NaN) and the third argument is an
+     * infinity of the opposite sign, the result is NaN.
+     *
+     * </ul>
+     *
+     * <p>Note that {@code fma(a, 1.0f, c)} returns the same
+     * result as ({@code a + c}).  However,
+     * {@code fma(a, b, +0.0f)} does <em>not</em> always return the
+     * same result as ({@code a * b}) since
+     * {@code fma(-0.0f, +0.0f, +0.0f)} is {@code +0.0f} while
+     * ({@code -0.0f * +0.0f}) is {@code -0.0f}; {@code fma(a, b, -0.0f)} is
+     * equivalent to ({@code a * b}) however.
+     *
+     * @apiNote This method corresponds to the fusedMultiplyAdd
+     * operation defined in IEEE 754-2008.
+     *
+     * @param a a value
+     * @param b a value
+     * @param c a value
+     *
+     * @return (<i>a</i>&nbsp;&times;&nbsp;<i>b</i>&nbsp;+&nbsp;<i>c</i>)
+     * computed, as if with unlimited range and precision, and rounded
+     * once to the nearest {@code float} value
+     */
+    // @HotSpotIntrinsicCandidate
+    public static float fma(float a, float b, float c) {
+        /*
+         *  Since the double format has more than twice the precision
+         *  of the float format, the multiply of a * b is exact in
+         *  double. The add of c to the product then incurs one
+         *  rounding error. Since the double format moreover has more
+         *  than (2p + 2) precision bits compared to the p bits of the
+         *  float format, the two roundings of (a * b + c), first to
+         *  the double format and then secondarily to the float format,
+         *  are equivalent to rounding the intermediate result directly
+         *  to the float format.
+         *
+         * In terms of strictfp vs default-fp concerns related to
+         * overflow and underflow, since
+         *
+         * (Float.MAX_VALUE * Float.MAX_VALUE) << Double.MAX_VALUE
+         * (Float.MIN_VALUE * Float.MIN_VALUE) >> Double.MIN_VALUE
+         *
+         * neither the multiply nor add will overflow or underflow in
+         * double. Therefore, it is not necessary for this method to
+         * be declared strictfp to have reproducible
+         * behavior. However, it is necessary to explicitly store down
+         * to a float variable to avoid returning a value in the float
+         * extended value set.
+         */
+        float result = (float)(((double) a * (double) b ) + (double) c);
+        return result;
+    }
+
+    /**
      * Returns the size of an ulp of the argument.  An ulp, unit in
      * the last place, of a {@code double} value is the positive
      * distance between this floating-point value and the {@code
--- a/src/java.base/share/classes/java/lang/Package.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/Package.java	Tue Apr 19 11:13:30 2016 -0700
@@ -36,8 +36,8 @@
 import java.util.Objects;
 
 import jdk.internal.loader.BootLoader;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
 
 
 /**
@@ -333,7 +333,7 @@
      * @see ClassLoader#getDefinedPackage
      */
     @CallerSensitive
-    @Deprecated
+    @Deprecated(since="9")
     @SuppressWarnings("deprecation")
     public static Package getPackage(String name) {
         ClassLoader l = ClassLoader.getClassLoader(Reflection.getCallerClass());
--- a/src/java.base/share/classes/java/lang/ProcessHandleImpl.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/ProcessHandleImpl.java	Tue Apr 19 11:13:30 2016 -0700
@@ -52,6 +52,11 @@
  */
 final class ProcessHandleImpl implements ProcessHandle {
     /**
+     * Default size of stack for reaper processes.
+     */
+    private static long REAPER_DEFAULT_STACKSIZE = 128 * 1024;
+
+    /**
      * Cache the ProcessHandle of this process.
      */
     private static final ProcessHandleImpl current;
@@ -79,10 +84,12 @@
                 ThreadGroup tg = Thread.currentThread().getThreadGroup();
                 while (tg.getParent() != null) tg = tg.getParent();
                 ThreadGroup systemThreadGroup = tg;
+                final long stackSize = Boolean.getBoolean("jdk.lang.processReaperUseDefaultStackSize")
+                        ? 0 : REAPER_DEFAULT_STACKSIZE;
 
                 ThreadFactory threadFactory = grimReaper -> {
-                    long stackSize = Boolean.getBoolean("jdk.lang.processReaperUseDefaultStackSize") ? 0 : 32768;
-                    Thread t = new Thread(systemThreadGroup, grimReaper, "process reaper", stackSize);
+                    Thread t = new Thread(systemThreadGroup, grimReaper,
+                            "process reaper", stackSize, false);
                     t.setDaemon(true);
                     // A small attempt (probably futile) to avoid priority inversion
                     t.setPriority(Thread.MAX_PRIORITY);
--- a/src/java.base/share/classes/java/lang/Runtime.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/Runtime.java	Tue Apr 19 11:13:30 2016 -0700
@@ -27,8 +27,8 @@
 
 import java.io.*;
 import java.util.StringTokenizer;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
 
 /**
  * Every Java application has a single instance of class
@@ -289,6 +289,7 @@
      *      finalizers being called on live objects while other threads are
      *      concurrently manipulating those objects, resulting in erratic
      *      behavior or deadlock.
+     *      This method is subject to removal in a future version of Java SE.
      *
      * @throws  SecurityException
      *        if a security manager exists and its {@code checkExit}
@@ -299,7 +300,7 @@
      * @see     java.lang.SecurityManager#checkExit(int)
      * @since   1.1
      */
-    @Deprecated
+    @Deprecated(since="1.2", forRemoval=true)
     public static void runFinalizersOnExit(boolean value) {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
@@ -894,8 +895,9 @@
      * stream in the local encoding into a character stream in Unicode is via
      * the {@code InputStreamReader} and {@code BufferedReader}
      * classes.
+     * This method is subject to removal in a future version of Java SE.
      */
-    @Deprecated
+    @Deprecated(since="1.1", forRemoval=true)
     public InputStream getLocalizedInputStream(InputStream in) {
         return in;
     }
@@ -915,6 +917,7 @@
      * Unicode character stream into a byte stream in the local encoding is via
      * the {@code OutputStreamWriter}, {@code BufferedWriter}, and
      * {@code PrintWriter} classes.
+     * This method is subject to removal in a future version of Java SE.
      *
      * @param      out OutputStream to localize
      * @return     a localized output stream
@@ -923,7 +926,7 @@
      * @see        java.io.OutputStreamWriter#OutputStreamWriter(java.io.OutputStream)
      * @see        java.io.PrintWriter#PrintWriter(java.io.OutputStream)
      */
-    @Deprecated
+    @Deprecated(since="1.1", forRemoval=true)
     public OutputStream getLocalizedOutputStream(OutputStream out) {
         return out;
     }
--- a/src/java.base/share/classes/java/lang/SecurityManager.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/SecurityManager.java	Tue Apr 19 11:13:30 2016 -0700
@@ -38,7 +38,7 @@
 import java.lang.reflect.*;
 import java.net.URL;
 
-import sun.reflect.CallerSensitive;
+import jdk.internal.reflect.CallerSensitive;
 import sun.security.util.SecurityConstants;
 
 /**
@@ -229,7 +229,7 @@
      *  It is recommended that the <code>checkPermission</code>
      *  call be used instead.
      */
-    @Deprecated
+    @Deprecated(since="1.2")
     protected boolean inCheck;
 
     /*
@@ -262,7 +262,7 @@
      *  It is recommended that the <code>checkPermission</code>
      *  call be used instead.
      */
-    @Deprecated
+    @Deprecated(since="1.2")
     public boolean getInCheck() {
         return inCheck;
     }
@@ -345,7 +345,7 @@
      * @see  java.lang.ClassLoader#getSystemClassLoader() getSystemClassLoader
      * @see  #checkPermission(java.security.Permission) checkPermission
      */
-    @Deprecated
+    @Deprecated(since="1.2")
     protected ClassLoader currentClassLoader() {
         ClassLoader cl = currentClassLoader0();
         if ((cl != null) && hasAllPermission())
@@ -391,7 +391,7 @@
      * @see  java.lang.ClassLoader#getSystemClassLoader() getSystemClassLoader
      * @see  #checkPermission(java.security.Permission) checkPermission
      */
-    @Deprecated
+    @Deprecated(since="1.2")
     protected Class<?> currentLoadedClass() {
         Class<?> c = currentLoadedClass0();
         if ((c != null) && hasAllPermission())
@@ -411,7 +411,7 @@
      *  call be used instead.
      *
      */
-    @Deprecated
+    @Deprecated(since="1.2")
     protected native int classDepth(String name);
 
     /**
@@ -449,7 +449,7 @@
      * @see   java.lang.ClassLoader#getSystemClassLoader() getSystemClassLoader
      * @see   #checkPermission(java.security.Permission) checkPermission
      */
-    @Deprecated
+    @Deprecated(since="1.2")
     protected int classLoaderDepth() {
         int depth = classLoaderDepth0();
         if (depth != -1) {
@@ -474,7 +474,7 @@
      *  It is recommended that the <code>checkPermission</code>
      *  call be used instead.
      */
-    @Deprecated
+    @Deprecated(since="1.2")
     protected boolean inClass(String name) {
         return classDepth(name) >= 0;
     }
@@ -491,7 +491,7 @@
      *  call be used instead.
      * @see        #currentClassLoader() currentClassLoader
      */
-    @Deprecated
+    @Deprecated(since="1.2")
     protected boolean inClassLoader() {
         return currentClassLoader() != null;
     }
@@ -1217,7 +1217,7 @@
      * @deprecated Use #checkPermission(java.security.Permission) instead
      * @see        #checkPermission(java.security.Permission) checkPermission
      */
-    @Deprecated
+    @Deprecated(since="1.4")
     public void checkMulticast(InetAddress maddr, byte ttl) {
         String host = maddr.getHostAddress();
         if (!host.startsWith("[") && host.indexOf(':') != -1) {
@@ -1297,9 +1297,10 @@
      *             was trusted to bring up a top-level window. The method has been
      *             obsoleted and code should instead use {@link #checkPermission}
      *             to check {@code AWTPermission("showWindowWithoutWarningBanner")}.
+     *             This method is subject to removal in a future version of Java SE.
      * @see        #checkPermission(java.security.Permission) checkPermission
      */
-    @Deprecated
+    @Deprecated(since="1.8", forRemoval=true)
     public boolean checkTopLevelWindow(Object window) {
         if (window == null) {
             throw new NullPointerException("window can't be null");
@@ -1340,9 +1341,10 @@
      *             thread could access the system clipboard. The method has been
      *             obsoleted and code should instead use {@link #checkPermission}
      *             to check {@code AWTPermission("accessClipboard")}.
+     *             This method is subject to removal in a future version of Java SE.
      * @see        #checkPermission(java.security.Permission) checkPermission
      */
-    @Deprecated
+    @Deprecated(since="1.8", forRemoval=true)
     public void checkSystemClipboardAccess() {
         checkPermission(SecurityConstants.ALL_PERMISSION);
     }
@@ -1358,9 +1360,10 @@
      *             thread could access the AWT event queue. The method has been
      *             obsoleted and code should instead use {@link #checkPermission}
      *             to check {@code AWTPermission("accessEventQueue")}.
+     *             This method is subject to removal in a future version of Java SE.
      * @see        #checkPermission(java.security.Permission) checkPermission
      */
-    @Deprecated
+    @Deprecated(since="1.8", forRemoval=true)
     public void checkAwtEventQueueAccess() {
         checkPermission(SecurityConstants.ALL_PERMISSION);
     }
@@ -1626,12 +1629,13 @@
      *             Users of this method should instead invoke {@link #checkPermission}
      *             directly.  This method will be changed in a future release
      *             to check the permission {@code java.security.AllPermission}.
+     *             This method is subject to removal in a future version of Java SE.
      *
      * @see java.lang.reflect.Member
      * @since 1.1
      * @see        #checkPermission(java.security.Permission) checkPermission
      */
-    @Deprecated
+    @Deprecated(since="1.8", forRemoval=true)
     @CallerSensitive
     public void checkMemberAccess(Class<?> clazz, int which) {
         if (clazz == null) {
--- a/src/java.base/share/classes/java/lang/Short.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/Short.java	Tue Apr 19 11:13:30 2016 -0700
@@ -302,7 +302,13 @@
      *
      * @param value     the value to be represented by the
      *                  {@code Short}.
+     *
+     * @deprecated
+     * It is rarely appropriate to use this constructor. The static factory
+     * {@link #valueOf(short)} is generally a better choice, as it is
+     * likely to yield significantly better space and time performance.
      */
+    @Deprecated(since="9")
     public Short(short value) {
         this.value = value;
     }
@@ -318,8 +324,14 @@
      *          {@code Short}
      * @throws  NumberFormatException If the {@code String}
      *          does not contain a parsable {@code short}.
-     * @see     java.lang.Short#parseShort(java.lang.String, int)
+     *
+     * @deprecated
+     * It is rarely appropriate to use this constructor.
+     * Use {@link #parseShort(String)} to convert a string to a
+     * {@code short} primitive, or use {@link #valueOf(String)}
+     * to convert a string to a {@code Short} object.
      */
+    @Deprecated(since="9")
     public Short(String s) throws NumberFormatException {
         this.value = parseShort(s, 10);
     }
--- a/src/java.base/share/classes/java/lang/StackFrameInfo.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/StackFrameInfo.java	Tue Apr 19 11:13:30 2016 -0700
@@ -37,24 +37,14 @@
     private final static JavaLangInvokeAccess jlInvokeAccess =
         SharedSecrets.getJavaLangInvokeAccess();
 
-    // -XX:+MemberNameInStackFrame will initialize MemberName and all other fields;
-    // otherwise, VM will set the hidden fields (injected by the VM).
-    // -XX:+MemberNameInStackFrame is temporary to enable performance measurement
-    //
-    // Footprint improvement: MemberName::clazz and MemberName::name
-    // can replace StackFrameInfo::declaringClass and StackFrameInfo::methodName
-    // Currently VM sets StackFrameInfo::methodName instead of expanding MemberName::name
+    // Footprint improvement: MemberName::clazz can replace
+    // StackFrameInfo::declaringClass.
 
     final StackWalker walker;
     final Class<?> declaringClass;
     final Object memberName;
-    final int bci;
-
-    // methodName, fileName, and lineNumber will be lazily set by the VM
-    // when first requested.
-    private String methodName;
-    private String fileName = null;     // default for unavailable filename
-    private int    lineNumber = -1;     // default for unavailable lineNumber
+    final short bci;
+    private volatile StackTraceElement ste;
 
     /*
      * Create StackFrameInfo for StackFrameTraverser and LiveStackFrameTraverser
@@ -78,77 +68,53 @@
         return declaringClass;
     }
 
-    // Call the VM to set methodName, lineNumber, and fileName
-    private synchronized void ensureMethodInfoInitialized() {
-        if (methodName == null) {
-            setMethodInfo();
-        }
+    @Override
+    public String getMethodName() {
+        return jlInvokeAccess.getName(memberName);
     }
 
     @Override
-    public String getMethodName() {
-        ensureMethodInfoInitialized();
-        return methodName;
+    public final Optional<String> getFileName() {
+        StackTraceElement ste = toStackTraceElement();
+        return ste.getFileName() != null ? Optional.of(ste.getFileName()) : Optional.empty();
     }
 
     @Override
-    public Optional<String> getFileName() {
-        ensureMethodInfoInitialized();
-        return fileName != null ? Optional.of(fileName) : Optional.empty();
+    public final OptionalInt getLineNumber() {
+        StackTraceElement ste = toStackTraceElement();
+        return ste.getLineNumber() > 0 ? OptionalInt.of(ste.getLineNumber()) : OptionalInt.empty();
     }
 
     @Override
-    public OptionalInt getLineNumber() {
-        ensureMethodInfoInitialized();
-        return lineNumber > 0 ? OptionalInt.of(lineNumber) : OptionalInt.empty();
-    }
-
-    @Override
-    public boolean isNativeMethod() {
-        ensureMethodInfoInitialized();
-        return lineNumber == -2;
+    public final boolean isNativeMethod() {
+        StackTraceElement ste = toStackTraceElement();
+        return ste.isNativeMethod();
     }
 
     @Override
     public String toString() {
-        ensureMethodInfoInitialized();
-        // similar format as StackTraceElement::toString
-        if (isNativeMethod()) {
-            return getClassName() + "." + getMethodName() + "(Native Method)";
-        } else {
-            // avoid allocating Optional objects
-            return getClassName() + "." + getMethodName() +
-                "(" + (fileName != null ? fileName : "Unknown Source") +
-                      (lineNumber > 0 ? ":" + lineNumber : " bci:" + bci) + ")";
-        }
+        StackTraceElement ste = toStackTraceElement();
+        return ste.toString();
     }
 
     /**
-     * Lazily initialize method name, file name, line number
+     * Fill in the fields of the given StackTraceElement
      */
-    private native void setMethodInfo();
-
-    /**
-     * Fill in source file name and line number of the given StackFrame array.
-     */
-    static native void fillInStackFrames(int startIndex,
-                                         Object[] stackframes,
-                                         int fromIndex, int toIndex);
+    private native void toStackTraceElement0(StackTraceElement ste);
 
     @Override
     public StackTraceElement toStackTraceElement() {
-        ensureMethodInfoInitialized();
-
-        Module module = declaringClass.getModule();
-        String moduleName = module.isNamed() ? module.getName() : null;
-        String moduleVersion = null;
-        if (module.isNamed() && module.getDescriptor().version().isPresent()) {
-            moduleVersion = module.getDescriptor().version().get().toString();
+        StackTraceElement s = ste;
+        if (s == null) {
+            synchronized (this) {
+                s = ste;
+                if (s == null) {
+                    s = new StackTraceElement();
+                    toStackTraceElement0(s);
+                    ste = s;
+                }
+            }
         }
-        return new StackTraceElement(moduleName, moduleVersion,
-                                     getClassName(), getMethodName(),
-                                     fileName,
-                                     lineNumber);
+        return s;
     }
-
 }
--- a/src/java.base/share/classes/java/lang/StackStreamFactory.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/StackStreamFactory.java	Tue Apr 19 11:13:30 2016 -0700
@@ -24,9 +24,7 @@
  */
 package java.lang;
 
-import jdk.internal.misc.VM;
-
-import java.io.PrintStream;
+import jdk.internal.reflect.MethodAccessor;
 import java.lang.StackWalker.Option;
 import java.lang.StackWalker.StackFrame;
 
@@ -34,12 +32,9 @@
 import java.lang.reflect.Method;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.util.Arrays;
-import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.NoSuchElementException;
 import java.util.Objects;
-import java.util.Optional;
 import java.util.Set;
 import java.util.Spliterator;
 import java.util.function.Consumer;
@@ -60,8 +55,7 @@
  * to avoid overhead of Stream/Lambda
  * 1. Support traversing Stream<StackFrame>
  * 2. StackWalker::getCallerClass
- * 3. Throwable::init and Throwable::getStackTrace
- * 4. AccessControlContext getting ProtectionDomain
+ * 3. AccessControlContext getting ProtectionDomain
  */
 final class StackStreamFactory {
     private StackStreamFactory() {}
@@ -78,25 +72,22 @@
     // These flags must match the values maintained in the VM
     @Native private static final int DEFAULT_MODE              = 0x0;
     @Native private static final int FILL_CLASS_REFS_ONLY      = 0x2;
-    @Native private static final int FILTER_FILL_IN_STACKTRACE = 0x10;
     @Native private static final int SHOW_HIDDEN_FRAMES        = 0x20;  // LambdaForms are hidden by the VM
     @Native private static final int FILL_LIVE_STACK_FRAMES    = 0x100;
-
     /*
      * For Throwable to use StackWalker, set useNewThrowable to true.
      * Performance work and extensive testing is needed to replace the
      * VM built-in backtrace filled in Throwable with the StackWalker.
      */
-    final static boolean useNewThrowable = getProperty("stackwalk.newThrowable", false);
     final static boolean isDebug = getProperty("stackwalk.debug", false);
 
     static <T> StackFrameTraverser<T>
         makeStackTraverser(StackWalker walker, Function<? super Stream<StackFrame>, ? extends T> function)
     {
         if (walker.hasLocalsOperandsOption())
-            return new LiveStackInfoTraverser<T>(walker, function);
+            return new LiveStackInfoTraverser<>(walker, function);
         else
-            return new StackFrameTraverser<T>(walker, function);
+            return new StackFrameTraverser<>(walker, function);
     }
 
     /**
@@ -106,40 +97,31 @@
         return new CallerClassFinder(walker);
     }
 
-    static boolean useStackTrace(Throwable t) {
-        if (t instanceof VirtualMachineError)
-            return false;
-
-        return VM.isBooted() && StackStreamFactory.useNewThrowable;
-    }
-
-    /*
-     * This should only be used by Throwable::<init>.
-     */
-    static StackTrace makeStackTrace(Throwable ex) {
-        return StackTrace.dump(ex);
-    }
-
-    /*
-     * This creates StackTrace for Thread::dumpThread to use.
-     */
-    static StackTrace makeStackTrace() {
-        return StackTrace.dump();
-    }
-
     enum WalkerState {
         NEW,     // the stream is new and stack walking has not started
         OPEN,    // the stream is open when it is being traversed.
         CLOSED;  // the stream is closed when the stack walking is done
     }
 
-    static abstract class AbstractStackWalker<T> {
+    /**
+     * Subclass of AbstractStackWalker implements a specific stack walking logic.
+     * It needs to set up the frame buffer and stack walking mode.
+     *
+     * It initiates the VM stack walking via the callStackWalk method that serves
+     * as the anchored frame and VM will call up to AbstractStackWalker::doStackWalk.
+     *
+     * @param <R> the type of the result returned from stack walking
+     * @param <T> the type of the data gathered for each frame.
+     *            For example, StackFrameInfo for StackWalker::walk or
+     *            Class<?> for StackWalker::getCallerClass
+     */
+    static abstract class AbstractStackWalker<R, T> {
         protected final StackWalker walker;
         protected final Thread thread;
         protected final int maxDepth;
         protected final long mode;
-        protected int depth;                 // traversed stack depth
-        protected FrameBuffer frameBuffer;   // buffer for VM to fill in
+        protected int depth;    // traversed stack depth
+        protected FrameBuffer<? extends T> frameBuffer;
         protected long anchor;
 
         // buffers to fill in stack frame information
@@ -157,16 +139,13 @@
         private int toStackWalkMode(StackWalker walker, int mode) {
             int newMode = mode;
             if (walker.hasOption(Option.SHOW_HIDDEN_FRAMES) &&
-                    !fillCallerClassOnly(newMode) /* don't show hidden frames for getCallerClass */)
+                    (mode & FILL_CLASS_REFS_ONLY) != FILL_CLASS_REFS_ONLY)
                 newMode |= SHOW_HIDDEN_FRAMES;
             if (walker.hasLocalsOperandsOption())
                 newMode |= FILL_LIVE_STACK_FRAMES;
             return newMode;
         }
 
-        private boolean fillCallerClassOnly(int mode) {
-            return (mode|FILL_CLASS_REFS_ONLY) != FILL_CLASS_REFS_ONLY;
-        }
         /**
          * A callback method to consume the stack frames.  This method is invoked
          * once stack walking begins (i.e. it is only invoked when walkFrames is called).
@@ -179,7 +158,7 @@
          *
          * @return the number of consumed frames
          */
-         protected abstract T consumeFrames();
+         protected abstract R consumeFrames();
 
         /**
          * Initialize FrameBuffer.  Subclass should implement this method to
@@ -252,7 +231,7 @@
          * Walks stack frames until {@link #consumeFrames} is done consuming
          * the frames it is interested in.
          */
-        final T walk() {
+        final R walk() {
             checkState(NEW);
             try {
                 // VM will need to stablize the stack before walking.  It will invoke
@@ -318,7 +297,7 @@
             }
 
             this.anchor = anchor;  // set anchor for this bulk stack frame traversal
-            frameBuffer.setBatch(bufStartIndex, bufEndIndex);
+            frameBuffer.setBatch(depth, bufStartIndex, bufEndIndex);
 
             // traverse all frames and perform the action on the stack frames, if specified
             return consumeFrames();
@@ -381,15 +360,14 @@
          * If all fetched stack frames are traversed, AbstractStackWalker::fetchStackFrames will
          * fetch the next batch of stack frames to continue.
          */
-        private T beginStackWalk() {
+        private R beginStackWalk() {
             // initialize buffers for VM to fill the stack frame info
             initFrameBuffer();
 
             return callStackWalk(mode, 0,
                                  frameBuffer.curBatchFrameCount(),
                                  frameBuffer.startIndex(),
-                                 frameBuffer.classes,
-                                 frameBuffer.stackFrames);
+                                 frameBuffer.frames());
         }
 
         /*
@@ -404,8 +382,7 @@
 
             int endIndex = fetchStackFrames(mode, anchor, batchSize,
                                             startIndex,
-                                            frameBuffer.classes,
-                                            frameBuffer.stackFrames);
+                                            frameBuffer.frames());
             if (isDebug) {
                 System.out.format("  more stack walk requesting %d got %d to %d frames%n",
                                   batchSize, frameBuffer.startIndex(), endIndex);
@@ -414,27 +391,26 @@
             if (numFrames == 0) {
                 frameBuffer.freeze(); // done stack walking
             } else {
-                frameBuffer.setBatch(startIndex, endIndex);
+                frameBuffer.setBatch(depth, startIndex, endIndex);
             }
             return numFrames;
         }
 
         /**
          * Begins stack walking.  This method anchors this frame and invokes
-         * AbstractStackWalker::doStackWalk after fetching the firt batch of stack frames.
+         * AbstractStackWalker::doStackWalk after fetching the first batch of stack frames.
          *
          * @param mode        mode of stack walking
          * @param skipframes  number of frames to be skipped before filling the frame buffer.
          * @param batchSize   the batch size, max. number of elements to be filled in the frame buffers.
          * @param startIndex  start index of the frame buffers to be filled.
-         * @param classes     Classes buffer of the stack frames
-         * @param frames      StackFrame buffer, or null
+         * @param frames      Either a Class<?> array, if mode is {@link #FILL_CLASS_REFS_ONLY}
+         *                    or a {@link StackFrameInfo} (or derivative) array otherwise.
          * @return            Result of AbstractStackWalker::doStackWalk
          */
-        private native T callStackWalk(long mode, int skipframes,
+        private native R callStackWalk(long mode, int skipframes,
                                        int batchSize, int startIndex,
-                                       Class<?>[] classes,
-                                       StackFrame[] frames);
+                                       T[] frames);
 
         /**
          * Fetch the next batch of stack frames.
@@ -443,185 +419,14 @@
          * @param anchor
          * @param batchSize   the batch size, max. number of elements to be filled in the frame buffers.
          * @param startIndex  start index of the frame buffers to be filled.
-         * @param classes     Classes buffer of the stack frames
-         * @param frames      StackFrame buffer, or null
+         * @param frames      Either a Class<?> array, if mode is {@link #FILL_CLASS_REFS_ONLY}
+         *                    or a {@link StackFrameInfo} (or derivative) array otherwise.
          *
          * @return the end index to the frame buffers
          */
         private native int fetchStackFrames(long mode, long anchor,
                                             int batchSize, int startIndex,
-                                            Class<?>[] classes,
-                                            StackFrame[] frames);
-
-
-        /*
-         * Frame buffer
-         *
-         * Each specialized AbstractStackWalker subclass may subclass the FrameBuffer.
-         */
-        class FrameBuffer {
-            static final int START_POS = 2;     // 0th and 1st elements are reserved
-
-            // buffers for VM to fill stack frame info
-            int currentBatchSize;    // current batch size
-            Class<?>[] classes;      // caller class for fast path
-
-            StackFrame[] stackFrames;
-
-            int origin;         // index to the current traversed stack frame
-            int fence;          // index to the last frame in the current batch
-
-            FrameBuffer(int initialBatchSize) {
-                if (initialBatchSize < MIN_BATCH_SIZE) {
-                    throw new IllegalArgumentException(initialBatchSize + " < minimum batch size: " + MIN_BATCH_SIZE);
-                }
-                this.origin = START_POS;
-                this.fence = 0;
-                this.currentBatchSize = initialBatchSize;
-                this.classes = new Class<?>[currentBatchSize];
-            }
-
-            int curBatchFrameCount() {
-                return currentBatchSize-START_POS;
-            }
-
-            /*
-             * Tests if this frame buffer is empty.  All frames are fetched.
-             */
-            final boolean isEmpty() {
-                return origin >= fence || (origin == START_POS && fence == 0);
-            }
-
-            /*
-             * Freezes this frame buffer.  The stack stream source is done fetching.
-             */
-            final void freeze() {
-                origin = 0;
-                fence = 0;
-            }
-
-            /*
-             * Tests if this frame buffer is active.  It is inactive when
-             * it is done for traversal.  All stack frames have been traversed.
-             */
-            final boolean isActive() {
-                return origin > 0 && (fence == 0 || origin < fence || fence == currentBatchSize);
-            }
-
-            /**
-             * Gets the class at the current frame and move to the next frame.
-             */
-            final Class<?> next() {
-                if (isEmpty()) {
-                    throw new NoSuchElementException("origin=" + origin + " fence=" + fence);
-                }
-                Class<?> c = classes[origin++];
-                if (isDebug) {
-                    int index = origin-1;
-                    System.out.format("  next frame at %d: %s (origin %d fence %d)%n", index,
-                                      Objects.toString(c), index, fence);
-                }
-                return c;
-            }
-
-            /**
-             * Gets the class at the current frame.
-             */
-            final Class<?> get() {
-                if (isEmpty()) {
-                    throw new NoSuchElementException("origin=" + origin + " fence=" + fence);
-                }
-                return classes[origin];
-            }
-
-            /*
-             * Returns the index of the current frame.
-             */
-            final int getIndex() {
-                return origin;
-            }
-
-            /*
-             * Set the start and end index of a new batch of stack frames that have
-             * been filled in this frame buffer.
-             */
-            final void setBatch(int startIndex, int endIndex) {
-                if (startIndex <= 0 || endIndex <= 0)
-                    throw new IllegalArgumentException("startIndex=" + startIndex + " endIndex=" + endIndex);
-
-                this.origin = startIndex;
-                this.fence = endIndex;
-                if (depth == 0 && fence > 0) {
-                    // filter the frames due to the stack stream implementation
-                    for (int i = START_POS; i < fence; i++) {
-                        Class<?> c = classes[i];
-                        if (isDebug) System.err.format("  frame %d: %s%n", i, c);
-                        if (filterStackWalkImpl(c)) {
-                            origin++;
-                        } else {
-                            break;
-                        }
-                    }
-                }
-            }
-
-            /*
-             * Checks if the origin is the expected start index.
-             */
-            final void check(int skipFrames) {
-                int index = skipFrames + START_POS;
-                if (origin != index) {
-                    // stack walk must continue with the previous frame depth
-                    throw new IllegalStateException("origin " + origin + " != " + index);
-                }
-            }
-
-            // ------ subclass may override the following methods -------
-            /**
-             * Resizes the buffers for VM to fill in the next batch of stack frames.
-             * The next batch will start at the given startIndex with the maximum number
-             * of elements.
-             *
-             * <p> Subclass may override this method to manage the allocated buffers.
-             *
-             * @param startIndex the start index for the first frame of the next batch to fill in.
-             * @param elements the number of elements for the next batch to fill in.
-             *
-             */
-            void resize(int startIndex, int elements) {
-                if (!isActive())
-                    throw new IllegalStateException("inactive frame buffer can't be resized");
-
-                int size = startIndex+elements;
-                if (classes.length < size) {
-                    // copy the elements in classes array to the newly allocated one.
-                    // classes[0] is a Thread object
-                    Class<?>[] prev = classes;
-                    classes = new Class<?>[size];
-                    System.arraycopy(prev, 0, classes, 0, START_POS);
-                }
-                currentBatchSize = size;
-            }
-
-            /*
-             * Returns the start index for this frame buffer is refilled.
-             *
-             * This implementation reuses the allocated buffer for the next batch
-             * of stack frames.  For subclass to retain the fetched stack frames,
-             * it should override this method to return the index at which the frame
-             * should be filled in for the next batch.
-             */
-            int startIndex() {
-                return START_POS;
-            }
-
-            /**
-             * Returns next StackFrame object in the current batch of stack frames
-             */
-            StackFrame nextStackFrame() {
-                throw new InternalError("should not reach here");
-            }
-        }
+                                            T[] frames);
     }
 
     /*
@@ -629,46 +434,66 @@
      *
      * This class implements Spliterator::forEachRemaining and Spliterator::tryAdvance.
      */
-    static class StackFrameTraverser<T> extends AbstractStackWalker<T>
+    static class StackFrameTraverser<T> extends AbstractStackWalker<T, StackFrameInfo>
             implements Spliterator<StackFrame>
     {
         static {
             stackWalkImplClasses.add(StackFrameTraverser.class);
         }
         private static final int CHARACTERISTICS = Spliterator.ORDERED | Spliterator.IMMUTABLE;
-        class Buffer extends FrameBuffer {
-            Buffer(int initialBatchSize) {
+
+        final class StackFrameBuffer extends FrameBuffer<StackFrameInfo> {
+            private StackFrameInfo[] stackFrames;
+            StackFrameBuffer(int initialBatchSize) {
                 super(initialBatchSize);
 
-                this.stackFrames = new StackFrame[initialBatchSize];
+                this.stackFrames = new StackFrameInfo[initialBatchSize];
                 for (int i = START_POS; i < initialBatchSize; i++) {
                     stackFrames[i] = new StackFrameInfo(walker);
                 }
             }
 
             @Override
+            StackFrameInfo[] frames() {
+                return stackFrames;
+            }
+
+            @Override
             void resize(int startIndex, int elements) {
-                super.resize(startIndex, elements);
+                if (!isActive())
+                    throw new IllegalStateException("inactive frame buffer can't be resized");
+
+                assert startIndex == START_POS :
+                       "bad start index " + startIndex + " expected " + START_POS;
 
                 int size = startIndex+elements;
                 if (stackFrames.length < size) {
-                    stackFrames = new StackFrame[size];
+                    StackFrameInfo[] newFrames = new StackFrameInfo[size];
+                    // copy initial magic...
+                    System.arraycopy(stackFrames, 0, newFrames, 0, startIndex);
+                    stackFrames = newFrames;
                 }
-                for (int i = startIndex(); i < size; i++) {
+                for (int i = startIndex; i < size; i++) {
                     stackFrames[i] = new StackFrameInfo(walker);
                 }
+                currentBatchSize = size;
             }
 
             @Override
-            StackFrame nextStackFrame() {
+            StackFrameInfo nextStackFrame() {
                 if (isEmpty()) {
                     throw new NoSuchElementException("origin=" + origin + " fence=" + fence);
                 }
 
-                StackFrame frame = stackFrames[origin];
+                StackFrameInfo frame = stackFrames[origin];
                 origin++;
                 return frame;
             }
+
+            @Override
+            final Class<?> at(int index) {
+                return stackFrames[index].declaringClass;
+            }
         }
 
         final Function<? super Stream<StackFrame>, ? extends T> function;  // callback
@@ -693,7 +518,7 @@
                 return null;
             }
 
-            StackFrame frame = frameBuffer.nextStackFrame();
+            StackFrameInfo frame = frameBuffer.nextStackFrame();
             depth++;
             return frame;
         }
@@ -710,7 +535,7 @@
 
         @Override
         protected void initFrameBuffer() {
-            this.frameBuffer = new Buffer(getNextBatchSize());
+            this.frameBuffer = new StackFrameBuffer(getNextBatchSize());
         }
 
         @Override
@@ -781,7 +606,7 @@
      * CallerClassFinder is specialized to return Class<?> for each stack frame.
      * StackFrame is not requested.
      */
-    static class CallerClassFinder extends AbstractStackWalker<Integer> {
+    static final class CallerClassFinder extends AbstractStackWalker<Integer, Class<?>> {
         static {
             stackWalkImplClasses.add(CallerClassFinder.class);
         }
@@ -790,6 +615,54 @@
 
         CallerClassFinder(StackWalker walker) {
             super(walker, FILL_CLASS_REFS_ONLY);
+            assert (mode & FILL_CLASS_REFS_ONLY) == FILL_CLASS_REFS_ONLY
+                   : "mode should contain FILL_CLASS_REFS_ONLY";
+        }
+
+        final class ClassBuffer extends FrameBuffer<Class<?>> {
+            Class<?>[] classes;      // caller class for fast path
+            ClassBuffer(int batchSize) {
+                super(batchSize);
+                classes = new Class<?>[batchSize];
+            }
+
+            @Override
+            Class<?>[] frames() { return classes;}
+
+            @Override
+            final Class<?> at(int index) { return classes[index];}
+
+
+            // ------ subclass may override the following methods -------
+            /**
+             * Resizes the buffers for VM to fill in the next batch of stack frames.
+             * The next batch will start at the given startIndex with the maximum number
+             * of elements.
+             *
+             * <p> Subclass may override this method to manage the allocated buffers.
+             *
+             * @param startIndex the start index for the first frame of the next batch to fill in.
+             * @param elements the number of elements for the next batch to fill in.
+             *
+             */
+            @Override
+            void resize(int startIndex, int elements) {
+                if (!isActive())
+                    throw new IllegalStateException("inactive frame buffer can't be resized");
+
+                assert startIndex == START_POS :
+                       "bad start index " + startIndex + " expected " + START_POS;
+
+                int size = startIndex+elements;
+                if (classes.length < size) {
+                    // copy the elements in classes array to the newly allocated one.
+                    // classes[0] is a Thread object
+                    Class<?>[] prev = classes;
+                    classes = new Class<?>[size];
+                    System.arraycopy(prev, 0, classes, 0, startIndex);
+                }
+                currentBatchSize = size;
+            }
         }
 
         Class<?> findCaller() {
@@ -810,15 +683,15 @@
                 if (isMethodHandleFrame(caller)) continue;
                 frames[n++] = caller;
             }
-
-            if (frames[1] == null)
+            if (frames[1] == null) {
                 throw new IllegalStateException("no caller frame");
+            }
             return n;
         }
 
         @Override
         protected void initFrameBuffer() {
-            this.frameBuffer = new FrameBuffer(getNextBatchSize());
+            this.frameBuffer = new ClassBuffer(getNextBatchSize());
         }
 
         @Override
@@ -832,215 +705,64 @@
         }
     }
 
-    /*
-     * StackTrace caches all frames in the buffer.  StackTraceElements are
-     * created lazily when Throwable::getStackTrace is called.
-     */
-    static class StackTrace extends AbstractStackWalker<Integer> {
-        static {
-            stackWalkImplClasses.add(StackTrace.class);
-        }
-
-        class GrowableBuffer extends FrameBuffer {
-            GrowableBuffer(int initialBatchSize) {
-                super(initialBatchSize);
-
-                this.stackFrames = new StackFrame[initialBatchSize];
-                for (int i = START_POS; i < initialBatchSize; i++) {
-                    stackFrames[i] = new StackFrameInfo(walker);
-                }
-            }
-
-            /*
-             * Returns the next index to fill
-             */
-            @Override
-            int startIndex() {
-                return origin;
-            }
-
-            /**
-             * Initialize the buffers for VM to fill in the stack frame information.
-             * The next batch will start at the given startIndex to
-             * the length of the buffer.
-             */
-            @Override
-            void resize(int startIndex, int elements) {
-                // Expand the frame buffer.
-                // Do not call super.resize that will reuse the filled elements
-                // in this frame buffer
-                int size = startIndex+elements;
-                if (classes.length < size) {
-                    // resize the frame buffer
-                    classes = Arrays.copyOf(classes, size);
-                    stackFrames = Arrays.copyOf(stackFrames, size);
-                }
-                for (int i = startIndex; i < size; i++) {
-                    stackFrames[i] = new StackFrameInfo(walker);
-                }
-                currentBatchSize = size;
-            }
-
-            StackTraceElement get(int index) {
-                return new StackTraceElement(classes[index].getName(), "unknown", null, -1);
-            }
-
-            /**
-             * Returns an array of StackTraceElement for all stack frames cached in
-             * this StackTrace object.
-             * <p>
-             * This method is intended for Throwable::getOurStackTrace use only.
-             */
-            StackTraceElement[] toStackTraceElements() {
-                int startIndex = START_POS;
-                for (int i = startIndex; i < classes.length; i++) {
-                    if (classes[i] != null && filterStackWalkImpl(classes[i])) {
-                        startIndex++;
-                    } else {
-                        break;
-                    }
-                }
-
-                // VM fills in the method name, filename, line number info
-                StackFrameInfo.fillInStackFrames(0, stackFrames, startIndex, startIndex + depth);
-
-                StackTraceElement[] stes = new StackTraceElement[depth];
-                for (int i = startIndex, j = 0; i < classes.length && j < depth; i++, j++) {
-                    if (isDebug) {
-                        System.err.println("StackFrame: " + i + " " + stackFrames[i]);
-                    }
-                    stes[j] = stackFrames[i].toStackTraceElement();
-                }
-                return stes;
-            }
-        }
-
-        private static final int MAX_STACK_FRAMES = 1024;
-        private static final StackWalker STACKTRACE_WALKER =
-            StackWalker.newInstanceNoCheck(EnumSet.of(Option.SHOW_REFLECT_FRAMES));
-
-        private StackTraceElement[] stes;
-        static StackTrace dump() {
-            return new StackTrace();
-        }
-
-        static StackTrace dump(Throwable ex) {
-            return new StackTrace(ex);
-        }
-
-        private StackTrace() {
-            this(STACKTRACE_WALKER, DEFAULT_MODE);
-        }
-
-        /*
-         * Throwable::fillInStackTrace and <init> of Throwable and subclasses
-         * are filtered in the VM.
-         */
-        private StackTrace(Throwable ex) {
-            this(STACKTRACE_WALKER, FILTER_FILL_IN_STACKTRACE);  // skip Throwable::init frames
-            if (isDebug) {
-                System.err.println("dump stack for " + ex.getClass().getName());
-            }
-        }
-
-        StackTrace(StackWalker walker, int mode) {
-            super(walker, mode, MAX_STACK_FRAMES);
-
-            // snapshot the stack trace
-            walk();
-        }
-
-        @Override
-        protected Integer consumeFrames() {
-            // traverse all frames and perform the action on the stack frames, if specified
-            int n = 0;
-            while (n < maxDepth && nextFrame() != null) {
-                n++;
-            }
-            return n;
-        }
-
-        @Override
-        protected void initFrameBuffer() {
-            this.frameBuffer = new GrowableBuffer(getNextBatchSize());
-        }
-
-        // TODO: implement better heuristic
-        @Override
-        protected int batchSize(int lastBatchFrameCount) {
-            // chunk size of VM backtrace is 32
-            return lastBatchFrameCount == 0 ? 32 : 32;
-        }
-
-        /**
-         * Returns an array of StackTraceElement for all stack frames cached in
-         * this StackTrace object.
-         * <p>
-         * This method is intended for Throwable::getOurStackTrace use only.
-         */
-        synchronized StackTraceElement[] getStackTraceElements() {
-            if (stes == null) {
-                stes = ((GrowableBuffer) frameBuffer).toStackTraceElements();
-                // release the frameBuffer memory
-                frameBuffer = null;
-            }
-            return stes;
-        }
-
-        /*
-         * Prints stack trace to the given PrintStream.
-         *
-         * Further implementation could skip creating StackTraceElement objects
-         * print directly to the PrintStream.
-         */
-        void printStackTrace(PrintStream s) {
-            StackTraceElement[] stes = getStackTraceElements();
-            synchronized (s) {
-                s.println("Stack trace");
-                for (StackTraceElement traceElement : stes)
-                    s.println("\tat " + traceElement);
-            }
-        }
-    }
-
-    static class LiveStackInfoTraverser<T> extends StackFrameTraverser<T> {
+    static final class LiveStackInfoTraverser<T> extends StackFrameTraverser<T> {
         static {
             stackWalkImplClasses.add(LiveStackInfoTraverser.class);
         }
         // VM will fill in all method info and live stack info directly in StackFrameInfo
-        class Buffer extends FrameBuffer {
-            Buffer(int initialBatchSize) {
+        final class LiveStackFrameBuffer extends FrameBuffer<LiveStackFrameInfo> {
+            private LiveStackFrameInfo[] stackFrames;
+            LiveStackFrameBuffer(int initialBatchSize) {
                 super(initialBatchSize);
-                this.stackFrames = new StackFrame[initialBatchSize];
+                this.stackFrames = new LiveStackFrameInfo[initialBatchSize];
                 for (int i = START_POS; i < initialBatchSize; i++) {
                     stackFrames[i] = new LiveStackFrameInfo(walker);
                 }
             }
 
             @Override
+            LiveStackFrameInfo[] frames() {
+                return stackFrames;
+            }
+
+            @Override
             void resize(int startIndex, int elements) {
-                super.resize(startIndex, elements);
+                if (!isActive()) {
+                    throw new IllegalStateException("inactive frame buffer can't be resized");
+                }
+                assert startIndex == START_POS :
+                       "bad start index " + startIndex + " expected " + START_POS;
+
                 int size = startIndex + elements;
-
                 if (stackFrames.length < size) {
-                    this.stackFrames = new StackFrame[size];
+                    LiveStackFrameInfo[] newFrames = new LiveStackFrameInfo[size];
+                    // copy initial magic...
+                    System.arraycopy(stackFrames, 0, newFrames, 0, startIndex);
+                    stackFrames = newFrames;
                 }
 
                 for (int i = startIndex(); i < size; i++) {
                     stackFrames[i] = new LiveStackFrameInfo(walker);
                 }
+
+                currentBatchSize = size;
             }
 
             @Override
-            StackFrame nextStackFrame() {
+            LiveStackFrameInfo nextStackFrame() {
                 if (isEmpty()) {
                     throw new NoSuchElementException("origin=" + origin + " fence=" + fence);
                 }
 
-                StackFrame frame = stackFrames[origin];
+                LiveStackFrameInfo frame = stackFrames[origin];
                 origin++;
                 return frame;
             }
+
+            @Override
+            final Class<?> at(int index) {
+                return stackFrames[index].declaringClass;
+            }
         }
 
         LiveStackInfoTraverser(StackWalker walker,
@@ -1050,7 +772,183 @@
 
         @Override
         protected void initFrameBuffer() {
-            this.frameBuffer = new Buffer(getNextBatchSize());
+            this.frameBuffer = new LiveStackFrameBuffer(getNextBatchSize());
+        }
+    }
+
+    /*
+     * Frame buffer
+     *
+     * Each specialized AbstractStackWalker subclass may subclass the FrameBuffer.
+     */
+    static abstract class FrameBuffer<F> {
+        static final int START_POS = 2;     // 0th and 1st elements are reserved
+
+        // buffers for VM to fill stack frame info
+        int currentBatchSize;    // current batch size
+        int origin;         // index to the current traversed stack frame
+        int fence;          // index to the last frame in the current batch
+
+        FrameBuffer(int initialBatchSize) {
+            if (initialBatchSize < MIN_BATCH_SIZE) {
+                throw new IllegalArgumentException(initialBatchSize +
+                        " < minimum batch size: " + MIN_BATCH_SIZE);
+            }
+            this.origin = START_POS;
+            this.fence = 0;
+            this.currentBatchSize = initialBatchSize;
+        }
+
+        /**
+         * Returns an array of frames that may be used to store frame objects
+         * when walking the stack.
+         *
+         * May be an array of {@code Class<?>} if the {@code AbstractStackWalker}
+         * mode is {@link #FILL_CLASS_REFS_ONLY}, or an array of
+         * {@link StackFrameInfo} (or derivative) array otherwise.
+         *
+         * @return An array of frames that may be used to store frame objects
+         * when walking the stack. Must not be null.
+         */
+        abstract F[] frames(); // must not return null
+
+        /**
+         * Resizes the buffers for VM to fill in the next batch of stack frames.
+         * The next batch will start at the given startIndex with the maximum number
+         * of elements.
+         *
+         * <p> Subclass may override this method to manage the allocated buffers.
+         *
+         * @param startIndex the start index for the first frame of the next batch to fill in.
+         * @param elements the number of elements for the next batch to fill in.
+         *
+         */
+        abstract void resize(int startIndex, int elements);
+
+        /**
+         * Return the class at the given position in the current batch.
+         * @param index the position of the frame.
+         * @return the class at the given position in the current batch.
+         */
+        abstract Class<?> at(int index);
+
+        // ------ subclass may override the following methods -------
+
+        /*
+         * Returns the start index for this frame buffer is refilled.
+         *
+         * This implementation reuses the allocated buffer for the next batch
+         * of stack frames.  For subclass to retain the fetched stack frames,
+         * it should override this method to return the index at which the frame
+         * should be filled in for the next batch.
+         */
+        int startIndex() {
+            return START_POS;
+        }
+
+        /**
+         * Returns next StackFrame object in the current batch of stack frames
+         */
+        F nextStackFrame() {
+            throw new InternalError("should not reach here");
+        }
+
+        // ------ FrameBuffer implementation ------
+
+        final int curBatchFrameCount() {
+            return currentBatchSize-START_POS;
+        }
+
+        /*
+         * Tests if this frame buffer is empty.  All frames are fetched.
+         */
+        final boolean isEmpty() {
+            return origin >= fence || (origin == START_POS && fence == 0);
+        }
+
+        /*
+         * Freezes this frame buffer.  The stack stream source is done fetching.
+         */
+        final void freeze() {
+            origin = 0;
+            fence = 0;
+        }
+
+        /*
+         * Tests if this frame buffer is active.  It is inactive when
+         * it is done for traversal.  All stack frames have been traversed.
+         */
+        final boolean isActive() {
+            return origin > 0 && (fence == 0 || origin < fence || fence == currentBatchSize);
+        }
+
+        /**
+         * Gets the class at the current frame and move to the next frame.
+         */
+        final Class<?> next() {
+            if (isEmpty()) {
+                throw new NoSuchElementException("origin=" + origin + " fence=" + fence);
+            }
+            Class<?> c = at(origin);
+            origin++;
+            if (isDebug) {
+                int index = origin-1;
+                System.out.format("  next frame at %d: %s (origin %d fence %d)%n", index,
+                        Objects.toString(c), index, fence);
+            }
+            return c;
+        }
+
+        /**
+         * Gets the class at the current frame.
+         */
+        final Class<?> get() {
+            if (isEmpty()) {
+                throw new NoSuchElementException("origin=" + origin + " fence=" + fence);
+            }
+            return at(origin);
+        }
+
+        /*
+         * Returns the index of the current frame.
+         */
+        final int getIndex() {
+            return origin;
+        }
+
+        /*
+         * Set the start and end index of a new batch of stack frames that have
+         * been filled in this frame buffer.
+         */
+        final void setBatch(int depth, int startIndex, int endIndex) {
+            if (startIndex <= 0 || endIndex <= 0)
+                throw new IllegalArgumentException("startIndex=" + startIndex + " endIndex=" + endIndex);
+
+            this.origin = startIndex;
+            this.fence = endIndex;
+            if (depth == 0 && fence > 0) {
+                // filter the frames due to the stack stream implementation
+                for (int i = START_POS; i < fence; i++) {
+                    Class<?> c = at(i);
+                    if (isDebug) System.err.format("  frame %d: %s%n", i, c);
+                    if (filterStackWalkImpl(c)) {
+                        origin++;
+                    } else {
+                        break;
+                    }
+                }
+            }
+        }
+
+        /*
+         * Checks if the origin is the expected start index.
+         */
+        final void check(int skipFrames) {
+            int index = skipFrames + START_POS;
+            if (origin != index) {
+                // stack walk must continue with the previous frame depth
+                throw new IllegalStateException("origin " + origin + " != " + index);
+            }
         }
     }
 
@@ -1081,13 +979,13 @@
     }
 
     private static boolean isReflectionFrame(Class<?> c) {
-        if (c.getName().startsWith("sun.reflect") &&
-                !sun.reflect.MethodAccessor.class.isAssignableFrom(c)) {
-            throw new InternalError("Not sun.reflect.MethodAccessor: " + c.toString());
+        if (c.getName().startsWith("jdk.internal.reflect") &&
+                !MethodAccessor.class.isAssignableFrom(c)) {
+            throw new InternalError("Not jdk.internal.reflect.MethodAccessor: " + c.toString());
         }
         // ## should filter all @Hidden frames?
         return c == Method.class ||
-                sun.reflect.MethodAccessor.class.isAssignableFrom(c) ||
+                MethodAccessor.class.isAssignableFrom(c) ||
                 c.getName().startsWith("java.lang.invoke.LambdaForm");
     }
 
--- a/src/java.base/share/classes/java/lang/StackTraceElement.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/StackTraceElement.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,6 +112,12 @@
         this.lineNumber     = lineNumber;
     }
 
+
+    /**
+     * Creates an empty stack frame element to be filled in by Throwable.
+     */
+    StackTraceElement() { }
+
     /**
      * Returns the name of the source file containing the execution point
      * represented by this stack trace element.  Generally, this corresponds
--- a/src/java.base/share/classes/java/lang/StackWalker.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/StackWalker.java	Tue Apr 19 11:13:30 2016 -0700
@@ -24,7 +24,7 @@
  */
 package java.lang;
 
-import sun.reflect.CallerSensitive;
+import jdk.internal.reflect.CallerSensitive;
 
 import java.util.*;
 import java.util.function.Consumer;
--- a/src/java.base/share/classes/java/lang/StrictMath.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/StrictMath.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1135,6 +1135,110 @@
     }
 
     /**
+     * Returns the fused multiply add of the three arguments; that is,
+     * returns the exact product of the first two arguments summed
+     * with the third argument and then rounded once to the nearest
+     * {@code double}.
+     *
+     * The rounding is done using the {@linkplain
+     * java.math.RoundingMode#HALF_EVEN round to nearest even
+     * rounding mode}.
+     *
+     * In contrast, if {@code a * b + c} is evaluated as a regular
+     * floating-point expression, two rounding errors are involved,
+     * the first for the multiply operation, the second for the
+     * addition operation.
+     *
+     * <p>Special cases:
+     * <ul>
+     * <li> If any argument is NaN, the result is NaN.
+     *
+     * <li> If one of the first two arguments is infinite and the
+     * other is zero, the result is NaN.
+     *
+     * <li> If the exact product of the first two arguments is infinite
+     * (in other words, at least one of the arguments is infinite and
+     * the other is neither zero nor NaN) and the third argument is an
+     * infinity of the opposite sign, the result is NaN.
+     *
+     * </ul>
+     *
+     * <p>Note that {@code fusedMac(a, 1.0, c)} returns the same
+     * result as ({@code a + c}).  However,
+     * {@code fusedMac(a, b, +0.0)} does <em>not</em> always return the
+     * same result as ({@code a * b}) since
+     * {@code fusedMac(-0.0, +0.0, +0.0)} is {@code +0.0} while
+     * ({@code -0.0 * +0.0}) is {@code -0.0}; {@code fusedMac(a, b, -0.0)} is
+     * equivalent to ({@code a * b}) however.
+     *
+     * @apiNote This method corresponds to the fusedMultiplyAdd
+     * operation defined in IEEE 754-2008.
+     *
+     * @param a a value
+     * @param b a value
+     * @param c a value
+     *
+     * @return (<i>a</i>&nbsp;&times;&nbsp;<i>b</i>&nbsp;+&nbsp;<i>c</i>)
+     * computed, as if with unlimited range and precision, and rounded
+     * once to the nearest {@code double} value
+     */
+    public static double fma(double a, double b, double c) {
+        return Math.fma(a, b, c);
+    }
+
+    /**
+     * Returns the fused multiply add of the three arguments; that is,
+     * returns the exact product of the first two arguments summed
+     * with the third argument and then rounded once to the nearest
+     * {@code float}.
+     *
+     * The rounding is done using the {@linkplain
+     * java.math.RoundingMode#HALF_EVEN round to nearest even
+     * rounding mode}.
+     *
+     * In contrast, if {@code a * b + c} is evaluated as a regular
+     * floating-point expression, two rounding errors are involved,
+     * the first for the multiply operation, the second for the
+     * addition operation.
+     *
+     * <p>Special cases:
+     * <ul>
+     * <li> If any argument is NaN, the result is NaN.
+     *
+     * <li> If one of the first two arguments is infinite and the
+     * other is zero, the result is NaN.
+     *
+     * <li> If the exact product of the first two arguments is infinite
+     * (in other words, at least one of the arguments is infinite and
+     * the other is neither zero nor NaN) and the third argument is an
+     * infinity of the opposite sign, the result is NaN.
+     *
+     * </ul>
+     *
+     * <p>Note that {@code fma(a, 1.0f, c)} returns the same
+     * result as ({@code a + c}).  However,
+     * {@code fma(a, b, +0.0f)} does <em>not</em> always return the
+     * same result as ({@code a * b}) since
+     * {@code fma(-0.0f, +0.0f, +0.0f)} is {@code +0.0f} while
+     * ({@code -0.0f * +0.0f}) is {@code -0.0f}; {@code fma(a, b, -0.0f)} is
+     * equivalent to ({@code a * b}) however.
+     *
+     * @apiNote This method corresponds to the fusedMultiplyAdd
+     * operation defined in IEEE 754-2008.
+     *
+     * @param a a value
+     * @param b a value
+     * @param c a value
+     *
+     * @return (<i>a</i>&nbsp;&times;&nbsp;<i>b</i>&nbsp;+&nbsp;<i>c</i>)
+     * computed, as if with unlimited range and precision, and rounded
+     * once to the nearest {@code float} value
+     */
+    public static float fma(float a, float b, float c) {
+        return Math.fma(a, b, c);
+    }
+
+    /**
      * Returns the size of an ulp of the argument.  An ulp, unit in
      * the last place, of a {@code double} value is the positive
      * distance between this floating-point value and the {@code
--- a/src/java.base/share/classes/java/lang/String.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/String.java	Tue Apr 19 11:13:30 2016 -0700
@@ -363,7 +363,7 @@
      * @see  #String(byte[], java.nio.charset.Charset)
      * @see  #String(byte[])
      */
-    @Deprecated
+    @Deprecated(since="1.1")
     public String(byte ascii[], int hibyte, int offset, int count) {
         checkBoundsOffCount(offset, count, ascii.length);
         if (count == 0) {
@@ -415,7 +415,7 @@
      * @see  #String(byte[], java.nio.charset.Charset)
      * @see  #String(byte[])
      */
-    @Deprecated
+    @Deprecated(since="1.1")
     public String(byte ascii[], int hibyte) {
         this(ascii, hibyte, 0, ascii.length);
     }
@@ -911,7 +911,7 @@
      *                 dst.length}
      *          </ul>
      */
-    @Deprecated
+    @Deprecated(since="1.1")
     public void getBytes(int srcBegin, int srcEnd, byte dst[], int dstBegin) {
         checkBoundsBeginEnd(srcBegin, srcEnd, length());
         Objects.requireNonNull(dst);
--- a/src/java.base/share/classes/java/lang/StringIndexOutOfBoundsException.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/StringIndexOutOfBoundsException.java	Tue Apr 19 11:13:30 2016 -0700
@@ -67,20 +67,4 @@
     public StringIndexOutOfBoundsException(int index) {
         super("String index out of range: " + index);
     }
-
-    /**
-     * Constructs a new {@code StringIndexOutOfBoundsException} class with
-     * arguments indicating two out of bound values.
-     *
-     * <p>The out of bound values are included in this exception's detail
-     * message.  The exact presentation format of the detail message is
-     * unspecified.
-     *
-     * @param a the first out of bound value.
-     * @param b the second out of bound value.
-     * @since 9
-     */
-    public StringIndexOutOfBoundsException(int a, int b) {
-        super("String indexed access out of bounds: " + a + ", " + b);
-    }
 }
--- a/src/java.base/share/classes/java/lang/System.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/System.java	Tue Apr 19 11:13:30 2016 -0700
@@ -56,8 +56,8 @@
 import java.util.ResourceBundle;
 import java.util.function.Supplier;
 import sun.nio.ch.Interruptible;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
 import sun.security.util.SecurityConstants;
 import sun.reflect.annotation.AnnotationType;
 import jdk.internal.HotSpotIntrinsicCandidate;
@@ -1715,6 +1715,7 @@
      *      finalizers being called on live objects while other threads are
      *      concurrently manipulating those objects, resulting in erratic
      *      behavior or deadlock.
+     *      This method is subject to removal in a future version of Java SE.
      * @param value indicating enabling or disabling of finalization
      * @throws  SecurityException
      *        if a security manager exists and its <code>checkExit</code>
@@ -1725,7 +1726,7 @@
      * @see     java.lang.SecurityManager#checkExit(int)
      * @since   1.1
      */
-    @Deprecated
+    @Deprecated(since="1.2", forRemoval=true)
     public static void runFinalizersOnExit(boolean value) {
         Runtime.runFinalizersOnExit(value);
     }
@@ -1978,7 +1979,7 @@
     private static void setJavaLangAccess() {
         // Allow privileged classes outside of java.lang
         SharedSecrets.setJavaLangAccess(new JavaLangAccess(){
-            public sun.reflect.ConstantPool getConstantPool(Class<?> klass) {
+            public jdk.internal.reflect.ConstantPool getConstantPool(Class<?> klass) {
                 return klass.getConstantPool();
             }
             public boolean casAnnotationType(Class<?> klass, AnnotationType oldType, AnnotationType newType) {
--- a/src/java.base/share/classes/java/lang/Thread.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/Thread.java	Tue Apr 19 11:13:30 2016 -0700
@@ -37,8 +37,8 @@
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.locks.LockSupport;
 import sun.nio.ch.Interruptible;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
 import sun.security.util.SecurityConstants;
 import jdk.internal.HotSpotIntrinsicCandidate;
 
@@ -890,7 +890,7 @@
      *       <a href="{@docRoot}/../technotes/guides/concurrency/threadPrimitiveDeprecation.html">Why
      *       are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
      */
-    @Deprecated
+    @Deprecated(since="1.2")
     public final void stop() {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
@@ -922,8 +922,9 @@
      *        For more information, see
      *        <a href="{@docRoot}/../technotes/guides/concurrency/threadPrimitiveDeprecation.html">Why
      *        are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
+     *        This method is subject to removal in a future version of Java SE.
      */
-    @Deprecated
+    @Deprecated(since="1.2", forRemoval=true)
     public final synchronized void stop(Throwable obj) {
         throw new UnsupportedOperationException();
     }
@@ -1043,9 +1044,10 @@
      *     "frozen" processes. For more information, see
      *     <a href="{@docRoot}/../technotes/guides/concurrency/threadPrimitiveDeprecation.html">
      *     Why are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
+     *     This method is subject to removal in a future version of Java SE.
      * @throws NoSuchMethodError always
      */
-    @Deprecated
+    @Deprecated(since="1.5", forRemoval=true)
     public void destroy() {
         throw new NoSuchMethodError();
     }
@@ -1083,7 +1085,7 @@
      *   <a href="{@docRoot}/../technotes/guides/concurrency/threadPrimitiveDeprecation.html">Why
      *   are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
      */
-    @Deprecated
+    @Deprecated(since="1.2")
     public final void suspend() {
         checkAccess();
         suspend0();
@@ -1109,7 +1111,7 @@
      *     <a href="{@docRoot}/../technotes/guides/concurrency/threadPrimitiveDeprecation.html">Why
      *     are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
      */
-    @Deprecated
+    @Deprecated(since="1.2")
     public final void resume() {
         checkAccess();
         resume0();
@@ -1270,8 +1272,10 @@
      * @deprecated The definition of this call depends on {@link #suspend},
      *             which is deprecated.  Further, the results of this call
      *             were never well-defined.
+     *             This method is subject to removal in a future version of Java SE.
+     * @see        StackWalker
      */
-    @Deprecated
+    @Deprecated(since="1.2", forRemoval=true)
     public native int countStackFrames();
 
     /**
@@ -1388,7 +1392,7 @@
      * This method is used only for debugging.
      */
     public static void dumpStack() {
-        StackStreamFactory.makeStackTrace().printStackTrace(System.err);
+        new Exception("Stack trace").printStackTrace();
     }
 
     /**
@@ -1610,8 +1614,7 @@
             }
             return stackTrace;
         } else {
-            // Don't need JVM help for current thread
-            return StackStreamFactory.makeStackTrace().getStackTraceElements();
+            return (new Exception()).getStackTrace();
         }
     }
 
--- a/src/java.base/share/classes/java/lang/ThreadGroup.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/ThreadGroup.java	Tue Apr 19 11:13:30 2016 -0700
@@ -607,7 +607,7 @@
      * @deprecated    This method is inherently unsafe.  See
      *     {@link Thread#stop} for details.
      */
-    @Deprecated
+    @Deprecated(since="1.2")
     public final void stop() {
         if (stopOrSuspend(false))
             Thread.currentThread().stop();
@@ -669,7 +669,7 @@
      * @deprecated    This method is inherently deadlock-prone.  See
      *     {@link Thread#suspend} for details.
      */
-    @Deprecated
+    @Deprecated(since="1.2")
     @SuppressWarnings("deprecation")
     public final void suspend() {
         if (stopOrSuspend(true))
@@ -732,7 +732,7 @@
      *       both of which have been deprecated, as they are inherently
      *       deadlock-prone.  See {@link Thread#suspend} for details.
      */
-    @Deprecated
+    @Deprecated(since="1.2")
     @SuppressWarnings("deprecation")
     public final void resume() {
         int ngroupsSnapshot;
@@ -1073,7 +1073,7 @@
      *             which is deprecated.  Further, the behavior of this call
      *             was never specified.
      */
-    @Deprecated
+    @Deprecated(since="1.2")
     public boolean allowThreadSuspension(boolean b) {
         this.vmAllowSuspension = b;
         if (!b) {
--- a/src/java.base/share/classes/java/lang/Throwable.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/Throwable.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,7 +118,7 @@
     private static final long serialVersionUID = -3042686055658047285L;
 
     /**
-     * Native code saves some indication of the stack backtrace in this slot.
+     * The JVM saves some indication of the stack backtrace in this slot.
      */
     private transient Object backtrace;
 
@@ -211,6 +211,11 @@
      */
     private StackTraceElement[] stackTrace = UNASSIGNED_STACK;
 
+    /**
+     * The JVM code sets the depth of the backtrace for later retrieval
+     */
+    private transient int depth;
+
     // Setting this static field introduces an acceptable
     // initialization dependency on a few java.util classes.
     private static final List<Throwable> SUPPRESSED_SENTINEL = Collections.emptyList();
@@ -780,11 +785,7 @@
     public synchronized Throwable fillInStackTrace() {
         if (stackTrace != null ||
             backtrace != null /* Out of protocol state */ ) {
-            if (backtrace == null && StackStreamFactory.useStackTrace(this)) {
-                backtrace = StackStreamFactory.makeStackTrace(this);
-            } else {
-                fillInStackTrace(0);
-            }
+            fillInStackTrace(0);
             stackTrace = UNASSIGNED_STACK;
         }
         return this;
@@ -825,14 +826,11 @@
         // backtrace if this is the first call to this method
         if (stackTrace == UNASSIGNED_STACK ||
             (stackTrace == null && backtrace != null) /* Out of protocol state */) {
-            if (backtrace instanceof StackStreamFactory.StackTrace) {
-                stackTrace = ((StackStreamFactory.StackTrace)backtrace).getStackTraceElements();
-            } else {
-                int depth = getStackTraceDepth();
-                stackTrace = new StackTraceElement[depth];
-                for (int i = 0; i < depth; i++)
-                    stackTrace[i] = getStackTraceElement(i);
+            stackTrace = new StackTraceElement[depth];
+            for (int i = 0; i < depth; i++) {
+                stackTrace[i] = new StackTraceElement();
             }
+            getStackTraceElements(stackTrace);
         } else if (stackTrace == null) {
             return UNASSIGNED_STACK;
         }
@@ -884,23 +882,11 @@
     }
 
     /**
-     * Returns the number of elements in the stack trace (or 0 if the stack
-     * trace is unavailable).
-     *
-     * package-protection for use by SharedSecrets.
+     * Gets the stack trace elements.
+     * @param  elements
+     * @throws IndexOutOfBoundsException if {@code elements.length != depth }
      */
-    native int getStackTraceDepth();
-
-    /**
-     * Returns the specified element of the stack trace.
-     *
-     * package-protection for use by SharedSecrets.
-     *
-     * @param index index of the element to return.
-     * @throws IndexOutOfBoundsException if {@code index < 0 ||
-     *         index >= getStackTraceDepth() }
-     */
-    native StackTraceElement getStackTraceElement(int index);
+    private native void getStackTraceElements(StackTraceElement[] elements);
 
     /**
      * Reads a {@code Throwable} from a stream, enforcing
--- a/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java	Tue Apr 19 11:13:30 2016 -0700
@@ -89,8 +89,7 @@
     static {
         final String key = "jdk.internal.lambda.dumpProxyClasses";
         String path = AccessController.doPrivileged(
-                new GetPropertyAction(key), null,
-                new PropertyPermission(key , "read"));
+                new GetPropertyAction(key));
         dumper = (null == path) ? null : ProxyClassesDumper.getInstance(path);
     }
 
--- a/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Tue Apr 19 11:13:30 2016 -0700
@@ -655,6 +655,8 @@
             mv.visitAnnotation(DONTINLINE_SIG, true);
         }
 
+        constantPlaceholder(lambdaForm); // keep LambdaForm instance & its compiled form lifetime tightly coupled.
+
         if (lambdaForm.customized != null) {
             // Since LambdaForm is customized for a particular MethodHandle, it's safe to substitute
             // receiver MethodHandle (at slot #0) with an embedded constant and use it instead.
--- a/src/java.base/share/classes/java/lang/invoke/Invokers.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/Invokers.java	Tue Apr 19 11:13:30 2016 -0700
@@ -131,11 +131,11 @@
         MethodType mtype = targetType;
         MethodType invokerType = mtype.insertParameterTypes(0, VarHandle.class);
 
-        LambdaForm lform = varHandleMethodGenericInvokerHandleForm(ak.name(), mtype);
+        LambdaForm lform = varHandleMethodGenericInvokerHandleForm(ak.methodName(), mtype);
         VarHandle.AccessDescriptor ad = new VarHandle.AccessDescriptor(mtype, ak.at.ordinal(), ak.ordinal());
         MethodHandle invoker = BoundMethodHandle.bindSingle(invokerType, lform, ad);
 
-        invoker = invoker.withInternalMemberName(MemberName.makeVarHandleMethodInvoke(ak.name(), mtype), false);
+        invoker = invoker.withInternalMemberName(MemberName.makeVarHandleMethodInvoke(ak.methodName(), mtype), false);
         assert(checkVarHandleInvoker(invoker));
 
         maybeCompileToBytecode(invoker);
@@ -146,11 +146,11 @@
         MethodType mtype = targetType;
         MethodType invokerType = mtype.insertParameterTypes(0, VarHandle.class);
 
-        LambdaForm lform = varHandleMethodExactInvokerHandleForm(ak.name(), mtype);
+        LambdaForm lform = varHandleMethodExactInvokerHandleForm(ak.methodName(), mtype);
         VarHandle.AccessDescriptor ad = new VarHandle.AccessDescriptor(mtype, ak.at.ordinal(), ak.ordinal());
         MethodHandle invoker = BoundMethodHandle.bindSingle(invokerType, lform, ad);
 
-        invoker = invoker.withInternalMemberName(MemberName.makeVarHandleMethodInvoke(ak.name(), mtype), false);
+        invoker = invoker.withInternalMemberName(MemberName.makeVarHandleMethodInvoke(ak.methodName(), mtype), false);
         assert(checkVarHandleInvoker(invoker));
 
         maybeCompileToBytecode(invoker);
--- a/src/java.base/share/classes/java/lang/invoke/MemberName.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/MemberName.java	Tue Apr 19 11:13:30 2016 -0700
@@ -374,7 +374,7 @@
     }
     public static boolean isVarHandleMethodInvokeName(String name) {
         try {
-            VarHandle.AccessMode.valueOf(name);
+            VarHandle.AccessMode.valueFromMethodName(name);
             return true;
         } catch (IllegalArgumentException e) {
             return false;
@@ -733,6 +733,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     public int hashCode() {
         // Avoid autoboxing getReferenceKind(), since this is used early and will force
         // early initialization of Byte$ByteCache
@@ -1132,6 +1133,10 @@
             public Object newMemberName() {
                 return new MemberName();
             }
+            public String getName(Object mname) {
+                MemberName memberName = (MemberName)mname;
+                return memberName.getName();
+            }
         });
     }
 }
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Tue Apr 19 11:13:30 2016 -0700
@@ -219,7 +219,8 @@
  * Method handles produced by lookups or constant loads from methods or
  * constructors with the variable arity modifier bit ({@code 0x0080})
  * have a corresponding variable arity, as if they were defined with
- * the help of {@link #asVarargsCollector asVarargsCollector}.
+ * the help of {@link #asVarargsCollector asVarargsCollector}
+ * or {@link #withVarargs withVarargs}.
  * <p>
  * A method reference may refer either to a static or non-static method.
  * In the non-static case, the method handle type includes an explicit
@@ -972,6 +973,36 @@
                 throw newIllegalArgumentException("array length is not legal for long[] or double[]", arrayLength);
         }
     }
+    /**
+      * Adapts this method handle to be {@linkplain #asVarargsCollector variable arity}
+      * if the boolean flag is true, else {@linkplain #asFixedArity fixed arity}.
+      * If the method handle is already of the proper arity mode, it is returned
+      * unchanged.
+      * @apiNote
+      * <p>This method is sometimes useful when adapting a method handle that
+      * may be variable arity, to ensure that the resulting adapter is also
+      * variable arity if and only if the original handle was.  For example,
+      * this code changes the first argument of a handle {@code mh} to {@code int} without
+      * disturbing its variable arity property:
+      * {@code mh.asType(mh.type().changeParameterType(0,int.class))
+      *     .withVarargs(mh.isVarargsCollector())}
+      * @param makeVarargs true if the return method handle should have variable arity behavior
+      * @return a method handle of the same type, with possibly adjusted variable arity behavior
+      * @throws IllegalArgumentException if {@code makeVarargs} is true and
+      *         this method handle does not have a trailing array parameter
+      * @since 9
+      * @see #asVarargsCollector
+      * @see #asFixedArity
+     */
+     public MethodHandle withVarargs(boolean makeVarargs) {
+        if (!makeVarargs) {
+            return asFixedArity();
+        } else if (!isVarargsCollector()) {
+            return asVarargsCollector(type().lastParameterType());
+        } else {
+            return this;
+        }
+    }
 
     /**
      * Makes an <em>array-collecting</em> method handle, which accepts a given number of trailing
@@ -1000,7 +1031,8 @@
      * to allow the target to use a simple {@code Object} as its last parameter type.)
      * <p>
      * In order to create a collecting adapter which is not restricted to a particular
-     * number of collected arguments, use {@link #asVarargsCollector asVarargsCollector} instead.
+     * number of collected arguments, use {@link #asVarargsCollector asVarargsCollector}
+     * or {@link #withVarargs withVarargs} instead.
      * <p>
      * Here are some examples of array-collecting method handles:
      * <blockquote><pre>{@code
@@ -1216,7 +1248,7 @@
      * <p>
      * No method handle transformations produce new method handles with
      * variable arity, unless they are documented as doing so.
-     * Therefore, besides {@code asVarargsCollector},
+     * Therefore, besides {@code asVarargsCollector} and {@code withVarargs},
      * all methods in {@code MethodHandle} and {@code MethodHandles}
      * will return a method handle with fixed arity,
      * except in the cases where they are specified to return their original
@@ -1273,6 +1305,7 @@
      *         or {@code arrayType} is not assignable to this method handle's trailing parameter type
      * @see #asCollector
      * @see #isVarargsCollector
+     * @see #withVarargs
      * @see #asFixedArity
      */
     public MethodHandle asVarargsCollector(Class<?> arrayType) {
@@ -1344,6 +1377,7 @@
      * @return a new method handle which accepts only a fixed number of arguments
      * @see #asVarargsCollector
      * @see #isVarargsCollector
+     * @see #withVarargs
      */
     public MethodHandle asFixedArity() {
         assert(!isVarargsCollector());
@@ -1428,11 +1462,11 @@
     /*non-public*/
     MethodHandle setVarargs(MemberName member) throws IllegalAccessException {
         if (!member.isVarargs())  return this;
-        Class<?> arrayType = type().lastParameterType();
-        if (arrayType.isArray()) {
-            return MethodHandleImpl.makeVarargsCollector(this, arrayType);
+        try {
+            return this.withVarargs(true);
+        } catch (IllegalArgumentException ex) {
+            throw member.makeAccessException("cannot make variable arity", null);
         }
-        throw member.makeAccessException("cannot make variable arity", null);
     }
 
     /*non-public*/
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,13 +33,13 @@
 import java.util.List;
 import java.util.function.Function;
 
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
 import jdk.internal.vm.annotation.Stable;
 import sun.invoke.empty.Empty;
 import sun.invoke.util.ValueConversions;
 import sun.invoke.util.VerifyType;
 import sun.invoke.util.Wrapper;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
 import static java.lang.invoke.LambdaForm.*;
 import static java.lang.invoke.MethodHandleStatics.*;
 import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
@@ -1055,7 +1055,7 @@
         if (!method.getInvocationType().equals(mh.type()))
             throw new InternalError(method.toString());
         mh = mh.withInternalMemberName(method, false);
-        mh = mh.asVarargsCollector(Object[].class);
+        mh = mh.withVarargs(true);
         assert(method.isVarargs());
         FAKE_METHOD_HANDLE_INVOKE[idx] = mh;
         return mh;
@@ -1754,6 +1754,18 @@
     }
 
     /**
+     * This method is bound as a filter in {@linkplain MethodHandles#countedLoop(MethodHandle, MethodHandle, MethodHandle,
+     * MethodHandle) counting loops} to pass the correct counter value to the body.
+     *
+     * @param counter the loop counter.
+     *
+     * @return the loop counter decremented by 1.
+     */
+    static int decrementCounter(int counter) {
+        return counter - 1;
+    }
+
+    /**
      * This is bound to initialize the loop-local iterator in {@linkplain MethodHandles#iteratedLoop iterating loops}.
      *
      * @param it the {@link Iterable} over which the loop iterates.
@@ -1879,7 +1891,8 @@
             MH_iterateNext           = 11,
             MH_tryFinallyExec        = 12,
             MH_tryFinallyVoidExec    = 13,
-            MH_LIMIT                 = 14;
+            MH_decrementCounter      = 14,
+            MH_LIMIT                 = 15;
 
     static MethodHandle getConstantHandle(int idx) {
         MethodHandle handle = HANDLES[idx];
@@ -1949,6 +1962,9 @@
                 case MH_tryFinallyVoidExec:
                     return IMPL_LOOKUP.findStatic(MethodHandleImpl.class, "tryFinallyVoidExecutor",
                             MethodType.methodType(void.class, MethodHandle.class, MethodHandle.class, Object[].class));
+                case MH_decrementCounter:
+                    return IMPL_LOOKUP.findStatic(MethodHandleImpl.class, "decrementCounter",
+                            MethodType.methodType(int.class, int.class));
             }
         } catch (ReflectiveOperationException ex) {
             throw newInternalError(ex);
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java	Tue Apr 19 11:13:30 2016 -0700
@@ -423,7 +423,7 @@
         // Get the access kind from the method name
         VarHandle.AccessMode ak;
         try {
-            ak = VarHandle.AccessMode.valueOf(name);
+            ak = VarHandle.AccessMode.valueFromMethodName(name);
         } catch (IllegalArgumentException e) {
             throw MethodHandleStatics.newInternalError(e);
         }
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,8 +30,8 @@
 import java.security.PrivilegedAction;
 import sun.invoke.WrapperInstance;
 import java.util.ArrayList;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
 import sun.reflect.misc.ReflectUtil;
 import static java.lang.invoke.MethodHandleStatics.*;
 
@@ -216,13 +216,7 @@
     }
 
     private static MethodHandle bindCaller(MethodHandle target, Class<?> hostClass) {
-        MethodHandle cbmh = MethodHandleImpl.bindCaller(target, hostClass);
-        if (target.isVarargsCollector()) {
-            MethodType type = cbmh.type();
-            int arity = type.parameterCount();
-            return cbmh.asVarargsCollector(type.parameterType(arity-1));
-        }
-        return cbmh;
+        return MethodHandleImpl.bindCaller(target, hostClass).withVarargs(target.isVarargsCollector());
     }
 
     /**
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Tue Apr 19 11:13:30 2016 -0700
@@ -28,6 +28,7 @@
 import java.lang.reflect.*;
 import java.util.ArrayList;
 import java.util.BitSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Arrays;
 import java.util.Objects;
@@ -37,13 +38,12 @@
 import sun.invoke.util.ValueConversions;
 import sun.invoke.util.VerifyAccess;
 import sun.invoke.util.Wrapper;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
 import sun.reflect.misc.ReflectUtil;
 import sun.security.util.SecurityConstants;
 import java.lang.invoke.LambdaForm.BasicType;
 
-import static java.lang.invoke.MethodHandleStatics.*;
 import static java.lang.invoke.MethodHandleImpl.Intrinsic;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
 import java.util.concurrent.ConcurrentHashMap;
@@ -53,9 +53,8 @@
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import jdk.internal.org.objectweb.asm.Opcodes;
 
-import static java.lang.invoke.MethodHandleImpl.Intrinsic;
-import static java.lang.invoke.MethodHandleNatives.Constants.*;
 import static java.lang.invoke.MethodHandleStatics.newIllegalArgumentException;
+import static java.lang.invoke.MethodType.methodType;
 
 /**
  * This class consists exclusively of static methods that operate on or return
@@ -952,7 +951,7 @@
         }
         private MethodHandle findVirtualForVH(String name, MethodType type) {
             try {
-                return varHandleInvoker(VarHandle.AccessMode.valueOf(name), type);
+                return varHandleInvoker(VarHandle.AccessMode.valueFromMethodName(name), type);
             } catch (IllegalArgumentException e) {
                 return null;
             }
@@ -1355,9 +1354,7 @@
 ...
 MethodHandle mh0 = lookup().findVirtual(defc, name, type);
 MethodHandle mh1 = mh0.bindTo(receiver);
-MethodType mt1 = mh1.type();
-if (mh0.isVarargsCollector())
-  mh1 = mh1.asVarargsCollector(mt1.parameterType(mt1.parameterCount()-1));
+mh1 = mh1.withVarargs(mh0.isVarargsCollector());
 return mh1;
          * }</pre></blockquote>
          * where {@code defc} is either {@code receiver.getClass()} or a super
@@ -2954,12 +2951,58 @@
         if (ident.type().returnType() == type)
             return ident;
         // something like identity(Foo.class); do not bother to intern these
-        assert(btw == Wrapper.OBJECT);
+        assert (btw == Wrapper.OBJECT);
         return makeIdentity(type);
     }
+
+    /**
+     * Produces a constant method handle of the requested return type which
+     * returns the default value for that type every time it is invoked.
+     * The resulting constant method handle will have no side effects.
+     * <p>The returned method handle is equivalent to {@code empty(methodType(type))}.
+     * It is also equivalent to {@code explicitCastArguments(constant(Object.class, null), methodType(type))},
+     * since {@code explicitCastArguments} converts {@code null} to default values.
+     * @param type the expected return type of the desired method handle
+     * @return a constant method handle that takes no arguments
+     *         and returns the default value of the given type (or void, if the type is void)
+     * @throws NullPointerException if the argument is null
+     * @see MethodHandles#constant
+     * @see MethodHandles#empty
+     * @since 9
+     */
+    public static  MethodHandle zero(Class<?> type) {
+        Objects.requireNonNull(type);
+        return type.isPrimitive() ?  zero(Wrapper.forPrimitiveType(type), type) : zero(Wrapper.OBJECT, type);
+    }
+
+    private static MethodHandle identityOrVoid(Class<?> type) {
+        return type == void.class ? zero(type) : identity(type);
+    }
+
+    /**
+     * Produces a method handle of the requested type which ignores any arguments, does nothing,
+     * and returns a suitable default depending on the return type.
+     * That is, it returns a zero primitive value, a {@code null}, or {@code void}.
+     * <p>The returned method handle is equivalent to
+     * {@code dropArguments(zero(type.returnType()), 0, type.parameterList())}.
+     * <p>
+     * @apiNote Given a predicate and target, a useful "if-then" construct can be produced as
+     * {@code guardWithTest(pred, target, empty(target.type())}.
+     * @param type the type of the desired method handle
+     * @return a constant method handle of the given type, which returns a default value of the given return type
+     * @throws NullPointerException if the argument is null
+     * @see MethodHandles#zero
+     * @see MethodHandles#constant
+     * @since 9
+     */
+    public static  MethodHandle empty(MethodType type) {
+        Objects.requireNonNull(type);
+        return dropArguments(zero(type.returnType()), 0, type.parameterList());
+    }
+
     private static final MethodHandle[] IDENTITY_MHS = new MethodHandle[Wrapper.values().length];
     private static MethodHandle makeIdentity(Class<?> ptype) {
-        MethodType mtype = MethodType.methodType(ptype, ptype);
+        MethodType mtype = methodType(ptype, ptype);
         LambdaForm lform = LambdaForm.identityForm(BasicType.basicType(ptype));
         return MethodHandleImpl.makeIntrinsic(mtype, lform, Intrinsic.IDENTITY);
     }
@@ -2977,7 +3020,7 @@
     }
     private static final MethodHandle[] ZERO_MHS = new MethodHandle[Wrapper.values().length];
     private static MethodHandle makeZero(Class<?> rtype) {
-        MethodType mtype = MethodType.methodType(rtype);
+        MethodType mtype = methodType(rtype);
         LambdaForm lform = LambdaForm.zeroForm(BasicType.basicType(rtype));
         return MethodHandleImpl.makeIntrinsic(mtype, lform, Intrinsic.ZERO);
     }
@@ -3148,8 +3191,7 @@
      * If {@code pos} is zero, the dummy arguments will precede
      * the target's real arguments; if {@code pos} is <i>N</i>
      * they will come after.
-     * <p>
-     * <b>Example:</b>
+     * @apiNote
      * <blockquote><pre>{@code
 import static java.lang.invoke.MethodHandles.*;
 import static java.lang.invoke.MethodType.*;
@@ -3188,6 +3230,99 @@
         return dropArguments(target, pos, Arrays.asList(valueTypes));
     }
 
+    // private version which allows caller some freedom with error handling
+    private static MethodHandle dropArgumentsToMatch(MethodHandle target, int skip, List<Class<?>> newTypes, int pos,
+                                      boolean nullOnFailure) {
+        List<Class<?>> oldTypes = target.type().parameterList();
+        int match = oldTypes.size();
+        if (skip != 0) {
+            if (skip < 0 || skip > match) {
+                throw newIllegalArgumentException("illegal skip", skip, target);
+            }
+            oldTypes = oldTypes.subList(skip, match);
+            match -= skip;
+        }
+        List<Class<?>> addTypes = newTypes;
+        int add = addTypes.size();
+        if (pos != 0) {
+            if (pos < 0 || pos > add) {
+                throw newIllegalArgumentException("illegal pos", pos, newTypes);
+            }
+            addTypes = addTypes.subList(pos, add);
+            add -= pos; assert(addTypes.size() == add);
+        }
+        // Do not add types which already match the existing arguments.
+        if (match > add || !oldTypes.equals(addTypes.subList(0, match))) {
+            if (nullOnFailure) {
+                return null;
+            }
+            throw newIllegalArgumentException("argument lists do not match", oldTypes, newTypes);
+        }
+        addTypes = addTypes.subList(match, add);
+        add -= match; assert(addTypes.size() == add);
+        // newTypes:     (   P*[pos], M*[match], A*[add] )
+        // target: ( S*[skip],        M*[match]  )
+        MethodHandle adapter = target;
+        if (add > 0) {
+            adapter = dropArguments(adapter, skip+ match, addTypes);
+        }
+        // adapter: (S*[skip],        M*[match], A*[add] )
+        if (pos > 0) {
+            adapter = dropArguments(adapter, skip, newTypes.subList(0, pos));
+       }
+        // adapter: (S*[skip], P*[pos], M*[match], A*[add] )
+        return adapter;
+    }
+
+    /**
+     * Adapts a target method handle to match the given parameter type list, if necessary, by adding dummy arguments.
+     * Some leading parameters are first skipped; they will be left unchanged and are otherwise ignored.
+     * The remaining types in the target's parameter type list must be contained as a sub-list of the given type list,
+     * at the given position.
+     * Any non-matching parameter types (before or after the matching sub-list) are inserted in corresponding
+     * positions of the target method handle's parameters, as if by {@link #dropArguments}.
+     * (More precisely, elements in the new list before {@code pos} are inserted into the target list at {@code skip},
+     * while elements in the new list after the match beginning at {@code pos} are inserted at the end of the
+     * target list.)
+     * The target's return type will be unchanged.
+     * @apiNote
+     * Two method handles whose argument lists are "effectively identical" (i.e., identical
+     * in a common prefix) may be mutually converted to a common type
+     * by two calls to {@code dropArgumentsToMatch}, as follows:
+     * <blockquote><pre>{@code
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+...
+...
+MethodHandle h0 = constant(boolean.class, true);
+MethodHandle h1 = lookup().findVirtual(String.class, "concat", methodType(String.class, String.class));
+MethodType bigType = h1.type().insertParameterTypes(1, String.class, int.class);
+MethodHandle h2 = dropArguments(h1, 0, bigType.parameterList());
+if (h1.type().parameterCount() < h2.type().parameterCount())
+    h1 = dropArgumentsToMatch(h1, 0, h2.type().parameterList(), 0);  // lengthen h1
+else
+    h2 = dropArgumentsToMatch(h2, 0, h1.type().parameterList(), 0);    // lengthen h2
+MethodHandle h3 = guardWithTest(h0, h1, h2);
+assertEquals("xy", h3.invoke("x", "y", 1, "a", "b", "c"));
+     * }</pre></blockquote>
+     * @param target the method handle to adapt
+     * @param skip number of targets parameters to disregard (they will be unchanged)
+     * @param newTypes the desired argument list of the method handle
+     * @param pos place in {@code newTypes} where the non-skipped target parameters must occur
+     * @return a possibly adapted method handle
+     * @throws NullPointerException if either argument is null
+     * @throws IllegalArgumentException
+     *         if either index is out of range in its corresponding list, or
+     *         if the non-skipped target parameter types match the new types at {@code pos}
+     * @since 9
+     */
+    public static
+    MethodHandle dropArgumentsToMatch(MethodHandle target, int skip, List<Class<?>> newTypes, int pos) {
+        Objects.requireNonNull(target);
+        Objects.requireNonNull(newTypes);
+        return dropArgumentsToMatch(target, skip, newTypes, pos, false);
+    }
+
     /**
      * Adapts a target method handle by pre-processing
      * one or more of its arguments, each with its own unary filter function,
@@ -3699,13 +3834,9 @@
         if (gtype.returnType() != boolean.class)
             throw newIllegalArgumentException("guard type is not a predicate "+gtype);
         List<Class<?>> targs = ttype.parameterList();
-        List<Class<?>> gargs = gtype.parameterList();
-        if (!targs.equals(gargs)) {
-            int gpc = gargs.size(), tpc = targs.size();
-            if (gpc >= tpc || !targs.subList(0, gpc).equals(gargs))
-                throw misMatchedTypes("target and test types", ttype, gtype);
-            test = dropArguments(test, gpc, targs.subList(gpc, tpc));
-            gtype = test.type();
+        test = dropArgumentsToMatch(test, 0, targs, 0, true);
+        if (test == null) {
+            throw misMatchedTypes("target and test types", ttype, gtype);
         }
         return MethodHandleImpl.makeGuardWithTest(test, target, fallback);
     }
@@ -3777,15 +3908,9 @@
             throw newIllegalArgumentException("handler does not accept exception type "+exType);
         if (htype.returnType() != ttype.returnType())
             throw misMatchedTypes("target and handler return types", ttype, htype);
-        List<Class<?>> targs = ttype.parameterList();
-        List<Class<?>> hargs = htype.parameterList();
-        hargs = hargs.subList(1, hargs.size());  // omit leading parameter from handler
-        if (!targs.equals(hargs)) {
-            int hpc = hargs.size(), tpc = targs.size();
-            if (hpc >= tpc || !targs.subList(0, hpc).equals(hargs))
-                throw misMatchedTypes("target and handler types", ttype, htype);
-            handler = dropArguments(handler, 1+hpc, targs.subList(hpc, tpc));
-            htype = handler.type();
+        handler = dropArgumentsToMatch(handler, 1, ttype.parameterList(), 0, true);
+        if (handler == null) {
+            throw misMatchedTypes("target and handler types", ttype, htype);
         }
         return MethodHandleImpl.makeGuardWithCatch(target, exType, handler);
     }
@@ -3806,7 +3931,7 @@
     MethodHandle throwException(Class<?> returnType, Class<? extends Throwable> exType) {
         if (!Throwable.class.isAssignableFrom(exType))
             throw new ClassCastException(exType.getName());
-        return MethodHandleImpl.throwException(MethodType.methodType(returnType, exType));
+        return MethodHandleImpl.throwException(methodType(returnType, exType));
     }
 
     /**
@@ -4043,16 +4168,16 @@
         for (int i = 0; i < nclauses; ++i) {
             Class<?> t = iterationVariableTypes.get(i);
             if (init.get(i) == null) {
-                init.set(i, zeroHandle(t));
+                init.set(i, empty(methodType(t, commonSuffix)));
             }
             if (step.get(i) == null) {
-                step.set(i, dropArguments(t == void.class ? zeroHandle(t) : identity(t), 0, commonPrefix.subList(0, i)));
+                step.set(i, dropArgumentsToMatch(identityOrVoid(t), 0, commonParameterSequence, i));
             }
             if (pred.get(i) == null) {
-                pred.set(i, constant(boolean.class, true));
+                pred.set(i, dropArguments(constant(boolean.class, true), 0, commonParameterSequence));
             }
             if (fini.get(i) == null) {
-                fini.set(i, zeroHandle(t));
+                fini.set(i, empty(methodType(t, commonParameterSequence)));
             }
         }
 
@@ -4146,7 +4271,8 @@
      * @since 9
      */
     public static MethodHandle whileLoop(MethodHandle init, MethodHandle pred, MethodHandle body) {
-        MethodHandle fin = init == null ? zeroHandle(void.class) : identity(init.type().returnType());
+        MethodHandle fin = init == null || init.type().returnType() == void.class ? zero(void.class) :
+                identity(init.type().returnType());
         MethodHandle[] checkExit = {null, null, pred, fin};
         MethodHandle[] varBody = {init, body};
         return loop(checkExit, varBody);
@@ -4212,7 +4338,8 @@
      * @since 9
      */
     public static MethodHandle doWhileLoop(MethodHandle init, MethodHandle body, MethodHandle pred) {
-        MethodHandle fin = init == null ? zeroHandle(void.class) : identity(init.type().returnType());
+        MethodHandle fin = init == null || init.type().returnType() == void.class ? zero(void.class) :
+                identity(init.type().returnType());
         MethodHandle[] clause = {init, body, pred, fin};
         return loop(clause);
     }
@@ -4322,11 +4449,13 @@
      * <blockquote><pre>{@code
      * MethodHandle countedLoop(MethodHandle start, MethodHandle end, MethodHandle init, MethodHandle body) {
      *     MethodHandle returnVar = dropArguments(identity(init.type().returnType()), 0, int.class, int.class);
-     *     // assume MH_increment and MH_lessThan are handles to x+1 and x<y of type int
+     *     // assume MH_increment and MH_lessThan are handles to x+1 and x<y of type int,
+     *     // assume MH_decrement is a handle to x-1 of type int
      *     MethodHandle[]
      *         indexVar = {start, MH_increment}, // i = start; i = i+1
      *         loopLimit = {end, null, MH_lessThan, returnVar }, // i<end
-     *         bodyClause = {init, dropArguments(body, 1, int.class)};  // v = body(i, v);
+     *         bodyClause = {init,
+     *                       filterArgument(dropArguments(body, 1, int.class), 0, MH_decrement}; // v = body(i-1, v)
      *     return loop(indexVar, loopLimit, bodyClause);
      * }
      * }</pre></blockquote>
@@ -4347,17 +4476,20 @@
      * @since 9
      */
     public static MethodHandle countedLoop(MethodHandle start, MethodHandle end, MethodHandle init, MethodHandle body) {
-        MethodHandle returnVar = dropArguments(init == null ? zeroHandle(void.class) : identity(init.type().returnType()),
-                0, int.class, int.class);
+        MethodHandle returnVar = dropArguments(init == null || init.type().returnType() == void.class ?
+                zero(void.class) : identity(init.type().returnType()), 0, int.class, int.class);
         MethodHandle[] indexVar = {start, MethodHandleImpl.getConstantHandle(MethodHandleImpl.MH_countedLoopStep)};
         MethodHandle[] loopLimit = {end, null, MethodHandleImpl.getConstantHandle(MethodHandleImpl.MH_countedLoopPred), returnVar};
-        MethodHandle[] bodyClause = {init, dropArguments(body, 1, int.class)};
+        MethodHandle[] bodyClause = {init,
+                filterArgument(dropArguments(body, 1, int.class), 0,
+                        MethodHandleImpl.getConstantHandle(MethodHandleImpl.MH_decrementCounter))};
         return loop(indexVar, loopLimit, bodyClause);
     }
 
     /**
      * Constructs a loop that ranges over the elements produced by an {@code Iterator<T>}.
      * The iterator will be produced by the evaluation of the {@code iterator} handle.
+     * This handle must have {@link java.util.Iterator} as its return type.
      * If this handle is passed as {@code null} the method {@link Iterable#iterator} will be used instead,
      * and will be applied to a leading argument of the loop handle.
      * Each value produced by the iterator is passed to the {@code body}, which must accept an initial {@code T} parameter.
@@ -4407,7 +4539,7 @@
      * assertEquals(reversedList, (List<String>) loop.invoke(list));
      * }</pre></blockquote>
      * <p>
-     * @implSpec The implementation of this method is equivalent to:
+     * @implSpec The implementation of this method is equivalent to (excluding error handling):
      * <blockquote><pre>{@code
      * MethodHandle iteratedLoop(MethodHandle iterator, MethodHandle init, MethodHandle body) {
      *     // assume MH_next and MH_hasNext are handles to methods of Iterator
@@ -4423,6 +4555,7 @@
      * }</pre></blockquote>
      *
      * @param iterator a handle to return the iterator to start the loop.
+     *             The handle must have {@link java.util.Iterator} as its return type.
      *             Passing {@code null} will make the loop call {@link Iterable#iterator()} on the first
      *             incoming value.
      * @param init initializer for additional loop state. This determines the loop's result type.
@@ -4438,21 +4571,23 @@
      * @since 9
      */
     public static MethodHandle iteratedLoop(MethodHandle iterator, MethodHandle init, MethodHandle body) {
-        checkIteratedLoop(body);
+        checkIteratedLoop(iterator, body);
+        final boolean voidInit = init == null || init.type().returnType() == void.class;
 
         MethodHandle initit = MethodHandleImpl.getConstantHandle(MethodHandleImpl.MH_initIterator);
         MethodHandle initIterator = iterator == null ?
-                initit.asType(initit.type().changeParameterType(0, body.type().parameterType(init == null ? 1 : 2))) :
+                initit.asType(initit.type().changeParameterType(0, body.type().parameterType(voidInit ? 1 : 2))) :
                 iterator;
         Class<?> itype = initIterator.type().returnType();
         Class<?> ttype = body.type().parameterType(0);
 
         MethodHandle returnVar =
-                dropArguments(init == null ? zeroHandle(void.class) : identity(init.type().returnType()), 0, itype);
+                dropArguments(voidInit ? zero(void.class) : identity(init.type().returnType()), 0, itype);
         MethodHandle initnx = MethodHandleImpl.getConstantHandle(MethodHandleImpl.MH_iterateNext);
         MethodHandle nextVal = initnx.asType(initnx.type().changeReturnType(ttype));
 
-        MethodHandle[] iterVar = {initIterator, null, MethodHandleImpl.getConstantHandle(MethodHandleImpl.MH_iteratePred), returnVar};
+        MethodHandle[] iterVar = {initIterator, null, MethodHandleImpl.getConstantHandle(MethodHandleImpl.MH_iteratePred),
+                returnVar};
         MethodHandle[] bodyClause = {init, filterArgument(body, 0, nextVal)};
 
         return loop(iterVar, bodyClause);
@@ -4542,15 +4677,11 @@
         checkTryFinally(target, cleanup);
 
         // Match parameter lists: if the cleanup has a shorter parameter list than the target, add ignored arguments.
-        int tpSize = targetParamTypes.size();
-        int cpPrefixLength = rtype == void.class ? 1 : 2;
-        int cpSize = cleanupParamTypes.size();
-        MethodHandle aCleanup = cpSize - cpPrefixLength < tpSize ?
-                dropArguments(cleanup, cpSize, targetParamTypes.subList(tpSize - (cpSize - cpPrefixLength), tpSize)) :
-                cleanup;
-
+        // The cleanup parameter list (minus the leading Throwable and result parameters) must be a sublist of the
+        // target parameter list.
+        cleanup = dropArgumentsToMatch(cleanup, (rtype == void.class ? 1 : 2), targetParamTypes, 0);
         MethodHandle aTarget = target.asSpreader(Object[].class, target.type().parameterCount());
-        aCleanup = aCleanup.asSpreader(Object[].class, tpSize);
+        MethodHandle aCleanup = cleanup.asSpreader(Object[].class, targetParamTypes.size());
 
         return MethodHandleImpl.makeTryFinally(aTarget, aCleanup, rtype, targetParamTypes);
     }
@@ -4641,16 +4772,6 @@
         return result;
     }
 
-    /**
-     * Wrap creation of a proper zero handle for a given type.
-     *
-     * @param type the type.
-     *
-     * @return a zero value for the given type.
-     */
-    static MethodHandle zeroHandle(Class<?> type) {
-        return type.isPrimitive() ?  zero(Wrapper.forPrimitiveType(type), type) : zero(Wrapper.OBJECT, type);
-    }
 
     private static void checkLoop0(MethodHandle[][] clauses) {
         if (clauses == null || clauses.length == 0) {
@@ -4720,7 +4841,10 @@
         }
     }
 
-    private static void checkIteratedLoop(MethodHandle body) {
+    private static void checkIteratedLoop(MethodHandle iterator, MethodHandle body) {
+        if (null != iterator && !Iterator.class.isAssignableFrom(iterator.type().returnType())) {
+            throw newIllegalArgumentException("iteratedLoop first argument must have Iterator return type");
+        }
         if (null == body) {
             throw newIllegalArgumentException("iterated loop body must not be null");
         }
--- a/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Tue Apr 19 11:13:30 2016 -0700
@@ -34,11 +34,11 @@
 
 import java.lang.invoke.MethodHandles.Lookup;
 import java.security.AccessController;
-import java.security.PrivilegedAction;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.function.Function;
+import sun.security.action.GetPropertyAction;
 
 import static jdk.internal.org.objectweb.asm.Opcodes.*;
 
@@ -188,20 +188,14 @@
     private static final ProxyClassesDumper DUMPER;
 
     static {
-        // Poke the privileged block once, taking everything we need:
-        final Object[] values = new Object[4];
-        AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
-            values[0] = System.getProperty("java.lang.invoke.stringConcat");
-            values[1] = Boolean.getBoolean("java.lang.invoke.stringConcat.cache");
-            values[2] = Boolean.getBoolean("java.lang.invoke.stringConcat.debug");
-            values[3] = System.getProperty("java.lang.invoke.stringConcat.dumpClasses");
-            return null;
-        });
-
-        final String strategy = (String)  values[0];
-        CACHE_ENABLE          = (Boolean) values[1];
-        DEBUG                 = (Boolean) values[2];
-        final String dumpPath = (String)  values[3];
+        final String strategy = AccessController.doPrivileged(
+                new GetPropertyAction("java.lang.invoke.stringConcat"));
+        CACHE_ENABLE = Boolean.parseBoolean(AccessController.doPrivileged(
+                new GetPropertyAction("java.lang.invoke.stringConcat.cache")));
+        DEBUG = Boolean.parseBoolean(AccessController.doPrivileged(
+                new GetPropertyAction("java.lang.invoke.stringConcat.debug")));
+        final String dumpPath = AccessController.doPrivileged(
+                new GetPropertyAction("java.lang.invoke.stringConcat.dumpClasses"));
 
         STRATEGY = (strategy == null) ? DEFAULT_STRATEGY : Strategy.valueOf(strategy);
         CACHE = CACHE_ENABLE ? new ConcurrentHashMap<>() : null;
--- a/src/java.base/share/classes/java/lang/invoke/VarForm.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/VarForm.java	Tue Apr 19 11:13:30 2016 -0700
@@ -69,13 +69,10 @@
         for (Class<?> c = implClass; c != VarHandle.class; c = c.getSuperclass()) {
             for (Method m : c.getDeclaredMethods()) {
                 if (Modifier.isStatic(m.getModifiers())) {
-                    try {
-                        AccessMode am = AccessMode.valueOf(m.getName());
+                    AccessMode am = AccessMode.methodNameToAccessMode.get(m.getName());
+                    if (am != null) {
                         assert table[am.ordinal()] == null;
                         table[am.ordinal()] = new MemberName(m);
-                    } catch (IllegalArgumentException ex) {
-                        // Ignore. Note the try/catch will be removed when
-                        // AccessMode enum constant names are renamed
                     }
                 }
             }
--- a/src/java.base/share/classes/java/lang/invoke/VarHandle.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/VarHandle.java	Tue Apr 19 11:13:30 2016 -0700
@@ -31,8 +31,12 @@
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 import java.util.function.BiFunction;
+import java.util.function.Function;
 
 import static java.lang.invoke.MethodHandleStatics.UNSAFE;
 import static java.lang.invoke.MethodHandleStatics.newInternalError;
@@ -152,7 +156,9 @@
  * supported, which may also include documenting restrictions based on the
  * variable type and whether a variable is read-only.  If an access mode is not
  * supported then the corresponding signature-polymorphic method will on
- * invocation throw an {@code UnsupportedOperationException}.
+ * invocation throw an {@code UnsupportedOperationException}.  Factory methods
+ * should document any additional undeclared exceptions that may be thrown by
+ * access mode methods.
  * The {@link #get get} access mode is supported for all
  * VarHandle instances and the corresponding method never throws
  * {@code UnsupportedOperationException}.
@@ -166,7 +172,7 @@
  * Unless stated otherwise in the documentation of a factory method, the access
  * modes {@code get} and {@code set} (if supported) provide atomic access for
  * reference types and all primitives types, with the exception of {@code long}
- * and {@code double} on 32-bit platforms
+ * and {@code double} on 32-bit platforms.
  *
  * <p>Access modes will override any memory ordering effects specified at
  * the declaration site of a variable.  For example, a VarHandle accessing a
@@ -272,7 +278,7 @@
  * <pre> {@code
  * MethodHandle mh = MethodHandles.lookup().findVirtual(
  *                       VarHandle.class,
- *                       VarHandle.AccessMode.{access-mode}.name(),
+ *                       VarHandle.AccessMode.{access-mode}.methodName(),
  *                       MethodType.methodType(R, p1, p2, ..., pN));
  *
  * R r = (R) mh.invokeExact(vh, p1, p2, ..., pN)
@@ -465,6 +471,8 @@
      * , statically represented using {@code Object}.
      * @throws WrongMethodTypeException if the access mode type is not
      * compatible with the caller's symbolic type descriptor.
+     * @throws ClassCastException if the access mode type is compatible with the
+     * caller's symbolic type descriptor, but a reference cast fails.
      */
     public final native
     @MethodHandle.PolymorphicSignature
@@ -489,6 +497,8 @@
      * for this VarHandle.
      * @throws WrongMethodTypeException if the access mode type is not
      * compatible with the caller's symbolic type descriptor.
+     * @throws ClassCastException if the access mode type is compatible with the
+     * caller's symbolic type descriptor, but a reference cast fails.
      */
     public final native
     @MethodHandle.PolymorphicSignature
@@ -518,6 +528,8 @@
      * for this VarHandle.
      * @throws WrongMethodTypeException if the access mode type is not
      * compatible with the caller's symbolic type descriptor.
+     * @throws ClassCastException if the access mode type is compatible with the
+     * caller's symbolic type descriptor, but a reference cast fails.
      */
     public final native
     @MethodHandle.PolymorphicSignature
@@ -534,6 +546,10 @@
      * must match the access mode type that is the result of calling
      * {@code accessModeType(VarHandle.AccessMode.setVolatile)} on this VarHandle.
      *
+     * @apiNote
+     * Ignoring the many semantic differences from C and C++, this method has
+     * memory ordering effects compatible with {@code memory_order_seq_cst}.
+     *
      * @param args the signature-polymorphic parameter list of the form
      * {@code (CT, T newValue)}
      * , statically represented using varargs.
@@ -541,9 +557,8 @@
      * for this VarHandle.
      * @throws WrongMethodTypeException if the access mode type is not
      * compatible with the caller's symbolic type descriptor.
-     * @apiNote Ignoring the many semantic differences from C and C++, this
-     * method has memory ordering effects compatible with
-     * {@code memory_order_seq_cst}.
+     * @throws ClassCastException if the access mode type is compatible with the
+     * caller's symbolic type descriptor, but a reference cast fails.
      */
     public final native
     @MethodHandle.PolymorphicSignature
@@ -571,6 +586,8 @@
      * for this VarHandle.
      * @throws WrongMethodTypeException if the access mode type is not
      * compatible with the caller's symbolic type descriptor.
+     * @throws ClassCastException if the access mode type is compatible with the
+     * caller's symbolic type descriptor, but a reference cast fails.
      */
     public final native
     @MethodHandle.PolymorphicSignature
@@ -595,6 +612,8 @@
      * for this VarHandle.
      * @throws WrongMethodTypeException if the access mode type is not
      * compatible with the caller's symbolic type descriptor.
+     * @throws ClassCastException if the access mode type is compatible with the
+     * caller's symbolic type descriptor, but a reference cast fails.
      */
     public final native
     @MethodHandle.PolymorphicSignature
@@ -614,6 +633,11 @@
      * must match the access mode type that is the result of calling
      * {@code accessModeType(VarHandle.AccessMode.getAcquire)} on this VarHandle.
      *
+     * @apiNote
+     * Ignoring the many semantic differences from C and C++, this method has
+     * memory ordering effects compatible with {@code memory_order_acquire}
+     * ordering.
+     *
      * @param args the signature-polymorphic parameter list of the form
      * {@code (CT)}
      * , statically represented using varargs.
@@ -624,9 +648,8 @@
      * for this VarHandle.
      * @throws WrongMethodTypeException if the access mode type is not
      * compatible with the caller's symbolic type descriptor.
-     * @apiNote Ignoring the many semantic differences from C and C++, this
-     * method has memory ordering effects compatible with
-     * {@code memory_order_acquire} ordering.
+     * @throws ClassCastException if the access mode type is compatible with the
+     * caller's symbolic type descriptor, but a reference cast fails.
      */
     public final native
     @MethodHandle.PolymorphicSignature
@@ -643,6 +666,11 @@
      * must match the access mode type that is the result of calling
      * {@code accessModeType(VarHandle.AccessMode.setRelease)} on this VarHandle.
      *
+     * @apiNote
+     * Ignoring the many semantic differences from C and C++, this method has
+     * memory ordering effects compatible with {@code memory_order_release}
+     * ordering.
+     *
      * @param args the signature-polymorphic parameter list of the form
      * {@code (CT, T newValue)}
      * , statically represented using varargs.
@@ -650,9 +678,8 @@
      * for this VarHandle.
      * @throws WrongMethodTypeException if the access mode type is not
      * compatible with the caller's symbolic type descriptor.
-     * @apiNote Ignoring the many semantic differences from C and C++, this
-     * method has memory ordering effects compatible with
-     * {@code memory_order_release} ordering.
+     * @throws ClassCastException if the access mode type is compatible with the
+     * caller's symbolic type descriptor, but a reference cast fails.
      */
     public final native
     @MethodHandle.PolymorphicSignature
@@ -685,6 +712,8 @@
      * for this VarHandle.
      * @throws WrongMethodTypeException if the access mode type is not
      * compatible with the caller's symbolic type descriptor.
+     * @throws ClassCastException if the access mode type is compatible with the
+     * caller's symbolic type descriptor, but a reference cast fails.
      * @see #setVolatile(Object...)
      * @see #getVolatile(Object...)
      */
@@ -718,6 +747,8 @@
      * for this VarHandle.
      * @throws WrongMethodTypeException if the access mode type is not
      * compatible with the caller's symbolic type descriptor.
+     * @throws ClassCastException if the access mode type is compatible with the
+     * caller's symbolic type descriptor, but a reference cast fails.
      * @see #setVolatile(Object...)
      * @see #getVolatile(Object...)
      */
@@ -751,6 +782,8 @@
      * for this VarHandle.
      * @throws WrongMethodTypeException if the access mode type is not
      * compatible with the caller's symbolic type descriptor.
+     * @throws ClassCastException if the access mode type is compatible with the
+     * caller's symbolic type descriptor, but a reference cast fails.
      * @see #set(Object...)
      * @see #getAcquire(Object...)
      */
@@ -783,6 +816,8 @@
      * for this VarHandle.
      * @throws WrongMethodTypeException if the access mode type is not
      * compatible with the caller's symbolic type descriptor.
+     * @throws ClassCastException if the access mode type is compatible with the
+     * caller's symbolic type descriptor, but a reference cast fails.
      * @see #setRelease(Object...)
      * @see #get(Object...)
      */
@@ -820,6 +855,8 @@
      * for this VarHandle.
      * @throws WrongMethodTypeException if the access mode type is not
      * compatible with the caller's symbolic type descriptor.
+     * @throws ClassCastException if the access mode type is compatible with the
+     * caller's symbolic type descriptor, but a reference cast fails.
      * @see #set(Object...)
      * @see #get(Object...)
      */
@@ -855,6 +892,8 @@
      * for this VarHandle.
      * @throws WrongMethodTypeException if the access mode type is not
      * compatible with the caller's symbolic type descriptor.
+     * @throws ClassCastException if the access mode type is compatible with the
+     * caller's symbolic type descriptor, but a reference cast fails.
      * @see #set(Object...)
      * @see #getAcquire(Object...)
      */
@@ -890,6 +929,8 @@
      * for this VarHandle.
      * @throws WrongMethodTypeException if the access mode type is not
      * compatible with the caller's symbolic type descriptor.
+     * @throws ClassCastException if the access mode type is compatible with the
+     * caller's symbolic type descriptor, but a reference cast fails.
      * @see #setRelease(Object...)
      * @see #get(Object...)
      */
@@ -920,6 +961,8 @@
      * for this VarHandle.
      * @throws WrongMethodTypeException if the access mode type is not
      * compatible with the caller's symbolic type descriptor.
+     * @throws ClassCastException if the access mode type is compatible with the
+     * caller's symbolic type descriptor, but a reference cast fails.
      * @see #setVolatile(Object...)
      * @see #getVolatile(Object...)
      */
@@ -954,6 +997,8 @@
      * for this VarHandle.
      * @throws WrongMethodTypeException if the access mode type is not
      * compatible with the caller's symbolic type descriptor.
+     * @throws ClassCastException if the access mode type is compatible with the
+     * caller's symbolic type descriptor, but a reference cast fails.
      * @see #setVolatile(Object...)
      * @see #getVolatile(Object...)
      */
@@ -984,6 +1029,8 @@
      * for this VarHandle.
      * @throws WrongMethodTypeException if the access mode type is not
      * compatible with the caller's symbolic type descriptor.
+     * @throws ClassCastException if the access mode type is compatible with the
+     * caller's symbolic type descriptor, but a reference cast fails.
      * @see #setVolatile(Object...)
      * @see #getVolatile(Object...)
      */
@@ -993,11 +1040,11 @@
     Object addAndGet(Object... args);
 
     enum AccessType {
-        get,                  // 0
-        set,                  // 1
-        compareAndSwap,       // 2
-        compareAndExchange,   // 3
-        getAndUpdate;         // 4
+        GET,                    // 0
+        SET,                    // 1
+        COMPARE_AND_SWAP,       // 2
+        COMPARE_AND_EXCHANGE,   // 3
+        GET_AND_UPDATE;         // 4
 
         MethodType getMethodType(VarHandle vh) {
             return getMethodType(this.ordinal(), vh);
@@ -1036,126 +1083,179 @@
          * method
          * {@link VarHandle#get VarHandle.get}
          */
-        get(AccessType.get, Object.class),   // 0
+        GET("get", AccessType.GET, Object.class),   // 0
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#set VarHandle.set}
          */
-        set(AccessType.set, void.class),     // 1
+        SET("set", AccessType.SET, void.class),     // 1
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#getVolatile VarHandle.getVolatile}
          */
-        getVolatile(AccessType.get, Object.class),  // 2
+        GET_VOLATILE("getVolatile", AccessType.GET, Object.class),  // 2
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#setVolatile VarHandle.setVolatile}
          */
-        setVolatile(AccessType.set, void.class),    // 3
+        SET_VOLATILE("setVolatile", AccessType.SET, void.class),    // 3
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#getAcquire VarHandle.getAcquire}
          */
-        getAcquire(AccessType.get, Object.class),   // 4
+        GET_ACQUIRE("getAcquire", AccessType.GET, Object.class),   // 4
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#setRelease VarHandle.setRelease}
          */
-        setRelease(AccessType.set, void.class),     // 5
+        SET_RELEASE("setRelease", AccessType.SET, void.class),     // 5
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#getOpaque VarHandle.getOpaque}
          */
-        getOpaque(AccessType.get, Object.class),    // 6
+        GET_OPAQUE("getOpaque", AccessType.GET, Object.class),    // 6
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#setOpaque VarHandle.setOpaque}
          */
-        setOpaque(AccessType.set, void.class),      // 7
+        SET_OPAQUE("setOpaque", AccessType.SET, void.class),      // 7
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#compareAndSet VarHandle.compareAndSet}
          */
-        compareAndSet(AccessType.compareAndSwap, boolean.class),    // 8
+        COMPARE_AND_SET("compareAndSet", AccessType.COMPARE_AND_SWAP, boolean.class),    // 8
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#compareAndExchangeVolatile VarHandle.compareAndExchangeVolatile}
          */
-        compareAndExchangeVolatile(AccessType.compareAndExchange, Object.class), // 9
+        COMPARE_AND_EXCHANGE_VOLATILE("compareAndExchangeVolatile", AccessType.COMPARE_AND_EXCHANGE, Object.class), // 9
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#compareAndExchangeAcquire VarHandle.compareAndExchangeAcquire}
          */
-        compareAndExchangeAcquire(AccessType.compareAndExchange, Object.class),  // 10
+        COMPARE_AND_EXCHANGE_ACQUIRE("compareAndExchangeAcquire", AccessType.COMPARE_AND_EXCHANGE, Object.class),  // 10
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#compareAndExchangeRelease VarHandle.compareAndExchangeRelease}
          */
-        compareAndExchangeRelease(AccessType.compareAndExchange, Object.class),  // 11
+        COMPARE_AND_EXCHANGE_RELEASE("compareAndExchangeRelease", AccessType.COMPARE_AND_EXCHANGE, Object.class),  // 11
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#weakCompareAndSet VarHandle.weakCompareAndSet}
          */
-        weakCompareAndSet(AccessType.compareAndSwap, boolean.class),        // 12
+        WEAK_COMPARE_AND_SET("weakCompareAndSet", AccessType.COMPARE_AND_SWAP, boolean.class),        // 12
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#weakCompareAndSetAcquire VarHandle.weakCompareAndSetAcquire}
          */
-        weakCompareAndSetAcquire(AccessType.compareAndSwap, boolean.class), // 13
+        WEAK_COMPARE_AND_SET_ACQUIRE("weakCompareAndSetAcquire", AccessType.COMPARE_AND_SWAP, boolean.class), // 13
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#weakCompareAndSetRelease VarHandle.weakCompareAndSetRelease}
          */
-        weakCompareAndSetRelease(AccessType.compareAndSwap, boolean.class), // 14
+        WEAK_COMPARE_AND_SET_RELEASE("weakCompareAndSetRelease", AccessType.COMPARE_AND_SWAP, boolean.class), // 14
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#getAndSet VarHandle.getAndSet}
          */
-        getAndSet(AccessType.getAndUpdate, Object.class),   // 15
+        GET_AND_SET("getAndSet", AccessType.GET_AND_UPDATE, Object.class),   // 15
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#getAndAdd VarHandle.getAndAdd}
          */
-        getAndAdd(AccessType.getAndUpdate, Object.class),   // 16
+        GET_AND_ADD("getAndAdd", AccessType.GET_AND_UPDATE, Object.class),   // 16
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#addAndGet VarHandle.addAndGet}
          */
-        addAndGet(AccessType.getAndUpdate, Object.class),   // 17
+        ADD_AND_GET("addAndGet", AccessType.GET_AND_UPDATE, Object.class),   // 17
         ;
 
+        static final Map<String, AccessMode> methodNameToAccessMode;
+        static {
+            // Initial capacity of # values is sufficient to avoid resizes
+            // for the smallest table size (32)
+            methodNameToAccessMode = new HashMap<>(AccessMode.values().length);
+            for (AccessMode am : AccessMode.values()) {
+                methodNameToAccessMode.put(am.methodName, am);
+            }
+        }
+
+        final String methodName;
         final AccessType at;
         final boolean isPolyMorphicInReturnType;
         final Class<?> returnType;
 
-        AccessMode(AccessType at, Class<?> returnType) {
+        AccessMode(final String methodName, AccessType at, Class<?> returnType) {
+            this.methodName = methodName;
             this.at = at;
 
+            // Assert method name is correctly derived from value name
+            assert methodName.equals(toMethodName(name()));
             // Assert that return type is correct
             // Otherwise, when disabled avoid using reflection
-            assert returnType == getReturnType(name());
+            assert returnType == getReturnType(methodName);
 
             this.returnType = returnType;
             isPolyMorphicInReturnType = returnType != Object.class;
         }
 
+        /**
+         * Returns the {@code VarHandle} signature-polymorphic method name
+         * associated with this {@code AccessMode} value
+         *
+         * @return the signature-polymorphic method name
+         * @see #valueFromMethodName
+         */
+        public String methodName() {
+            return methodName;
+        }
+
+        /**
+         * Returns the {@code AccessMode} value associated with the specified
+         * {@code VarHandle} signature-polymorphic method name.
+         *
+         * @param methodName the signature-polymorphic method name
+         * @return the {@code AccessMode} value
+         * @throws IllegalArgumentException if there is no {@code AccessMode}
+         *         value associated with method name (indicating the method
+         *         name does not correspond to a {@code VarHandle}
+         *         signature-polymorphic method name).
+         * @see #methodName
+         */
+        public static AccessMode valueFromMethodName(String methodName) {
+            AccessMode am = methodNameToAccessMode.get(methodName);
+            if (am != null) return am;
+            throw new IllegalArgumentException("No AccessMode value for method name " + methodName);
+        }
+
+        private static String toMethodName(String name) {
+            StringBuilder s = new StringBuilder(name.toLowerCase());
+            int i;
+            while ((i = s.indexOf("_")) !=  -1) {
+                s.deleteCharAt(i);
+                s.setCharAt(i, Character.toUpperCase(s.charAt(i)));
+            }
+            return s.toString();
+        }
+
         private static Class<?> getReturnType(String name) {
             try {
                 Method m = VarHandle.class.getMethod(name, Object[].class);
@@ -1279,12 +1379,14 @@
         UNSAFE.fullFence();
     }
 
-    static final BiFunction<Integer, Integer, ArrayIndexOutOfBoundsException> AIOOBE_SUPPLIER = new BiFunction<>() {
-        @Override
-        public ArrayIndexOutOfBoundsException apply(Integer a, Integer b) {
-            return new ArrayIndexOutOfBoundsException(a, b);
-        }
-    };
+    static final BiFunction<String, List<Integer>, ArrayIndexOutOfBoundsException>
+            AIOOBE_SUPPLIER = Objects.outOfBoundsExceptionFormatter(
+            new Function<String, ArrayIndexOutOfBoundsException>() {
+                @Override
+                public ArrayIndexOutOfBoundsException apply(String s) {
+                    return new ArrayIndexOutOfBoundsException(s);
+                }
+            });
 
     private static final long VFORM_OFFSET;
 
--- a/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java	Tue Apr 19 11:13:30 2016 -0700
@@ -27,9 +27,9 @@
 
 import java.security.AccessController;
 
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
-import sun.reflect.ReflectionFactory;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
+import jdk.internal.reflect.ReflectionFactory;
 import java.lang.annotation.Annotation;
 
 /**
@@ -230,7 +230,7 @@
     // very early in the bootstrapping process.
     static final ReflectionFactory reflectionFactory =
         AccessController.doPrivileged(
-            new sun.reflect.ReflectionFactory.GetReflectionFactoryAction());
+            new ReflectionFactory.GetReflectionFactoryAction());
 
     /**
      * @throws NullPointerException {@inheritDoc}
--- a/src/java.base/share/classes/java/lang/reflect/Constructor.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/reflect/Constructor.java	Tue Apr 19 11:13:30 2016 -0700
@@ -26,9 +26,9 @@
 package java.lang.reflect;
 
 import jdk.internal.misc.SharedSecrets;
-import sun.reflect.CallerSensitive;
-import sun.reflect.ConstructorAccessor;
-import sun.reflect.Reflection;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.ConstructorAccessor;
+import jdk.internal.reflect.Reflection;
 import sun.reflect.annotation.TypeAnnotation;
 import sun.reflect.annotation.TypeAnnotationParser;
 import sun.reflect.generics.repository.ConstructorRepository;
--- a/src/java.base/share/classes/java/lang/reflect/Field.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/reflect/Field.java	Tue Apr 19 11:13:30 2016 -0700
@@ -26,9 +26,9 @@
 package java.lang.reflect;
 
 import jdk.internal.misc.SharedSecrets;
-import sun.reflect.CallerSensitive;
-import sun.reflect.FieldAccessor;
-import sun.reflect.Reflection;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.FieldAccessor;
+import jdk.internal.reflect.Reflection;
 import sun.reflect.generics.repository.FieldRepository;
 import sun.reflect.generics.factory.CoreReflectionFactory;
 import sun.reflect.generics.factory.GenericsFactory;
--- a/src/java.base/share/classes/java/lang/reflect/Method.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/reflect/Method.java	Tue Apr 19 11:13:30 2016 -0700
@@ -27,9 +27,9 @@
 
 import jdk.internal.HotSpotIntrinsicCandidate;
 import jdk.internal.misc.SharedSecrets;
-import sun.reflect.CallerSensitive;
-import sun.reflect.MethodAccessor;
-import sun.reflect.Reflection;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.MethodAccessor;
+import jdk.internal.reflect.Reflection;
 import sun.reflect.generics.repository.MethodRepository;
 import sun.reflect.generics.factory.CoreReflectionFactory;
 import sun.reflect.generics.factory.GenericsFactory;
--- a/src/java.base/share/classes/java/lang/reflect/Modifier.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/reflect/Modifier.java	Tue Apr 19 11:13:30 2016 -0700
@@ -27,8 +27,8 @@
 
 import java.security.AccessController;
 import java.util.StringJoiner;
-import sun.reflect.LangReflectAccess;
-import sun.reflect.ReflectionFactory;
+import jdk.internal.reflect.LangReflectAccess;
+import jdk.internal.reflect.ReflectionFactory;
 
 /**
  * The Modifier class provides {@code static} methods and
@@ -51,8 +51,7 @@
      *  packages
      */
     static {
-        sun.reflect.ReflectionFactory factory =
-            AccessController.doPrivileged(
+        ReflectionFactory factory = AccessController.doPrivileged(
                 new ReflectionFactory.GetReflectionFactoryAction());
         factory.setLangReflectAccess(new java.lang.reflect.ReflectAccess());
     }
--- a/src/java.base/share/classes/java/lang/reflect/Module.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/reflect/Module.java	Tue Apr 19 11:13:30 2016 -0700
@@ -56,8 +56,8 @@
 import jdk.internal.misc.JavaLangReflectModuleAccess;
 import jdk.internal.misc.SharedSecrets;
 import jdk.internal.module.ServicesCatalog;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
 import sun.security.util.SecurityConstants;
 
 /**
--- a/src/java.base/share/classes/java/lang/reflect/Proxy.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/reflect/Proxy.java	Tue Apr 19 11:13:30 2016 -0700
@@ -47,8 +47,8 @@
 import jdk.internal.module.Modules;
 import jdk.internal.misc.Unsafe;
 import jdk.internal.misc.VM;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
 import sun.reflect.misc.ReflectUtil;
 import sun.security.util.SecurityConstants;
 
@@ -689,13 +689,14 @@
         }
 
         /*
-         * Returns all types referenced by all public method signatures of
+         * Returns all types referenced by all public non-static method signatures of
          * the proxy interfaces
          */
         private static Set<Class<?>> referencedTypes(ClassLoader loader,
                                                      List<Class<?>> interfaces) {
             return interfaces.stream()
                  .flatMap(intf -> Stream.of(intf.getMethods())
+                                        .filter(m -> !Modifier.isStatic(m.getModifiers()))
                                         .flatMap(ProxyBuilder::methodRefTypes)
                                         .map(ProxyBuilder::getElementType)
                                         .filter(t -> !t.isPrimitive()))
@@ -795,26 +796,13 @@
             // map to dynamic proxy module and add reads edge and qualified exports, if necessary
             Module target = getDynamicModule(loader);
 
-            // set up proxy class access to proxy interfaces and superinterfaces
-            Deque<Class<?>> deque = new LinkedList<>(interfaces);
-            Set<Class<?>> visited = new HashSet<>();
-            while (!deque.isEmpty()) {
-                Class<?> c = deque.poll();
-                if (!visited.add(c)) {
-                    continue;
-                }
+            // set up proxy class access to proxy interfaces and types
+            // referenced in the method signature
+            Set<Class<?>> types = new HashSet<>(interfaces);
+            types.addAll(refTypes);
+            for (Class<?> c : types) {
                 ensureAccess(target, c);
-
-                // add all superinterfaces
-                for (Class<?> intf : c.getInterfaces()) {
-                    deque.add(intf);
-                }
             }
-
-            // set up proxy class access to types referenced in the method signature
-            refTypes.stream()
-                    .filter(t -> !visited.contains(t))
-                    .forEach(t -> ensureAccess(target, t));
             return target;
         }
 
--- a/src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1750,7 +1750,7 @@
          * Get or assign the index for a CONSTANT_Float entry.
          */
         public short getFloat(float f) {
-            return getValue(new Float(f));
+            return getValue(f);
         }
 
         /**
--- a/src/java.base/share/classes/java/lang/reflect/ReflectAccess.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/lang/reflect/ReflectAccess.java	Tue Apr 19 11:13:30 2016 -0700
@@ -25,14 +25,14 @@
 
 package java.lang.reflect;
 
-import sun.reflect.MethodAccessor;
-import sun.reflect.ConstructorAccessor;
+import jdk.internal.reflect.MethodAccessor;
+import jdk.internal.reflect.ConstructorAccessor;
 
 /** Package-private class implementing the
     sun.reflect.LangReflectAccess interface, allowing the java.lang
     package to instantiate objects in this package. */
 
-class ReflectAccess implements sun.reflect.LangReflectAccess {
+class ReflectAccess implements jdk.internal.reflect.LangReflectAccess {
     public Field newField(Class<?> declaringClass,
                           String name,
                           Class<?> type,
--- a/src/java.base/share/classes/java/net/InetAddress.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/net/InetAddress.java	Tue Apr 19 11:13:30 2016 -0700
@@ -894,19 +894,17 @@
      */
     private static final class PlatformNameService implements NameService {
 
-                public InetAddress[] lookupAllHostAddr(String host)
-                    throws UnknownHostException {
-
-                    return impl.lookupAllHostAddr(host);
-
-                            }
-
-        public String getHostByAddr(byte[] addr) throws UnknownHostException {
-
-            return impl.getHostByAddr(addr);
-
+        public InetAddress[] lookupAllHostAddr(String host)
+            throws UnknownHostException
+        {
+            return impl.lookupAllHostAddr(host);
         }
 
+        public String getHostByAddr(byte[] addr)
+            throws UnknownHostException
+        {
+            return impl.getHostByAddr(addr);
+        }
     }
 
     /**
@@ -991,7 +989,6 @@
             return host;
         }
 
-
         /**
          * <p>Lookup a host mapping by name. Retrieve the IP addresses
          * associated with a host.
@@ -1004,7 +1001,6 @@
          * @throws UnknownHostException
          *             if no IP address for the {@code host} could be found
          */
-
         public InetAddress[] lookupAllHostAddr(String host)
                 throws UnknownHostException {
             String hostEntry;
--- a/src/java.base/share/classes/java/net/URLClassLoader.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/net/URLClassLoader.java	Tue Apr 19 11:13:30 2016 -0700
@@ -465,23 +465,21 @@
     }
 
     /**
-     * Defines a new package by name in this ClassLoader. The attributes
-     * contained in the specified Manifest will be used to obtain package
-     * version and sealing information. For sealed packages, the additional
-     * URL specifies the code source URL from which the package was loaded.
+     * Defines a new package by name in this {@code URLClassLoader}.
+     * The attributes contained in the specified {@code Manifest}
+     * will be used to obtain package version and sealing information.
+     * For sealed packages, the additional URL specifies the code source URL
+     * from which the package was loaded.
      *
      * @param name  the package name
-     * @param man   the Manifest containing package version and sealing
+     * @param man   the {@code Manifest} containing package version and sealing
      *              information
      * @param url   the code source url for the package, or null if none
-     * @exception   IllegalArgumentException if the package name duplicates
-     *              an existing package either in this class loader or one
-     *              of its ancestors
-     * @return the newly defined Package object
+     * @throws      IllegalArgumentException if the package name is
+     *              already defined by this class loader
+     * @return      the newly defined {@code Package} object
      */
-    protected Package definePackage(String name, Manifest man, URL url)
-        throws IllegalArgumentException
-    {
+    protected Package definePackage(String name, Manifest man, URL url) {
         String path = name.replace('.', '/').concat("/");
         String specTitle = null, specVersion = null, specVendor = null;
         String implTitle = null, implVersion = null, implVendor = null;
--- a/src/java.base/share/classes/java/nio/file/Files.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/nio/file/Files.java	Tue Apr 19 11:13:30 2016 -0700
@@ -77,6 +77,8 @@
 import java.util.stream.Stream;
 import java.util.stream.StreamSupport;
 
+import sun.nio.fs.AbstractFileSystemProvider;
+
 /**
  * This class consists exclusively of static methods that operate on files,
  * directories, or other types of files.
@@ -2193,6 +2195,12 @@
      *          method denies read access to the file.
      */
     public static boolean isDirectory(Path path, LinkOption... options) {
+        if (options.length == 0) {
+            FileSystemProvider provider = provider(path);
+            if (provider instanceof AbstractFileSystemProvider)
+                return ((AbstractFileSystemProvider)provider).isDirectory(path);
+        }
+
         try {
             return readAttributes(path, BasicFileAttributes.class, options).isDirectory();
         } catch (IOException ioe) {
@@ -2230,6 +2238,12 @@
      *          method denies read access to the file.
      */
     public static boolean isRegularFile(Path path, LinkOption... options) {
+        if (options.length == 0) {
+            FileSystemProvider provider = provider(path);
+            if (provider instanceof AbstractFileSystemProvider)
+                return ((AbstractFileSystemProvider)provider).isRegularFile(path);
+        }
+
         try {
             return readAttributes(path, BasicFileAttributes.class, options).isRegularFile();
         } catch (IOException ioe) {
@@ -2385,6 +2399,12 @@
      * @see #notExists
      */
     public static boolean exists(Path path, LinkOption... options) {
+        if (options.length == 0) {
+            FileSystemProvider provider = provider(path);
+            if (provider instanceof AbstractFileSystemProvider)
+                return ((AbstractFileSystemProvider)provider).exists(path);
+        }
+
         try {
             if (followLinks(options)) {
                 provider(path).checkAccess(path);
--- a/src/java.base/share/classes/java/security/AccessController.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/security/AccessController.java	Tue Apr 19 11:13:30 2016 -0700
@@ -26,8 +26,8 @@
 package java.security;
 
 import sun.security.util.Debug;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
 
 /**
  * <p> The AccessController class is used for access control operations
--- a/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -140,7 +140,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/java/security/AlgorithmParameters.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/security/AlgorithmParameters.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -128,7 +128,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/java/security/KeyFactory.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/security/KeyFactory.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -155,7 +155,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/java/security/KeyPairGenerator.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/security/KeyPairGenerator.java	Tue Apr 19 11:13:30 2016 -0700
@@ -197,7 +197,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/java/security/KeyStore.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/security/KeyStore.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -843,7 +843,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/java/security/MessageDigest.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/security/MessageDigest.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -148,7 +148,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/java/security/Policy.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/security/Policy.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -357,7 +357,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/java/security/SecureRandom.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/security/SecureRandom.java	Tue Apr 19 11:13:30 2016 -0700
@@ -270,7 +270,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/java/security/Signature.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/security/Signature.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -205,7 +205,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/java/security/cert/CertPathBuilder.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/security/cert/CertPathBuilder.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -144,7 +144,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/java/security/cert/CertPathValidator.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/security/cert/CertPathValidator.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -145,7 +145,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/java/security/cert/CertStore.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/security/cert/CertStore.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -203,7 +203,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/java/security/cert/CertificateFactory.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/security/cert/CertificateFactory.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -165,7 +165,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/java/text/ChoiceFormat.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/text/ChoiceFormat.java	Tue Apr 19 11:13:30 2016 -0700
@@ -437,7 +437,7 @@
         if (status.index == start) {
             status.errorIndex = furthest;
         }
-        return new Double(bestNumber);
+        return Double.valueOf(bestNumber);
     }
 
     /**
--- a/src/java.base/share/classes/java/text/DecimalFormat.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/text/DecimalFormat.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1996,7 +1996,7 @@
         // special case NaN
         if (text.regionMatches(pos.index, symbols.getNaN(), 0, symbols.getNaN().length())) {
             pos.index = pos.index + symbols.getNaN().length();
-            return new Double(Double.NaN);
+            return Double.valueOf(Double.NaN);
         }
 
         boolean[] status = new boolean[STATUS_LENGTH];
@@ -2007,19 +2007,19 @@
         // special case INFINITY
         if (status[STATUS_INFINITE]) {
             if (status[STATUS_POSITIVE] == (multiplier >= 0)) {
-                return new Double(Double.POSITIVE_INFINITY);
+                return Double.valueOf(Double.POSITIVE_INFINITY);
             } else {
-                return new Double(Double.NEGATIVE_INFINITY);
+                return Double.valueOf(Double.NEGATIVE_INFINITY);
             }
         }
 
         if (multiplier == 0) {
             if (digitList.isZero()) {
-                return new Double(Double.NaN);
+                return Double.valueOf(Double.NaN);
             } else if (status[STATUS_POSITIVE]) {
-                return new Double(Double.POSITIVE_INFINITY);
+                return Double.valueOf(Double.POSITIVE_INFINITY);
             } else {
-                return new Double(Double.NEGATIVE_INFINITY);
+                return Double.valueOf(Double.NEGATIVE_INFINITY);
             }
         }
 
@@ -2093,8 +2093,8 @@
                             !isParseIntegerOnly();
             }
 
-            return gotDouble ?
-                (Number)new Double(doubleResult) : (Number)Long.valueOf(longResult);
+            // cast inside of ?: because of binary numeric promotion, JLS 15.25
+            return gotDouble ? (Number)doubleResult : (Number)longResult;
         }
     }
 
--- a/src/java.base/share/classes/java/time/Duration.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/time/Duration.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1350,6 +1350,48 @@
         return nanos;
     }
 
+
+    //-----------------------------------------------------------------------
+    /**
+     * Returns a copy of this {@code Duration} truncated to the specified unit.
+     * <p>
+     * Truncating the duration returns a copy of the original with conceptual fields
+     * smaller than the specified unit set to zero.
+     * For example, truncating with the {@link ChronoUnit#MINUTES MINUTES} unit will
+     * round down to the nearest minute, setting the seconds and nanoseconds to zero.
+     * <p>
+     * The unit must have a {@linkplain TemporalUnit#getDuration() duration}
+     * that divides into the length of a standard day without remainder.
+     * This includes all supplied time units on {@link ChronoUnit} and
+     * {@link ChronoUnit#DAYS DAYS}. Other ChronoUnits throw an exception.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @param unit the unit to truncate to, not null
+     * @return a {@code Duration} based on this duration with the time truncated, not null
+     * @throws DateTimeException if the unit is invalid for truncation
+     * @throws UnsupportedTemporalTypeException if the unit is not supported
+     */
+    public Duration truncatedTo(TemporalUnit unit) {
+        Objects.requireNonNull(unit, "unit");
+        if (unit == ChronoUnit.SECONDS && (seconds >= 0 || nanos == 0)) {
+            return new Duration(seconds, 0);
+        } else if (unit == ChronoUnit.NANOS) {
+            return this;
+        }
+        Duration unitDur = unit.getDuration();
+        if (unitDur.getSeconds() > LocalTime.SECONDS_PER_DAY) {
+            throw new UnsupportedTemporalTypeException("Unit is too large to be used for truncation");
+        }
+        long dur = unitDur.toNanos();
+        if ((LocalTime.NANOS_PER_DAY % dur) != 0) {
+            throw new UnsupportedTemporalTypeException("Unit must divide into a standard day without remainder");
+        }
+        long nod = (seconds % LocalTime.SECONDS_PER_DAY) * LocalTime.NANOS_PER_SECOND + nanos;
+        long result = (nod / dur) * dur ;
+        return plusNanos(result - nod);
+    }
+
     //-----------------------------------------------------------------------
     /**
      * Compares this duration to the specified {@code Duration}.
--- a/src/java.base/share/classes/java/util/Objects.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/util/Objects.java	Tue Apr 19 11:13:30 2016 -0700
@@ -25,26 +25,28 @@
 
 package java.util;
 
+import jdk.internal.HotSpotIntrinsicCandidate;
+
 import java.util.function.BiFunction;
+import java.util.function.Function;
 import java.util.function.Supplier;
-import jdk.internal.HotSpotIntrinsicCandidate;
 
 /**
  * This class consists of {@code static} utility methods for operating
  * on objects, or checking certain conditions before operation.  These utilities
  * include {@code null}-safe or {@code null}-tolerant methods for computing the
  * hash code of an object, returning a string for an object, comparing two
- * objects, and checking if indexes or sub-range values are out of bounds.
+ * objects, and checking if indexes or sub-range values are out-of-bounds.
  *
  * @apiNote
  * Static methods such as {@link Objects#checkIndex},
  * {@link Objects#checkFromToIndex}, and {@link Objects#checkFromIndexSize} are
  * provided for the convenience of checking if values corresponding to indexes
- * and sub-ranges are out of bounds.
+ * and sub-ranges are out-of-bounds.
  * Variations of these static methods support customization of the runtime
  * exception, and corresponding exception detail message, that is thrown when
- * values are out of bounds.  Such methods accept a functional interface
- * argument, instances of {@code BiFunction}, that maps out of bound values to a
+ * values are out-of-bounds.  Such methods accept a functional interface
+ * argument, instances of {@code BiFunction}, that maps out-of-bound values to a
  * runtime exception.  Care should be taken when using such methods in
  * combination with an argument that is a lambda expression, method reference or
  * class that capture values.  In such cases the cost of capture, related to
@@ -347,29 +349,176 @@
     }
 
     /**
-     * Maps out of bounds values to a runtime exception.
+     * Maps out-of-bounds values to a runtime exception.
      *
-     * @param a the first out of bound value
-     * @param b the second out of bound value
-     * @param oobe the exception mapping function that when applied with out of
-     *        bounds arguments returns a runtime exception.  If {@code null}
-     *        then, it is as if an exception mapping function was supplied that
-     *        returns {@link IndexOutOfBoundsException} for any given arguments.
+     * @param checkKind the kind of bounds check, whose name may correspond
+     *        to the name of one of the range check methods, checkIndex,
+     *        checkFromToIndex, checkFromIndexSize
+     * @param args the out-of-bounds arguments that failed the range check.
+     *        If the checkKind corresponds a the name of a range check method
+     *        then the bounds arguments are those that can be passed in order
+     *        to the method.
+     * @param oobef the exception formatter that when applied with a checkKind
+     *        and a list out-of-bounds arguments returns a runtime exception.
+     *        If {@code null} then, it is as if an exception formatter was
+     *        supplied that returns {@link IndexOutOfBoundsException} for any
+     *        given arguments.
      * @return the runtime exception
      */
     private static RuntimeException outOfBounds(
-            int a, int b, BiFunction<Integer, Integer, ? extends RuntimeException> oobe) {
-        RuntimeException e = oobe == null
-                             ? null : oobe.apply(a, b);
+            BiFunction<String, List<Integer>, ? extends RuntimeException> oobef,
+            String checkKind,
+            Integer... args) {
+        List<Integer> largs = List.of(args);
+        RuntimeException e = oobef == null
+                             ? null : oobef.apply(checkKind, largs);
         return e == null
-               ? new IndexOutOfBoundsException(a, b) : e;
+               ? new IndexOutOfBoundsException(outOfBoundsMessage(checkKind, largs)) : e;
+    }
+
+    // Specific out-of-bounds exception producing methods that avoid
+    // the varargs-based code in the critical methods there by reducing their
+    // the byte code size, and therefore less likely to peturb inlining
+
+    private static RuntimeException outOfBoundsCheckIndex(
+            BiFunction<String, List<Integer>, ? extends RuntimeException> oobe,
+            int index, int length) {
+        return outOfBounds(oobe, "checkIndex", index, length);
+    }
+
+    private static RuntimeException outOfBoundsCheckFromToIndex(
+            BiFunction<String, List<Integer>, ? extends RuntimeException> oobe,
+            int fromIndex, int toIndex, int length) {
+        return outOfBounds(oobe, "checkFromToIndex", fromIndex, toIndex, length);
+    }
+
+    private static RuntimeException outOfBoundsCheckFromIndexSize(
+            BiFunction<String, List<Integer>, ? extends RuntimeException> oobe,
+            int fromIndex, int size, int length) {
+        return outOfBounds(oobe, "checkFromIndexSize", fromIndex, size, length);
+    }
+
+    /**
+     * Returns an out-of-bounds exception formatter from an given exception
+     * factory.  The exception formatter is a function that formats an
+     * out-of-bounds message from its arguments and applies that message to the
+     * given exception factory to produce and relay an exception.
+     *
+     * <p>The exception formatter accepts two arguments: a {@code String}
+     * describing the out-of-bounds range check that failed, referred to as the
+     * <em>check kind</em>; and a {@code List<Integer>} containing the
+     * out-of-bound integer values that failed the check.  The list of
+     * out-of-bound values is not modified.
+     *
+     * <p>Three check kinds are supported {@code checkIndex},
+     * {@code checkFromToIndex} and {@code checkFromIndexSize} corresponding
+     * respectively to the specified application of an exception formatter as an
+     * argument to the out-of-bounds range check methods
+     * {@link #checkIndex(int, int, BiFunction) checkIndex},
+     * {@link #checkFromToIndex(int, int, int, BiFunction) checkFromToIndex}, and
+     * {@link #checkFromIndexSize(int, int, int, BiFunction) checkFromIndexSize}.
+     * Thus a supported check kind corresponds to a method name and the
+     * out-of-bound integer values correspond to method argument values, in
+     * order, preceding the exception formatter argument (similar in many
+     * respects to the form of arguments required for a reflective invocation of
+     * such a range check method).
+     *
+     * <p>Formatter arguments conforming to such supported check kinds will
+     * produce specific exception messages describing failed out-of-bounds
+     * checks.  Otherwise, more generic exception messages will be produced in
+     * any of the following cases: the check kind is supported but fewer
+     * or more out-of-bounds values are supplied, the check kind is not
+     * supported, the check kind is {@code null}, or the list of out-of-bound
+     * values is {@code null}.
+     *
+     * @apiNote
+     * This method produces an out-of-bounds exception formatter that can be
+     * passed as an argument to any of the supported out-of-bounds range check
+     * methods declared by {@code Objects}.  For example, a formatter producing
+     * an {@code ArrayIndexOutOfBoundsException} may be produced and stored on a
+     * {@code static final} field as follows:
+     * <pre>{@code
+     * static final
+     * BiFunction<String, List<Integer>, ArrayIndexOutOfBoundsException> AIOOBEF =
+     *     outOfBoundsExceptionFormatter(ArrayIndexOutOfBoundsException::new);
+     * }</pre>
+     * The formatter instance {@code AIOOBEF} may be passed as an argument to an
+     * out-of-bounds range check method, such as checking if an {@code index}
+     * is within the bounds of a {@code limit}:
+     * <pre>{@code
+     * checkIndex(index, limit, AIOOBEF);
+     * }</pre>
+     * If the bounds check fails then the range check method will throw an
+     * {@code ArrayIndexOutOfBoundsException} with an appropriate exception
+     * message that is a produced from {@code AIOOBEF} as follows:
+     * <pre>{@code
+     * AIOOBEF.apply("checkIndex", List.of(index, limit));
+     * }</pre>
+     *
+     * @param f the exception factory, that produces an exception from a message
+     *        where the message is produced and formatted by the returned
+     *        exception formatter.  If this factory is stateless and side-effect
+     *        free then so is the returned formatter.
+     *        Exceptions thrown by the factory are relayed to the caller
+     *        of the returned formatter.
+     * @param <X> the type of runtime exception to be returned by the given
+     *        exception factory and relayed by the exception formatter
+     * @return the out-of-bounds exception formatter
+     */
+    public static <X extends RuntimeException>
+    BiFunction<String, List<Integer>, X> outOfBoundsExceptionFormatter(Function<String, X> f) {
+        // Use anonymous class to avoid bootstrap issues if this method is
+        // used early in startup
+        return new BiFunction<String, List<Integer>, X>() {
+            @Override
+            public X apply(String checkKind, List<Integer> args) {
+                return f.apply(outOfBoundsMessage(checkKind, args));
+            }
+        };
+    }
+
+    private static String outOfBoundsMessage(String checkKind, List<Integer> args) {
+        if (checkKind == null && args == null) {
+            return String.format("Range check failed");
+        } else if (checkKind == null) {
+            return String.format("Range check failed: %s", args);
+        } else if (args == null) {
+            return String.format("Range check failed: %s", checkKind);
+        }
+
+        int argSize = 0;
+        switch (checkKind) {
+            case "checkIndex":
+                argSize = 2;
+                break;
+            case "checkFromToIndex":
+            case "checkFromIndexSize":
+                argSize = 3;
+                break;
+            default:
+        }
+
+        // Switch to default if fewer or more arguments than required are supplied
+        switch ((args.size() != argSize) ? "" : checkKind) {
+            case "checkIndex":
+                return String.format("Index %d out-of-bounds for length %d",
+                                     args.get(0), args.get(1));
+            case "checkFromToIndex":
+                return String.format("Range [%d, %d) out-of-bounds for length %d",
+                                     args.get(0), args.get(1), args.get(2));
+            case "checkFromIndexSize":
+                return String.format("Range [%d, %<d + %d) out-of-bounds for length %d",
+                                     args.get(0), args.get(1), args.get(2));
+            default:
+                return String.format("Range check failed: %s %s", checkKind, args);
+        }
     }
 
     /**
      * Checks if the {@code index} is within the bounds of the range from
      * {@code 0} (inclusive) to {@code length} (exclusive).
      *
-     * <p>The {@code index} is defined to be out of bounds if any of the
+     * <p>The {@code index} is defined to be out-of-bounds if any of the
      * following inequalities is true:
      * <ul>
      *  <li>{@code index < 0}</li>
@@ -377,14 +526,20 @@
      *  <li>{@code length < 0}, which is implied from the former inequalities</li>
      * </ul>
      *
+     * <p>This method behaves as if {@link #checkIndex(int, int, BiFunction)}
+     * was called with same out-of-bounds arguments and an exception formatter
+     * argument produced from an invocation of
+     * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} (though it may
+     * be more efficient).
+     *
      * @param index the index
      * @param length the upper-bound (exclusive) of the range
      * @return {@code index} if it is within bounds of the range
-     * @throws IndexOutOfBoundsException if the {@code index} is out of bounds
+     * @throws IndexOutOfBoundsException if the {@code index} is out-of-bounds
      * @since 9
      */
     public static
-    int checkIndex(int index, int length) throws IndexOutOfBoundsException {
+    int checkIndex(int index, int length) {
         return checkIndex(index, length, null);
     }
 
@@ -392,7 +547,7 @@
      * Checks if the {@code index} is within the bounds of the range from
      * {@code 0} (inclusive) to {@code length} (exclusive).
      *
-     * <p>The {@code index} is defined to be out of bounds if any of the
+     * <p>The {@code index} is defined to be out-of-bounds if any of the
      * following inequalities is true:
      * <ul>
      *  <li>{@code index < 0}</li>
@@ -400,40 +555,42 @@
      *  <li>{@code length < 0}, which is implied from the former inequalities</li>
      * </ul>
      *
-     * <p>If the {@code index} is out of bounds, then a runtime exception is
-     * thrown that is the result of applying the arguments {@code index} and
-     * {@code length} to the given exception mapping function.
+     * <p>If the {@code index} is out-of-bounds, then a runtime exception is
+     * thrown that is the result of applying the following arguments to the
+     * exception formatter: the name of this method, {@code checkIndex};
+     * and an unmodifiable list integers whose values are, in order, the
+     * out-of-bounds arguments {@code index} and {@code length}.
      *
-     * @param <T> the type of runtime exception to throw if the arguments are
-     *        out of bounds
+     * @param <X> the type of runtime exception to throw if the arguments are
+     *        out-of-bounds
      * @param index the index
      * @param length the upper-bound (exclusive) of the range
-     * @param oobe the exception mapping function that when applied with out
-     *        of bounds arguments returns a runtime exception.  If {@code null}
-     *        or returns {@code null} then, it is as if an exception mapping
-     *        function was supplied that returns
-     *        {@link IndexOutOfBoundsException} for any given arguments.
-     *        Exceptions thrown by the function are relayed to the caller.
+     * @param oobef the exception formatter that when applied with this
+     *        method name and out-of-bounds arguments returns a runtime
+     *        exception.  If {@code null} or returns {@code null} then, it is as
+     *        if an exception formatter produced from an invocation of
+     *        {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used
+     *        instead (though it may be more efficient).
+     *        Exceptions thrown by the formatter are relayed to the caller.
      * @return {@code index} if it is within bounds of the range
-     * @throws T if the {@code index} is out of bounds, then a runtime exception
-     *         is thrown that is the result of applying the out of bounds
-     *         arguments to the exception mapping function.
-     * @throws IndexOutOfBoundsException if the {@code index} is out of bounds
-     *         and the exception mapping function is {@code null}
+     * @throws X if the {@code index} is out-of-bounds and the exception
+     *         formatter is non-{@code null}
+     * @throws IndexOutOfBoundsException if the {@code index} is out-of-bounds
+     *         and the exception formatter is {@code null}
      * @since 9
      *
      * @implNote
-     * This method is made intrinsic in optimizing compilers to guide
-     * them to perform unsigned comparisons of the index and length
-     * when it is known the length is a non-negative value (such as
-     * that of an array length or from the upper bound of a loop)
+     * This method is made intrinsic in optimizing compilers to guide them to
+     * perform unsigned comparisons of the index and length when it is known the
+     * length is a non-negative value (such as that of an array length or from
+     * the upper bound of a loop)
     */
     @HotSpotIntrinsicCandidate
-    public static <T extends RuntimeException>
+    public static <X extends RuntimeException>
     int checkIndex(int index, int length,
-                   BiFunction<Integer, Integer, T> oobe) throws T, IndexOutOfBoundsException {
+                   BiFunction<String, List<Integer>, X> oobef) {
         if (index < 0 || index >= length)
-            throw outOfBounds(index, length, oobe);
+            throw outOfBoundsCheckIndex(oobef, index, length);
         return index;
     }
 
@@ -442,7 +599,7 @@
      * {@code toIndex} (exclusive) is within the bounds of range from {@code 0}
      * (inclusive) to {@code length} (exclusive).
      *
-     * <p>The sub-range is defined to be out of bounds if any of the following
+     * <p>The sub-range is defined to be out-of-bounds if any of the following
      * inequalities is true:
      * <ul>
      *  <li>{@code fromIndex < 0}</li>
@@ -451,15 +608,21 @@
      *  <li>{@code length < 0}, which is implied from the former inequalities</li>
      * </ul>
      *
+     * <p>This method behaves as if {@link #checkFromToIndex(int, int, int, BiFunction)}
+     * was called with same out-of-bounds arguments and an exception formatter
+     * argument produced from an invocation of
+     * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} (though it may
+     * be more efficient).
+     *
      * @param fromIndex the lower-bound (inclusive) of the sub-range
      * @param toIndex the upper-bound (exclusive) of the sub-range
      * @param length the upper-bound (exclusive) the range
      * @return {@code fromIndex} if the sub-range within bounds of the range
-     * @throws IndexOutOfBoundsException if the sub-range is out of bounds
+     * @throws IndexOutOfBoundsException if the sub-range is out-of-bounds
      * @since 9
      */
     public static
-    int checkFromToIndex(int fromIndex, int toIndex, int length) throws IndexOutOfBoundsException {
+    int checkFromToIndex(int fromIndex, int toIndex, int length) {
         return checkFromToIndex(fromIndex, toIndex, length, null);
     }
 
@@ -468,7 +631,7 @@
      * {@code toIndex} (exclusive) is within the bounds of range from {@code 0}
      * (inclusive) to {@code length} (exclusive).
      *
-     * <p>The sub-range is defined to be out of bounds if any of the following
+     * <p>The sub-range is defined to be out-of-bounds if any of the following
      * inequalities is true:
      * <ul>
      *  <li>{@code fromIndex < 0}</li>
@@ -477,34 +640,36 @@
      *  <li>{@code length < 0}, which is implied from the former inequalities</li>
      * </ul>
      *
-     * <p>If the sub-range is out of bounds, then a runtime exception is thrown
-     * that is the result of applying the arguments {@code fromIndex} and
-     * {@code toIndex} to the given exception mapping function.
+     * <p>If the sub-range  is out-of-bounds, then a runtime exception is
+     * thrown that is the result of applying the following arguments to the
+     * exception formatter: the name of this method, {@code checkFromToIndex};
+     * and an unmodifiable list integers whose values are, in order, the
+     * out-of-bounds arguments {@code fromIndex}, {@code toIndex}, and {@code length}.
      *
-     * @param <T> the type of runtime exception to throw if the arguments are
-     *        out of bounds
+     * @param <X> the type of runtime exception to throw if the arguments are
+     *        out-of-bounds
      * @param fromIndex the lower-bound (inclusive) of the sub-range
      * @param toIndex the upper-bound (exclusive) of the sub-range
      * @param length the upper-bound (exclusive) the range
-     * @param oobe the exception mapping function that when applied with out
-     *        of bounds arguments returns a runtime exception.  If {@code null}
-     *        or returns {@code null} then, it is as if an exception mapping
-     *        function was supplied that returns
-     *        {@link IndexOutOfBoundsException} for any given arguments.
-     *        Exceptions thrown by the function are relayed to the caller.
+     * @param oobef the exception formatter that when applied with this
+     *        method name and out-of-bounds arguments returns a runtime
+     *        exception.  If {@code null} or returns {@code null} then, it is as
+     *        if an exception formatter produced from an invocation of
+     *        {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used
+     *        instead (though it may be more efficient).
+     *        Exceptions thrown by the formatter are relayed to the caller.
      * @return {@code fromIndex} if the sub-range within bounds of the range
-     * @throws T if the sub-range is out of bounds, then a runtime exception is
-     *         thrown that is the result of applying the out of bounds arguments
-     *         to the exception mapping function.
-     * @throws IndexOutOfBoundsException if the sub-range is out of bounds and
-     *         the exception mapping function is {@code null}
+     * @throws X if the sub-range is out-of-bounds and the exception factory
+     *         function is non-{@code null}
+     * @throws IndexOutOfBoundsException if the sub-range is out-of-bounds and
+     *         the exception factory function is {@code null}
      * @since 9
      */
-    public static <T extends RuntimeException>
+    public static <X extends RuntimeException>
     int checkFromToIndex(int fromIndex, int toIndex, int length,
-                         BiFunction<Integer, Integer, T> oobe) throws T, IndexOutOfBoundsException {
+                         BiFunction<String, List<Integer>, X> oobef) {
         if (fromIndex < 0 || fromIndex > toIndex || toIndex > length)
-            throw outOfBounds(fromIndex, toIndex, oobe);
+            throw outOfBoundsCheckFromToIndex(oobef, fromIndex, toIndex, length);
         return fromIndex;
     }
 
@@ -513,7 +678,7 @@
      * {@code fromIndex + size} (exclusive) is within the bounds of range from
      * {@code 0} (inclusive) to {@code length} (exclusive).
      *
-     * <p>The sub-range is defined to be out of bounds if any of the following
+     * <p>The sub-range is defined to be out-of-bounds if any of the following
      * inequalities is true:
      * <ul>
      *  <li>{@code fromIndex < 0}</li>
@@ -522,15 +687,21 @@
      *  <li>{@code length < 0}, which is implied from the former inequalities</li>
      * </ul>
      *
+     * <p>This method behaves as if {@link #checkFromIndexSize(int, int, int, BiFunction)}
+     * was called with same out-of-bounds arguments and an exception formatter
+     * argument produced from an invocation of
+     * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} (though it may
+     * be more efficient).
+     *
      * @param fromIndex the lower-bound (inclusive) of the sub-interval
      * @param size the size of the sub-range
      * @param length the upper-bound (exclusive) of the range
      * @return {@code fromIndex} if the sub-range within bounds of the range
-     * @throws IndexOutOfBoundsException if the sub-range is out of bounds
+     * @throws IndexOutOfBoundsException if the sub-range is out-of-bounds
      * @since 9
      */
     public static
-    int checkFromIndexSize(int fromIndex, int size, int length) throws IndexOutOfBoundsException {
+    int checkFromIndexSize(int fromIndex, int size, int length) {
         return checkFromIndexSize(fromIndex, size, length, null);
     }
 
@@ -539,7 +710,7 @@
      * {@code fromIndex + size} (exclusive) is within the bounds of range from
      * {@code 0} (inclusive) to {@code length} (exclusive).
      *
-     * <p>The sub-range is defined to be out of bounds if any of the following
+     * <p>The sub-range is defined to be out-of-bounds if any of the following
      * inequalities is true:
      * <ul>
      *  <li>{@code fromIndex < 0}</li>
@@ -548,34 +719,37 @@
      *  <li>{@code length < 0}, which is implied from the former inequalities</li>
      * </ul>
      *
-     * <p>If the sub-range is out of bounds then, a runtime exception is thrown
-     * that is the result of applying the arguments {@code fromIndex} and
-     * {@code size} to the given exception mapping function.
+     * <p>If the sub-range  is out-of-bounds, then a runtime exception is
+     * thrown that is the result of applying the following arguments to the
+     * exception formatter: the name of this method, {@code checkFromIndexSize};
+     * and an unmodifiable list integers whose values are, in order, the
+     * out-of-bounds arguments {@code fromIndex}, {@code size}, and
+     * {@code length}.
      *
-     * @param <T> the type of runtime exception to throw if the arguments are
-     *        out of bounds
+     * @param <X> the type of runtime exception to throw if the arguments are
+     *        out-of-bounds
      * @param fromIndex the lower-bound (inclusive) of the sub-interval
      * @param size the size of the sub-range
      * @param length the upper-bound (exclusive) of the range
-     * @param oobe the exception mapping function that when applied with out
-     *        of bounds arguments returns a runtime exception.  If {@code null}
-     *        or returns {@code null} then, it is as if an exception mapping
-     *        function was supplied that returns
-     *        {@link IndexOutOfBoundsException} for any given arguments.
-     *        Exceptions thrown by the function are relayed to the caller.
+     * @param oobef the exception formatter that when applied with this
+     *        method name and out-of-bounds arguments returns a runtime
+     *        exception.  If {@code null} or returns {@code null} then, it is as
+     *        if an exception formatter produced from an invocation of
+     *        {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used
+     *        instead (though it may be more efficient).
+     *        Exceptions thrown by the formatter are relayed to the caller.
      * @return {@code fromIndex} if the sub-range within bounds of the range
-     * @throws T if the sub-range is out of bounds, then a runtime exception is
-     *         thrown that is the result of applying the out of bounds arguments
-     *         to the exception mapping function.
-     * @throws IndexOutOfBoundsException if the sub-range is out of bounds and
-     *         the exception mapping function is {@code null}
+     * @throws X if the sub-range is out-of-bounds and the exception factory
+     *         function is non-{@code null}
+     * @throws IndexOutOfBoundsException if the sub-range is out-of-bounds and
+     *         the exception factory function is {@code null}
      * @since 9
      */
-    public static <T extends RuntimeException>
+    public static <X extends RuntimeException>
     int checkFromIndexSize(int fromIndex, int size, int length,
-                           BiFunction<Integer, Integer, T> oobe) throws T, IndexOutOfBoundsException {
+                           BiFunction<String, List<Integer>, X> oobef) {
         if ((length | fromIndex | size) < 0 || size > length - fromIndex)
-            throw outOfBounds(fromIndex, size, oobe);
+            throw outOfBoundsCheckFromIndexSize(oobef, fromIndex, size, length);
         return fromIndex;
     }
 }
--- a/src/java.base/share/classes/java/util/ResourceBundle.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/util/ResourceBundle.java	Tue Apr 19 11:13:30 2016 -0700
@@ -64,8 +64,8 @@
 
 import jdk.internal.misc.JavaUtilResourceBundleAccess;
 import jdk.internal.misc.SharedSecrets;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
 import sun.util.locale.BaseLocale;
 import sun.util.locale.LocaleObjectCache;
 import sun.util.locale.provider.ResourceBundleProviderSupport;
--- a/src/java.base/share/classes/java/util/ServiceLoader.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/util/ServiceLoader.java	Tue Apr 19 11:13:30 2016 -0700
@@ -51,8 +51,8 @@
 import jdk.internal.module.ServicesCatalog;
 import jdk.internal.module.ServicesCatalog.ServiceProvider;
 
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
 
 
 /**
--- a/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java	Tue Apr 19 11:13:30 2016 -0700
@@ -455,7 +455,7 @@
             s = v1 * v1 + v2 * v2;
         } while (s >= 1 || s == 0);
         double multiplier = StrictMath.sqrt(-2 * StrictMath.log(s)/s);
-        nextLocalGaussian.set(new Double(v2 * multiplier));
+        nextLocalGaussian.set(Double.valueOf(v2 * multiplier));
         return v1 * multiplier;
     }
 
--- a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java	Tue Apr 19 11:13:30 2016 -0700
@@ -42,8 +42,8 @@
 import java.security.PrivilegedExceptionAction;
 import java.util.function.IntBinaryOperator;
 import java.util.function.IntUnaryOperator;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
 
 /**
  * A reflection-based utility that enables atomic updates to
--- a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java	Tue Apr 19 11:13:30 2016 -0700
@@ -42,8 +42,8 @@
 import java.security.PrivilegedExceptionAction;
 import java.util.function.LongBinaryOperator;
 import java.util.function.LongUnaryOperator;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
 
 /**
  * A reflection-based utility that enables atomic updates to
--- a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java	Tue Apr 19 11:13:30 2016 -0700
@@ -42,8 +42,8 @@
 import java.security.PrivilegedExceptionAction;
 import java.util.function.BinaryOperator;
 import java.util.function.UnaryOperator;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
 
 /**
  * A reflection-based utility that enables atomic updates to
--- a/src/java.base/share/classes/java/util/jar/JarFile.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/java/util/jar/JarFile.java	Tue Apr 19 11:13:30 2016 -0700
@@ -894,7 +894,8 @@
     private static final byte[] CLASSPATH_LASTOCC;
 
     private static final byte[] MULTIRELEASE_CHARS =
-            {'M','U','L','T','I','-','R','E','L','E', 'A', 'S', 'E', ':', ' '};
+            {'M','U','L','T','I','-','R','E','L','E', 'A', 'S', 'E', ':',
+                    ' ', 'T', 'R', 'U', 'E'};
 
     // The bad character shift for "multi-release: "
     private static final byte[] MULTIRELEASE_LASTOCC;
@@ -914,17 +915,17 @@
 
         MULTIRELEASE_LASTOCC = new byte[64];
         MULTIRELEASE_LASTOCC[(int)'M' - 32] = 1;
-        MULTIRELEASE_LASTOCC[(int)'U' - 32] = 2;
-        MULTIRELEASE_LASTOCC[(int)'T' - 32] = 4;
         MULTIRELEASE_LASTOCC[(int)'I' - 32] = 5;
         MULTIRELEASE_LASTOCC[(int)'-' - 32] = 6;
-        MULTIRELEASE_LASTOCC[(int)'R' - 32] = 7;
         MULTIRELEASE_LASTOCC[(int)'L' - 32] = 9;
         MULTIRELEASE_LASTOCC[(int)'A' - 32] = 11;
         MULTIRELEASE_LASTOCC[(int)'S' - 32] = 12;
-        MULTIRELEASE_LASTOCC[(int)'E' - 32] = 13;
         MULTIRELEASE_LASTOCC[(int)':' - 32] = 14;
         MULTIRELEASE_LASTOCC[(int)' ' - 32] = 15;
+        MULTIRELEASE_LASTOCC[(int)'T' - 32] = 16;
+        MULTIRELEASE_LASTOCC[(int)'R' - 32] = 17;
+        MULTIRELEASE_LASTOCC[(int)'U' - 32] = 18;
+        MULTIRELEASE_LASTOCC[(int)'E' - 32] = 19;
     }
 
     private JarEntry getManEntry() {
@@ -966,7 +967,7 @@
      * Since there are no repeated substring in our search strings,
      * the good suffix shifts can be replaced with a comparison.
      */
-    private boolean match(byte[] src, byte[] b, byte[] lastOcc) {
+    private int match(byte[] src, byte[] b, byte[] lastOcc) {
         int len = src.length;
         int last = b.length - len;
         int i = 0;
@@ -990,9 +991,9 @@
                     continue next;
                 }
             }
-            return true;
+            return i;
         }
-        return false;
+        return -1;
     }
 
     /**
@@ -1011,11 +1012,35 @@
             if (manEntry != null) {
                 byte[] b = getBytes(manEntry);
                 hasClassPathAttribute = match(CLASSPATH_CHARS, b,
-                        CLASSPATH_LASTOCC);
+                        CLASSPATH_LASTOCC) != -1;
                 // is this a multi-release jar file
                 if (MULTI_RELEASE_ENABLED && version != BASE_VERSION) {
-                    isMultiRelease = match(MULTIRELEASE_CHARS, b,
-                            MULTIRELEASE_LASTOCC);
+                    int i = match(MULTIRELEASE_CHARS, b, MULTIRELEASE_LASTOCC);
+                    if (i != -1) {
+                        i += MULTIRELEASE_CHARS.length;
+                        if (i < b.length) {
+                            byte c = b[i++];
+                            // Check that the value is followed by a newline
+                            // and does not have a continuation
+                            if (c == '\n' &&
+                                    (i == b.length || b[i] != ' ')) {
+                                isMultiRelease = true;
+                            } else if (c == '\r') {
+                                if (i == b.length) {
+                                    isMultiRelease = true;
+                                } else {
+                                    c = b[i++];
+                                    if (c == '\n') {
+                                        if (i == b.length || b[i] != ' ') {
+                                            isMultiRelease = true;
+                                        }
+                                    } else if (c != ' ') {
+                                        isMultiRelease = true;
+                                    }
+                                }
+                            }
+                        }
+                    }
                 }
             }
             hasCheckedSpecialAttributes = true;
--- a/src/java.base/share/classes/javax/crypto/Cipher.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/javax/crypto/Cipher.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -480,7 +480,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -114,7 +114,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/javax/crypto/KeyAgreement.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/javax/crypto/KeyAgreement.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -152,7 +152,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/javax/crypto/KeyGenerator.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/javax/crypto/KeyGenerator.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -204,7 +204,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/javax/crypto/Mac.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/javax/crypto/Mac.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -154,7 +154,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -139,7 +139,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,7 +118,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/javax/net/ssl/SSLContext.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/javax/net/ssl/SSLContext.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -138,7 +138,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -132,7 +132,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/javax/security/auth/login/Configuration.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/javax/security/auth/login/Configuration.java	Tue Apr 19 11:13:30 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -313,7 +313,8 @@
      *
      * @implNote
      * The JDK Reference Implementation additionally uses the
-     * {@code jdk.security.provider.preferred} property to determine
+     * {@code jdk.security.provider.preferred}
+     * {@link Security#getProperty(String) Security} property to determine
      * the preferred provider order for the specified algorithm. This
      * may be different than the order of providers returned by
      * {@link Security#getProviders() Security.getProviders()}.
--- a/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java	Tue Apr 19 11:13:30 2016 -0700
@@ -288,22 +288,24 @@
 
             return buffer;
         } else {
+            if (channel == null) {
+                throw new InternalError("Image file channel not open");
+            }
+
             ByteBuffer buffer = ImageBufferCache.getBuffer(size);
-            int read = 0;
-
+            int read;
             try {
-                if (channel == null) {
-                    throw new InternalError("Image file channel not open");
-                }
-
                 read = channel.read(buffer, offset);
                 buffer.rewind();
             } catch (IOException ex) {
+                ImageBufferCache.releaseBuffer(buffer);
                 throw new RuntimeException(ex);
             }
 
             if (read != size) {
                 ImageBufferCache.releaseBuffer(buffer);
+                throw new RuntimeException("Short read: " + read +
+                                           " instead of " + size + " bytes");
             }
 
             return buffer;
--- a/src/java.base/share/classes/jdk/internal/jimage/ImageBufferCache.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/jdk/internal/jimage/ImageBufferCache.java	Tue Apr 19 11:13:30 2016 -0700
@@ -24,110 +24,112 @@
  */
 package jdk.internal.jimage;
 
+import java.lang.ref.WeakReference;
 import java.nio.ByteBuffer;
-import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
 
 /**
  * @implNote This class needs to maintain JDK 8 source compatibility.
  *
  * It is used internally in the JDK to implement jimage/jrtfs access,
- * but also compiled and delivered as part of the jrtfs.jar to support access
+ * but also compiled and delivered as part of the jrt-fs.jar to support access
  * to the jimage file provided by the shipped JDK by tools running on JDK 8.
  */
 class ImageBufferCache {
-    private static final int MAX_FREE_BUFFERS = 3;
+    private static final int MAX_CACHED_BUFFERS = 3;
     private static final int LARGE_BUFFER = 0x10000;
-    private static final ThreadLocal<ArrayList<ImageBufferCache>>
-            threadLocal = new ThreadLocal<>();
+    private static final ThreadLocal<BufferReference[]> CACHE =
+        new ThreadLocal<BufferReference[]>() {
+            @Override
+            protected BufferReference[] initialValue() {
+                // 1 extra slot to simplify logic of releaseBuffer()
+                return new BufferReference[MAX_CACHED_BUFFERS + 1];
+            }
+        };
 
-    private final ByteBuffer buffer;
-    private boolean isUsed;
+    private static ByteBuffer allocateBuffer(long size) {
+        return ByteBuffer.allocateDirect((int)((size + 0xFFF) & ~0xFFF));
+    }
 
     static ByteBuffer getBuffer(long size) {
         if (size < 0 || Integer.MAX_VALUE < size) {
             throw new IndexOutOfBoundsException("size");
         }
 
-        ByteBuffer buffer = null;
+        ByteBuffer result = null;
 
         if (size > LARGE_BUFFER) {
-            buffer = ByteBuffer.allocateDirect((int)((size + 0xFFF) & ~0xFFF));
+            result = allocateBuffer(size);
         } else {
-            ArrayList<ImageBufferCache> buffers = threadLocal.get();
+            BufferReference[] cache = CACHE.get();
 
-            if (buffers == null) {
-                buffers = new ArrayList<>(MAX_FREE_BUFFERS);
-                threadLocal.set(buffers);
+            // buffers are ordered by decreasing capacity
+            // cache[MAX_CACHED_BUFFERS] is always null
+            for (int i = MAX_CACHED_BUFFERS - 1; i >= 0; i--) {
+                BufferReference reference = cache[i];
+
+                if (reference != null) {
+                    ByteBuffer buffer = reference.get();
+
+                    if (buffer != null && size <= buffer.capacity()) {
+                        cache[i] = null;
+                        result = buffer;
+                        result.rewind();
+                        break;
+                    }
+                }
             }
 
-            int i = 0, j = buffers.size();
-            for (ImageBufferCache imageBuffer : buffers) {
-                if (size <= imageBuffer.capacity()) {
-                    j = i;
-
-                    if (!imageBuffer.isUsed) {
-                        imageBuffer.isUsed = true;
-                        buffer = imageBuffer.buffer;
-
-                        break;
-                    }
-                } else {
-                    break;
-                }
-
-                i++;
-            }
-
-            if (buffer == null) {
-                ImageBufferCache imageBuffer = new ImageBufferCache((int)size);
-                buffers.add(j, imageBuffer);
-                buffer = imageBuffer.buffer;
+            if (result == null) {
+                result = allocateBuffer(size);
             }
         }
 
-        buffer.rewind();
-        buffer.limit((int)size);
+        result.limit((int)size);
 
-        return buffer;
+        return result;
     }
 
     static void releaseBuffer(ByteBuffer buffer) {
-        ArrayList<ImageBufferCache> buffers = threadLocal.get();
-
-        if (buffers == null) {
-            return;
-        }
-
         if (buffer.capacity() > LARGE_BUFFER) {
             return;
         }
 
-        int i = 0, j = buffers.size();
-        for (ImageBufferCache imageBuffer : buffers) {
-            if (!imageBuffer.isUsed) {
-                j = Math.min(j, i);
-            }
+        BufferReference[] cache = CACHE.get();
 
-            if (imageBuffer.buffer == buffer) {
-                imageBuffer.isUsed = false;
-                j = Math.min(j, i);
-
-                break;
+        // expunge cleared BufferRef(s)
+        for (int i = 0; i < MAX_CACHED_BUFFERS; i++) {
+            BufferReference reference = cache[i];
+            if (reference != null && reference.get() == null) {
+                cache[i] = null;
             }
         }
 
-        if (buffers.size() > MAX_FREE_BUFFERS && j != buffers.size()) {
-            buffers.remove(j);
+        // insert buffer back with new BufferRef wrapping it
+        cache[MAX_CACHED_BUFFERS] = new BufferReference(buffer);
+        Arrays.sort(cache, DECREASING_CAPACITY_NULLS_LAST);
+        // squeeze the smallest one out
+        cache[MAX_CACHED_BUFFERS] = null;
+    }
+
+    private static Comparator<BufferReference> DECREASING_CAPACITY_NULLS_LAST =
+        new Comparator<BufferReference>() {
+            @Override
+            public int compare(BufferReference br1, BufferReference br2) {
+                return Integer.compare(br2 == null ? 0 : br2.capacity,
+                                       br1 == null ? 0 : br1.capacity);
+            }
+        };
+
+    private static class BufferReference extends WeakReference<ByteBuffer> {
+        // saved capacity so that DECREASING_CAPACITY_NULLS_LAST comparator
+        // is stable in the presence of GC clearing the WeakReference concurrently
+        final int capacity;
+
+        BufferReference(ByteBuffer buffer) {
+            super(buffer);
+            capacity = buffer.capacity();
         }
     }
-
-    private ImageBufferCache(int needed) {
-        this.buffer = ByteBuffer.allocateDirect((needed + 0xFFF) & ~0xFFF);
-        this.isUsed = true;
-        this.buffer.limit(needed);
-    }
-
-    private long capacity() {
-        return buffer.capacity();
-    }
 }
--- a/src/java.base/share/classes/jdk/internal/jimage/ImageReader.java	Tue Apr 19 13:00:00 2016 +0530
+++ b/src/java.base/share/classes/jdk/internal/jimage/ImageReader.java	Tue Apr 19 11:13:30 2016 -0700
@@ -136,7 +136,7 @@
         private final BasicFileAttributes fileAttrs;
         private boolean completed;
 
-        Node(String name, BasicFileAttributes fileAttrs) {
+        protected Node(String name, BasicFileAttributes fileAttrs) {
             this.name = Objects.requireNonNull(name);
             this.fileAttrs = Objects.requireNonNull(fileAttrs);
         }
--- a/src/java.base/share/classes/jdk/internal/jrtfs/AbstractJrtFileAttributes.java	Tue Apr 19 13:00:00 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package jdk.internal.jrtfs;
-
-import java.nio.file.attribute.BasicFileAttributes;
-import java.util.Formatter;
-
-/**
- * Base class for file attributes supported by jrt file systems.
- *
- * @implNote This class needs to maintain JDK 8 source compatibility.
- *
- * It is used internally in the JDK to implement jimage/jrtfs access,
- * but also compiled and delivered as part of the jrtfs.jar to support access
- * to the jimage file provided by the shipped JDK by tools running on JDK 8.
- */
-public abstract class AbstractJrtFileAttributes implements BasicFileAttributes {
-
-    // jrt fs specific attributes
-    /**
-     * Compressed resource file. If not available or not applicable, 0L is
-     * returned.
-     *
-     * @return the compressed resource size for compressed resources.
-     */
-    public abstract long compressedSize();
-
-    /**
-     * "file" extension of a file resource.
-     *
-     * @return extension string for the file resource
-     */
-    public abstract String extension();
-
-    @Override
-    public final String toString() {
-        StringBuilder sb = new StringBuilder(1024);
-        try (Formatter fm = new Formatter(sb)) {
-            if (creationTime() != null) {
-                fm.format("    creationTime    : %tc%n", creationTime().toMillis());
-            } else {
-                fm.format("    creationTime    : null%n");
-            }
-
-            if (lastAccessTime() != null) {
-                fm.format("    lastAccessTime  : %tc%n", lastAccessTime().toMillis());
-            } else {
-                fm.format("    lastAccessTime  : null%n");
-            }
-            fm.format("    lastModifiedTime: %tc%n", lastModifiedTime().toMillis());
-            fm.format("    isRegularFile   : %b%n", isRegularFile());
-            fm.format("    isDirectory     : %b%n", isDirectory());
-            fm.format("    isSymbolicLink  : %b%n", isSymbolicLink());
-            fm.format("    isOther         : %b%n", isOther());
-            fm.format("    fileKey         : %s%n", fileKey());
-            fm.format("    size            : %d%n", size());
-            fm.format("    compressedSize  : %d%n", compressedSize());
-            fm.format("    extension       : %s%n", extension());
-        }
-        return sb.toString();
-    }
-}
--- a/src/java.base/share/classes/jdk/internal/jrtfs/AbstractJrtFileSystem.java	Tue Apr 19 13:00:00 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,372 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package jdk.internal.jrtfs;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.ByteBuffer;
-import java.nio.channels.Channels;
-import java.nio.channels.FileChannel;
-import java.nio.channels.NonWritableChannelException;
-import java.nio.channels.ReadableByteChannel;
-import java.nio.channels.SeekableByteChannel;
-import java.nio.charset.Charset;
-import java.nio.file.ClosedFileSystemException;
-import java.nio.file.CopyOption;
-import java.nio.file.FileStore;
-import java.nio.file.FileSystem;
-import java.nio.file.FileSystemNotFoundException;
-import java.nio.file.Files;
-import java.nio.file.LinkOption;
-import java.nio.file.OpenOption;
-import java.nio.file.Path;
-import java.nio.file.PathMatcher;
-import java.nio.file.ReadOnlyFileSystemException;
-import java.nio.file.StandardOpenOption;
-import java.nio.file.WatchService;
-import java.nio.file.attribute.FileAttribute;
-import java.nio.file.attribute.FileTime;
-import java.nio.file.attribute.UserPrincipalLookupService;
-import java.nio.file.spi.FileSystemProvider;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Pattern;
-
-/**
- * Base class for jrt file systems. jrt filesystem implementations are currently
- * available on top of .jimage file and on top "exploded" build directories.
- *
- * @implNote This class needs to maintain JDK 8 source compatibility.
- *
- * It is used internally in the JDK to implement jimage/jrtfs access,
- * but also compiled and delivered as part of the jrtfs.jar to support access
- * to the jimage file provided by the shipped JDK by tools running on JDK 8.
- */
-abstract class AbstractJrtFileSystem extends FileSystem {
-
-    private final JrtFileSystemProvider provider;
-
-    AbstractJrtFileSystem(JrtFileSystemProvider provider, Map<String, ?> options) {
-        this.provider = provider;
-    }
-
-    private static final Charset UTF_8 = Charset.forName("UTF-8");
-
-    // static utility methods
-    static ReadOnlyFileSystemException readOnly() {
-        return new ReadOnlyFileSystemException();
-    }
-
-    // if a Path does not exist, throw exception
-    static void checkExists(Path path) {
-        if (Files.notExists(path)) {
-            throw new FileSystemNotFoundException(path.toString());
-        }
-    }
-
-    static byte[] getBytes(String name) {
-        return name.getBytes(UTF_8);
-    }
-
-    static String getString(byte[] name) {
-        return new String(name, UTF_8);
-    }
-
-    // do the supplied options imply that we have to chase symlinks?
-    static boolean followLinks(LinkOption... options) {
-        if (options != null) {
-            for (LinkOption lo : options) {
-                if (lo == LinkOption.NOFOLLOW_LINKS) {
-                    return false;
-                } else if (lo == null) {
-                    throw new NullPointerException();
-                } else {
-                    throw new AssertionError("should not reach here");
-                }
-            }
-        }
-        return true;
-    }
-
-    // check that the options passed are supported by (read-only) jrt file system
-    static void checkOptions(Set<? extends OpenOption> options) {
-        // check for options of null type and option is an intance of StandardOpenOption
-        for (OpenOption option : options) {
-            if (option == null) {
-                throw new NullPointerException();
-            }
-            if (!(option instanceof StandardOpenOption)) {
-                throw new IllegalArgumentException();
-            }
-        }
-
-        if (options.contains(StandardOpenOption.WRITE)
-                || options.contains(StandardOpenOption.APPEND)) {
-            throw readOnly();
-        }
-    }
-
-    // FileSystem method implementations
-    @Override
-    public FileSystemProvider provider() {
-        return provider;
-    }
-
-    @Override
-    public Iterable<Path> getRootDirectories() {
-        ArrayList<Path> pathArr = new ArrayList<>();
-        pathArr.add(getRootPath());
-        return pathArr;
-    }
-
-    @Override
-    public AbstractJrtPath getPath(String first, String... more) {
-        String path;
-        if (more.length == 0) {
-            path = first;
-        } else {
-            StringBuilder sb = new StringBuilder();
-            sb.append(first);
-            for (String segment : more) {
-                if (segment.length() > 0) {
-                    if (sb.length() > 0) {
-                        sb.append('/');
-                    }
-                    sb.append(segment);
-                }
-            }
-            path = sb.toString();
-        }
-        return getRootPath().newJrtPath(getBytes(path));
-    }
-
-    @Override
-    public final boolean isReadOnly() {
-        return true;
-    }
-
-    @Override
-    public final UserPrincipalLookupService getUserPrincipalLookupService() {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public final WatchService newWatchService() {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public final Iterable<FileStore> getFileStores() {
-        ArrayList<FileStore> list = new ArrayList<>(1);
-        list.add(getFileStore(getRootPath()));
-        return list;
-    }
-
-    private static final Set<String> supportedFileAttributeViews
-            = Collections.unmodifiableSet(
-                    new HashSet<String>(Arrays.asList("basic", "jrt")));
-
-    @Override
-    public final Set<String> supportedFileAttributeViews() {
-        return supportedFileAttributeViews;
-    }
-
-    @Override
-    public final String toString() {
-        return "jrt:/";
-    }
-
-    @Override
-    public final String getSeparator() {
-        return "/";
-    }
-
-    private static final String GLOB_SYNTAX = "glob";
-    private static final String REGEX_SYNTAX = "regex";
-
-    @Override
-    public PathMatcher getPathMatcher(String syntaxAndInput) {
-        int pos = syntaxAndInput.indexOf(':');
-        if (pos <= 0 || pos == syntaxAndInput.length()) {
-            throw new IllegalArgumentException();
-        }
-        String syntax = syntaxAndInput.substring(0, pos);
-        String input = syntaxAndInput.substring(pos + 1);
-        String expr;
-        if (syntax.equalsIgnoreCase(GLOB_SYNTAX)) {
-            expr = JrtUtils.toRegexPattern(input);
-        } else {
-            if (syntax.equalsIgnoreCase(REGEX_SYNTAX)) {
-                expr = input;
-            } else {
-                throw new UnsupportedOperationException("Syntax '" + syntax
-                        + "' not recognized");
-            }
-        }
-        // return matcher
-        final Pattern pattern = Pattern.compile(expr);
-        return (Path path) -> pattern.matcher(path.toString()).matches();
-    }
-
-    // These methods throw read only file system exception
-    final void setTimes(AbstractJrtPath jrtPath, FileTime mtime, FileTime atime, FileTime ctime)
-            throws IOException {
-        throw readOnly();
-    }
-
-    final void createDirectory(AbstractJrtPath jrtPath, FileAttribute<?>... attrs) throws IOException {
-        throw readOnly();
-    }
-
-    final void deleteFile(AbstractJrtPath jrtPath, boolean failIfNotExists)
-            throws IOException {
-        throw readOnly();
-    }
-
-    final OutputStream newOutputStream(AbstractJrtPath jrtPath, OpenOption... options)
-            throws IOException {
-        throw readOnly();
-    }
-
-    final void copyFile(boolean deletesrc, AbstractJrtPath srcPath, AbstractJrtPath dstPath, CopyOption... options)
-            throws IOException {
-        throw readOnly();
-    }
-
-    final FileChannel newFileChannel(AbstractJrtPath jrtPath,
-            Set<? extends OpenOption> options,
-            FileAttribute<?>... attrs)
-            throws IOException {
-        throw new UnsupportedOperationException("newFileChannel");
-    }
-
-    final InputStream newInputStream(AbstractJrtPath jrtPath) throws IOException {
-        return new ByteArrayInputStream(getFileContent(jrtPath));
-    }
-
-    final SeekableByteChannel newByteChannel(AbstractJrtPath jrtPath,
-            Set<? extends OpenOption> options,
-            FileAttribute<?>... attrs)
-            throws IOException {
-        checkOptions(options);
-
-        byte[] buf = getFileContent(jrtPath);
-        final ReadableByteChannel rbc
-                = Channels.newChannel(new ByteArrayInputStream(buf));
-        final long size = buf.length;
-        return new SeekableByteChannel() {
-            long read = 0;
-
-            @Override
-            public boolean isOpen() {
-                return rbc.isOpen();
-            }
-
-            @Override
-            public long position() throws IOException {
-                return read;
-            }
-
-            @Override
-            public SeekableByteChannel position(long pos)
-                    throws IOException {
-                throw new UnsupportedOperationException();
-            }
-
-            @Override
-            public int read(ByteBuffer dst) throws IOException {
-                int n = rbc.read(dst);
-                if (n > 0) {
-                    read += n;
-                }
-                return n;
-            }
-
-            @Override
-            public SeekableByteChannel truncate(long size)
-                    throws IOException {
-                throw new NonWritableChannelException();
-            }
-
-            @Override
-            public int write(ByteBuffer src) throws IOException {
-                throw new NonWritableChannelException();
-            }
-
-            @Override
-            public long size() throws IOException {
-                return size;
-            }
-
-            @Override
-            public void close() throws IOException {
-                rbc.close();
-            }
-        };
-    }
-
-    final JrtFileStore getFileStore(AbstractJrtPath jrtPath) {
-        return new JrtFileStore(jrtPath);
-    }
-
-    final void ensureOpen() throws IOException {
-        if (!isOpen()) {
-            throw new ClosedFileSystemException();
-        }
-    }
-
-    // abstract methods to be implemented by a particular jrt file system
-    abstract AbstractJrtPath getRootPath();
-
-    abstract boolean isSameFile(AbstractJrtPath jrtPath1, AbstractJrtPath jrtPath2) throws IOException;
-
-    abstract boolean isLink(AbstractJrtPath jrtPath) throws IOException;
-
-    abstract AbstractJrtPath resolveLink(AbstractJrtPath jrtPath) throws IOException;
-
-    abstract AbstractJrtFileAttributes getFileAttributes(AbstractJrtPath jrtPath, LinkOption... options) throws IOException;
-
-    abstract boolean exists(AbstractJrtPath jrtPath) throws IOException;
-
-    abstract boolean isDirectory(AbstractJrtPath jrtPath, boolean resolveLinks) throws IOException;
-
-    /**
-     * returns the list of child paths of the given directory "path"
-     *
-     * @param path name of the directory whose content is listed
-     * @return iterator for child paths of the given directory path
-     */
-    abstract Iterator<Path> iteratorOf(AbstractJrtPath jrtPath) throws IOException;
-
-    // returns the content of the file resource specified by the path
-    abstract byte[] getFileContent(AbstractJrtPath jrtPath) throws IOException;
-}
--- a/src/java.base/share/classes/jdk/internal/jrtfs/AbstractJrtPath.java	Tue Apr 19 13:00:00 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,935 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package jdk.internal.jrtfs;
-
-import java.io.*;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.nio.channels.*;
-import java.nio.file.*;
-import java.nio.file.DirectoryStream.Filter;
-import java.nio.file.attribute.*;
-import java.util.*;
-import static java.nio.file.StandardOpenOption.*;
-import static java.nio.file.StandardCopyOption.*;
-
-/**
- * Base class for Path implementation of jrt file systems.
- *
- * @implNote This class needs to maintain JDK 8 source compatibility.
- *
- * It is used internally in the JDK to implement jimage/jrtfs access,
- * but also compiled and delivered as part of the jrtfs.jar to support access
- * to the jimage file provided by the shipped JDK by tools running on JDK 8.
- */
-abstract class AbstractJrtPath implements Path {
-
-    protected final AbstractJrtFileSystem jrtfs;
-    private final byte[] path;
-    private volatile int[] offsets;
-    private int hashcode = 0;  // cached hashcode (created lazily)
-
-    AbstractJrtPath(AbstractJrtFileSystem jrtfs, byte[] path) {
-        this(jrtfs, path, false);
-        this.resolved = null;
-    }
-
-    AbstractJrtPath(AbstractJrtFileSystem jrtfs, byte[] path, boolean normalized) {
-        this.resolved = null;
-        this.jrtfs = jrtfs;
-        if (normalized) {
-            this.path = path;
-        } else {
-            this.path = normalize(path);
-        }
-    }
-
-    // factory methods to create subtypes of AbstractJrtPath
-    protected abstract AbstractJrtPath newJrtPath(byte[] path);
-
-    protected abstract AbstractJrtPath newJrtPath(byte[] path, boolean normalized);
-
-    final byte[] getName() {
-        return path;
-    }
-
-    @Override
-    public final AbstractJrtPath getRoot() {
-        if (this.isAbsolute()) {
-            return jrtfs.getRootPath();
-        } else {
-            return null;
-        }
-    }
-
-    @Override
-    public final AbstractJrtPath getFileName() {
-        initOffsets();
-        int count = offsets.length;
-        if (count == 0) {
-            return null;  // no elements so no name
-        }
-        if (count == 1 && path[0] != '/') {
-            return this;
-        }
-        int lastOffset = offsets[count - 1];
-        int len = path.length - lastOffset;
-        byte[] result = new byte[len];
-        System.arraycopy(path, lastOffset, result, 0, len);
-        return newJrtPath(result);
-    }
-
-    @Override
-    public final AbstractJrtPath getParent() {
-        initOffsets();
-        int count = offsets.length;
-        if (count == 0) // no elements so no parent
-        {
-            return null;
-        }
-        int len = offsets[count - 1] - 1;
-        if (len <= 0) // parent is root only (may be null)
-        {
-            return getRoot();
-        }
-        byte[] result = new byte[len];
-        System.arraycopy(path, 0, result, 0, len);
-        return newJrtPath(result);
-    }
-
-    @Override
-    public final int getNameCount() {
-        initOffsets();
-        return offsets.length;
-    }
-
-    @Override
-    public final AbstractJrtPath getName(int index) {
-        initOffsets();
-        if (index < 0 || index >= offsets.length) {
-            throw new IllegalArgumentException();
-        }
-        int begin = offsets[index];
-        int len;
-        if (index == (offsets.length - 1)) {
-            len = path.length - begin;
-        } else {
-            len = offsets[index + 1] - begin - 1;
-        }
-        // construct result
-        byte[] result = new byte[len];
-        System.arraycopy(path, begin, result, 0, len);
-        return newJrtPath(result);
-    }
-
-    @Override
-    public final AbstractJrtPath subpath(int beginIndex, int endIndex) {
-        initOffsets();
-        if (beginIndex < 0
-                || beginIndex >= offsets.length
-                || endIndex > offsets.length
-                || beginIndex >= endIndex) {
-            throw new IllegalArgumentException();
-        }
-
-        // starting offset and length
-        int begin = offsets[beginIndex];
-        int len;
-        if (endIndex == offsets.length) {
-            len = path.length - begin;
-        } else {
-            len = offsets[endIndex] - begin - 1;
-        }
-        // construct result
-        byte[] result = new byte[len];
-        System.arraycopy(path, begin, result, 0, len);
-        return newJrtPath(result);
-    }
-
-    @Override
-    public final AbstractJrtPath toRealPath(LinkOption... options) throws IOException {
-        AbstractJrtPath realPath = newJrtPath(getResolvedPath()).toAbsolutePath();
-        realPath = JrtFileSystem.followLinks(options) ? jrtfs.resolveLink(this) : realPath;
-        realPath.checkAccess();
-        return realPath;
-    }
-
-    final AbstractJrtPath readSymbolicLink() throws IOException {
-        if (!jrtfs.isLink(this)) {
-            throw new IOException("not a symbolic link");
-        }
-
-        return jrtfs.resolveLink(this);
-    }
-
-    final boolean isHidden() {
-        return false;
-    }
-
-    @Override
-    public final AbstractJrtPath toAbsolutePath() {
-        if (isAbsolute()) {
-            return this;
-        } else {
-            //add / bofore the existing path
-            byte[] tmp = new byte[path.length + 1];
-            tmp[0] = '/';
-            System.arraycopy(path, 0, tmp, 1, path.length);
-            return newJrtPath(tmp).normalize();
-        }
-    }
-
-    @Override
-    public final URI toUri() {
-        try {
-            return new URI("jrt",
-                    JrtFileSystem.getString(toAbsolutePath().path),
-                    null);
-        } catch (URISyntaxException ex) {
-            throw new AssertionError(ex);
-        }
-    }
-
-    private boolean equalsNameAt(AbstractJrtPath other, int index) {
-        int mbegin = offsets[index];
-        int mlen;
-        if (index == (offsets.length - 1)) {
-            mlen = path.length - mbegin;
-        } else {
-            mlen = offsets[index + 1] - mbegin - 1;
-        }
-        int obegin = other.offsets[index];
-        int olen;
-        if (index == (other.offsets.length - 1)) {
-            olen = other.path.length - obegin;
-        } else {
-            olen = other.offsets[index + 1] - obegin - 1;
-        }
-        if (mlen != olen) {
-            return false;
-        }
-        int n = 0;
-        while (n < mlen) {
-            if (path[mbegin + n] != other.path[obegin + n]) {
-                return false;
-            }
-            n++;
-        }
-        return true;
-    }
-
-    @Override
-    public final AbstractJrtPath relativize(Path other) {
-        final AbstractJrtPath o = checkPath(other);
-        if (o.equals(this)) {
-            return newJrtPath(new byte[0], true);
-        }
-        if (/* this.getFileSystem() != o.getFileSystem() || */this.isAbsolute() != o.isAbsolute()) {
-            throw new IllegalArgumentException();
-        }
-        int mc = this.getNameCount();
-        int oc = o.getNameCount();
-        int n = Math.min(mc, oc);
-        int i = 0;
-        while (i < n) {
-            if (!equalsNameAt(o, i)) {
-                break;
-            }
-            i++;
-        }
-        int dotdots = mc - i;
-        int len = dotdots * 3 - 1;
-        if (i < oc) {
-            len += (o.path.length - o.offsets[i] + 1);
-        }
-        byte[] result = new byte[len];
-
-        int pos = 0;
-        while (dotdots > 0) {
-            result[pos++] = (byte) '.';
-            result[pos++] = (byte) '.';
-            if (pos < len) // no tailing slash at the end
-            {
-                result[pos++] = (byte) '/';
-            }
-            dotdots--;
-        }
-        if (i < oc) {
-            System.arraycopy(o.path, o.offsets[i],
-                    result, pos,
-                    o.path.length - o.offsets[i]);
-        }
-        return newJrtPath(result);
-    }
-
-    @Override
-    public AbstractJrtFileSystem getFileSystem() {
-        return jrtfs;
-    }
-
-    @Override
-    public final boolean isAbsolute() {
-        return (this.path.length > 0 && path[0] == '/');
-    }
-
-    @Override
-    public final AbstractJrtPath resolve(Path other) {
-        final AbstractJrtPath o = checkPath(other);
-        if (o.isAbsolute()) {
-            return o;
-        }
-        byte[] res;
-        if (this.path[path.length - 1] == '/') {
-            res = new byte[path.length + o.path.length];
-            System.arraycopy(path, 0, res, 0, path.length);
-            System.arraycopy(o.path, 0, res, path.length, o.path.length);
-        } else {
-            res = new byte[path.length + 1 + o.path.length];
-            System.arraycopy(path, 0, res, 0, path.length);
-            res[path.length] = '/';
-            System.arraycopy(o.path, 0, res, path.length + 1, o.path.length);
-        }
-        return newJrtPath(res);
-    }
-
-    @Override
-    public final Path resolveSibling(Path other) {
-        if (other == null) {
-            throw new NullPointerException();
-        }
-        Path parent = getParent();
-        return (parent == null) ? other : parent.resolve(other);
-    }
-
-    @Override
-    public final boolean startsWith(Path other) {
-        final AbstractJrtPath o = checkPath(other);
-        if (o.isAbsolute() != this.isAbsolute()
-                || o.path.length > this.path.length) {
-            return false;
-        }
-        int olast = o.path.length;
-        for (int i = 0; i < olast; i++) {
-            if (o.path[i] != this.path[i]) {
-                return false;
-            }
-        }
-        olast--;
-        return o.path.length == this.path.length
-                || o.path[olast] == '/'
-                || this.path[olast + 1] == '/';
-    }
-
-    @Override
-    public final boolean endsWith(Path other) {
-        final AbstractJrtPath o = checkPath(other);
-        int olast = o.path.length - 1;
-        if (olast > 0 && o.path[olast] == '/') {
-            olast--;
-        }
-        int last = this.path.length - 1;
-        if (last > 0 && this.path[last] == '/') {
-            last--;
-        }
-        if (olast == -1) // o.path.length == 0
-        {
-            return last == -1;
-        }
-        if ((o.isAbsolute() && (!this.isAbsolute() || olast != last))
-                || (last < olast)) {
-            return false;
-        }
-        for (; olast >= 0; olast--, last--) {
-            if (o.path[olast] != this.path[last]) {
-                return false;
-            }
-        }
-        return o.path[olast + 1] == '/'
-                || last == -1 || this.path[last] == '/';
-    }
-
-    @Override
-    public final AbstractJrtPath resolve(String other) {
-        return resolve(getFileSystem().getPath(other));
-    }
-
-    @Override
-    public final Path resolveSibling(String other) {
-        return resolveSibling(getFileSystem().getPath(other));
-    }
-
-    @Override
-    public final boolean startsWith(String other) {
-        return startsWith(getFileSystem().getPath(other));
-    }
-
-    @Override
-    public final boolean endsWith(String other) {
-        return endsWith(getFileSystem().getPath(other));
-    }
-
-    @Override
-    public final AbstractJrtPath normalize() {
-        byte[] res = getResolved();
-        if (res == path) // no change
-        {
-            return this;
-        }
-        return newJrtPath(res, true);
-    }
-
-    private AbstractJrtPath checkPath(Path path) {
-        if (path == null) {
-            throw new NullPointerException();
-        }
-        if (!(path instanceof AbstractJrtPath)) {
-            throw new ProviderMismatchException();
-        }
-        return (AbstractJrtPath) path;
-    }
-
-    // create offset list if not already created
-    private void initOffsets() {
-        if (offsets == null) {
-            int count, index;
-            // count names
-            count = 0;
-            index = 0;
-            while (index < path.length) {
-                byte c = path[index++];
-                if (c != '/') {
-                    count++;
-                    while (index < path.length && path[index] != '/') {
-                        index++;
-                    }
-                }
-            }
-            // populate offsets
-            int[] result = new int[count];
-            count = 0;
-            index = 0;
-            while (index < path.length) {
-                byte c = path[index];
-                if (c == '/') {
-                    index++;
-                } else {
-                    result[count++] = index++;
-                    while (index < path.length && path[index] != '/') {
-                        index++;
-                    }
-                }
-            }
-            synchronized (this) {
-                if (offsets == null) {
-                    offsets = result;
-                }
-            }
-        }
-    }
-
-    private volatile byte[] resolved;
-
-    final byte[] getResolvedPath() {
-        byte[] r = resolved;
-        if (r == null) {
-            if (isAbsolute()) {
-                r = getResolved();
-            } else {
-                r = toAbsolutePath().getResolvedPath();
-            }
-            resolved = r;
-        }
-        return resolved;
-    }
-
-    // removes redundant slashs, replace "\" to separator "/"
-    // and check for invalid characters
-    private static byte[] normalize(byte[] path) {
-        if (path.length == 0) {
-            return path;
-        }
-        byte prevC = 0;
-        for (int i = 0; i < path.length; i++) {
-            byte c = path[i];
-            if (c == '\\') {
-                return normalize(path, i);
-            }
-            if (c == (byte) '/' && prevC == '/') {
-                return normalize(path, i - 1);
-            }
-            if (c == '\u0000') {
-                throw new InvalidPathException(JrtFileSystem.getString(path),
-                        "Path: nul character not allowed");
-            }
-            prevC = c;
-        }
-
-        if (path.length > 1 && path[path.length - 1] == '/') {
-            return Arrays.copyOf(path, path.length - 1);
-        }
-
-        return path;
-    }
-
-    private static byte[] normalize(byte[] path, int off) {
-        byte[] to = new byte[path.length];
-        int n = 0;
-        while (n < off) {
-            to[n] = path[n];
-            n++;
-        }
-        int m = n;
-        byte prevC = 0;
-        while (n < path.length) {
-            byte c = path[n++];
-            if (c == (byte) '\\') {
-                c = (byte) '/';
-            }
-            if (c == (byte) '/' && prevC == (byte) '/') {
-                continue;
-            }
-            if (c == '\u0000') {
-                throw new InvalidPathException(JrtFileSystem.getString(path),
-                        "Path: nul character not allowed");
-            }
-            to[m++] = c;
-            prevC = c;
-        }
-        if (m > 1 && to[m - 1] == '/') {
-            m--;
-        }
-        return (m == to.length) ? to : Arrays.copyOf(to, m);
-    }
-
-    // Remove DotSlash(./) and resolve DotDot (..) components
-    private byte[] getResolved() {
-        if (path.length == 0) {
-            return path;
-        }
-        for (int i = 0; i < path.length; i++) {
-            byte c = path[i];
-            if (c == (byte) '.') {
-                return resolve0();
-            }
-        }
-
-        return path;
-    }
-
-    // TBD: performance, avoid initOffsets
-    private byte[] resolve0() {
-        byte[] to = new byte[path.length];
-        int nc = getNameCount();
-        int[] lastM = new int[nc];
-        int lastMOff = -1;
-        int m = 0;
-        for (int i = 0; i < nc; i++) {
-            int n = offsets[i];
-            int len = (i == offsets.length - 1)
-                    ? (path.length - n) : (offsets[i + 1] - n - 1);
-            if (len == 1 && path[n] == (byte) '.') {
-                if (m == 0 && path[0] == '/') // absolute path
-                {
-                    to[m++] = '/';
-                }
-                continue;
-            }
-            if (len == 2 && path[n] == '.' && path[n + 1] == '.') {
-                if (lastMOff >= 0) {
-                    m = lastM[lastMOff--];  // retreat
-                    continue;
-                }
-                if (path[0] == '/') {  // "/../xyz" skip
-                    if (m == 0) {
-                        to[m++] = '/';
-                    }
-                } else {               // "../xyz" -> "../xyz"
-                    if (m != 0 && to[m - 1] != '/') {
-                        to[m++] = '/';
-                    }
-                    while (len-- > 0) {
-                        to[m++] = path[n++];
-                    }
-                }
-                continue;
-            }
-            if (m == 0 && path[0] == '/' || // absolute path
-                    m != 0 && to[m - 1] != '/') {   // not the first name
-                to[m++] = '/';
-            }
-            lastM[++lastMOff] = m;
-            while (len-- > 0) {
-                to[m++] = path[n++];
-            }
-        }
-        if (m > 1 && to[m - 1] == '/') {
-            m--;
-        }
-        return (m == to.length) ? to : Arrays.copyOf(to, m);
-    }
-
-    @Override
-    public final String toString() {
-        return JrtFileSystem.getString(path);
-    }
-
-    @Override
-    public final int hashCode() {
-        int h = hashcode;
-        if (h == 0) {
-            hashcode = h = Arrays.hashCode(path);
-        }
-        return h;
-    }
-
-    @Override
-    public final boolean equals(Object obj) {
-        return obj != null
-                && obj instanceof AbstractJrtPath
-                && this.jrtfs == ((AbstractJrtPath) obj).jrtfs
-                && compareTo((Path) obj) == 0;
-    }
-
-    @Override
-    public final int compareTo(Path other) {
-        final AbstractJrtPath o = checkPath(other);
-        int len1 = this.path.length;
-        int len2 = o.path.length;
-
-        int n = Math.min(len1, len2);
-        byte v1[] = this.path;
-        byte v2[] = o.path;
-
-        int k = 0;
-        while (k < n) {
-            int c1 = v1[k] & 0xff;
-            int c2 = v2[k] & 0xff;
-            if (c1 != c2) {
-                return c1 - c2;
-            }
-            k++;
-        }
-        return len1 - len2;
-    }
-
-    @Override
-    public final WatchKey register(
-            WatchService watcher,
-            WatchEvent.Kind<?>[] events,
-            WatchEvent.Modifier... modifiers) {
-        if (watcher == null || events == null || modifiers == null) {
-            throw new NullPointerException();
-        }
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public final WatchKey register(WatchService watcher, WatchEvent.Kind<?>... events) {
-        return register(watcher, events, new WatchEvent.Modifier[0]);
-    }
-
-    @Override
-    public final File toFile() {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public final Iterator<Path> iterator() {
-        return new Iterator<Path>() {
-            private int i = 0;
-
-            @Override
-            public boolean hasNext() {
-                return (i < getNameCount());
-            }
-
-            @Override
-            public Path next() {
-                if (i < getNameCount()) {
-                    Path result = getName(i);
-                    i++;
-                    return result;
-                } else {
-                    throw new NoSuchElementException();
-                }
-            }
-
-            @Override
-            public void remove() {
-                throw new ReadOnlyFileSystemException();
-            }
-        };
-    }
-
-    /////////////////////////////////////////////////////////////////////
-    // Helpers for JrtFileSystemProvider and JrtFileSystem
-    final int getPathLength() {
-        return path.length;
-    }
-
-    final void createDirectory(FileAttribute<?>... attrs)
-            throws IOException {
-        jrtfs.createDirectory(this, attrs);
-    }
-
-    final InputStream newInputStream(OpenOption... options) throws IOException {
-        if (options.length > 0) {
-            for (OpenOption opt : options) {
-                if (opt != READ) {
-                    throw new UnsupportedOperationException("'" + opt + "' not allowed");
-                }
-            }
-        }
-        return jrtfs.newInputStream(this);
-    }
-
-    final DirectoryStream<Path> newDirectoryStream(Filter<? super Path> filter)
-            throws IOException {
-        return new JrtDirectoryStream(this, filter);
-    }
-
-    final void delete() throws IOException {
-        jrtfs.deleteFile(this, true);
-    }
-
-    final void deleteIfExists() throws IOException {
-        jrtfs.deleteFile(this, false);
-    }
-
-    final AbstractJrtFileAttributes getAttributes(LinkOption... options) throws IOException {
-        AbstractJrtFileAttributes zfas = jrtfs.getFileAttributes(this, options);
-        if (zfas == null) {
-            throw new NoSuchFileException(toString());
-        }
-        return zfas;
-    }
-
-    final void setAttribute(String attribute, Object value, LinkOption... options)
-            throws IOException {
-        String type;
-        String attr;
-        int colonPos = attribute.indexOf(':');
-        if (colonPos == -1) {
-            type = "basic";
-            attr = attribute;
-        } else {
-            type = attribute.substring(0, colonPos++);
-            attr = attribute.substring(colonPos);
-        }
-        JrtFileAttributeView view = JrtFileAttributeView.get(this, type, options);
-        if (view == null) {
-            throw new UnsupportedOperationException("view <" + view + "> is not supported");
-        }
-        view.setAttribute(attr, value);
-    }
-
-    final void setTimes(FileTime mtime, FileTime atime, FileTime ctime)
-            throws IOException {
-        jrtfs.setTimes(this, mtime, atime, ctime);
-    }
-
-    final Map<String, Object> readAttributes(String attributes, LinkOption... options)
-            throws IOException {
-        String view;
-        String attrs;
-        int colonPos = attributes.indexOf(':');
-        if (colonPos == -1) {
-            view = "basic";
-            attrs = attributes;
-        } else {
-            view = attributes.substring(0, colonPos++);
-            attrs = attributes.substring(colonPos);
-        }
-        JrtFileAttributeView jrtfv = JrtFileAttributeView.get(this, view, options);
-        if (jrtfv == null) {
-            throw new UnsupportedOperationException("view not supported");
-        }
-        return jrtfv.readAttributes(attrs);
-    }
-
-    final FileStore getFileStore() throws IOException {
-        // each JrtFileSystem only has one root (as requested for now)
-        if (exists()) {
-            return jrtfs.getFileStore(this);
-        }
-        throw new NoSuchFileException(JrtFileSystem.getString(path));
-    }
-
-    final boolean isSameFile(Path other) throws IOException {
-        if (this.equals(other)) {
-            return true;
-        }
-        if (other == null
-                || this.getFileSystem() != other.getFileSystem()) {
-            return false;
-        }
-        this.checkAccess();
-        AbstractJrtPath target = (AbstractJrtPath) other;
-        target.checkAccess();
-        return Arrays.equals(this.getResolvedPath(), target.getResolvedPath())
-                || jrtfs.isSameFile(this, target);
-    }
-
-    final SeekableByteChannel newByteChannel(Set<? extends OpenOption> options,
-            FileAttribute<?>... attrs)
-            throws IOException {
-        return jrtfs.newByteChannel(this, options, attrs);
-    }
-
-    final FileChannel newFileChannel(Set<? extends OpenOption> options,
-            FileAttribute<?>... attrs)
-            throws IOException {
-        return jrtfs.newFileChannel(this, options, attrs);
-    }
-
-    final void checkAccess(AccessMode... modes) throws IOException {
-        boolean w = false;
-        boolean x = false;
-        for (AccessMode mode : modes) {
-            switch (mode) {
-                case READ:
-                    break;
-                case WRITE:
-                    w = true;
-                    break;
-                case EXECUTE:
-                    x = true;
-                    break;
-                default:
-                    throw new UnsupportedOperationException();
-            }
-        }
-
-        BasicFileAttributes attrs = jrtfs.getFileAttributes(this);
-        if (attrs == null && (path.length != 1 || path[0] != '/')) {
-            throw new NoSuchFileException(toString());
-        }
-        if (w) {
-//            if (jrtfs.isReadOnly())
-            throw new AccessDeniedException(toString());
-        }
-        if (x) {
-            throw new AccessDeniedException(toString());
-        }
-    }
-
-    final boolean exists() {
-        try {
-            return jrtfs.exists(this);
-        } catch (IOException x) {
-        }
-        return false;
-    }
-
-    final OutputStream newOutputStream(OpenOption... options) throws IOException {
-        if (options.length == 0) {
-            return jrtfs.newOutputStream(this,
-                    CREATE_NEW, WRITE);
-        }
-        return jrtfs.newOutputStream(this, options);
-    }
-
-    final void move(AbstractJrtPath target, CopyOption... options)
-            throws IOException {
-        if (this.jrtfs == target.jrtfs) {
-            jrtfs.copyFile(true,
-                    this, target,
-                    options);
-        } else {
-            copyToTarget(target, options);
-            delete();
-        }
-    }
-
-    final void copy(AbstractJrtPath target, CopyOption... options)
-            throws IOException {
-        if (this.jrtfs == target.jrtfs) {
-            jrtfs.copyFile(false,
-                    this, target,
-                    options);
-        } else {
-            copyToTarget(target, options);
-        }
-    }
-
-    private void copyToTarget(AbstractJrtPath target, CopyOption... options)
-            throws IOException {
-        boolean replaceExisting = false;
-        boolean copyAttrs = false;
-        for (CopyOption opt : options) {
-            if (opt == REPLACE_EXISTING) {
-                replaceExisting = true;
-            } else if (opt == COPY_ATTRIBUTES) {
-                copyAttrs = true;
-            }
-        }
-        // attributes of source file
-        BasicFileAttributes jrtfas = getAttributes();
-        // check if target exists
-        boolean exists;
-        if (replaceExisting) {
-            try {
-                target.deleteIfExists();
-                exists = false;
-            } catch (DirectoryNotEmptyException x) {
-                exists = true;
-            }
-        } else {
-            exists = target.exists();
-        }
-        if (exists) {
-            throw new FileAlreadyExistsException(target.toString());
-        }
-
-        if (jrtfas.isDirectory()) {
-            // create directory or file
-            target.createDirectory();
-        } else {
-            try (InputStream is = jrtfs.newInputStream(this); OutputStream os = target.newOutputStream()) {
-                byte[] buf = new byte[8192];
-                int n;
-                while ((n = is.read(buf)) != -1) {
-                    os.write(buf, 0, n);
-                }
-            }
-        }
-        if (copyAttrs) {
-            BasicFileAttributeView view
-                    = JrtFileAttributeView.get(target, BasicFileAttributeView.class);
-            try {
-                view.setTimes(jrtfas.lastModifiedTime(),
-                        jrtfas.lastAccessTime(),
-                        jrtfas.creationTime());
-            } catch (IOException x) {
-                // rollback?
-                try {
-                    target.delete();
-                } catch (IOException ignore) {
-                }
-                throw x;
-            }
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/jrtfs/ExplodedImage.java	Tue Apr 19 11:13:30 2016 -0700
@@ -0,0 +1,295 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.internal.jrtfs;
+
+import java.io.IOException;
+import java.nio.file.DirectoryStream;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystemException;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import jdk.internal.jimage.ImageReader.Node;
+
+/**
+ * A jrt file system built on $JAVA_HOME/modules directory ('exploded modules
+ * build')
+ *
+ * @implNote This class needs to maintain JDK 8 source compatibility.
+ *
+ * It is used internally in the JDK to implement jimage/jrtfs access,
+ * but also compiled and delivered as part of the jrtfs.jar to support access
+ * to the jimage file provided by the shipped JDK by tools running on JDK 8.
+ */
+class ExplodedImage extends SystemImage {
+
+    private static final String MODULES = "/modules/";
+    private static final String PACKAGES = "/packages/";
+    private static final int PACKAGES_LEN = PACKAGES.length();
+
+    private final FileSystem defaultFS;
+    private final String separator;
+    private final Map<String, PathNode> nodes = Collections.synchronizedMap(new HashMap<>());
+    private final BasicFileAttributes modulesDirAttrs;
+
+    ExplodedImage(Path modulesDir) throws IOException {
+        defaultFS = FileSystems.getDefault();
+        String str = defaultFS.getSeparator();
+        separator = str.equals("/") ? null : str;
+        modulesDirAttrs = Files.readAttributes(modulesDir, BasicFileAttributes.class);
+        initNodes();
+    }
+
+    // A Node that is backed by actual default file system Path
+    private final class PathNode extends Node {
+
+        // Path in underlying default file system
+        private Path path;
+        private PathNode link;
+        private List<Node> children;
+
+        PathNode(String name, Path path, BasicFileAttributes attrs) {  // path
+            super(name, attrs);
+            this.path = path;
+        }
+
+        PathNode(String name, Node link) {              // link
+            super(name, link.getFileAttributes());
+            this.link = (PathNode)link;
+        }
+
+        PathNode(String name, List<Node> children) {    // dir
+            super(name, modulesDirAttrs);
+            this.children = children;
+        }
+
+        @Override
+        public boolean isDirectory() {
+            return children != null ||
+                   (link == null && getFileAttributes().isDirectory());
+        }
+
+        @Override
+        public boolean isLink() {
+            return link != null;
+        }
+
+        @Override
+        public PathNode resolveLink(boolean recursive) {
+            if (link == null)
+                return this;
+            return recursive && link.isLink() ? link.resolveLink(true) : link;
+        }
+
+        byte[] getContent() throws IOException {
+            if (!getFileAttributes().isRegularFile())
+                throw new FileSystemException(getName() + " is not file");
+            return Files.readAllBytes(path);
+        }
+
+        @Override
+        public List<Node> getChildren() {
+            if (!isDirectory())
+                throw new IllegalArgumentException("not a directory: " + getNameString());
+            if (children == null) {
+                List<Node> list = new ArrayList<>();
+                try (DirectoryStream<Path> stream = Files.newDirectoryStream(path)) {
+                    for (Path p : stream) {
+                        p = explodedModulesDir.relativize(p);
+                        String pName = MODULES + nativeSlashToFrontSlash(p.toString());
+                        Node node = findNode(pName);
+                        if (node != null) {  // findNode may choose to hide certain files!
+                            list.add(node);
+                        }
+                    }
+                } catch (IOException x) {
+                    return null;
+                }
+                children = list;
+            }
+            return children;
+        }
+    }
+
+    @Override
+    public void close() throws IOException {
+        nodes.clear();
+    }
+
+    @Override
+    public byte[] getResource(Node node) throws IOException {
+        return ((PathNode)node).getContent();
+    }
+
+    // find Node for the given Path
+    @Override
+    public synchronized Node findNode(String str) {
+        Node node = findModulesNode(str);
+        if (node != null) {
+            return node;
+        }
+        // lazily created for paths like /packages/<package>/<module>/xyz
+        // For example /packages/java.lang/java.base/java/lang/
+        if (str.startsWith(PACKAGES)) {
+            // pkgEndIdx marks end of <package> part
+            int pkgEndIdx = str.indexOf('/', PACKAGES_LEN);
+            if (pkgEndIdx != -1) {
+                // modEndIdx marks end of <module> part
+                int modEndIdx = str.indexOf('/', pkgEndIdx + 1);
+                if (modEndIdx != -1) {
+                    // make sure we have such module link!
+                    // ie., /packages/<package>/<module> is valid
+                    Node linkNode = nodes.get(str.substring(0, modEndIdx));
+                    if (linkNode == null || !linkNode.isLink()) {
+                        return null;
+                    }
+                    // map to "/modules/zyz" path and return that node
+                    // For example, "/modules/java.base/java/lang" for
+                    // "/packages/java.lang/java.base/java/lang".
+                    String mod = MODULES + str.substring(pkgEndIdx + 1);
+                    return findModulesNode(mod);
+                }
+            }
+        }
+        return null;
+    }
+
+    // find a Node for a path that starts like "/modules/..."
+    Node findModulesNode(String str) {
+        PathNode node = nodes.get(str);
+        if (node != null) {
+            return node;
+        }
+        // lazily created "/modules/xyz/abc/" Node
+        // This is mapped to default file system path "<JDK_MODULES_DIR>/xyz/abc"
+        Path p = underlyingPath(str);
+        if (p != null) {
+            try {
+                BasicFileAttributes attrs = Files.readAttributes(p, BasicFileAttributes.class);
+                if (attrs.isRegularFile()) {
+                    Path f = p.getFileName();
+                    if (f.toString().startsWith("_the."))
+                        return null;
+                }
+                node = new PathNode(str, p, attrs);
+                nodes.put(str, node);
+                return node;
+            } catch (IOException x) {
+                // does not exists or unable to determine
+            }
+        }
+        return null;
+    }
+
+    Path underlyingPath(String str) {
+        if (str.startsWith(MODULES)) {
+            str = frontSlashToNativeSlash(str.substring("/modules".length()));
+            return defaultFS.getPath(explodedModulesDir.toString(), str);
+        }
+        return null;
+    }
+
+    // convert "/" to platform path separator
+    private String frontSlashToNativeSlash(String str) {
+        return separator ==