diff --git a/.hgtags b/.hgtags
index f6f4a8d..7e7ca57 100644
--- a/.hgtags
+++ b/.hgtags
@@ -155,3 +155,5 @@
 27f0c08c427c65fcab6917edf646f59058e59524 jdk8-b31
 ddfe5562f61f54ed2121ac0c73b688b94f3e66b5 jdk8-b32
 78cea258caaba3980ba186c426da82c8fe41bfd7 jdk8-b33
+29b680393f33bf953688c17d93aca7a870ca4024 jdk8-b34
+2e3e1356ffbddb2ae95c08da72830ba9ab8b3181 jdk8-b35
diff --git a/make/com/sun/tools/attach/Makefile b/make/com/sun/tools/attach/Makefile
index 1f12824..9053eaa 100644
--- a/make/com/sun/tools/attach/Makefile
+++ b/make/com/sun/tools/attach/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,8 @@
 #
 
 
+LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../../../..
 PACKAGE = com.sun.tools.attach
 LIBRARY = attach
diff --git a/make/common/Defs-linux.gmk b/make/common/Defs-linux.gmk
index 02bfc4c..a0bfc3c 100644
--- a/make/common/Defs-linux.gmk
+++ b/make/common/Defs-linux.gmk
@@ -131,8 +131,9 @@
   # Setting ENABLE_FULL_DEBUG_SYMBOLS=1 (and OBJCOPY) above enables the
   # JDK build to import .debuginfo or .diz files from the HotSpot build.
   # However, adding FDS support to the JDK build will occur in phases
-  # so a different make variable (LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS)
-  # is used to indicate that a particular library supports FDS.
+  # so a different make variable (LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS
+  # and PROGRAM_SUPPORTS_FULL_DEBUG_SYMBOLS) is used to indicate that a
+  # particular library or program supports FDS.
 
   ifeq ($(OBJCOPY),)
     _JUNK_ := $(shell \
@@ -156,9 +157,7 @@
     _JUNK_ := $(shell \
       echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)")
 
-    # HACK: disable ZIP_DEBUGINFO_FILES by default until install repo
-    # changes are promoted
-    ZIP_DEBUGINFO_FILES ?= 0
+    ZIP_DEBUGINFO_FILES ?= 1
 
     _JUNK_ := $(shell \
       echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")
@@ -261,6 +260,17 @@
   CFLAGS_REQUIRED += $(DEBUG_FLAG)
 endif
 
+# If Full Debug Symbols is enabled, then we want the same debug and
+# optimization flags as used by FASTDEBUG.
+#
+ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+  ifeq ($(LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS),1)
+    ifeq ($(VARIANT), OPT)
+      CC_OPT = $(DEBUG_FLAG) $(CC_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL))
+    endif
+  endif
+endif
+
 CFLAGS_OPT      = $(CC_OPT)
 CFLAGS_DBG      = $(DEBUG_FLAG)
 CFLAGS_COMMON += $(CFLAGS_REQUIRED)
diff --git a/make/common/Defs-solaris.gmk b/make/common/Defs-solaris.gmk
index bb484c5..5c272be 100644
--- a/make/common/Defs-solaris.gmk
+++ b/make/common/Defs-solaris.gmk
@@ -138,8 +138,9 @@
   # Setting ENABLE_FULL_DEBUG_SYMBOLS=1 (and OBJCOPY) above enables the
   # JDK build to import .debuginfo or .diz files from the HotSpot build.
   # However, adding FDS support to the JDK build will occur in phases
-  # so a different make variable (LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS)
-  # is used to indicate that a particular library supports FDS.
+  # so a different make variable (LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS
+  # and PROGRAM_SUPPORTS_FULL_DEBUG_SYMBOLS) is used to indicate that a
+  # particular library or program supports FDS.
 
   ifeq ($(OBJCOPY),)
     _JUNK_ := $(shell \
@@ -164,9 +165,7 @@
     _JUNK_ := $(shell \
       echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)")
 
-    # HACK: disable ZIP_DEBUGINFO_FILES by default until install repo
-    # changes are promoted
-    ZIP_DEBUGINFO_FILES ?= 0
+    ZIP_DEBUGINFO_FILES ?= 1
 
     _JUNK_ := $(shell \
       echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")
@@ -240,6 +239,21 @@
   CXXFLAGS_DEBUG_OPTION  = -g0 $(CXX_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL))
 endif
 
+# If Full Debug Symbols is enabled, then we want the same debug and
+# optimization flags as used by FASTDEBUG. We also want all the
+# debug info in one place (-xs).
+#
+ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+  ifeq ($(LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS),1)
+    ifeq ($(VARIANT), OPT)
+      CC_OPT   = -g  -xs $(CC_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL))
+      CXX_OPT  = -g0 -xs $(CXX_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL))
+    endif
+    CFLAGS_DEBUG_OPTION    += -xs
+    CXXFLAGS_DEBUG_OPTION  += -xs
+  endif
+endif
+
 CFLAGS_COMMON   = -L$(OBJDIR)
 
 # Do not allow C99 language features like declarations in code etc.
diff --git a/make/common/Defs-windows.gmk b/make/common/Defs-windows.gmk
index 3d1ec78..7afe0b5 100644
--- a/make/common/Defs-windows.gmk
+++ b/make/common/Defs-windows.gmk
@@ -113,9 +113,7 @@
   echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
 
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-  # HACK: disable ZIP_DEBUGINFO_FILES by default until install repo
-  # changes are promoted
-  ZIP_DEBUGINFO_FILES ?= 0
+  ZIP_DEBUGINFO_FILES ?= 1
 else
   ZIP_DEBUGINFO_FILES=0
 endif
diff --git a/make/common/Library.gmk b/make/common/Library.gmk
index 00c7897..2583e83 100644
--- a/make/common/Library.gmk
+++ b/make/common/Library.gmk
@@ -181,8 +181,17 @@
 	$(CP) $(OBJDIR)/$(@F) $@
 	@$(call binary_file_verification,$@)
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+  ifeq ($(ZIP_DEBUGINFO_FILES),1)
+	(set -e ; \
+	 $(CD) $(OBJDIR) ; \
+	 $(ZIPEXE) -q $(LIBRARY).diz $(LIBRARY).map $(LIBRARY).pdb ; \
+	)
+	$(CP) $(OBJDIR)/$(LIBRARY).diz $(@D)
+	$(RM) $(OBJDIR)/$(LIBRARY).map $(OBJDIR)/$(LIBRARY).pdb
+  else
 	$(CP) $(OBJDIR)/$(LIBRARY).map $(@D)
 	$(CP) $(OBJDIR)/$(LIBRARY).pdb $(@D)
+  endif
 endif
 
 endif # LIBRARY
@@ -248,6 +257,37 @@
 ifeq ($(WRITE_LIBVERSION),true)
 	$(MCS) -d -a "$(FULL_VERSION)" $@
 endif # WRITE_LIBVERSION
+  ifneq ($(PLATFORM), macosx)
+    ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+      ifeq ($(LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS),1)
+	(set -e ; \
+	 $(CD) $(@D) ; \
+	 $(OBJCOPY) --only-keep-debug $(@F) $(LIBRARY).debuginfo ; \
+	 $(OBJCOPY) --add-gnu-debuglink=$(LIBRARY).debuginfo $(@F) ; \
+	)
+        ifeq ($(STRIP_POLICY),all_strip)
+	  $(STRIP) $@
+        else
+          ifeq ($(STRIP_POLICY),min_strip)
+            ifeq ($(PLATFORM), solaris)
+	      $(STRIP) -x $@
+            else
+              # assume Linux
+	      $(STRIP) -g $@
+            endif
+          # implied else here is no stripping at all
+          endif
+        endif
+        ifeq ($(ZIP_DEBUGINFO_FILES),1)
+	  (set -e ; \
+	   $(CD) $(@D) ; \
+	   $(ZIPEXE) -q $(LIBRARY).diz $(LIBRARY).debuginfo ; \
+	   $(RM) $(LIBRARY).debuginfo ; \
+	  )
+        endif
+      endif # LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS
+    endif # ENABLE_FULL_DEBUG_SYMBOLS
+  endif # PLATFORM-!macosx
 endif # LIBRARY
 
 endif # PLATFORM
diff --git a/make/common/Program.gmk b/make/common/Program.gmk
index c57ca01..4e211d8 100644
--- a/make/common/Program.gmk
+++ b/make/common/Program.gmk
@@ -189,6 +189,15 @@
 	$(MT) /manifest $(OBJDIR)/$(PROGRAM).exe.manifest /outputresource:$@;#1
   endif
 	@$(call binary_file_verification,$@)
+  ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+    ifeq ($(ZIP_DEBUGINFO_FILES),1)
+	(set -e ; \
+	 $(CD) $(OBJDIR) ; \
+	 $(ZIPEXE) -q $(PROGRAM).diz $(PROGRAM).map $(PROGRAM).pdb ; \
+	 $(RM) $(PROGRAM).map $(PROGRAM).pdb ; \
+	)
+    endif
+  endif
 else
   #
   # Note that we have to link -lthread even when USE_PTHREADS is true.
@@ -232,6 +241,42 @@
 	-codesign -s openjdk_codesign $@
   endif
 	@$(call binary_file_verification,$@)
+  ifneq ($(PLATFORM), macosx)
+    ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+      ifeq ($(PROGRAM_SUPPORTS_FULL_DEBUG_SYMBOLS),1)
+	(set -e ; \
+	 $(CD) $(@D) ; \
+	 $(OBJCOPY) --only-keep-debug $(@F) $(@F).debuginfo ; \
+	 $(OBJCOPY) --add-gnu-debuglink=$(@F).debuginfo $(@F) ; \
+	)
+        ifeq ($(STRIP_POLICY),all_strip)
+	  $(STRIP) $@
+        else
+          ifeq ($(STRIP_POLICY),min_strip)
+            ifeq ($(PLATFORM), solaris)
+	      $(STRIP) -x $@
+            else
+              # assume Linux
+	      $(STRIP) -g $@
+            endif
+          # implied else here is no stripping at all
+          endif
+        endif
+        ifeq ($(ZIP_DEBUGINFO_FILES),1)
+	  (set -e ; \
+	   $(CD) $(@D) ; \
+	   $(ZIPEXE) -q $(@F).diz $(@F).debuginfo ; \
+	   $(RM) $(@F).debuginfo ; \
+	  )
+          # save ZIP'ed debug info with rest of the program's build artifacts
+	  $(MV) $@.diz $(OBJDIR)
+        else
+          # save debug info with rest of the program's build artifacts
+	  $(MV) $@.debuginfo $(OBJDIR)
+        endif
+      endif # PROGRAM_SUPPORTS_FULL_DEBUG_SYMBOLS
+    endif # ENABLE_FULL_DEBUG_SYMBOLS
+  endif # PLATFORM-!macosx
 endif # PLATFORM
 
 clean:: 
@@ -240,12 +285,16 @@
 	$(RM) $(OBJDIR)/$(PROGRAM).ico
 	$(RM) $(OBJDIR)/$(PROGRAM).lcf
 	$(RM) $(OBJDIR)/$(PROGRAM).map
+	$(RM) $(OBJDIR)/$(PROGRAM).pdb
 	$(RM) $(OBJDIR)/$(PROGRAM).exp
 	$(RM) $(OBJDIR)/$(PROGRAM).lib
 	$(RM) $(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX)
 	$(RM) $(OBJDIR)/$(PROGRAM).ilk
 	$(RM) *.pdb
+else
+	$(RM) $(OBJDIR)/$(PROGRAM).debuginfo
 endif
+	$(RM) $(OBJDIR)/$(PROGRAM).diz
 
 
 clobber:: 
diff --git a/make/common/Release.gmk b/make/common/Release.gmk
index d4e5511..d8ec1b7 100644
--- a/make/common/Release.gmk
+++ b/make/common/Release.gmk
@@ -873,7 +873,9 @@
 	   -o -name \*.dll | $(EGREP) -v -i "$(MSVCRNN_DLL)" > $@
 else
 	$(FIND) $(JRE_IMAGE_DIR)/lib -type f -name \*.$(LIB_SUFFIX) >> $@
-	$(FILE) `$(FIND) $(JRE_IMAGE_DIR)/bin -type f -name \*$(EXE_SUFFIX)` \
+# The FILE command reports .debuginfo files as "ELF", but we don't want
+# those files in the JRE_BIN_LIST file. EXE_SUFFIX is empty on non-Windows.
+	$(FILE) `$(FIND) $(JRE_IMAGE_DIR)/bin -type f ! -name '*.debuginfo' -name \*$(EXE_SUFFIX)` \
 	    | $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@
 endif
 
@@ -1140,9 +1142,11 @@
 else
 	$(RM) $@
 	$(FIND) $(JDK_IMAGE_DIR)/jre/lib -type f -name \*.$(LIB_SUFFIX) >> $@
-	$(FILE) `$(FIND) $(JDK_IMAGE_DIR)/jre/bin -type f -name \*$(EXE_SUFFIX)` \
+# The FILE command reports .debuginfo files as "ELF", but we don't want
+# those files in the JDK_BIN_LIST file. EXE_SUFFIX is empty on non-Windows.
+	$(FILE) `$(FIND) $(JDK_IMAGE_DIR)/jre/bin -type f ! -name '*.debuginfo' -name \*$(EXE_SUFFIX)` \
 	    | $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@
-	file `$(FIND) $(JDK_IMAGE_DIR)/bin -type f -name \*$(EXE_SUFFIX)` \
+	file `$(FIND) $(JDK_IMAGE_DIR)/bin -type f ! -name '*.debuginfo' -name \*$(EXE_SUFFIX)` \
 	    | $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@
 endif
 
diff --git a/make/java/instrument/Makefile b/make/java/instrument/Makefile
index 76a0553..c81ce67 100644
--- a/make/java/instrument/Makefile
+++ b/make/java/instrument/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
 # Makefile for building the Java Programming Language Instrumentation Services
 # agent, supporting java.lang.instrument
 
+LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../..
 PACKAGE = sun.instrument
 LIBRARY = instrument
diff --git a/make/java/java/reflect/Makefile b/make/java/java/reflect/Makefile
index 40bd886..6dfceb8 100644
--- a/make/java/java/reflect/Makefile
+++ b/make/java/java/reflect/Makefile
@@ -36,7 +36,7 @@
 #
 # Files to compile.
 #
-AUTO_FILES_JAVA_DIRS = java/lang/reflect sun/reflect
+AUTO_FILES_JAVA_DIRS = java/lang/reflect sun/reflect java/lang/annotation
 
 #
 # Install .lib file.
diff --git a/make/java/java_crw_demo/Makefile b/make/java/java_crw_demo/Makefile
index ebcadd7..96da00b 100644
--- a/make/java/java_crw_demo/Makefile
+++ b/make/java/java_crw_demo/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
 # questions.
 #
 
+LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../..
 
 LIBRARY = java_crw_demo
diff --git a/make/java/java_hprof_demo/Makefile b/make/java/java_hprof_demo/Makefile
index 9880547..7aab2e4 100644
--- a/make/java/java_hprof_demo/Makefile
+++ b/make/java/java_hprof_demo/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
 # questions.
 #
 
+LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../..
 LIBRARY = hprof
 PRODUCT = sun
diff --git a/make/java/main/java/Makefile b/make/java/main/java/Makefile
index 1766880..1c3478b 100644
--- a/make/java/main/java/Makefile
+++ b/make/java/main/java/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
 # questions.
 #
 
+PROGRAM_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../../..
 PROGRAM = java
 PRODUCT = java
diff --git a/make/java/management/Makefile b/make/java/management/Makefile
index bffb5ed..61b1dc5 100644
--- a/make/java/management/Makefile
+++ b/make/java/management/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
 # questions.
 #
 
+LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../..
 PACKAGE = java.lang.management
 LIBRARY = management
diff --git a/make/java/npt/Makefile b/make/java/npt/Makefile
index e5efd9d..39fdde6 100644
--- a/make/java/npt/Makefile
+++ b/make/java/npt/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
 # questions.
 #
 
+LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../..
 
 # It's currently used by jpda and hprof.  Put it in base module for now.
diff --git a/make/java/verify/Makefile b/make/java/verify/Makefile
index 4343e4a..9100069 100644
--- a/make/java/verify/Makefile
+++ b/make/java/verify/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 # Build libverify.so
 #
 
+LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../..
 PRODUCT = java
 LIBRARY = verify
diff --git a/make/jpda/jdwp/Makefile b/make/jpda/jdwp/Makefile
index 99286ae..fb44007 100644
--- a/make/jpda/jdwp/Makefile
+++ b/make/jpda/jdwp/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 # Makefile for building JDWP
 #
 
+LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../..
 PACKAGE = com.sun.tools.jdwp
 PRODUCT = jpda
diff --git a/make/jpda/transport/socket/Makefile b/make/jpda/transport/socket/Makefile
index 0f7fc2b..6e44f34 100644
--- a/make/jpda/transport/socket/Makefile
+++ b/make/jpda/transport/socket/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 # Makefile for building the JDI back-end implementation
 #
 
+LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../../..
 LIBRARY = dt_socket
 PRODUCT = jbug
diff --git a/make/launchers/Makefile.launcher b/make/launchers/Makefile.launcher
index a290ccf..3183a05 100644
--- a/make/launchers/Makefile.launcher
+++ b/make/launchers/Makefile.launcher
@@ -27,6 +27,8 @@
 # Makefile for building simple launchers
 #
 
+PROGRAM_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ..
 PACKAGE = launcher
 PRODUCT = sun
diff --git a/make/mkdemo/jvmti/compiledMethodLoad/Makefile b/make/mkdemo/jvmti/compiledMethodLoad/Makefile
index b53a1e7..955ad68 100644
--- a/make/mkdemo/jvmti/compiledMethodLoad/Makefile
+++ b/make/mkdemo/jvmti/compiledMethodLoad/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
 # questions.
 #
 
+LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../../..
 PRODUCT = demo/jvmti
 DEMONAME = compiledMethodLoad
diff --git a/make/mkdemo/jvmti/gctest/Makefile b/make/mkdemo/jvmti/gctest/Makefile
index 8423d77..537c073 100644
--- a/make/mkdemo/jvmti/gctest/Makefile
+++ b/make/mkdemo/jvmti/gctest/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
 # questions.
 #
 
+LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../../..
 PRODUCT = demo/jvmti
 DEMONAME = gctest
diff --git a/make/mkdemo/jvmti/heapTracker/Makefile b/make/mkdemo/jvmti/heapTracker/Makefile
index 3e46e5b..e58dccc 100644
--- a/make/mkdemo/jvmti/heapTracker/Makefile
+++ b/make/mkdemo/jvmti/heapTracker/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
 # questions.
 #
 
+LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../../..
 PRODUCT = demo/jvmti
 DEMONAME = heapTracker
diff --git a/make/mkdemo/jvmti/heapViewer/Makefile b/make/mkdemo/jvmti/heapViewer/Makefile
index e697d19..2431f3d 100644
--- a/make/mkdemo/jvmti/heapViewer/Makefile
+++ b/make/mkdemo/jvmti/heapViewer/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
 # questions.
 #
 
+LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../../..
 PRODUCT = demo/jvmti
 DEMONAME = heapViewer
diff --git a/make/mkdemo/jvmti/hprof/Makefile b/make/mkdemo/jvmti/hprof/Makefile
index fca8ec4..29d71b5 100644
--- a/make/mkdemo/jvmti/hprof/Makefile
+++ b/make/mkdemo/jvmti/hprof/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
 # questions.
 #
 
+LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../../..
 PRODUCT = demo/jvmti
 DEMONAME = hprof
diff --git a/make/mkdemo/jvmti/minst/Makefile b/make/mkdemo/jvmti/minst/Makefile
index c73e15e..bc0bd56 100644
--- a/make/mkdemo/jvmti/minst/Makefile
+++ b/make/mkdemo/jvmti/minst/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
 # questions.
 #
 
+LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../../..
 PRODUCT = demo/jvmti
 DEMONAME = minst
diff --git a/make/mkdemo/jvmti/mtrace/Makefile b/make/mkdemo/jvmti/mtrace/Makefile
index e4ec50f..6057c96 100644
--- a/make/mkdemo/jvmti/mtrace/Makefile
+++ b/make/mkdemo/jvmti/mtrace/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
 # questions.
 #
 
+LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../../..
 PRODUCT = demo/jvmti
 DEMONAME = mtrace
diff --git a/make/mkdemo/jvmti/versionCheck/Makefile b/make/mkdemo/jvmti/versionCheck/Makefile
index 0be53f1..a850ba2 100644
--- a/make/mkdemo/jvmti/versionCheck/Makefile
+++ b/make/mkdemo/jvmti/versionCheck/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
 # questions.
 #
 
+LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../../..
 PRODUCT = demo/jvmti
 DEMONAME = versionCheck
diff --git a/make/mkdemo/jvmti/waiters/Makefile b/make/mkdemo/jvmti/waiters/Makefile
index 9929c06..dd850b4 100644
--- a/make/mkdemo/jvmti/waiters/Makefile
+++ b/make/mkdemo/jvmti/waiters/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
 # questions.
 #
 
+LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../../..
 PRODUCT = demo/jvmti
 DEMONAME = waiters
diff --git a/make/sun/font/Makefile b/make/sun/font/Makefile
index 509dad6..5dd35dd 100644
--- a/make/sun/font/Makefile
+++ b/make/sun/font/Makefile
@@ -62,7 +62,7 @@
     java/text/Bidi.java \
     sun/font/FileFont.java \
     sun/font/FileFontStrike.java \
-    sun/font/FontManager.java \
+    sun/font/SunFontManager.java \
     sun/font/GlyphList.java \
     sun/font/NativeFont.java \
     sun/font/StrikeCache.java \
diff --git a/make/sun/font/t2k/Makefile b/make/sun/font/t2k/Makefile
index 71903e0..0827baf 100644
--- a/make/sun/font/t2k/Makefile
+++ b/make/sun/font/t2k/Makefile
@@ -52,7 +52,6 @@
 FILES_export = \
     java/awt/Font.java \
     sun/font/FileFont.java \
-    sun/font/FontManager.java \
     sun/font/GlyphList.java \
     sun/font/NativeFont.java \
     sun/font/StrikeCache.java \
diff --git a/make/sun/tracing/dtrace/Makefile b/make/sun/tracing/dtrace/Makefile
index bf4d68b..c0d3c97 100644
--- a/make/sun/tracing/dtrace/Makefile
+++ b/make/sun/tracing/dtrace/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,9 @@
 #
 # Makefile for building dtrace extension
 #
+
+LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1
+
 BUILDDIR = ../../..
 PACKAGE = sun.tracing.dtrace
 LIBRARY = jsdt
diff --git a/makefiles/common/shared/Defs-utils.gmk b/makefiles/common/shared/Defs-utils.gmk
new file mode 100644
index 0000000..4c38e4b
--- /dev/null
+++ b/makefiles/common/shared/Defs-utils.gmk
@@ -0,0 +1,2 @@
+# Purposely empty for now, should be removed eventually.
+
diff --git a/src/macosx/classes/sun/nio/ch/DefaultSelectorProvider.java b/src/macosx/classes/sun/nio/ch/DefaultSelectorProvider.java
index 16af3aa..e717c6c 100644
--- a/src/macosx/classes/sun/nio/ch/DefaultSelectorProvider.java
+++ b/src/macosx/classes/sun/nio/ch/DefaultSelectorProvider.java
@@ -4,7 +4,9 @@
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * 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
@@ -40,7 +42,7 @@
      * Returns the default SelectorProvider.
      */
     public static SelectorProvider create() {
-            return new sun.nio.ch.PollSelectorProvider();
+        return new sun.nio.ch.KQueueSelectorProvider();
     }
 
 }
diff --git a/src/macosx/classes/sun/nio/ch/KQueueArrayWrapper.java b/src/macosx/classes/sun/nio/ch/KQueueArrayWrapper.java
index 71d098d..7ec35f1 100644
--- a/src/macosx/classes/sun/nio/ch/KQueueArrayWrapper.java
+++ b/src/macosx/classes/sun/nio/ch/KQueueArrayWrapper.java
@@ -4,7 +4,9 @@
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * 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
@@ -64,8 +66,8 @@
     static short FD_OFFSET;
     static short FILTER_OFFSET;
 
-    // kevent array size (just under 1K bytes)
-    static final int NUM_KEVENTS = 50;
+    // kevent array size
+    static final int NUM_KEVENTS = 128;
 
     // Are we in a 64-bit VM?
     static boolean is64bit = false;
diff --git a/src/macosx/classes/sun/nio/ch/KQueueSelectorImpl.java b/src/macosx/classes/sun/nio/ch/KQueueSelectorImpl.java
index 60d523b..b150426 100644
--- a/src/macosx/classes/sun/nio/ch/KQueueSelectorImpl.java
+++ b/src/macosx/classes/sun/nio/ch/KQueueSelectorImpl.java
@@ -4,7 +4,9 @@
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * 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
@@ -49,8 +51,8 @@
     // Count of registered descriptors (including interrupt)
     private int totalChannels;
 
-    // Map from file descriptors to selection keys
-    private HashMap<Integer,SelectionKeyImpl> fdToKey;
+    // Map from a file descriptor to an entry containing the selection key
+    private HashMap<Integer,MapEntry> fdMap;
 
     // True if this Selector has been closed
     private boolean closed = false;
@@ -59,6 +61,20 @@
     private Object interruptLock = new Object();
     private boolean interruptTriggered = false;
 
+    // used by updateSelectedKeys to handle cases where the same file
+    // descriptor is polled by more than one filter
+    private long updateCount;
+
+    // Used to map file descriptors to a selection key and "update count"
+    // (see updateSelectedKeys for usage).
+    private static class MapEntry {
+        SelectionKeyImpl ski;
+        long updateCount;
+        MapEntry(SelectionKeyImpl ski) {
+            this.ski = ski;
+        }
+    }
+
     /**
      * Package private constructor called by factory method in
      * the abstract superclass Selector.
@@ -70,7 +86,7 @@
         fd1 = (int)fds;
         kqueueWrapper = new KQueueArrayWrapper();
         kqueueWrapper.initInterrupt(fd0, fd1);
-        fdToKey = new HashMap<>();
+        fdMap = new HashMap<>();
         totalChannels = 1;
     }
 
@@ -82,8 +98,6 @@
         if (closed)
             throw new ClosedSelectorException();
         processDeregisterQueue();
-        if (timeout == 0  &&  totalChannels == 1)
-            return 0;
         try {
             begin();
             entries = kqueueWrapper.poll(timeout);
@@ -94,10 +108,9 @@
         return updateSelectedKeys(entries);
     }
 
-
     /**
-     * Update the keys whose fd's have been selected by the devpoll
-     * driver. Add the ready keys to the ready queue.
+     * Update the keys whose fd's have been selected by kqueue.
+     * Add the ready keys to the selected key set.
      * If the interrupt fd has been selected, drain it and clear the interrupt.
      */
     private int updateSelectedKeys(int entries)
@@ -106,24 +119,42 @@
         int numKeysUpdated = 0;
         boolean interrupted = false;
 
+        // A file descriptor may be registered with kqueue with more than one
+        // filter and so there may be more than one event for a fd. The update
+        // count in the MapEntry tracks when the fd was last updated and this
+        // ensures that the ready ops are updated rather than replaced by a
+        // second or subsequent event.
+        updateCount++;
+
         for (int i = 0; i < entries; i++) {
             int nextFD = kqueueWrapper.getDescriptor(i);
             if (nextFD == fd0) {
                 interrupted = true;
             } else {
-                SelectionKeyImpl ski = fdToKey.get(new Integer(nextFD));
-                // ski is null in the case of an interrupt
-                if (ski != null) {
+                MapEntry me = fdMap.get(Integer.valueOf(nextFD));
+
+                // entry is null in the case of an interrupt
+                if (me != null) {
                     int rOps = kqueueWrapper.getReventOps(i);
+                    SelectionKeyImpl ski = me.ski;
                     if (selectedKeys.contains(ski)) {
-                        if (ski.channel.translateAndSetReadyOps(rOps, ski)) {
-                            numKeysUpdated++;
+                        // first time this file descriptor has been encountered on this
+                        // update?
+                        if (me.updateCount != updateCount) {
+                            if (ski.channel.translateAndSetReadyOps(rOps, ski)) {
+                                numKeysUpdated++;
+                                me.updateCount = updateCount;
+                            }
+                        } else {
+                            // ready ops have already been set on this update
+                            ski.channel.translateAndUpdateReadyOps(rOps, ski);
                         }
                     } else {
                         ski.channel.translateAndSetReadyOps(rOps, ski);
-                        if ((ski.readyOps() & ski.interestOps()) != 0) {
+                        if ((ski.nioReadyOps() & ski.nioInterestOps()) != 0) {
                             selectedKeys.add(ski);
                             numKeysUpdated++;
+                            me.updateCount = updateCount;
                         }
                     }
                 }
@@ -137,7 +168,6 @@
                 interruptTriggered = false;
             }
         }
-
         return numKeysUpdated;
     }
 
@@ -145,6 +175,12 @@
     protected void implClose() throws IOException {
         if (!closed) {
             closed = true;
+
+            // prevent further wakeup
+            synchronized (interruptLock) {
+                interruptTriggered = true;
+            }
+
             FileDispatcherImpl.closeIntFD(fd0);
             FileDispatcherImpl.closeIntFD(fd1);
             if (kqueueWrapper != null) {
@@ -172,8 +208,10 @@
 
 
     protected void implRegister(SelectionKeyImpl ski) {
+        if (closed)
+            throw new ClosedSelectorException();
         int fd = IOUtil.fdVal(ski.channel.getFD());
-        fdToKey.put(new Integer(fd), ski);
+        fdMap.put(Integer.valueOf(fd), new MapEntry(ski));
         totalChannels++;
         keys.add(ski);
     }
@@ -181,7 +219,7 @@
 
     protected void implDereg(SelectionKeyImpl ski) throws IOException {
         int fd = ski.channel.getFDVal();
-        fdToKey.remove(new Integer(fd));
+        fdMap.remove(Integer.valueOf(fd));
         kqueueWrapper.release(fd);
         totalChannels--;
         keys.remove(ski);
@@ -194,6 +232,8 @@
 
 
     public void putEventOps(SelectionKeyImpl ski, int ops) {
+        if (closed)
+            throw new ClosedSelectorException();
         int fd = IOUtil.fdVal(ski.channel.getFD());
         kqueueWrapper.setInterest(fd, ops);
     }
diff --git a/src/macosx/classes/sun/nio/ch/KQueueSelectorProvider.java b/src/macosx/classes/sun/nio/ch/KQueueSelectorProvider.java
index 6e7b7cf..e07775f 100644
--- a/src/macosx/classes/sun/nio/ch/KQueueSelectorProvider.java
+++ b/src/macosx/classes/sun/nio/ch/KQueueSelectorProvider.java
@@ -4,7 +4,9 @@
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * 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
diff --git a/src/macosx/native/sun/nio/ch/KQueueArrayWrapper.c b/src/macosx/native/sun/nio/ch/KQueueArrayWrapper.c
index a26b317..8d49d9c 100644
--- a/src/macosx/native/sun/nio/ch/KQueueArrayWrapper.c
+++ b/src/macosx/native/sun/nio/ch/KQueueArrayWrapper.c
@@ -4,7 +4,9 @@
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * 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
diff --git a/src/share/classes/com/sun/tools/example/debug/tty/VMConnection.java b/src/share/classes/com/sun/tools/example/debug/tty/VMConnection.java
index 73a075b..34a0037 100644
--- a/src/share/classes/com/sun/tools/example/debug/tty/VMConnection.java
+++ b/src/share/classes/com/sun/tools/example/debug/tty/VMConnection.java
@@ -114,6 +114,23 @@
             String value = token.substring(index + 1,
                                            token.length() - 1); // Remove comma delimiter
 
+            /*
+             * for values enclosed in quotes (single and/or double quotes)
+             * strip off enclosing quote chars
+             * needed for quote enclosed delimited substrings
+             */
+            if (name.equals("options")) {
+                StringBuilder sb = new StringBuilder();
+                for (String s : splitStringAtNonEnclosedWhiteSpace(value)) {
+                    while (isEnclosed(s, "\"") || isEnclosed(s, "'")) {
+                        s = s.substring(1, s.length() - 1);
+                    }
+                    sb.append(s);
+                    sb.append(" ");
+                }
+                value = sb.toString();
+            }
+
             Connector.Argument argument = arguments.get(name);
             if (argument == null) {
                 throw new IllegalArgumentException
@@ -136,6 +153,152 @@
         return arguments;
     }
 
+    private static boolean isEnclosed(String value, String enclosingChar) {
+        if (value.indexOf(enclosingChar) == 0) {
+            int lastIndex = value.lastIndexOf(enclosingChar);
+            if (lastIndex > 0 && lastIndex  == value.length() - 1) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private static List<String> splitStringAtNonEnclosedWhiteSpace(String value) throws IllegalArgumentException {
+        List<String> al = new ArrayList<String>();
+        char[] arr;
+        int startPosition = 0;
+        int endPosition = 0;
+        final char SPACE = ' ';
+        final char DOUBLEQ = '"';
+        final char SINGLEQ = '\'';
+
+        /*
+         * An "open" or "active" enclosing state is where
+         * the first valid start quote qualifier is found,
+         * and there is a search in progress for the
+         * relevant end matching quote
+         *
+         * enclosingTargetChar set to SPACE
+         * is used to signal a non open enclosing state
+         */
+        char enclosingTargetChar = SPACE;
+
+        if (value == null) {
+            throw new IllegalArgumentException
+                (MessageOutput.format("value string is null"));
+        }
+
+        // split parameter string into individual chars
+        arr = value.toCharArray();
+
+        for (int i = 0; i < arr.length; i++) {
+            switch (arr[i]) {
+                case SPACE: {
+                    // do nothing for spaces
+                    // unless last in array
+                    if (isLastChar(arr, i)) {
+                        endPosition = i;
+                        // break for substring creation
+                        break;
+                    }
+                    continue;
+                }
+                case DOUBLEQ:
+                case SINGLEQ: {
+                    if (enclosingTargetChar == arr[i]) {
+                        // potential match to close open enclosing
+                        if (isNextCharWhitespace(arr, i)) {
+                            // if peek next is whitespace
+                            // then enclosing is a valid substring
+                            endPosition = i;
+                            // reset enclosing target char
+                            enclosingTargetChar = SPACE;
+                            // break for substring creation
+                            break;
+                        }
+                    }
+                    if (enclosingTargetChar == SPACE) {
+                        // no open enclosing state
+                        // handle as normal char
+                        if (isPreviousCharWhitespace(arr, i)) {
+                            startPosition = i;
+                            // peek forward for end candidates
+                            if (value.indexOf(arr[i], i + 1) >= 0) {
+                                // set open enclosing state by
+                                // setting up the target char
+                                enclosingTargetChar = arr[i];
+                            } else {
+                                // no more target chars left to match
+                                // end enclosing, handle as normal char
+                                if (isNextCharWhitespace(arr, i)) {
+                                    endPosition = i;
+                                    // break for substring creation
+                                    break;
+                                }
+                            }
+                        }
+                    }
+                    continue;
+                }
+                default: {
+                    // normal non-space, non-" and non-' chars
+                    if (enclosingTargetChar == SPACE) {
+                        // no open enclosing state
+                        if (isPreviousCharWhitespace(arr, i)) {
+                            // start of space delim substring
+                            startPosition = i;
+                        }
+                        if (isNextCharWhitespace(arr, i)) {
+                            // end of space delim substring
+                            endPosition = i;
+                            // break for substring creation
+                            break;
+                        }
+                    }
+                    continue;
+                }
+            }
+
+            // break's end up here
+            if (startPosition > endPosition) {
+                throw new IllegalArgumentException
+                    (MessageOutput.format("Illegal option values"));
+            }
+
+            // extract substring and add to List<String>
+            al.add(value.substring(startPosition, ++endPosition));
+
+            // set new start position
+            i = startPosition = endPosition;
+
+        } // for loop
+
+        return al;
+    }
+
+    static private boolean isPreviousCharWhitespace(char[] arr, int curr_pos) {
+        return isCharWhitespace(arr, curr_pos - 1);
+    }
+
+    static private boolean isNextCharWhitespace(char[] arr, int curr_pos) {
+        return isCharWhitespace(arr, curr_pos + 1);
+    }
+
+    static private boolean isCharWhitespace(char[] arr, int pos) {
+        if (pos < 0 || pos >= arr.length) {
+            // outside arraybounds is considered an implicit space
+            return true;
+        }
+        if (arr[pos] == ' ') {
+            return true;
+        }
+        return false;
+    }
+
+    static private boolean isLastChar(char[] arr, int pos) {
+        return (pos + 1 == arr.length);
+    }
+
     VMConnection(String connectSpec, int traceFlags) {
         String nameString;
         String argString;
diff --git a/src/share/classes/java/net/HttpCookie.java b/src/share/classes/java/net/HttpCookie.java
index bb12564..1963e1f 100644
--- a/src/share/classes/java/net/HttpCookie.java
+++ b/src/share/classes/java/net/HttpCookie.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -616,9 +616,6 @@
      *   would be accepted.</li>
      *   <li>A Set-Cookie2 with Domain=.com or Domain=.com., will always be
      *   rejected, because there is no embedded dot.</li>
-     *   <li>A Set-Cookie2 with Domain=ajax.com will be accepted, and the
-     *   value for Domain will be taken to be .ajax.com, because a dot
-     *   gets prepended to the value.</li>
      *   <li>A Set-Cookie2 from request-host example for Domain=.local will
      *   be accepted, because the effective host name for the request-
      *   host is example.local, and example.local domain-matches .local.</li>
diff --git a/src/share/classes/java/nio/file/Files.java b/src/share/classes/java/nio/file/Files.java
index f46ae4c..e3449b0 100644
--- a/src/share/classes/java/nio/file/Files.java
+++ b/src/share/classes/java/nio/file/Files.java
@@ -269,7 +269,7 @@
      *     WritableByteChannel wbc = Files.newByteChannel(path, EnumSet.of(CREATE,APPEND));
      *
      *     // create file with initial permissions, opening it for both reading and writing
-     *     {@code FileAttribute<<SetPosixFilePermission>> perms = ...}
+     *     {@code FileAttribute<Set<PosixFilePermission>> perms = ...}
      *     SeekableByteChannel sbc = Files.newByteChannel(path, EnumSet.of(CREATE_NEW,READ,WRITE), perms);
      * </pre>
      *
diff --git a/src/share/classes/java/security/CodeSource.java b/src/share/classes/java/security/CodeSource.java
index b821a4e..94cdcef 100644
--- a/src/share/classes/java/security/CodeSource.java
+++ b/src/share/classes/java/security/CodeSource.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -114,7 +114,7 @@
      *
      * @return a hash code value for this object.
      */
-
+    @Override
     public int hashCode() {
         if (location != null)
             return location.hashCode();
@@ -133,6 +133,7 @@
      *
      * @return true if the objects are considered equal, false otherwise.
      */
+    @Override
     public boolean equals(Object obj) {
         if (obj == this)
             return true;
@@ -231,10 +232,10 @@
 
     /**
      * Returns true if this CodeSource object "implies" the specified CodeSource.
-     * <P>
-     * More specifically, this method makes the following checks, in order.
+     * <p>
+     * More specifically, this method makes the following checks.
      * If any fail, it returns false. If they all succeed, it returns true.<p>
-     * <ol>
+     * <ul>
      * <li> <i>codesource</i> must not be null.
      * <li> If this object's certificates are not null, then all
      * of this object's certificates must be present in <i>codesource</i>'s
@@ -242,14 +243,14 @@
      * <li> If this object's location (getLocation()) is not null, then the
      * following checks are made against this object's location and
      * <i>codesource</i>'s:<p>
-     *   <ol>
+     *   <ul>
      *     <li>  <i>codesource</i>'s location must not be null.
      *
      *     <li>  If this object's location
      *           equals <i>codesource</i>'s location, then return true.
      *
      *     <li>  This object's protocol (getLocation().getProtocol()) must be
-     *           equal to <i>codesource</i>'s protocol.
+     *           equal to <i>codesource</i>'s protocol, ignoring case.
      *
      *     <li>  If this object's host (getLocation().getHost()) is not null,
      *           then the SocketPermission
@@ -258,7 +259,8 @@
      *
      *     <li>  If this object's port (getLocation().getPort()) is not
      *           equal to -1 (that is, if a port is specified), it must equal
-     *           <i>codesource</i>'s port.
+     *           <i>codesource</i>'s port or default port
+     *           (codesource.getLocation().getDefaultPort()).
      *
      *     <li>  If this object's file (getLocation().getFile()) doesn't equal
      *           <i>codesource</i>'s file, then the following checks are made:
@@ -275,8 +277,8 @@
      *     <li>  If this object's reference (getLocation().getRef()) is
      *           not null, it must equal <i>codesource</i>'s reference.
      *
-     *   </ol>
-     * </ol>
+     *   </ul>
+     * </ul>
      * <p>
      * For example, the codesource objects with the following locations
      * and null certificates all imply
@@ -369,92 +371,96 @@
      *
      * @param that CodeSource to compare against
      */
-    private boolean matchLocation(CodeSource that)
-        {
-            if (location == null) {
-                return true;
-            }
+    private boolean matchLocation(CodeSource that) {
+        if (location == null)
+            return true;
 
-            if ((that == null) || (that.location == null))
+        if ((that == null) || (that.location == null))
+            return false;
+
+        if (location.equals(that.location))
+            return true;
+
+        if (!location.getProtocol().equalsIgnoreCase(that.location.getProtocol()))
+            return false;
+
+        int thisPort = location.getPort();
+        if (thisPort != -1) {
+            int thatPort = that.location.getPort();
+            int port = thatPort != -1 ? thatPort
+                                      : that.location.getDefaultPort();
+            if (thisPort != port)
                 return false;
-
-            if (location.equals(that.location))
-                return true;
-
-            if (!location.getProtocol().equals(that.location.getProtocol()))
-                return false;
-
-            String thisHost = location.getHost();
-            String thatHost = that.location.getHost();
-
-            if (thisHost != null) {
-                if (("".equals(thisHost) || "localhost".equals(thisHost)) &&
-                    ("".equals(thatHost) || "localhost".equals(thatHost))) {
-                    // ok
-                } else if (!thisHost.equals(thatHost)) {
-                    if (thatHost == null) {
-                        return false;
-                    }
-                    if (this.sp == null) {
-                        this.sp = new SocketPermission(thisHost, "resolve");
-                    }
-                    if (that.sp == null) {
-                        that.sp = new SocketPermission(thatHost, "resolve");
-                    }
-                    if (!this.sp.implies(that.sp)) {
-                        return false;
-                    }
-                }
-            }
-
-            if (location.getPort() != -1) {
-                if (location.getPort() != that.location.getPort())
-                    return false;
-            }
-
-            if (location.getFile().endsWith("/-")) {
-                // Matches the directory and (recursively) all files
-                // and subdirectories contained in that directory.
-                // For example, "/a/b/-" implies anything that starts with
-                // "/a/b/"
-                String thisPath = location.getFile().substring(0,
-                                                location.getFile().length()-1);
-                if (!that.location.getFile().startsWith(thisPath))
-                    return false;
-            } else if (location.getFile().endsWith("/*")) {
-                // Matches the directory and all the files contained in that
-                // directory.
-                // For example, "/a/b/*" implies anything that starts with
-                // "/a/b/" but has no further slashes
-                int last = that.location.getFile().lastIndexOf('/');
-                if (last == -1)
-                    return false;
-                String thisPath = location.getFile().substring(0,
-                                                location.getFile().length()-1);
-                String thatPath = that.location.getFile().substring(0, last+1);
-                if (!thatPath.equals(thisPath))
-                    return false;
-            } else {
-                // Exact matches only.
-                // For example, "/a/b" and "/a/b/" both imply "/a/b/"
-                if ((!that.location.getFile().equals(location.getFile()))
-                && (!that.location.getFile().equals(location.getFile()+"/"))) {
-                    return false;
-                }
-            }
-
-            if (location.getRef() == null)
-                return true;
-            else
-                return location.getRef().equals(that.location.getRef());
         }
 
+        if (location.getFile().endsWith("/-")) {
+            // Matches the directory and (recursively) all files
+            // and subdirectories contained in that directory.
+            // For example, "/a/b/-" implies anything that starts with
+            // "/a/b/"
+            String thisPath = location.getFile().substring(0,
+                                            location.getFile().length()-1);
+            if (!that.location.getFile().startsWith(thisPath))
+                return false;
+        } else if (location.getFile().endsWith("/*")) {
+            // Matches the directory and all the files contained in that
+            // directory.
+            // For example, "/a/b/*" implies anything that starts with
+            // "/a/b/" but has no further slashes
+            int last = that.location.getFile().lastIndexOf('/');
+            if (last == -1)
+                return false;
+            String thisPath = location.getFile().substring(0,
+                                            location.getFile().length()-1);
+            String thatPath = that.location.getFile().substring(0, last+1);
+            if (!thatPath.equals(thisPath))
+                return false;
+        } else {
+            // Exact matches only.
+            // For example, "/a/b" and "/a/b/" both imply "/a/b/"
+            if ((!that.location.getFile().equals(location.getFile()))
+                && (!that.location.getFile().equals(location.getFile()+"/"))) {
+                return false;
+            }
+        }
+
+        if (location.getRef() != null
+            && !location.getRef().equals(that.location.getRef())) {
+            return false;
+        }
+
+        String thisHost = location.getHost();
+        String thatHost = that.location.getHost();
+        if (thisHost != null) {
+            if (("".equals(thisHost) || "localhost".equals(thisHost)) &&
+                ("".equals(thatHost) || "localhost".equals(thatHost))) {
+                // ok
+            } else if (!thisHost.equals(thatHost)) {
+                if (thatHost == null) {
+                    return false;
+                }
+                if (this.sp == null) {
+                    this.sp = new SocketPermission(thisHost, "resolve");
+                }
+                if (that.sp == null) {
+                    that.sp = new SocketPermission(thatHost, "resolve");
+                }
+                if (!this.sp.implies(that.sp)) {
+                    return false;
+                }
+            }
+        }
+        // everything matches
+        return true;
+    }
+
     /**
      * Returns a string describing this CodeSource, telling its
      * URL and certificates.
      *
      * @return information about this CodeSource.
      */
+    @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
         sb.append("(");
diff --git a/src/share/classes/java/util/AbstractCollection.java b/src/share/classes/java/util/AbstractCollection.java
index 2ae70f7..3824f39 100644
--- a/src/share/classes/java/util/AbstractCollection.java
+++ b/src/share/classes/java/util/AbstractCollection.java
@@ -170,6 +170,7 @@
      * @throws ArrayStoreException  {@inheritDoc}
      * @throws NullPointerException {@inheritDoc}
      */
+    @SuppressWarnings("unchecked")
     public <T> T[] toArray(T[] a) {
         // Estimate size of array; be prepared to see more or fewer elements
         int size = size();
@@ -180,13 +181,21 @@
 
         for (int i = 0; i < r.length; i++) {
             if (! it.hasNext()) { // fewer elements than expected
-                if (a != r)
+                if (a == r) {
+                    r[i] = null; // null-terminate
+                } else if (a.length < i) {
                     return Arrays.copyOf(r, i);
-                r[i] = null; // null-terminate
-                return r;
+                } else {
+                    System.arraycopy(r, 0, a, 0, i);
+                    if (a.length > i) {
+                        a[i] = null;
+                    }
+                }
+                return a;
             }
             r[i] = (T)it.next();
         }
+        // more elements than expected
         return it.hasNext() ? finishToArray(r, it) : r;
     }
 
@@ -208,6 +217,7 @@
      * @return array containing the elements in the given array, plus any
      *         further elements returned by the iterator, trimmed to size
      */
+    @SuppressWarnings("unchecked")
     private static <T> T[] finishToArray(T[] r, Iterator<?> it) {
         int i = r.length;
         while (it.hasNext()) {
diff --git a/src/share/classes/java/util/AbstractList.java b/src/share/classes/java/util/AbstractList.java
index 4492166..0b60515 100644
--- a/src/share/classes/java/util/AbstractList.java
+++ b/src/share/classes/java/util/AbstractList.java
@@ -516,7 +516,7 @@
             return false;
 
         ListIterator<E> e1 = listIterator();
-        ListIterator e2 = ((List) o).listIterator();
+        ListIterator<?> e2 = ((List<?>) o).listIterator();
         while (e1.hasNext() && e2.hasNext()) {
             E o1 = e1.next();
             Object o2 = e2.next();
diff --git a/src/share/classes/java/util/AbstractMap.java b/src/share/classes/java/util/AbstractMap.java
index a3ad3d3..aba5048 100644
--- a/src/share/classes/java/util/AbstractMap.java
+++ b/src/share/classes/java/util/AbstractMap.java
@@ -443,7 +443,7 @@
 
         if (!(o instanceof Map))
             return false;
-        Map<K,V> m = (Map<K,V>) o;
+        Map<?,?> m = (Map<?,?>) o;
         if (m.size() != size())
             return false;
 
@@ -534,7 +534,7 @@
      * @return a shallow copy of this map
      */
     protected Object clone() throws CloneNotSupportedException {
-        AbstractMap<K,V> result = (AbstractMap<K,V>)super.clone();
+        AbstractMap<?,?> result = (AbstractMap<?,?>)super.clone();
         result.keySet = null;
         result.values = null;
         return result;
@@ -652,7 +652,7 @@
         public boolean equals(Object o) {
             if (!(o instanceof Map.Entry))
                 return false;
-            Map.Entry e = (Map.Entry)o;
+            Map.Entry<?,?> e = (Map.Entry<?,?>)o;
             return eq(key, e.getKey()) && eq(value, e.getValue());
         }
 
@@ -783,7 +783,7 @@
         public boolean equals(Object o) {
             if (!(o instanceof Map.Entry))
                 return false;
-            Map.Entry e = (Map.Entry)o;
+            Map.Entry<?,?> e = (Map.Entry<?,?>)o;
             return eq(key, e.getKey()) && eq(value, e.getValue());
         }
 
diff --git a/src/share/classes/java/util/AbstractSet.java b/src/share/classes/java/util/AbstractSet.java
index 1f1a49c..03e45ba 100644
--- a/src/share/classes/java/util/AbstractSet.java
+++ b/src/share/classes/java/util/AbstractSet.java
@@ -88,7 +88,7 @@
 
         if (!(o instanceof Set))
             return false;
-        Collection c = (Collection) o;
+        Collection<?> c = (Collection<?>) o;
         if (c.size() != size())
             return false;
         try {
diff --git a/src/share/classes/java/util/ArrayDeque.java b/src/share/classes/java/util/ArrayDeque.java
index eb70aaa..8a9a0ee 100644
--- a/src/share/classes/java/util/ArrayDeque.java
+++ b/src/share/classes/java/util/ArrayDeque.java
@@ -813,7 +813,8 @@
      */
     public ArrayDeque<E> clone() {
         try {
-            ArrayDeque<E> result = (ArrayDeque<E>) super.clone();
+            @SuppressWarnings("unchecked")
+                ArrayDeque<E> result = (ArrayDeque<E>) super.clone();
             result.elements = Arrays.copyOf(elements, elements.length);
             return result;
 
@@ -849,6 +850,7 @@
     /**
      * Deserialize this deque.
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream s)
             throws IOException, ClassNotFoundException {
         s.defaultReadObject();
diff --git a/src/share/classes/java/util/ArrayList.java b/src/share/classes/java/util/ArrayList.java
index 3b02927..eb44bd9 100644
--- a/src/share/classes/java/util/ArrayList.java
+++ b/src/share/classes/java/util/ArrayList.java
@@ -300,8 +300,7 @@
      */
     public Object clone() {
         try {
-            @SuppressWarnings("unchecked")
-                ArrayList<E> v = (ArrayList<E>) super.clone();
+            ArrayList<?> v = (ArrayList<?>) super.clone();
             v.elementData = Arrays.copyOf(elementData, size);
             v.modCount = 0;
             return v;
diff --git a/src/share/classes/java/util/Arrays.java b/src/share/classes/java/util/Arrays.java
index fd408e2..d0c3a60 100644
--- a/src/share/classes/java/util/Arrays.java
+++ b/src/share/classes/java/util/Arrays.java
@@ -560,6 +560,7 @@
      * off is the offset to generate corresponding low, high in src
      * To be removed in a future release.
      */
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     private static void mergeSort(Object[] src,
                                   Object[] dest,
                                   int low,
@@ -746,6 +747,7 @@
      * off is the offset into src corresponding to low in dest
      * To be removed in a future release.
      */
+    @SuppressWarnings({ "rawtypes", "unchecked" })
     private static void mergeSort(Object[] src,
                                   Object[] dest,
                                   int low, int high, int off,
@@ -1477,8 +1479,10 @@
 
         while (low <= high) {
             int mid = (low + high) >>> 1;
-            Comparable midVal = (Comparable)a[mid];
-            int cmp = midVal.compareTo(key);
+            @SuppressWarnings("rawtypes")
+                Comparable midVal = (Comparable)a[mid];
+            @SuppressWarnings("unchecked")
+                int cmp = midVal.compareTo(key);
 
             if (cmp < 0)
                 low = mid + 1;
@@ -2215,6 +2219,7 @@
      * @throws NullPointerException if <tt>original</tt> is null
      * @since 1.6
      */
+    @SuppressWarnings("unchecked")
     public static <T> T[] copyOf(T[] original, int newLength) {
         return (T[]) copyOf(original, newLength, original.getClass());
     }
@@ -2242,6 +2247,7 @@
      * @since 1.6
      */
     public static <T,U> T[] copyOf(U[] original, int newLength, Class<? extends T[]> newType) {
+        @SuppressWarnings("unchecked")
         T[] copy = ((Object)newType == (Object)Object[].class)
             ? (T[]) new Object[newLength]
             : (T[]) Array.newInstance(newType.getComponentType(), newLength);
@@ -2470,8 +2476,9 @@
      * @throws NullPointerException if <tt>original</tt> is null
      * @since 1.6
      */
+    @SuppressWarnings("unchecked")
     public static <T> T[] copyOfRange(T[] original, int from, int to) {
-        return copyOfRange(original, from, to, (Class<T[]>) original.getClass());
+        return copyOfRange(original, from, to, (Class<? extends T[]>) original.getClass());
     }
 
     /**
@@ -2509,6 +2516,7 @@
         int newLength = to - from;
         if (newLength < 0)
             throw new IllegalArgumentException(from + " > " + to);
+        @SuppressWarnings("unchecked")
         T[] copy = ((Object)newType == (Object)Object[].class)
             ? (T[]) new Object[newLength]
             : (T[]) Array.newInstance(newType.getComponentType(), newLength);
@@ -2851,6 +2859,7 @@
             return a.clone();
         }
 
+        @SuppressWarnings("unchecked")
         public <T> T[] toArray(T[] a) {
             int size = size();
             if (a.length < size)
@@ -3634,7 +3643,7 @@
             if (element == null) {
                 buf.append("null");
             } else {
-                Class eClass = element.getClass();
+                Class<?> eClass = element.getClass();
 
                 if (eClass.isArray()) {
                     if (eClass == byte[].class)
diff --git a/src/share/classes/java/util/Calendar.java b/src/share/classes/java/util/Calendar.java
index 21de734..0e04b22 100644
--- a/src/share/classes/java/util/Calendar.java
+++ b/src/share/classes/java/util/Calendar.java
@@ -840,7 +840,7 @@
      * of a Locale.
      */
     private static final ConcurrentMap<Locale, int[]> cachedLocaleData
-        = new ConcurrentHashMap<Locale, int[]>(3);
+        = new ConcurrentHashMap<>(3);
 
     // Special values of stamp[]
     /**
@@ -1499,7 +1499,7 @@
         DateFormatSymbols symbols = DateFormatSymbols.getInstance(locale);
         String[] strings = getFieldStrings(field, style, symbols);
         if (strings != null) {
-            Map<String,Integer> names = new HashMap<String,Integer>();
+            Map<String,Integer> names = new HashMap<>();
             for (int i = 0; i < strings.length; i++) {
                 if (strings[i].length() == 0) {
                     continue;
diff --git a/src/share/classes/java/util/Collections.java b/src/share/classes/java/util/Collections.java
index d18d568..5332603 100644
--- a/src/share/classes/java/util/Collections.java
+++ b/src/share/classes/java/util/Collections.java
@@ -150,6 +150,7 @@
      *         detects that the natural ordering of the list elements is
      *         found to violate the {@link Comparable} contract
      */
+    @SuppressWarnings("unchecked")
     public static <T extends Comparable<? super T>> void sort(List<T> list) {
         Object[] a = list.toArray();
         Arrays.sort(a);
@@ -212,13 +213,14 @@
      * @throws IllegalArgumentException (optional) if the comparator is
      *         found to violate the {@link Comparator} contract
      */
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     public static <T> void sort(List<T> list, Comparator<? super T> c) {
         Object[] a = list.toArray();
         Arrays.sort(a, (Comparator)c);
-        ListIterator i = list.listIterator();
+        ListIterator<T> i = list.listIterator();
         for (int j=0; j<a.length; j++) {
             i.next();
-            i.set(a[j]);
+            i.set((T)a[j]);
         }
     }
 
@@ -357,9 +359,10 @@
      *         or the search key is not mutually comparable with the
      *         elements of the list using this comparator.
      */
+    @SuppressWarnings("unchecked")
     public static <T> int binarySearch(List<? extends T> list, T key, Comparator<? super T> c) {
         if (c==null)
-            return binarySearch((List) list, key);
+            return binarySearch((List<? extends Comparable<? super T>>) list, key);
 
         if (list instanceof RandomAccess || list.size()<BINARYSEARCH_THRESHOLD)
             return Collections.indexedBinarySearch(list, key, c);
@@ -406,9 +409,6 @@
         return -(low + 1);  // key not found
     }
 
-    private interface SelfComparable extends Comparable<SelfComparable> {}
-
-
     /**
      * Reverses the order of the elements in the specified list.<p>
      *
@@ -418,12 +418,16 @@
      * @throws UnsupportedOperationException if the specified list or
      *         its list-iterator does not support the <tt>set</tt> operation.
      */
+    @SuppressWarnings({ "rawtypes", "unchecked" })
     public static void reverse(List<?> list) {
         int size = list.size();
         if (size < REVERSE_THRESHOLD || list instanceof RandomAccess) {
             for (int i=0, mid=size>>1, j=size-1; i<mid; i++, j--)
                 swap(list, i, j);
         } else {
+            // instead of using a raw type here, it's possible to capture
+            // the wildcard but it will require a call to a supplementary
+            // private method
             ListIterator fwd = list.listIterator();
             ListIterator rev = list.listIterator(size);
             for (int i=0, mid=list.size()>>1; i<mid; i++) {
@@ -493,6 +497,7 @@
      * @throws UnsupportedOperationException if the specified list or its
      *         list-iterator does not support the <tt>set</tt> operation.
      */
+    @SuppressWarnings({ "rawtypes", "unchecked" })
     public static void shuffle(List<?> list, Random rnd) {
         int size = list.size();
         if (size < SHUFFLE_THRESHOLD || list instanceof RandomAccess) {
@@ -506,6 +511,9 @@
                 swap(arr, i-1, rnd.nextInt(i));
 
             // Dump array back into list
+            // instead of using a raw type here, it's possible to capture
+            // the wildcard but it will require a call to a supplementary
+            // private method
             ListIterator it = list.listIterator();
             for (int i=0; i<arr.length; i++) {
                 it.next();
@@ -527,7 +535,11 @@
      *         || j &lt; 0 || j &gt;= list.size()).
      * @since 1.4
      */
+    @SuppressWarnings({ "rawtypes", "unchecked" })
     public static void swap(List<?> list, int i, int j) {
+        // instead of using a raw type here, it's possible to capture
+        // the wildcard but it will require a call to a supplementary
+        // private method
         final List l = list;
         l.set(i, l.set(j, l.get(i)));
     }
@@ -657,9 +669,10 @@
      * @throws NoSuchElementException if the collection is empty.
      * @see Comparable
      */
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     public static <T> T min(Collection<? extends T> coll, Comparator<? super T> comp) {
         if (comp==null)
-            return (T)min((Collection<SelfComparable>) (Collection) coll);
+            return (T)min((Collection) coll);
 
         Iterator<? extends T> i = coll.iterator();
         T candidate = i.next();
@@ -727,9 +740,10 @@
      * @throws NoSuchElementException if the collection is empty.
      * @see Comparable
      */
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     public static <T> T max(Collection<? extends T> coll, Comparator<? super T> comp) {
         if (comp==null)
-            return (T)max((Collection<SelfComparable>) (Collection) coll);
+            return (T)max((Collection) coll);
 
         Iterator<? extends T> i = coll.iterator();
         T candidate = i.next();
@@ -1389,7 +1403,9 @@
             extends UnmodifiableSet<Map.Entry<K,V>> {
             private static final long serialVersionUID = 7854390611657943733L;
 
+            @SuppressWarnings({ "unchecked", "rawtypes" })
             UnmodifiableEntrySet(Set<? extends Map.Entry<? extends K, ? extends V>> s) {
+                // Need to cast to raw in order to work around a limitation in the type system
                 super((Set)s);
             }
             public Iterator<Map.Entry<K,V>> iterator() {
@@ -1408,13 +1424,15 @@
                 };
             }
 
+            @SuppressWarnings("unchecked")
             public Object[] toArray() {
                 Object[] a = c.toArray();
                 for (int i=0; i<a.length; i++)
-                    a[i] = new UnmodifiableEntry<>((Map.Entry<K,V>)a[i]);
+                    a[i] = new UnmodifiableEntry<>((Map.Entry<? extends K, ? extends V>)a[i]);
                 return a;
             }
 
+            @SuppressWarnings("unchecked")
             public <T> T[] toArray(T[] a) {
                 // We don't pass a to c.toArray, to avoid window of
                 // vulnerability wherein an unscrupulous multithreaded client
@@ -1422,7 +1440,7 @@
                 Object[] arr = c.toArray(a.length==0 ? a : Arrays.copyOf(a, 0));
 
                 for (int i=0; i<arr.length; i++)
-                    arr[i] = new UnmodifiableEntry<>((Map.Entry<K,V>)arr[i]);
+                    arr[i] = new UnmodifiableEntry<>((Map.Entry<? extends K, ? extends V>)arr[i]);
 
                 if (arr.length > a.length)
                     return (T[])arr;
@@ -1464,7 +1482,7 @@
 
                 if (!(o instanceof Set))
                     return false;
-                Set s = (Set) o;
+                Set<?> s = (Set<?>) o;
                 if (s.size() != c.size())
                     return false;
                 return containsAll(s); // Invokes safe containsAll() above
@@ -1493,7 +1511,7 @@
                         return true;
                     if (!(o instanceof Map.Entry))
                         return false;
-                    Map.Entry t = (Map.Entry)o;
+                    Map.Entry<?,?> t = (Map.Entry<?,?>)o;
                     return eq(e.getKey(),   t.getKey()) &&
                            eq(e.getValue(), t.getValue());
                 }
diff --git a/src/share/classes/java/util/ComparableTimSort.java b/src/share/classes/java/util/ComparableTimSort.java
index 22427a2..ae1ab6a 100644
--- a/src/share/classes/java/util/ComparableTimSort.java
+++ b/src/share/classes/java/util/ComparableTimSort.java
@@ -114,7 +114,6 @@
 
         // Allocate temp storage (which may be increased later if necessary)
         int len = a.length;
-        @SuppressWarnings({"unchecked", "UnnecessaryLocalVariable"})
         Object[] newArray = new Object[len < 2 * INITIAL_TMP_STORAGE_LENGTH ?
                                        len >>> 1 : INITIAL_TMP_STORAGE_LENGTH];
         tmp = newArray;
@@ -209,14 +208,13 @@
      * @param start the index of the first element in the range that is
      *        not already known to be sorted ({@code lo <= start <= hi})
      */
-    @SuppressWarnings("fallthrough")
+    @SuppressWarnings({ "fallthrough", "rawtypes", "unchecked" })
     private static void binarySort(Object[] a, int lo, int hi, int start) {
         assert lo <= start && start <= hi;
         if (start == lo)
             start++;
         for ( ; start < hi; start++) {
-            @SuppressWarnings("unchecked")
-            Comparable<Object> pivot = (Comparable) a[start];
+            Comparable pivot = (Comparable) a[start];
 
             // Set left (and right) to the index where a[start] (pivot) belongs
             int left = lo;
@@ -279,7 +277,7 @@
      * @return  the length of the run beginning at the specified position in
      *          the specified array
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     private static int countRunAndMakeAscending(Object[] a, int lo, int hi) {
         assert lo < hi;
         int runHi = lo + 1;
@@ -614,7 +612,7 @@
      *        (must be aBase + aLen)
      * @param len2  length of second run to be merged (must be > 0)
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     private void mergeLo(int base1, int len1, int base2, int len2) {
         assert len1 > 0 && len2 > 0 && base1 + len1 == base2;
 
@@ -731,7 +729,7 @@
      *        (must be aBase + aLen)
      * @param len2  length of second run to be merged (must be > 0)
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     private void mergeHi(int base1, int len1, int base2, int len2) {
         assert len1 > 0 && len2 > 0 && base1 + len1 == base2;
 
@@ -865,7 +863,6 @@
             else
                 newSize = Math.min(newSize, a.length >>> 1);
 
-            @SuppressWarnings({"unchecked", "UnnecessaryLocalVariable"})
             Object[] newArray = new Object[newSize];
             tmp = newArray;
         }
diff --git a/src/share/classes/java/util/Currency.java b/src/share/classes/java/util/Currency.java
index ad241c8..1fbdad4 100644
--- a/src/share/classes/java/util/Currency.java
+++ b/src/share/classes/java/util/Currency.java
@@ -404,7 +404,7 @@
     public static Set<Currency> getAvailableCurrencies() {
         synchronized(Currency.class) {
             if (available == null) {
-                available = new HashSet<Currency>(256);
+                available = new HashSet<>(256);
 
                 // Add simple currencies first
                 for (char c1 = 'A'; c1 <= 'Z'; c1 ++) {
diff --git a/src/share/classes/java/util/EnumMap.java b/src/share/classes/java/util/EnumMap.java
index a7c248f..90046ab 100644
--- a/src/share/classes/java/util/EnumMap.java
+++ b/src/share/classes/java/util/EnumMap.java
@@ -120,11 +120,12 @@
         return (value == null ? NULL : value);
     }
 
+    @SuppressWarnings("unchecked")
     private V unmaskNull(Object value) {
-        return (V) (value == NULL ? null : value);
+        return (V)(value == NULL ? null : value);
     }
 
-    private static final Enum[] ZERO_LENGTH_ENUM_ARRAY = new Enum[0];
+    private static final Enum<?>[] ZERO_LENGTH_ENUM_ARRAY = new Enum<?>[0];
 
     /**
      * Creates an empty enum map with the specified key type.
@@ -218,12 +219,12 @@
      *            key
      */
     public boolean containsKey(Object key) {
-        return isValidKey(key) && vals[((Enum)key).ordinal()] != null;
+        return isValidKey(key) && vals[((Enum<?>)key).ordinal()] != null;
     }
 
     private boolean containsMapping(Object key, Object value) {
         return isValidKey(key) &&
-            maskNull(value).equals(vals[((Enum)key).ordinal()]);
+            maskNull(value).equals(vals[((Enum<?>)key).ordinal()]);
     }
 
     /**
@@ -243,7 +244,7 @@
      */
     public V get(Object key) {
         return (isValidKey(key) ?
-                unmaskNull(vals[((Enum)key).ordinal()]) : null);
+                unmaskNull(vals[((Enum<?>)key).ordinal()]) : null);
     }
 
     // Modification Operations
@@ -285,7 +286,7 @@
     public V remove(Object key) {
         if (!isValidKey(key))
             return null;
-        int index = ((Enum)key).ordinal();
+        int index = ((Enum<?>)key).ordinal();
         Object oldValue = vals[index];
         vals[index] = null;
         if (oldValue != null)
@@ -296,7 +297,7 @@
     private boolean removeMapping(Object key, Object value) {
         if (!isValidKey(key))
             return false;
-        int index = ((Enum)key).ordinal();
+        int index = ((Enum<?>)key).ordinal();
         if (maskNull(value).equals(vals[index])) {
             vals[index] = null;
             size--;
@@ -314,7 +315,7 @@
             return false;
 
         // Cheaper than instanceof Enum followed by getDeclaringClass
-        Class keyClass = key.getClass();
+        Class<?> keyClass = key.getClass();
         return keyClass == keyType || keyClass.getSuperclass() == keyType;
     }
 
@@ -331,8 +332,7 @@
      */
     public void putAll(Map<? extends K, ? extends V> m) {
         if (m instanceof EnumMap) {
-            EnumMap<? extends K, ? extends V> em =
-                (EnumMap<? extends K, ? extends V>)m;
+            EnumMap<?, ?> em = (EnumMap<?, ?>)m;
             if (em.keyType != keyType) {
                 if (em.isEmpty())
                     return;
@@ -476,13 +476,13 @@
         public boolean contains(Object o) {
             if (!(o instanceof Map.Entry))
                 return false;
-            Map.Entry entry = (Map.Entry)o;
+            Map.Entry<?,?> entry = (Map.Entry<?,?>)o;
             return containsMapping(entry.getKey(), entry.getValue());
         }
         public boolean remove(Object o) {
             if (!(o instanceof Map.Entry))
                 return false;
-            Map.Entry entry = (Map.Entry)o;
+            Map.Entry<?,?> entry = (Map.Entry<?,?>)o;
             return removeMapping(entry.getKey(), entry.getValue());
         }
         public int size() {
@@ -610,7 +610,7 @@
                 if (!(o instanceof Map.Entry))
                     return false;
 
-                Map.Entry e = (Map.Entry)o;
+                Map.Entry<?,?> e = (Map.Entry<?,?>)o;
                 V ourValue = unmaskNull(vals[index]);
                 Object hisValue = e.getValue();
                 return (e.getKey() == keyUniverse[index] &&
@@ -655,11 +655,11 @@
         if (this == o)
             return true;
         if (o instanceof EnumMap)
-            return equals((EnumMap)o);
+            return equals((EnumMap<?,?>)o);
         if (!(o instanceof Map))
             return false;
 
-        Map<K,V> m = (Map<K,V>)o;
+        Map<?,?> m = (Map<?,?>)o;
         if (size != m.size())
             return false;
 
@@ -680,7 +680,7 @@
         return true;
     }
 
-    private boolean equals(EnumMap em) {
+    private boolean equals(EnumMap<?,?> em) {
         if (em.keyType != keyType)
             return size == 0 && em.size == 0;
 
@@ -721,6 +721,7 @@
      *
      * @return a shallow copy of this enum map
      */
+    @SuppressWarnings("unchecked")
     public EnumMap<K, V> clone() {
         EnumMap<K, V> result = null;
         try {
@@ -736,7 +737,7 @@
      * Throws an exception if e is not of the correct type for this enum set.
      */
     private void typeCheck(K key) {
-        Class keyClass = key.getClass();
+        Class<?> keyClass = key.getClass();
         if (keyClass != keyType && keyClass.getSuperclass() != keyType)
             throw new ClassCastException(keyClass + " != " + keyType);
     }
@@ -785,6 +786,7 @@
      * Reconstitute the <tt>EnumMap</tt> instance from a stream (i.e.,
      * deserialize it).
      */
+    @SuppressWarnings("unchecked")
     private void readObject(java.io.ObjectInputStream s)
         throws java.io.IOException, ClassNotFoundException
     {
diff --git a/src/share/classes/java/util/EnumSet.java b/src/share/classes/java/util/EnumSet.java
index 2c6a52a..dab4bd7 100644
--- a/src/share/classes/java/util/EnumSet.java
+++ b/src/share/classes/java/util/EnumSet.java
@@ -88,11 +88,11 @@
     /**
      * All of the values comprising T.  (Cached for performance.)
      */
-    final Enum[] universe;
+    final Enum<?>[] universe;
 
-    private static Enum[] ZERO_LENGTH_ENUM_ARRAY = new Enum[0];
+    private static Enum<?>[] ZERO_LENGTH_ENUM_ARRAY = new Enum<?>[0];
 
-    EnumSet(Class<E>elementType, Enum[] universe) {
+    EnumSet(Class<E>elementType, Enum<?>[] universe) {
         this.elementType = elementType;
         this.universe    = universe;
     }
@@ -105,7 +105,7 @@
      * @throws NullPointerException if <tt>elementType</tt> is null
      */
     public static <E extends Enum<E>> EnumSet<E> noneOf(Class<E> elementType) {
-        Enum[] universe = getUniverse(elementType);
+        Enum<?>[] universe = getUniverse(elementType);
         if (universe == null)
             throw new ClassCastException(elementType + " not an enum");
 
@@ -358,6 +358,7 @@
      *
      * @return a copy of this set
      */
+    @SuppressWarnings("unchecked")
     public EnumSet<E> clone() {
         try {
             return (EnumSet<E>) super.clone();
@@ -375,7 +376,7 @@
      * Throws an exception if e is not of the correct type for this enum set.
      */
     final void typeCheck(E e) {
-        Class eClass = e.getClass();
+        Class<?> eClass = e.getClass();
         if (eClass != elementType && eClass.getSuperclass() != elementType)
             throw new ClassCastException(eClass + " != " + elementType);
     }
@@ -413,16 +414,19 @@
          *
          * @serial
          */
-        private final Enum[] elements;
+        private final Enum<?>[] elements;
 
         SerializationProxy(EnumSet<E> set) {
             elementType = set.elementType;
             elements = set.toArray(ZERO_LENGTH_ENUM_ARRAY);
         }
 
+        // instead of cast to E, we should perhaps use elementType.cast()
+        // to avoid injection of forged stream, but it will slow the implementation
+        @SuppressWarnings("unchecked")
         private Object readResolve() {
             EnumSet<E> result = EnumSet.noneOf(elementType);
-            for (Enum e : elements)
+            for (Enum<?> e : elements)
                 result.add((E)e);
             return result;
         }
diff --git a/src/share/classes/java/util/HashMap.java b/src/share/classes/java/util/HashMap.java
index 916d695..efc707f 100644
--- a/src/share/classes/java/util/HashMap.java
+++ b/src/share/classes/java/util/HashMap.java
@@ -146,7 +146,7 @@
     /**
      * The table, resized as necessary. Length MUST Always be a power of two.
      */
-    transient Entry[] table;
+    transient Entry<?,?>[] table;
 
     /**
      * The number of key-value mappings contained in this map.
@@ -311,16 +311,17 @@
      *
      * @see #put(Object, Object)
      */
+    @SuppressWarnings("unchecked")
     public V get(Object key) {
         if (key == null)
-            return getForNullKey();
+            return (V)getForNullKey();
         int hash = hash(key.hashCode());
-        for (Entry<K,V> e = table[indexFor(hash, table.length)];
+        for (Entry<?,?> e = table[indexFor(hash, table.length)];
              e != null;
              e = e.next) {
             Object k;
             if (e.hash == hash && ((k = e.key) == key || key.equals(k)))
-                return e.value;
+                return (V)e.value;
         }
         return null;
     }
@@ -332,8 +333,8 @@
      * operations (get and put), but incorporated with conditionals in
      * others.
      */
-    private V getForNullKey() {
-        for (Entry<K,V> e = table[0]; e != null; e = e.next) {
+    private Object getForNullKey() {
+        for (Entry<?,?> e = table[0]; e != null; e = e.next) {
             if (e.key == null)
                 return e.value;
         }
@@ -357,15 +358,16 @@
      * HashMap.  Returns null if the HashMap contains no mapping
      * for the key.
      */
+    @SuppressWarnings("unchecked")
     final Entry<K,V> getEntry(Object key) {
         int hash = (key == null) ? 0 : hash(key.hashCode());
-        for (Entry<K,V> e = table[indexFor(hash, table.length)];
+        for (Entry<?,?> e = table[indexFor(hash, table.length)];
              e != null;
              e = e.next) {
             Object k;
             if (e.hash == hash &&
                 ((k = e.key) == key || (key != null && key.equals(k))))
-                return e;
+                return (Entry<K,V>)e;
         }
         return null;
     }
@@ -388,7 +390,9 @@
             return putForNullKey(value);
         int hash = hash(key.hashCode());
         int i = indexFor(hash, table.length);
-        for (Entry<K,V> e = table[i]; e != null; e = e.next) {
+        @SuppressWarnings("unchecked")
+        Entry<K,V> e = (Entry<K,V>)table[i];
+        for(; e != null; e = e.next) {
             Object k;
             if (e.hash == hash && ((k = e.key) == key || key.equals(k))) {
                 V oldValue = e.value;
@@ -407,7 +411,9 @@
      * Offloaded version of put for null keys
      */
     private V putForNullKey(V value) {
-        for (Entry<K,V> e = table[0]; e != null; e = e.next) {
+        @SuppressWarnings("unchecked")
+        Entry<K,V> e = (Entry<K,V>)table[0];
+        for(; e != null; e = e.next) {
             if (e.key == null) {
                 V oldValue = e.value;
                 e.value = value;
@@ -435,7 +441,8 @@
          * clone or deserialize.  It will only happen for construction if the
          * input Map is a sorted map whose ordering is inconsistent w/ equals.
          */
-        for (Entry<K,V> e = table[i]; e != null; e = e.next) {
+        for (@SuppressWarnings("unchecked")
+             Entry<?,V> e = (Entry<?,V>)table[i]; e != null; e = e.next) {
             Object k;
             if (e.hash == hash &&
                 ((k = e.key) == key || (key != null && key.equals(k)))) {
@@ -467,14 +474,14 @@
      *        is irrelevant).
      */
     void resize(int newCapacity) {
-        Entry[] oldTable = table;
+        Entry<?,?>[] oldTable = table;
         int oldCapacity = oldTable.length;
         if (oldCapacity == MAXIMUM_CAPACITY) {
             threshold = Integer.MAX_VALUE;
             return;
         }
 
-        Entry[] newTable = new Entry[newCapacity];
+        Entry<?,?>[] newTable = new Entry<?,?>[newCapacity];
         transfer(newTable);
         table = newTable;
         threshold = (int)(newCapacity * loadFactor);
@@ -483,17 +490,18 @@
     /**
      * Transfers all entries from current table to newTable.
      */
-    void transfer(Entry[] newTable) {
-        Entry[] src = table;
+    @SuppressWarnings("unchecked")
+    void transfer(Entry<?,?>[] newTable) {
+        Entry<?,?>[] src = table;
         int newCapacity = newTable.length;
         for (int j = 0; j < src.length; j++) {
-            Entry<K,V> e = src[j];
+            Entry<K,V> e = (Entry<K,V>)src[j];
             if (e != null) {
                 src[j] = null;
                 do {
                     Entry<K,V> next = e.next;
                     int i = indexFor(e.hash, newCapacity);
-                    e.next = newTable[i];
+                    e.next = (Entry<K,V>)newTable[i];
                     newTable[i] = e;
                     e = next;
                 } while (e != null);
@@ -560,7 +568,8 @@
     final Entry<K,V> removeEntryForKey(Object key) {
         int hash = (key == null) ? 0 : hash(key.hashCode());
         int i = indexFor(hash, table.length);
-        Entry<K,V> prev = table[i];
+        @SuppressWarnings("unchecked")
+            Entry<K,V> prev = (Entry<K,V>)table[i];
         Entry<K,V> e = prev;
 
         while (e != null) {
@@ -591,11 +600,12 @@
         if (!(o instanceof Map.Entry))
             return null;
 
-        Map.Entry<K,V> entry = (Map.Entry<K,V>) o;
+        Map.Entry<?,?> entry = (Map.Entry<?,?>) o;
         Object key = entry.getKey();
         int hash = (key == null) ? 0 : hash(key.hashCode());
         int i = indexFor(hash, table.length);
-        Entry<K,V> prev = table[i];
+        @SuppressWarnings("unchecked")
+            Entry<K,V> prev = (Entry<K,V>)table[i];
         Entry<K,V> e = prev;
 
         while (e != null) {
@@ -623,7 +633,7 @@
      */
     public void clear() {
         modCount++;
-        Entry[] tab = table;
+        Entry<?,?>[] tab = table;
         for (int i = 0; i < tab.length; i++)
             tab[i] = null;
         size = 0;
@@ -641,9 +651,9 @@
         if (value == null)
             return containsNullValue();
 
-        Entry[] tab = table;
+        Entry<?,?>[] tab = table;
         for (int i = 0; i < tab.length ; i++)
-            for (Entry e = tab[i] ; e != null ; e = e.next)
+            for (Entry<?,?> e = tab[i] ; e != null ; e = e.next)
                 if (value.equals(e.value))
                     return true;
         return false;
@@ -653,9 +663,9 @@
      * Special-case code for containsValue with null argument
      */
     private boolean containsNullValue() {
-        Entry[] tab = table;
+        Entry<?,?>[] tab = table;
         for (int i = 0; i < tab.length ; i++)
-            for (Entry e = tab[i] ; e != null ; e = e.next)
+            for (Entry<?,?> e = tab[i] ; e != null ; e = e.next)
                 if (e.value == null)
                     return true;
         return false;
@@ -667,6 +677,7 @@
      *
      * @return a shallow copy of this map
      */
+    @SuppressWarnings("unchecked")
     public Object clone() {
         HashMap<K,V> result = null;
         try {
@@ -674,7 +685,7 @@
         } catch (CloneNotSupportedException e) {
             // assert false;
         }
-        result.table = new Entry[table.length];
+        result.table = new Entry<?,?>[table.length];
         result.entrySet = null;
         result.modCount = 0;
         result.size = 0;
@@ -717,7 +728,7 @@
         public final boolean equals(Object o) {
             if (!(o instanceof Map.Entry))
                 return false;
-            Map.Entry e = (Map.Entry)o;
+            Map.Entry<?,?> e = (Map.Entry<?,?>)o;
             Object k1 = getKey();
             Object k2 = e.getKey();
             if (k1 == k2 || (k1 != null && k1.equals(k2))) {
@@ -762,7 +773,8 @@
      * Subclass overrides this to alter the behavior of put method.
      */
     void addEntry(int hash, K key, V value, int bucketIndex) {
-        Entry<K,V> e = table[bucketIndex];
+        @SuppressWarnings("unchecked")
+            Entry<K,V> e = (Entry<K,V>)table[bucketIndex];
         table[bucketIndex] = new Entry<>(hash, key, value, e);
         if (size++ >= threshold)
             resize(2 * table.length);
@@ -777,21 +789,22 @@
      * clone, and readObject.
      */
     void createEntry(int hash, K key, V value, int bucketIndex) {
-        Entry<K,V> e = table[bucketIndex];
+        @SuppressWarnings("unchecked")
+            Entry<K,V> e = (Entry<K,V>)table[bucketIndex];
         table[bucketIndex] = new Entry<>(hash, key, value, e);
         size++;
     }
 
     private abstract class HashIterator<E> implements Iterator<E> {
-        Entry<K,V> next;        // next entry to return
+        Entry<?,?> next;        // next entry to return
         int expectedModCount;   // For fast-fail
         int index;              // current slot
-        Entry<K,V> current;     // current entry
+        Entry<?,?> current;     // current entry
 
         HashIterator() {
             expectedModCount = modCount;
             if (size > 0) { // advance to first entry
-                Entry[] t = table;
+                Entry<?,?>[] t = table;
                 while (index < t.length && (next = t[index++]) == null)
                     ;
             }
@@ -801,20 +814,21 @@
             return next != null;
         }
 
+        @SuppressWarnings("unchecked")
         final Entry<K,V> nextEntry() {
             if (modCount != expectedModCount)
                 throw new ConcurrentModificationException();
-            Entry<K,V> e = next;
+            Entry<?,?> e = next;
             if (e == null)
                 throw new NoSuchElementException();
 
             if ((next = e.next) == null) {
-                Entry[] t = table;
+                Entry<?,?>[] t = table;
                 while (index < t.length && (next = t[index++]) == null)
                     ;
             }
             current = e;
-            return e;
+            return (Entry<K,V>)e;
         }
 
         public void remove() {
@@ -965,7 +979,7 @@
         public boolean contains(Object o) {
             if (!(o instanceof Map.Entry))
                 return false;
-            Map.Entry<K,V> e = (Map.Entry<K,V>) o;
+            Map.Entry<?,?> e = (Map.Entry<?,?>) o;
             Entry<K,V> candidate = getEntry(e.getKey());
             return candidate != null && candidate.equals(e);
         }
@@ -1039,8 +1053,10 @@
 
         // Read the keys and values, and put the mappings in the HashMap
         for (int i=0; i<size; i++) {
-            K key = (K) s.readObject();
-            V value = (V) s.readObject();
+            @SuppressWarnings("unchecked")
+                K key = (K) s.readObject();
+            @SuppressWarnings("unchecked")
+                V value = (V) s.readObject();
             putForCreate(key, value);
         }
     }
diff --git a/src/share/classes/java/util/HashSet.java b/src/share/classes/java/util/HashSet.java
index ba6ea97..c8622fb 100644
--- a/src/share/classes/java/util/HashSet.java
+++ b/src/share/classes/java/util/HashSet.java
@@ -247,6 +247,7 @@
      *
      * @return a shallow copy of this set
      */
+    @SuppressWarnings("unchecked")
     public Object clone() {
         try {
             HashSet<E> newSet = (HashSet<E>) super.clone();
@@ -296,7 +297,7 @@
         // Read in HashMap capacity and load factor and create backing HashMap
         int capacity = s.readInt();
         float loadFactor = s.readFloat();
-        map = (((HashSet)this) instanceof LinkedHashSet ?
+        map = (((HashSet<?>)this) instanceof LinkedHashSet ?
                new LinkedHashMap<E,Object>(capacity, loadFactor) :
                new HashMap<E,Object>(capacity, loadFactor));
 
@@ -305,7 +306,8 @@
 
         // Read in all elements in the proper order.
         for (int i=0; i<size; i++) {
-            E e = (E) s.readObject();
+            @SuppressWarnings("unchecked")
+                E e = (E) s.readObject();
             map.put(e, PRESENT);
         }
     }
diff --git a/src/share/classes/java/util/Hashtable.java b/src/share/classes/java/util/Hashtable.java
index e134716..d0b9d46 100644
--- a/src/share/classes/java/util/Hashtable.java
+++ b/src/share/classes/java/util/Hashtable.java
@@ -129,7 +129,7 @@
     /**
      * The hash table data.
      */
-    private transient Entry[] table;
+    private transient Entry<?,?>[] table;
 
     /**
      * The total number of entries in the hash table.
@@ -182,7 +182,7 @@
         if (initialCapacity==0)
             initialCapacity = 1;
         this.loadFactor = loadFactor;
-        table = new Entry[initialCapacity];
+        table = new Entry<?,?>[initialCapacity];
         threshold = (int)(initialCapacity * loadFactor);
     }
 
@@ -288,9 +288,9 @@
             throw new NullPointerException();
         }
 
-        Entry tab[] = table;
+        Entry<?,?> tab[] = table;
         for (int i = tab.length ; i-- > 0 ;) {
-            for (Entry<K,V> e = tab[i] ; e != null ; e = e.next) {
+            for (Entry<?,?> e = tab[i] ; e != null ; e = e.next) {
                 if (e.value.equals(value)) {
                     return true;
                 }
@@ -326,10 +326,10 @@
      * @see     #contains(Object)
      */
     public synchronized boolean containsKey(Object key) {
-        Entry tab[] = table;
+        Entry<?,?> tab[] = table;
         int hash = key.hashCode();
         int index = (hash & 0x7FFFFFFF) % tab.length;
-        for (Entry<K,V> e = tab[index] ; e != null ; e = e.next) {
+        for (Entry<?,?> e = tab[index] ; e != null ; e = e.next) {
             if ((e.hash == hash) && e.key.equals(key)) {
                 return true;
             }
@@ -352,13 +352,14 @@
      * @throws NullPointerException if the specified key is null
      * @see     #put(Object, Object)
      */
+    @SuppressWarnings("unchecked")
     public synchronized V get(Object key) {
-        Entry tab[] = table;
+        Entry<?,?> tab[] = table;
         int hash = key.hashCode();
         int index = (hash & 0x7FFFFFFF) % tab.length;
-        for (Entry<K,V> e = tab[index] ; e != null ; e = e.next) {
+        for (Entry<?,?> e = tab[index] ; e != null ; e = e.next) {
             if ((e.hash == hash) && e.key.equals(key)) {
-                return e.value;
+                return (V)e.value;
             }
         }
         return null;
@@ -379,9 +380,10 @@
      * number of keys in the hashtable exceeds this hashtable's capacity
      * and load factor.
      */
+    @SuppressWarnings("unchecked")
     protected void rehash() {
         int oldCapacity = table.length;
-        Entry[] oldMap = table;
+        Entry<?,?>[] oldMap = table;
 
         // overflow-conscious code
         int newCapacity = (oldCapacity << 1) + 1;
@@ -391,19 +393,19 @@
                 return;
             newCapacity = MAX_ARRAY_SIZE;
         }
-        Entry[] newMap = new Entry[newCapacity];
+        Entry<?,?>[] newMap = new Entry<?,?>[newCapacity];
 
         modCount++;
         threshold = (int)(newCapacity * loadFactor);
         table = newMap;
 
         for (int i = oldCapacity ; i-- > 0 ;) {
-            for (Entry<K,V> old = oldMap[i] ; old != null ; ) {
+            for (Entry<K,V> old = (Entry<K,V>)oldMap[i] ; old != null ; ) {
                 Entry<K,V> e = old;
                 old = old.next;
 
                 int index = (e.hash & 0x7FFFFFFF) % newCapacity;
-                e.next = newMap[index];
+                e.next = (Entry<K,V>)newMap[index];
                 newMap[index] = e;
             }
         }
@@ -433,13 +435,15 @@
         }
 
         // Makes sure the key is not already in the hashtable.
-        Entry tab[] = table;
+        Entry<?,?> tab[] = table;
         int hash = key.hashCode();
         int index = (hash & 0x7FFFFFFF) % tab.length;
-        for (Entry<K,V> e = tab[index] ; e != null ; e = e.next) {
-            if ((e.hash == hash) && e.key.equals(key)) {
-                V old = e.value;
-                e.value = value;
+        @SuppressWarnings("unchecked")
+        Entry<K,V> entry = (Entry<K,V>)tab[index];
+        for(; entry != null ; entry = entry.next) {
+            if ((entry.hash == hash) && entry.key.equals(key)) {
+                V old = entry.value;
+                entry.value = value;
                 return old;
             }
         }
@@ -454,7 +458,8 @@
         }
 
         // Creates the new entry.
-        Entry<K,V> e = tab[index];
+        @SuppressWarnings("unchecked")
+        Entry<K,V> e = (Entry<K,V>)tab[index];
         tab[index] = new Entry<>(hash, key, value, e);
         count++;
         return null;
@@ -470,10 +475,12 @@
      * @throws  NullPointerException  if the key is <code>null</code>
      */
     public synchronized V remove(Object key) {
-        Entry tab[] = table;
+        Entry<?,?> tab[] = table;
         int hash = key.hashCode();
         int index = (hash & 0x7FFFFFFF) % tab.length;
-        for (Entry<K,V> e = tab[index], prev = null ; e != null ; prev = e, e = e.next) {
+        @SuppressWarnings("unchecked")
+        Entry<K,V> e = (Entry<K,V>)tab[index];
+        for(Entry<K,V> prev = null ; e != null ; prev = e, e = e.next) {
             if ((e.hash == hash) && e.key.equals(key)) {
                 modCount++;
                 if (prev != null) {
@@ -508,7 +515,7 @@
      * Clears this hashtable so that it contains no keys.
      */
     public synchronized void clear() {
-        Entry tab[] = table;
+        Entry<?,?> tab[] = table;
         modCount++;
         for (int index = tab.length; --index >= 0; )
             tab[index] = null;
@@ -524,11 +531,11 @@
      */
     public synchronized Object clone() {
         try {
-            Hashtable<K,V> t = (Hashtable<K,V>) super.clone();
-            t.table = new Entry[table.length];
+            Hashtable<?,?> t = (Hashtable<?,?>)super.clone();
+            t.table = new Entry<?,?>[table.length];
             for (int i = table.length ; i-- > 0 ; ) {
                 t.table[i] = (table[i] != null)
-                    ? (Entry<K,V>) table[i].clone() : null;
+                    ? (Entry<?,?>) table[i].clone() : null;
             }
             t.keySet = null;
             t.entrySet = null;
@@ -675,13 +682,13 @@
         public boolean contains(Object o) {
             if (!(o instanceof Map.Entry))
                 return false;
-            Map.Entry entry = (Map.Entry)o;
+            Map.Entry<?,?> entry = (Map.Entry<?,?>)o;
             Object key = entry.getKey();
-            Entry[] tab = table;
+            Entry<?,?>[] tab = table;
             int hash = key.hashCode();
             int index = (hash & 0x7FFFFFFF) % tab.length;
 
-            for (Entry e = tab[index]; e != null; e = e.next)
+            for (Entry<?,?> e = tab[index]; e != null; e = e.next)
                 if (e.hash==hash && e.equals(entry))
                     return true;
             return false;
@@ -690,14 +697,15 @@
         public boolean remove(Object o) {
             if (!(o instanceof Map.Entry))
                 return false;
-            Map.Entry<K,V> entry = (Map.Entry<K,V>) o;
-            K key = entry.getKey();
-            Entry[] tab = table;
+            Map.Entry<?,?> entry = (Map.Entry<?,?>) o;
+            Object key = entry.getKey();
+            Entry<?,?>[] tab = table;
             int hash = key.hashCode();
             int index = (hash & 0x7FFFFFFF) % tab.length;
 
-            for (Entry<K,V> e = tab[index], prev = null; e != null;
-                 prev = e, e = e.next) {
+            @SuppressWarnings("unchecked")
+            Entry<K,V> e = (Entry<K,V>)tab[index];
+            for(Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
                 if (e.hash==hash && e.equals(entry)) {
                     modCount++;
                     if (prev != null)
@@ -776,7 +784,7 @@
 
         if (!(o instanceof Map))
             return false;
-        Map<K,V> t = (Map<K,V>) o;
+        Map<?,?> t = (Map<?,?>) o;
         if (t.size() != size())
             return false;
 
@@ -826,9 +834,9 @@
             return h;  // Returns zero
 
         loadFactor = -loadFactor;  // Mark hashCode computation in progress
-        Entry[] tab = table;
+        Entry<?,?>[] tab = table;
         for (int i = 0; i < tab.length; i++)
-            for (Entry e = tab[i]; e != null; e = e.next)
+            for (Entry<?,?> e = tab[i]; e != null; e = e.next)
                 h += e.key.hashCode() ^ e.value.hashCode();
         loadFactor = -loadFactor;  // Mark hashCode computation complete
 
@@ -859,7 +867,7 @@
 
             // Stack copies of the entries in the table
             for (int index = 0; index < table.length; index++) {
-                Entry entry = table[index];
+                Entry<?,?> entry = table[index];
 
                 while (entry != null) {
                     entryStack =
@@ -899,14 +907,15 @@
             length--;
         if (origlength > 0 && length > origlength)
             length = origlength;
-
-        Entry[] table = new Entry[length];
+        Entry<?,?>[] table = new Entry<?,?>[length];
         count = 0;
 
         // Read the number of elements and then all the key/value objects
         for (; elements > 0; elements--) {
-            K key = (K)s.readObject();
-            V value = (V)s.readObject();
+            @SuppressWarnings("unchecked")
+                K key = (K)s.readObject();
+            @SuppressWarnings("unchecked")
+                V value = (V)s.readObject();
             // synch could be eliminated for performance
             reconstitutionPut(table, key, value);
         }
@@ -924,7 +933,7 @@
      * because we are creating a new instance. Also, no return value
      * is needed.
      */
-    private void reconstitutionPut(Entry[] tab, K key, V value)
+    private void reconstitutionPut(Entry<?,?>[] tab, K key, V value)
         throws StreamCorruptedException
     {
         if (value == null) {
@@ -934,13 +943,14 @@
         // This should not happen in deserialized version.
         int hash = key.hashCode();
         int index = (hash & 0x7FFFFFFF) % tab.length;
-        for (Entry<K,V> e = tab[index] ; e != null ; e = e.next) {
+        for (Entry<?,?> e = tab[index] ; e != null ; e = e.next) {
             if ((e.hash == hash) && e.key.equals(key)) {
                 throw new java.io.StreamCorruptedException();
             }
         }
         // Creates the new entry.
-        Entry<K,V> e = tab[index];
+        @SuppressWarnings("unchecked")
+            Entry<K,V> e = (Entry<K,V>)tab[index];
         tab[index] = new Entry<>(hash, key, value, e);
         count++;
     }
@@ -961,6 +971,7 @@
             this.next = next;
         }
 
+        @SuppressWarnings("unchecked")
         protected Object clone() {
             return new Entry<>(hash, key, value,
                                   (next==null ? null : (Entry<K,V>) next.clone()));
@@ -988,7 +999,7 @@
         public boolean equals(Object o) {
             if (!(o instanceof Map.Entry))
                 return false;
-            Map.Entry e = (Map.Entry)o;
+            Map.Entry<?,?> e = (Map.Entry<?,?>)o;
 
             return (key==null ? e.getKey()==null : key.equals(e.getKey())) &&
                (value==null ? e.getValue()==null : value.equals(e.getValue()));
@@ -1016,10 +1027,10 @@
      * by passing an Enumeration.
      */
     private class Enumerator<T> implements Enumeration<T>, Iterator<T> {
-        Entry[] table = Hashtable.this.table;
+        Entry<?,?>[] table = Hashtable.this.table;
         int index = table.length;
-        Entry<K,V> entry = null;
-        Entry<K,V> lastReturned = null;
+        Entry<?,?> entry = null;
+        Entry<?,?> lastReturned = null;
         int type;
 
         /**
@@ -1041,9 +1052,9 @@
         }
 
         public boolean hasMoreElements() {
-            Entry<K,V> e = entry;
+            Entry<?,?> e = entry;
             int i = index;
-            Entry[] t = table;
+            Entry<?,?>[] t = table;
             /* Use locals for faster loop iteration */
             while (e == null && i > 0) {
                 e = t[--i];
@@ -1053,10 +1064,11 @@
             return e != null;
         }
 
+        @SuppressWarnings("unchecked")
         public T nextElement() {
-            Entry<K,V> et = entry;
+            Entry<?,?> et = entry;
             int i = index;
-            Entry[] t = table;
+            Entry<?,?>[] t = table;
             /* Use locals for faster loop iteration */
             while (et == null && i > 0) {
                 et = t[--i];
@@ -1064,7 +1076,7 @@
             entry = et;
             index = i;
             if (et != null) {
-                Entry<K,V> e = lastReturned = entry;
+                Entry<?,?> e = lastReturned = entry;
                 entry = e.next;
                 return type == KEYS ? (T)e.key : (type == VALUES ? (T)e.value : (T)e);
             }
@@ -1091,11 +1103,12 @@
                 throw new ConcurrentModificationException();
 
             synchronized(Hashtable.this) {
-                Entry[] tab = Hashtable.this.table;
+                Entry<?,?>[] tab = Hashtable.this.table;
                 int index = (lastReturned.hash & 0x7FFFFFFF) % tab.length;
 
-                for (Entry<K,V> e = tab[index], prev = null; e != null;
-                     prev = e, e = e.next) {
+                @SuppressWarnings("unchecked")
+                Entry<K,V> e = (Entry<K,V>)tab[index];
+                for(Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
                     if (e == lastReturned) {
                         modCount++;
                         expectedModCount++;
diff --git a/src/share/classes/java/util/IdentityHashMap.java b/src/share/classes/java/util/IdentityHashMap.java
index 930c3ac..6355557 100644
--- a/src/share/classes/java/util/IdentityHashMap.java
+++ b/src/share/classes/java/util/IdentityHashMap.java
@@ -327,6 +327,7 @@
      *
      * @see #put(Object, Object)
      */
+    @SuppressWarnings("unchecked")
     public V get(Object key) {
         Object k = maskNull(key);
         Object[] tab = table;
@@ -431,7 +432,8 @@
         Object item;
         while ( (item = tab[i]) != null) {
             if (item == k) {
-                V oldValue = (V) tab[i + 1];
+                @SuppressWarnings("unchecked")
+                    V oldValue = (V) tab[i + 1];
                 tab[i + 1] = value;
                 return oldValue;
             }
@@ -524,7 +526,8 @@
             if (item == k) {
                 modCount++;
                 size--;
-                V oldValue = (V) tab[i + 1];
+                @SuppressWarnings("unchecked")
+                    V oldValue = (V) tab[i + 1];
                 tab[i + 1] = null;
                 tab[i] = null;
                 closeDeletion(i);
@@ -638,7 +641,7 @@
         if (o == this) {
             return true;
         } else if (o instanceof IdentityHashMap) {
-            IdentityHashMap m = (IdentityHashMap) o;
+            IdentityHashMap<?,?> m = (IdentityHashMap<?,?>) o;
             if (m.size() != size)
                 return false;
 
@@ -650,7 +653,7 @@
             }
             return true;
         } else if (o instanceof Map) {
-            Map m = (Map)o;
+            Map<?,?> m = (Map<?,?>)o;
             return entrySet().equals(m.entrySet());
         } else {
             return false;  // o is not a Map
@@ -698,7 +701,7 @@
      */
     public Object clone() {
         try {
-            IdentityHashMap<K,V> m = (IdentityHashMap<K,V>) super.clone();
+            IdentityHashMap<?,?> m = (IdentityHashMap<?,?>) super.clone();
             m.entrySet = null;
             m.table = table.clone();
             return m;
@@ -768,7 +771,7 @@
             int len = tab.length;
 
             int d = deletedSlot;
-            K key = (K) tab[d];
+            Object key = tab[d];
             tab[d] = null;        // vacate the slot
             tab[d + 1] = null;
 
@@ -818,12 +821,14 @@
     }
 
     private class KeyIterator extends IdentityHashMapIterator<K> {
+        @SuppressWarnings("unchecked")
         public K next() {
             return (K) unmaskNull(traversalTable[nextIndex()]);
         }
     }
 
     private class ValueIterator extends IdentityHashMapIterator<V> {
+        @SuppressWarnings("unchecked")
         public V next() {
             return (V) traversalTable[nextIndex() + 1];
         }
@@ -854,16 +859,19 @@
                 this.index = index;
             }
 
+            @SuppressWarnings("unchecked")
             public K getKey() {
                 checkIndexForEntryUse();
                 return (K) unmaskNull(traversalTable[index]);
             }
 
+            @SuppressWarnings("unchecked")
             public V getValue() {
                 checkIndexForEntryUse();
                 return (V) traversalTable[index+1];
             }
 
+            @SuppressWarnings("unchecked")
             public V setValue(V value) {
                 checkIndexForEntryUse();
                 V oldValue = (V) traversalTable[index+1];
@@ -880,7 +888,7 @@
 
                 if (!(o instanceof Map.Entry))
                     return false;
-                Map.Entry e = (Map.Entry)o;
+                Map.Entry<?,?> e = (Map.Entry<?,?>)o;
                 return (e.getKey() == unmaskNull(traversalTable[index]) &&
                        e.getValue() == traversalTable[index+1]);
             }
@@ -1109,13 +1117,13 @@
         public boolean contains(Object o) {
             if (!(o instanceof Map.Entry))
                 return false;
-            Map.Entry entry = (Map.Entry)o;
+            Map.Entry<?,?> entry = (Map.Entry<?,?>)o;
             return containsMapping(entry.getKey(), entry.getValue());
         }
         public boolean remove(Object o) {
             if (!(o instanceof Map.Entry))
                 return false;
-            Map.Entry entry = (Map.Entry)o;
+            Map.Entry<?,?> entry = (Map.Entry<?,?>)o;
             return removeMapping(entry.getKey(), entry.getValue());
         }
         public int size() {
@@ -1213,8 +1221,10 @@
 
         // Read the keys and values, and put the mappings in the table
         for (int i=0; i<size; i++) {
-            K key = (K) s.readObject();
-            V value = (V) s.readObject();
+            @SuppressWarnings("unchecked")
+                K key = (K) s.readObject();
+            @SuppressWarnings("unchecked")
+                V value = (V) s.readObject();
             putForCreate(key, value);
         }
     }
@@ -1226,7 +1236,7 @@
     private void putForCreate(K key, V value)
         throws IOException
     {
-        K k = (K)maskNull(key);
+        Object k = maskNull(key);
         Object[] tab = table;
         int len = tab.length;
         int i = hash(k, len);
diff --git a/src/share/classes/java/util/IllegalFormatConversionException.java b/src/share/classes/java/util/IllegalFormatConversionException.java
index 9bdbfc4..2b30922 100644
--- a/src/share/classes/java/util/IllegalFormatConversionException.java
+++ b/src/share/classes/java/util/IllegalFormatConversionException.java
@@ -40,7 +40,7 @@
     private static final long serialVersionUID = 17000126L;
 
     private char c;
-    private Class arg;
+    private Class<?> arg;
 
     /**
      * Constructs an instance of this class with the mismatched conversion and
diff --git a/src/share/classes/java/util/JumboEnumSet.java b/src/share/classes/java/util/JumboEnumSet.java
index 9380210..5db15bb 100644
--- a/src/share/classes/java/util/JumboEnumSet.java
+++ b/src/share/classes/java/util/JumboEnumSet.java
@@ -46,7 +46,7 @@
     // Redundant - maintained for performance
     private int size = 0;
 
-    JumboEnumSet(Class<E>elementType, Enum[] universe) {
+    JumboEnumSet(Class<E>elementType, Enum<?>[] universe) {
         super(elementType, universe);
         elements = new long[(universe.length + 63) >>> 6];
     }
@@ -127,6 +127,7 @@
             return unseen != 0;
         }
 
+        @Override
         public E next() {
             if (!hasNext())
                 throw new NoSuchElementException();
@@ -176,11 +177,11 @@
     public boolean contains(Object e) {
         if (e == null)
             return false;
-        Class eClass = e.getClass();
+        Class<?> eClass = e.getClass();
         if (eClass != elementType && eClass.getSuperclass() != elementType)
             return false;
 
-        int eOrdinal = ((Enum)e).ordinal();
+        int eOrdinal = ((Enum<?>)e).ordinal();
         return (elements[eOrdinal >>> 6] & (1L << eOrdinal)) != 0;
     }
 
@@ -217,10 +218,10 @@
     public boolean remove(Object e) {
         if (e == null)
             return false;
-        Class eClass = e.getClass();
+        Class<?> eClass = e.getClass();
         if (eClass != elementType && eClass.getSuperclass() != elementType)
             return false;
-        int eOrdinal = ((Enum)e).ordinal();
+        int eOrdinal = ((Enum<?>)e).ordinal();
         int eWordNum = eOrdinal >>> 6;
 
         long oldElements = elements[eWordNum];
@@ -246,7 +247,7 @@
         if (!(c instanceof JumboEnumSet))
             return super.containsAll(c);
 
-        JumboEnumSet es = (JumboEnumSet)c;
+        JumboEnumSet<?> es = (JumboEnumSet<?>)c;
         if (es.elementType != elementType)
             return es.isEmpty();
 
@@ -268,7 +269,7 @@
         if (!(c instanceof JumboEnumSet))
             return super.addAll(c);
 
-        JumboEnumSet es = (JumboEnumSet)c;
+        JumboEnumSet<?> es = (JumboEnumSet<?>)c;
         if (es.elementType != elementType) {
             if (es.isEmpty())
                 return false;
@@ -294,7 +295,7 @@
         if (!(c instanceof JumboEnumSet))
             return super.removeAll(c);
 
-        JumboEnumSet es = (JumboEnumSet)c;
+        JumboEnumSet<?> es = (JumboEnumSet<?>)c;
         if (es.elementType != elementType)
             return false;
 
@@ -348,7 +349,7 @@
         if (!(o instanceof JumboEnumSet))
             return super.equals(o);
 
-        JumboEnumSet es = (JumboEnumSet)o;
+        JumboEnumSet<?> es = (JumboEnumSet<?>)o;
         if (es.elementType != elementType)
             return size == 0 && es.size == 0;
 
diff --git a/src/share/classes/java/util/LinkedHashMap.java b/src/share/classes/java/util/LinkedHashMap.java
index 4f80ec4..5e656c8 100644
--- a/src/share/classes/java/util/LinkedHashMap.java
+++ b/src/share/classes/java/util/LinkedHashMap.java
@@ -246,11 +246,12 @@
      * by superclass resize.  It is overridden for performance, as it is
      * faster to iterate using our linked list.
      */
+    @SuppressWarnings("unchecked")
     void transfer(HashMap.Entry[] newTable) {
         int newCapacity = newTable.length;
         for (Entry<K,V> e = header.after; e != header; e = e.after) {
             int index = indexFor(e.hash, newCapacity);
-            e.next = newTable[index];
+            e.next = (HashMap.Entry<K,V>)newTable[index];
             newTable[index] = e;
         }
     }
@@ -267,11 +268,11 @@
     public boolean containsValue(Object value) {
         // Overridden to take advantage of faster iterator
         if (value==null) {
-            for (Entry e = header.after; e != header; e = e.after)
+            for (Entry<?,?> e = header.after; e != header; e = e.after)
                 if (e.value==null)
                     return true;
         } else {
-            for (Entry e = header.after; e != header; e = e.after)
+            for (Entry<?,?> e = header.after; e != header; e = e.after)
                 if (value.equals(e.value))
                     return true;
         }
@@ -437,7 +438,8 @@
      * table or remove the eldest entry.
      */
     void createEntry(int hash, K key, V value, int bucketIndex) {
-        HashMap.Entry<K,V> old = table[bucketIndex];
+        @SuppressWarnings("unchecked")
+            HashMap.Entry<K,V> old = (HashMap.Entry<K,V>)table[bucketIndex];
         Entry<K,V> e = new Entry<>(hash, key, value, old);
         table[bucketIndex] = e;
         e.addBefore(header);
diff --git a/src/share/classes/java/util/Observable.java b/src/share/classes/java/util/Observable.java
index 7104071..25295e8 100644
--- a/src/share/classes/java/util/Observable.java
+++ b/src/share/classes/java/util/Observable.java
@@ -61,12 +61,12 @@
  */
 public class Observable {
     private boolean changed = false;
-    private Vector obs;
+    private Vector<Observer> obs;
 
     /** Construct an Observable with zero Observers. */
 
     public Observable() {
-        obs = new Vector();
+        obs = new Vector<>();
     }
 
     /**
diff --git a/src/share/classes/java/util/PriorityQueue.java b/src/share/classes/java/util/PriorityQueue.java
index b4416ab..bb9c114 100644
--- a/src/share/classes/java/util/PriorityQueue.java
+++ b/src/share/classes/java/util/PriorityQueue.java
@@ -449,6 +449,7 @@
      *         this queue
      * @throws NullPointerException if the specified array is null
      */
+    @SuppressWarnings("unchecked")
     public <T> T[] toArray(T[] a) {
         if (a.length < size)
             // Make a new array of a's runtime type, but my contents:
@@ -514,6 +515,7 @@
                 (forgetMeNot != null && !forgetMeNot.isEmpty());
         }
 
+        @SuppressWarnings("unchecked")
         public E next() {
             if (expectedModCount != modCount)
                 throw new ConcurrentModificationException();
@@ -571,8 +573,10 @@
             return null;
         int s = --size;
         modCount++;
-        E result = (E) queue[0];
-        E x = (E) queue[s];
+        @SuppressWarnings("unchecked")
+            E result = (E) queue[0];
+        @SuppressWarnings("unchecked")
+            E x = (E) queue[s];
         queue[s] = null;
         if (s != 0)
             siftDown(0, x);
@@ -598,7 +602,8 @@
         if (s == i) // removed last element
             queue[i] = null;
         else {
-            E moved = (E) queue[s];
+            @SuppressWarnings("unchecked")
+                E moved = (E) queue[s];
             queue[s] = null;
             siftDown(i, moved);
             if (queue[i] == moved) {
@@ -629,6 +634,7 @@
             siftUpComparable(k, x);
     }
 
+    @SuppressWarnings("unchecked")
     private void siftUpComparable(int k, E x) {
         Comparable<? super E> key = (Comparable<? super E>) x;
         while (k > 0) {
@@ -645,8 +651,9 @@
     private void siftUpUsingComparator(int k, E x) {
         while (k > 0) {
             int parent = (k - 1) >>> 1;
-            Object e = queue[parent];
-            if (comparator.compare(x, (E) e) >= 0)
+            @SuppressWarnings("unchecked")
+                E e = (E) queue[parent];
+            if (comparator.compare(x, e) >= 0)
                 break;
             queue[k] = e;
             k = parent;
@@ -669,6 +676,7 @@
             siftDownComparable(k, x);
     }
 
+    @SuppressWarnings("unchecked")
     private void siftDownComparable(int k, E x) {
         Comparable<? super E> key = (Comparable<? super E>)x;
         int half = size >>> 1;        // loop while a non-leaf
@@ -687,6 +695,7 @@
         queue[k] = key;
     }
 
+    @SuppressWarnings("unchecked")
     private void siftDownUsingComparator(int k, E x) {
         int half = size >>> 1;
         while (k < half) {
@@ -708,6 +717,7 @@
      * Establishes the heap invariant (described above) in the entire tree,
      * assuming nothing about the order of the elements prior to the call.
      */
+    @SuppressWarnings("unchecked")
     private void heapify() {
         for (int i = (size >>> 1) - 1; i >= 0; i--)
             siftDown(i, (E) queue[i]);
diff --git a/src/share/classes/java/util/Properties.java b/src/share/classes/java/util/Properties.java
index 7c7e13b..c2fdad4 100644
--- a/src/share/classes/java/util/Properties.java
+++ b/src/share/classes/java/util/Properties.java
@@ -824,7 +824,7 @@
         bw.write("#" + new Date().toString());
         bw.newLine();
         synchronized (this) {
-            for (Enumeration e = keys(); e.hasMoreElements();) {
+            for (Enumeration<?> e = keys(); e.hasMoreElements();) {
                 String key = (String)e.nextElement();
                 String val = (String)get(key);
                 key = saveConvert(key, true, escUnicode);
@@ -987,7 +987,7 @@
      * @see     #stringPropertyNames
      */
     public Enumeration<?> propertyNames() {
-        Hashtable h = new Hashtable();
+        Hashtable<String,Object> h = new Hashtable<>();
         enumerate(h);
         return h.keys();
     }
@@ -1026,10 +1026,10 @@
      */
     public void list(PrintStream out) {
         out.println("-- listing properties --");
-        Hashtable h = new Hashtable();
+        Hashtable<String,Object> h = new Hashtable<>();
         enumerate(h);
-        for (Enumeration e = h.keys() ; e.hasMoreElements() ;) {
-            String key = (String)e.nextElement();
+        for (Enumeration<String> e = h.keys() ; e.hasMoreElements() ;) {
+            String key = e.nextElement();
             String val = (String)h.get(key);
             if (val.length() > 40) {
                 val = val.substring(0, 37) + "...";
@@ -1054,10 +1054,10 @@
      */
     public void list(PrintWriter out) {
         out.println("-- listing properties --");
-        Hashtable h = new Hashtable();
+        Hashtable<String,Object> h = new Hashtable<>();
         enumerate(h);
-        for (Enumeration e = h.keys() ; e.hasMoreElements() ;) {
-            String key = (String)e.nextElement();
+        for (Enumeration<String> e = h.keys() ; e.hasMoreElements() ;) {
+            String key = e.nextElement();
             String val = (String)h.get(key);
             if (val.length() > 40) {
                 val = val.substring(0, 37) + "...";
@@ -1072,11 +1072,11 @@
      * @throws ClassCastException if any of the property keys
      *         is not of String type.
      */
-    private synchronized void enumerate(Hashtable h) {
+    private synchronized void enumerate(Hashtable<String,Object> h) {
         if (defaults != null) {
             defaults.enumerate(h);
         }
-        for (Enumeration e = keys() ; e.hasMoreElements() ;) {
+        for (Enumeration<?> e = keys() ; e.hasMoreElements() ;) {
             String key = (String)e.nextElement();
             h.put(key, get(key));
         }
@@ -1091,7 +1091,7 @@
         if (defaults != null) {
             defaults.enumerateStringProperties(h);
         }
-        for (Enumeration e = keys() ; e.hasMoreElements() ;) {
+        for (Enumeration<?> e = keys() ; e.hasMoreElements() ;) {
             Object k = e.nextElement();
             Object v = get(k);
             if (k instanceof String && v instanceof String) {
diff --git a/src/share/classes/java/util/PropertyPermission.java b/src/share/classes/java/util/PropertyPermission.java
index 1773188..c89b28b 100644
--- a/src/share/classes/java/util/PropertyPermission.java
+++ b/src/share/classes/java/util/PropertyPermission.java
@@ -442,7 +442,7 @@
      * Key is property name; value is PropertyPermission.
      * Not serialized; see serialization section at end of class.
      */
-    private transient Map<String, Permission> perms;
+    private transient Map<String, PropertyPermission> perms;
 
     /**
      * Boolean saying if "*" is in the collection.
@@ -488,7 +488,7 @@
         String propName = pp.getName();
 
         synchronized (this) {
-            PropertyPermission existing = (PropertyPermission) perms.get(propName);
+            PropertyPermission existing = perms.get(propName);
 
             if (existing != null) {
                 int oldMask = existing.getMask();
@@ -499,7 +499,7 @@
                     perms.put(propName, new PropertyPermission(propName, actions));
                 }
             } else {
-                perms.put(propName, permission);
+                perms.put(propName, pp);
             }
         }
 
@@ -533,7 +533,7 @@
         // short circuit if the "*" Permission was added
         if (all_allowed) {
             synchronized (this) {
-                x = (PropertyPermission) perms.get("*");
+                x = perms.get("*");
             }
             if (x != null) {
                 effective |= x.getMask();
@@ -550,7 +550,7 @@
         //System.out.println("check "+name);
 
         synchronized (this) {
-            x = (PropertyPermission) perms.get(name);
+            x = perms.get(name);
         }
 
         if (x != null) {
@@ -570,7 +570,7 @@
             name = name.substring(0, last+1) + "*";
             //System.out.println("check "+name);
             synchronized (this) {
-                x = (PropertyPermission) perms.get(name);
+                x = perms.get(name);
             }
 
             if (x != null) {
@@ -592,11 +592,15 @@
      *
      * @return an enumeration of all the PropertyPermission objects.
      */
-
+    @SuppressWarnings("unchecked")
     public Enumeration<Permission> elements() {
         // Convert Iterator of Map values into an Enumeration
         synchronized (this) {
-            return Collections.enumeration(perms.values());
+            /**
+             * Casting to rawtype since Enumeration<PropertyPermission>
+             * cannot be directly cast to Enumeration<Permission>
+             */
+            return (Enumeration)Collections.enumeration(perms.values());
         }
     }
 
@@ -633,7 +637,8 @@
         // Don't call out.defaultWriteObject()
 
         // Copy perms into a Hashtable
-        Hashtable<String, Permission> permissions = new Hashtable<>(perms.size()*2);
+        Hashtable<String, Permission> permissions =
+            new Hashtable<>(perms.size()*2);
         synchronized (this) {
             permissions.putAll(perms);
         }
@@ -661,8 +666,8 @@
 
         // Get permissions
         @SuppressWarnings("unchecked")
-        Hashtable<String, Permission> permissions =
-            (Hashtable<String, Permission>)gfields.get("permissions", null);
+        Hashtable<String, PropertyPermission> permissions =
+            (Hashtable<String, PropertyPermission>)gfields.get("permissions", null);
         perms = new HashMap<>(permissions.size()*2);
         perms.putAll(permissions);
     }
diff --git a/src/share/classes/java/util/RegularEnumSet.java b/src/share/classes/java/util/RegularEnumSet.java
index 4bcb578..63f5f52 100644
--- a/src/share/classes/java/util/RegularEnumSet.java
+++ b/src/share/classes/java/util/RegularEnumSet.java
@@ -41,7 +41,7 @@
      */
     private long elements = 0L;
 
-    RegularEnumSet(Class<E>elementType, Enum[] universe) {
+    RegularEnumSet(Class<E>elementType, Enum<?>[] universe) {
         super(elementType, universe);
     }
 
@@ -96,6 +96,7 @@
             return unseen != 0;
         }
 
+        @SuppressWarnings("unchecked")
         public E next() {
             if (unseen == 0)
                 throw new NoSuchElementException();
@@ -139,11 +140,11 @@
     public boolean contains(Object e) {
         if (e == null)
             return false;
-        Class eClass = e.getClass();
+        Class<?> eClass = e.getClass();
         if (eClass != elementType && eClass.getSuperclass() != elementType)
             return false;
 
-        return (elements & (1L << ((Enum)e).ordinal())) != 0;
+        return (elements & (1L << ((Enum<?>)e).ordinal())) != 0;
     }
 
     // Modification Operations
@@ -160,7 +161,7 @@
         typeCheck(e);
 
         long oldElements = elements;
-        elements |= (1L << ((Enum)e).ordinal());
+        elements |= (1L << ((Enum<?>)e).ordinal());
         return elements != oldElements;
     }
 
@@ -173,12 +174,12 @@
     public boolean remove(Object e) {
         if (e == null)
             return false;
-        Class eClass = e.getClass();
+        Class<?> eClass = e.getClass();
         if (eClass != elementType && eClass.getSuperclass() != elementType)
             return false;
 
         long oldElements = elements;
-        elements &= ~(1L << ((Enum)e).ordinal());
+        elements &= ~(1L << ((Enum<?>)e).ordinal());
         return elements != oldElements;
     }
 
@@ -197,7 +198,7 @@
         if (!(c instanceof RegularEnumSet))
             return super.containsAll(c);
 
-        RegularEnumSet es = (RegularEnumSet)c;
+        RegularEnumSet<?> es = (RegularEnumSet<?>)c;
         if (es.elementType != elementType)
             return es.isEmpty();
 
@@ -216,7 +217,7 @@
         if (!(c instanceof RegularEnumSet))
             return super.addAll(c);
 
-        RegularEnumSet es = (RegularEnumSet)c;
+        RegularEnumSet<?> es = (RegularEnumSet<?>)c;
         if (es.elementType != elementType) {
             if (es.isEmpty())
                 return false;
@@ -242,7 +243,7 @@
         if (!(c instanceof RegularEnumSet))
             return super.removeAll(c);
 
-        RegularEnumSet es = (RegularEnumSet)c;
+        RegularEnumSet<?> es = (RegularEnumSet<?>)c;
         if (es.elementType != elementType)
             return false;
 
@@ -295,7 +296,7 @@
         if (!(o instanceof RegularEnumSet))
             return super.equals(o);
 
-        RegularEnumSet es = (RegularEnumSet)o;
+        RegularEnumSet<?> es = (RegularEnumSet<?>)o;
         if (es.elementType != elementType)
             return elements == 0 && es.elements == 0;
         return es.elements == elements;
diff --git a/src/share/classes/java/util/ResourceBundle.java b/src/share/classes/java/util/ResourceBundle.java
index c7b425d..6be14d5 100644
--- a/src/share/classes/java/util/ResourceBundle.java
+++ b/src/share/classes/java/util/ResourceBundle.java
@@ -294,7 +294,8 @@
     /**
      * Queue for reference objects referring to class loaders or bundles.
      */
-    private static final ReferenceQueue<Object> referenceQueue = new ReferenceQueue<>();
+    private static final ReferenceQueue<Object> referenceQueue =
+        new ReferenceQueue<>();
 
     /**
      * The parent bundle of this bundle.
@@ -417,7 +418,7 @@
      * caller's caller.
      */
     private static ClassLoader getLoader() {
-        Class[] stack = getClassContext();
+        Class<?>[] stack = getClassContext();
         /* Magic number 2 identifies our caller's caller */
         Class<?> c = stack[2];
         ClassLoader cl = (c == null) ? null : c.getClassLoader();
@@ -434,7 +435,7 @@
         return cl;
     }
 
-    private static native Class[] getClassContext();
+    private static native Class<?>[] getClassContext();
 
     /**
      * A wrapper of ClassLoader.getSystemClassLoader().
diff --git a/src/share/classes/java/util/ServiceLoader.java b/src/share/classes/java/util/ServiceLoader.java
index b3c34ae..62aa9dd 100644
--- a/src/share/classes/java/util/ServiceLoader.java
+++ b/src/share/classes/java/util/ServiceLoader.java
@@ -218,20 +218,20 @@
         reload();
     }
 
-    private static void fail(Class service, String msg, Throwable cause)
+    private static void fail(Class<?> service, String msg, Throwable cause)
         throws ServiceConfigurationError
     {
         throw new ServiceConfigurationError(service.getName() + ": " + msg,
                                             cause);
     }
 
-    private static void fail(Class service, String msg)
+    private static void fail(Class<?> service, String msg)
         throws ServiceConfigurationError
     {
         throw new ServiceConfigurationError(service.getName() + ": " + msg);
     }
 
-    private static void fail(Class service, URL u, int line, String msg)
+    private static void fail(Class<?> service, URL u, int line, String msg)
         throws ServiceConfigurationError
     {
         fail(service, u + ":" + line + ": " + msg);
@@ -240,7 +240,7 @@
     // Parse a single line from the given configuration file, adding the name
     // on the line to the names list.
     //
-    private int parseLine(Class service, URL u, BufferedReader r, int lc,
+    private int parseLine(Class<?> service, URL u, BufferedReader r, int lc,
                           List<String> names)
         throws IOException, ServiceConfigurationError
     {
@@ -286,7 +286,7 @@
     //         If an I/O error occurs while reading from the given URL, or
     //         if a configuration-file format error is detected
     //
-    private Iterator<String> parse(Class service, URL u)
+    private Iterator<String> parse(Class<?> service, URL u)
         throws ServiceConfigurationError
     {
         InputStream in = null;
diff --git a/src/share/classes/java/util/TimeZone.java b/src/share/classes/java/util/TimeZone.java
index e9d6cef..647e350 100644
--- a/src/share/classes/java/util/TimeZone.java
+++ b/src/share/classes/java/util/TimeZone.java
@@ -428,7 +428,7 @@
         // The structure is:
         //   Map(key=id, value=SoftReference(Map(key=locale, value=displaynames)))
         private static final Map<String, SoftReference<Map<Locale, String[]>>> CACHE =
-            new ConcurrentHashMap<String, SoftReference<Map<Locale, String[]>>>();
+            new ConcurrentHashMap<>();
     }
 
     private static final String[] getDisplayNames(String id, Locale locale) {
@@ -452,9 +452,9 @@
 
         String[] names = TimeZoneNameUtility.retrieveDisplayNames(id, locale);
         if (names != null) {
-            Map<Locale, String[]> perLocale = new ConcurrentHashMap<Locale, String[]>();
+            Map<Locale, String[]> perLocale = new ConcurrentHashMap<>();
             perLocale.put(locale, names);
-            ref = new SoftReference<Map<Locale, String[]>>(perLocale);
+            ref = new SoftReference<>(perLocale);
             displayNames.put(id, ref);
         }
         return names;
diff --git a/src/share/classes/java/util/TreeMap.java b/src/share/classes/java/util/TreeMap.java
index c7aae65..dfa1509 100644
--- a/src/share/classes/java/util/TreeMap.java
+++ b/src/share/classes/java/util/TreeMap.java
@@ -307,7 +307,7 @@
     public void putAll(Map<? extends K, ? extends V> map) {
         int mapSize = map.size();
         if (size==0 && mapSize!=0 && map instanceof SortedMap) {
-            Comparator c = ((SortedMap)map).comparator();
+            Comparator<?> c = ((SortedMap<?,?>)map).comparator();
             if (c == comparator || (c != null && c.equals(comparator))) {
                 ++modCount;
                 try {
@@ -340,7 +340,8 @@
             return getEntryUsingComparator(key);
         if (key == null)
             throw new NullPointerException();
-        Comparable<? super K> k = (Comparable<? super K>) key;
+        @SuppressWarnings("unchecked")
+            Comparable<? super K> k = (Comparable<? super K>) key;
         Entry<K,V> p = root;
         while (p != null) {
             int cmp = k.compareTo(p.key);
@@ -361,7 +362,8 @@
      * worthwhile here.)
      */
     final Entry<K,V> getEntryUsingComparator(Object key) {
-        K k = (K) key;
+        @SuppressWarnings("unchecked")
+            K k = (K) key;
         Comparator<? super K> cpr = comparator;
         if (cpr != null) {
             Entry<K,V> p = root;
@@ -554,7 +556,8 @@
         else {
             if (key == null)
                 throw new NullPointerException();
-            Comparable<? super K> k = (Comparable<? super K>) key;
+            @SuppressWarnings("unchecked")
+                Comparable<? super K> k = (Comparable<? super K>) key;
             do {
                 parent = t;
                 cmp = k.compareTo(t.key);
@@ -618,9 +621,9 @@
      * @return a shallow copy of this map
      */
     public Object clone() {
-        TreeMap<K,V> clone = null;
+        TreeMap<?,?> clone;
         try {
-            clone = (TreeMap<K,V>) super.clone();
+            clone = (TreeMap<?,?>) super.clone();
         } catch (CloneNotSupportedException e) {
             throw new InternalError(e);
         }
@@ -803,7 +806,7 @@
      */
     public NavigableSet<K> navigableKeySet() {
         KeySet<K> nks = navigableKeySet;
-        return (nks != null) ? nks : (navigableKeySet = new KeySet(this));
+        return (nks != null) ? nks : (navigableKeySet = new KeySet<>(this));
     }
 
     /**
@@ -859,9 +862,9 @@
     public NavigableMap<K, V> descendingMap() {
         NavigableMap<K, V> km = descendingMap;
         return (km != null) ? km :
-            (descendingMap = new DescendingSubMap(this,
-                                                  true, null, true,
-                                                  true, null, true));
+            (descendingMap = new DescendingSubMap<>(this,
+                                                    true, null, true,
+                                                    true, null, true));
     }
 
     /**
@@ -874,9 +877,9 @@
      */
     public NavigableMap<K,V> subMap(K fromKey, boolean fromInclusive,
                                     K toKey,   boolean toInclusive) {
-        return new AscendingSubMap(this,
-                                   false, fromKey, fromInclusive,
-                                   false, toKey,   toInclusive);
+        return new AscendingSubMap<>(this,
+                                     false, fromKey, fromInclusive,
+                                     false, toKey,   toInclusive);
     }
 
     /**
@@ -888,9 +891,9 @@
      * @since 1.6
      */
     public NavigableMap<K,V> headMap(K toKey, boolean inclusive) {
-        return new AscendingSubMap(this,
-                                   true,  null,  true,
-                                   false, toKey, inclusive);
+        return new AscendingSubMap<>(this,
+                                     true,  null,  true,
+                                     false, toKey, inclusive);
     }
 
     /**
@@ -902,9 +905,9 @@
      * @since 1.6
      */
     public NavigableMap<K,V> tailMap(K fromKey, boolean inclusive) {
-        return new AscendingSubMap(this,
-                                   false, fromKey, inclusive,
-                                   true,  null,    true);
+        return new AscendingSubMap<>(this,
+                                     false, fromKey, inclusive,
+                                     true,  null,    true);
     }
 
     /**
@@ -978,8 +981,8 @@
         public boolean contains(Object o) {
             if (!(o instanceof Map.Entry))
                 return false;
-            Map.Entry<K,V> entry = (Map.Entry<K,V>) o;
-            V value = entry.getValue();
+            Map.Entry<?,?> entry = (Map.Entry<?,?>) o;
+            Object value = entry.getValue();
             Entry<K,V> p = getEntry(entry.getKey());
             return p != null && valEquals(p.getValue(), value);
         }
@@ -987,8 +990,8 @@
         public boolean remove(Object o) {
             if (!(o instanceof Map.Entry))
                 return false;
-            Map.Entry<K,V> entry = (Map.Entry<K,V>) o;
-            V value = entry.getValue();
+            Map.Entry<?,?> entry = (Map.Entry<?,?>) o;
+            Object value = entry.getValue();
             Entry<K,V> p = getEntry(entry.getKey());
             if (p != null && valEquals(p.getValue(), value)) {
                 deleteEntry(p);
@@ -1023,21 +1026,21 @@
     }
 
     static final class KeySet<E> extends AbstractSet<E> implements NavigableSet<E> {
-        private final NavigableMap<E, Object> m;
-        KeySet(NavigableMap<E,Object> map) { m = map; }
+        private final NavigableMap<E, ?> m;
+        KeySet(NavigableMap<E,?> map) { m = map; }
 
         public Iterator<E> iterator() {
             if (m instanceof TreeMap)
-                return ((TreeMap<E,Object>)m).keyIterator();
+                return ((TreeMap<E,?>)m).keyIterator();
             else
-                return (Iterator<E>)(((TreeMap.NavigableSubMap)m).keyIterator());
+                return ((TreeMap.NavigableSubMap<E,?>)m).keyIterator();
         }
 
         public Iterator<E> descendingIterator() {
             if (m instanceof TreeMap)
-                return ((TreeMap<E,Object>)m).descendingKeyIterator();
+                return ((TreeMap<E,?>)m).descendingKeyIterator();
             else
-                return (Iterator<E>)(((TreeMap.NavigableSubMap)m).descendingKeyIterator());
+                return ((TreeMap.NavigableSubMap<E,?>)m).descendingKeyIterator();
         }
 
         public int size() { return m.size(); }
@@ -1052,11 +1055,11 @@
         public E last() { return m.lastKey(); }
         public Comparator<? super E> comparator() { return m.comparator(); }
         public E pollFirst() {
-            Map.Entry<E,Object> e = m.pollFirstEntry();
+            Map.Entry<E,?> e = m.pollFirstEntry();
             return (e == null) ? null : e.getKey();
         }
         public E pollLast() {
-            Map.Entry<E,Object> e = m.pollLastEntry();
+            Map.Entry<E,?> e = m.pollLastEntry();
             return (e == null) ? null : e.getKey();
         }
         public boolean remove(Object o) {
@@ -1085,7 +1088,7 @@
             return tailSet(fromElement, true);
         }
         public NavigableSet<E> descendingSet() {
-            return new KeySet(m.descendingMap());
+            return new KeySet<>(m.descendingMap());
         }
     }
 
@@ -1184,6 +1187,7 @@
     /**
      * Compares two keys using the correct comparison method for this TreeMap.
      */
+    @SuppressWarnings("unchecked")
     final int compare(Object k1, Object k2) {
         return comparator==null ? ((Comparable<? super K>)k1).compareTo((K)k2)
             : comparator.compare((K)k1, (K)k2);
@@ -1488,7 +1492,7 @@
         public final NavigableSet<K> navigableKeySet() {
             KeySet<K> nksv = navigableKeySetView;
             return (nksv != null) ? nksv :
-                (navigableKeySetView = new TreeMap.KeySet(this));
+                (navigableKeySetView = new TreeMap.KeySet<>(this));
         }
 
         public final Set<K> keySet() {
@@ -1522,7 +1526,7 @@
                 if (size == -1 || sizeModCount != m.modCount) {
                     sizeModCount = m.modCount;
                     size = 0;
-                    Iterator i = iterator();
+                    Iterator<?> i = iterator();
                     while (i.hasNext()) {
                         size++;
                         i.next();
@@ -1539,11 +1543,11 @@
             public boolean contains(Object o) {
                 if (!(o instanceof Map.Entry))
                     return false;
-                Map.Entry<K,V> entry = (Map.Entry<K,V>) o;
-                K key = entry.getKey();
+                Map.Entry<?,?> entry = (Map.Entry<?,?>) o;
+                Object key = entry.getKey();
                 if (!inRange(key))
                     return false;
-                TreeMap.Entry node = m.getEntry(key);
+                TreeMap.Entry<?,?> node = m.getEntry(key);
                 return node != null &&
                     valEquals(node.getValue(), entry.getValue());
             }
@@ -1551,8 +1555,8 @@
             public boolean remove(Object o) {
                 if (!(o instanceof Map.Entry))
                     return false;
-                Map.Entry<K,V> entry = (Map.Entry<K,V>) o;
-                K key = entry.getKey();
+                Map.Entry<?,?> entry = (Map.Entry<?,?>) o;
+                Object key = entry.getKey();
                 if (!inRange(key))
                     return false;
                 TreeMap.Entry<K,V> node = m.getEntry(key);
@@ -1709,34 +1713,34 @@
                 throw new IllegalArgumentException("fromKey out of range");
             if (!inRange(toKey, toInclusive))
                 throw new IllegalArgumentException("toKey out of range");
-            return new AscendingSubMap(m,
-                                       false, fromKey, fromInclusive,
-                                       false, toKey,   toInclusive);
+            return new AscendingSubMap<>(m,
+                                         false, fromKey, fromInclusive,
+                                         false, toKey,   toInclusive);
         }
 
         public NavigableMap<K,V> headMap(K toKey, boolean inclusive) {
             if (!inRange(toKey, inclusive))
                 throw new IllegalArgumentException("toKey out of range");
-            return new AscendingSubMap(m,
-                                       fromStart, lo,    loInclusive,
-                                       false,     toKey, inclusive);
+            return new AscendingSubMap<>(m,
+                                         fromStart, lo,    loInclusive,
+                                         false,     toKey, inclusive);
         }
 
         public NavigableMap<K,V> tailMap(K fromKey, boolean inclusive) {
             if (!inRange(fromKey, inclusive))
                 throw new IllegalArgumentException("fromKey out of range");
-            return new AscendingSubMap(m,
-                                       false, fromKey, inclusive,
-                                       toEnd, hi,      hiInclusive);
+            return new AscendingSubMap<>(m,
+                                         false, fromKey, inclusive,
+                                         toEnd, hi,      hiInclusive);
         }
 
         public NavigableMap<K,V> descendingMap() {
             NavigableMap<K,V> mv = descendingMapView;
             return (mv != null) ? mv :
                 (descendingMapView =
-                 new DescendingSubMap(m,
-                                      fromStart, lo, loInclusive,
-                                      toEnd,     hi, hiInclusive));
+                 new DescendingSubMap<>(m,
+                                        fromStart, lo, loInclusive,
+                                        toEnd,     hi, hiInclusive));
         }
 
         Iterator<K> keyIterator() {
@@ -1790,34 +1794,34 @@
                 throw new IllegalArgumentException("fromKey out of range");
             if (!inRange(toKey, toInclusive))
                 throw new IllegalArgumentException("toKey out of range");
-            return new DescendingSubMap(m,
-                                        false, toKey,   toInclusive,
-                                        false, fromKey, fromInclusive);
+            return new DescendingSubMap<>(m,
+                                          false, toKey,   toInclusive,
+                                          false, fromKey, fromInclusive);
         }
 
         public NavigableMap<K,V> headMap(K toKey, boolean inclusive) {
             if (!inRange(toKey, inclusive))
                 throw new IllegalArgumentException("toKey out of range");
-            return new DescendingSubMap(m,
-                                        false, toKey, inclusive,
-                                        toEnd, hi,    hiInclusive);
+            return new DescendingSubMap<>(m,
+                                          false, toKey, inclusive,
+                                          toEnd, hi,    hiInclusive);
         }
 
         public NavigableMap<K,V> tailMap(K fromKey, boolean inclusive) {
             if (!inRange(fromKey, inclusive))
                 throw new IllegalArgumentException("fromKey out of range");
-            return new DescendingSubMap(m,
-                                        fromStart, lo, loInclusive,
-                                        false, fromKey, inclusive);
+            return new DescendingSubMap<>(m,
+                                          fromStart, lo, loInclusive,
+                                          false, fromKey, inclusive);
         }
 
         public NavigableMap<K,V> descendingMap() {
             NavigableMap<K,V> mv = descendingMapView;
             return (mv != null) ? mv :
                 (descendingMapView =
-                 new AscendingSubMap(m,
-                                     fromStart, lo, loInclusive,
-                                     toEnd,     hi, hiInclusive));
+                 new AscendingSubMap<>(m,
+                                       fromStart, lo, loInclusive,
+                                       toEnd,     hi, hiInclusive));
         }
 
         Iterator<K> keyIterator() {
@@ -1862,9 +1866,9 @@
         private boolean fromStart = false, toEnd = false;
         private K fromKey, toKey;
         private Object readResolve() {
-            return new AscendingSubMap(TreeMap.this,
-                                       fromStart, fromKey, true,
-                                       toEnd, toKey, false);
+            return new AscendingSubMap<>(TreeMap.this,
+                                         fromStart, fromKey, true,
+                                         toEnd, toKey, false);
         }
         public Set<Map.Entry<K,V>> entrySet() { throw new InternalError(); }
         public K lastKey() { throw new InternalError(); }
@@ -2331,12 +2335,12 @@
      * @param defaultVal if non-null, this default value is used for
      *        each value in the map.  If null, each value is read from
      *        iterator or stream, as described above.
-     * @throws IOException propagated from stream reads. This cannot
+     * @throws java.io.IOException propagated from stream reads. This cannot
      *         occur if str is null.
      * @throws ClassNotFoundException propagated from readObject.
      *         This cannot occur if str is null.
      */
-    private void buildFromSorted(int size, Iterator it,
+    private void buildFromSorted(int size, Iterator<?> it,
                                  java.io.ObjectInputStream str,
                                  V defaultVal)
         throws  java.io.IOException, ClassNotFoundException {
@@ -2359,9 +2363,10 @@
      * @param redLevel the level at which nodes should be red.
      *        Must be equal to computeRedLevel for tree of this size.
      */
+    @SuppressWarnings("unchecked")
     private final Entry<K,V> buildFromSorted(int level, int lo, int hi,
                                              int redLevel,
-                                             Iterator it,
+                                             Iterator<?> it,
                                              java.io.ObjectInputStream str,
                                              V defaultVal)
         throws  java.io.IOException, ClassNotFoundException {
@@ -2391,9 +2396,9 @@
         V value;
         if (it != null) {
             if (defaultVal==null) {
-                Map.Entry<K,V> entry = (Map.Entry<K,V>)it.next();
-                key = entry.getKey();
-                value = entry.getValue();
+                Map.Entry<?,?> entry = (Map.Entry<?,?>)it.next();
+                key = (K)entry.getKey();
+                value = (V)entry.getValue();
             } else {
                 key = (K)it.next();
                 value = defaultVal;
diff --git a/src/share/classes/java/util/TreeSet.java b/src/share/classes/java/util/TreeSet.java
index 6b2a33d..db71096 100644
--- a/src/share/classes/java/util/TreeSet.java
+++ b/src/share/classes/java/util/TreeSet.java
@@ -302,7 +302,7 @@
             m instanceof TreeMap) {
             SortedSet<? extends E> set = (SortedSet<? extends E>) c;
             TreeMap<E,Object> map = (TreeMap<E, Object>) m;
-            Comparator<? super E> cc = (Comparator<? super E>) set.comparator();
+            Comparator<?> cc = set.comparator();
             Comparator<? super E> mc = map.comparator();
             if (cc==mc || (cc != null && cc.equals(mc))) {
                 map.addAllForTreeSet(set, PRESENT);
@@ -469,8 +469,9 @@
      *
      * @return a shallow copy of this set
      */
+    @SuppressWarnings("unchecked")
     public Object clone() {
-        TreeSet<E> clone = null;
+        TreeSet<E> clone;
         try {
             clone = (TreeSet<E>) super.clone();
         } catch (CloneNotSupportedException e) {
@@ -519,14 +520,11 @@
         s.defaultReadObject();
 
         // Read in Comparator
-        Comparator<? super E> c = (Comparator<? super E>) s.readObject();
+        @SuppressWarnings("unchecked")
+            Comparator<? super E> c = (Comparator<? super E>) s.readObject();
 
         // Create backing TreeMap
-        TreeMap<E,Object> tm;
-        if (c==null)
-            tm = new TreeMap<>();
-        else
-            tm = new TreeMap<>(c);
+        TreeMap<E,Object> tm = new TreeMap<>(c);
         m = tm;
 
         // Read in size
diff --git a/src/share/classes/java/util/WeakHashMap.java b/src/share/classes/java/util/WeakHashMap.java
index eb61520..f5f6237 100644
--- a/src/share/classes/java/util/WeakHashMap.java
+++ b/src/share/classes/java/util/WeakHashMap.java
@@ -186,7 +186,7 @@
 
     @SuppressWarnings("unchecked")
     private Entry<K,V>[] newTable(int n) {
-        return (Entry<K,V>[]) new Entry[n];
+        return (Entry<K,V>[]) new Entry<?,?>[n];
     }
 
     /**
diff --git a/src/share/classes/java/util/regex/Matcher.java b/src/share/classes/java/util/regex/Matcher.java
index d654790..5e437e6 100644
--- a/src/share/classes/java/util/regex/Matcher.java
+++ b/src/share/classes/java/util/regex/Matcher.java
@@ -759,16 +759,19 @@
             char nextChar = replacement.charAt(cursor);
             if (nextChar == '\\') {
                 cursor++;
+                if (cursor == replacement.length())
+                    throw new IllegalArgumentException(
+                        "character to be escaped is missing");
                 nextChar = replacement.charAt(cursor);
                 result.append(nextChar);
                 cursor++;
             } else if (nextChar == '$') {
                 // Skip past $
                 cursor++;
-                // A StringIndexOutOfBoundsException is thrown if
-                // this "$" is the last character in replacement
-                // string in current implementation, a IAE might be
-                // more appropriate.
+                // Throw IAE if this "$" is the last character in replacement
+                if (cursor == replacement.length())
+                   throw new IllegalArgumentException(
+                        "Illegal group reference: group index is missing");
                 nextChar = replacement.charAt(cursor);
                 int refNum = -1;
                 if (nextChar == '{') {
diff --git a/src/share/classes/sun/awt/image/ImageWatched.java b/src/share/classes/sun/awt/image/ImageWatched.java
index 4d7220a..b740aa1 100644
--- a/src/share/classes/sun/awt/image/ImageWatched.java
+++ b/src/share/classes/sun/awt/image/ImageWatched.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -143,6 +143,7 @@
         if (iw != null && !isWatcher(iw)) {
             watcherList = new WeakLink(iw, watcherList);
         }
+        watcherList = watcherList.removeWatcher(null);
     }
 
     public synchronized boolean isWatcher(ImageObserver iw) {
diff --git a/src/share/classes/sun/nio/ch/DatagramChannelImpl.java b/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
index 466a5db..6386893 100644
--- a/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
+++ b/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -970,7 +970,8 @@
 
     protected void implCloseSelectableChannel() throws IOException {
         synchronized (stateLock) {
-            nd.preClose(fd);
+            if (state != ST_KILLED)
+                nd.preClose(fd);
             ResourceManager.afterUdpClose();
 
             // if member of mulitcast group then invalidate all keys
diff --git a/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java b/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
index 671fad2..a7f90a9 100644
--- a/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
+++ b/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -261,7 +261,8 @@
 
     protected void implCloseSelectableChannel() throws IOException {
         synchronized (stateLock) {
-            nd.preClose(fd);
+            if (state != ST_KILLED)
+                nd.preClose(fd);
             long th = thread;
             if (th != 0)
                 NativeThread.signal(th);
diff --git a/src/share/classes/sun/nio/ch/SocketChannelImpl.java b/src/share/classes/sun/nio/ch/SocketChannelImpl.java
index ba55ab1..fe2c5fe 100644
--- a/src/share/classes/sun/nio/ch/SocketChannelImpl.java
+++ b/src/share/classes/sun/nio/ch/SocketChannelImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -816,7 +816,8 @@
             // channel from using the old fd, which might be recycled in the
             // meantime and allocated to an entirely different channel.
             //
-            nd.preClose(fd);
+            if (state != ST_KILLED)
+                nd.preClose(fd);
 
             // Signal native threads, if needed.  If a target thread is not
             // currently blocked in an I/O operation then no harm is done since
diff --git a/src/share/classes/sun/nio/cs/ext/SJIS_0213.java b/src/share/classes/sun/nio/cs/ext/SJIS_0213.java
index 6c47bd6..10fd8b7 100644
--- a/src/share/classes/sun/nio/cs/ext/SJIS_0213.java
+++ b/src/share/classes/sun/nio/cs/ext/SJIS_0213.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,8 @@
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CoderResult;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Arrays;
 import sun.nio.cs.CharsetMapping;
 
@@ -73,8 +75,12 @@
         return new Encoder(this);
     }
 
-    static CharsetMapping mapping =
-        CharsetMapping.get(SJIS_0213.class.getResourceAsStream("sjis0213.dat"));
+    static CharsetMapping mapping = AccessController.doPrivileged(
+        new PrivilegedAction<CharsetMapping>() {
+            public CharsetMapping run() {
+                return CharsetMapping.get(SJIS_0213.class.getResourceAsStream("sjis0213.dat"));
+            }
+        });
 
     protected static class Decoder extends CharsetDecoder {
         protected static final char UNMAPPABLE = CharsetMapping.UNMAPPABLE_DECODING;
diff --git a/src/share/classes/sun/security/ec/ECParameters.java b/src/share/classes/sun/security/ec/ECParameters.java
index 9d15995..614ba3f 100644
--- a/src/share/classes/sun/security/ec/ECParameters.java
+++ b/src/share/classes/sun/security/ec/ECParameters.java
@@ -87,8 +87,8 @@
         if ((data.length == 0) || (data[0] != 4)) {
             throw new IOException("Only uncompressed point format supported");
         }
-        int n = (curve.getField().getFieldSize() + 7 ) >> 3;
-        if (data.length != (n * 2) + 1) {
+        int n = data.length / 2;
+        if (n > ((curve.getField().getFieldSize() + 7 ) >> 3)) {
             throw new IOException("Point does not match field size");
         }
         byte[] xb = new byte[n];
diff --git a/src/share/classes/sun/security/krb5/Credentials.java b/src/share/classes/sun/security/krb5/Credentials.java
index 15328cd..3414e2f 100644
--- a/src/share/classes/sun/security/krb5/Credentials.java
+++ b/src/share/classes/sun/security/krb5/Credentials.java
@@ -330,12 +330,17 @@
         CredentialsCache ccache =
             CredentialsCache.getInstance(princ, ticketCache);
 
-        if (ccache == null)
+        if (ccache == null) {
             return null;
+        }
 
         sun.security.krb5.internal.ccache.Credentials tgtCred  =
             ccache.getDefaultCreds();
 
+        if (tgtCred == null) {
+            return null;
+        }
+
         if (EType.isSupported(tgtCred.getEType())) {
             return tgtCred.setKrbCreds();
         } else {
@@ -375,19 +380,21 @@
             cache = CredentialsCache.getInstance();
         }
         if (cache != null) {
-            if (DEBUG) {
-                System.out.println(">>> KrbCreds found the default ticket " +
-                                   "granting ticket in credential cache.");
-            }
             sun.security.krb5.internal.ccache.Credentials temp =
                 cache.getDefaultCreds();
-            if (EType.isSupported(temp.getEType())) {
-                result = temp.setKrbCreds();
-            } else {
+            if (temp != null) {
                 if (DEBUG) {
-                    System.out.println(
-                        ">>> unsupported key type found the default TGT: " +
-                        temp.getEType());
+                    System.out.println(">>> KrbCreds found the default ticket"
+                            + " granting ticket in credential cache.");
+                }
+                if (EType.isSupported(temp.getEType())) {
+                    result = temp.setKrbCreds();
+                } else {
+                    if (DEBUG) {
+                        System.out.println(
+                            ">>> unsupported key type found the default TGT: " +
+                            temp.getEType());
+                    }
                 }
             }
         }
diff --git a/src/share/classes/sun/security/ssl/AppOutputStream.java b/src/share/classes/sun/security/ssl/AppOutputStream.java
index 6be00b8..f9f6e9e 100644
--- a/src/share/classes/sun/security/ssl/AppOutputStream.java
+++ b/src/share/classes/sun/security/ssl/AppOutputStream.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -91,9 +91,20 @@
         // however they like; if we buffered here, they couldn't.
         try {
             do {
+                boolean holdRecord = false;
                 int howmuch;
                 if (isFirstRecordOfThePayload && c.needToSplitPayload()) {
                     howmuch = Math.min(0x01, r.availableDataBytes());
+                     /*
+                      * Nagle's algorithm (TCP_NODELAY) was coming into
+                      * play here when writing short (split) packets.
+                      * Signal to the OutputRecord code to internally
+                      * buffer this small packet until the next outbound
+                      * packet (of any type) is written.
+                      */
+                     if ((len != 1) && (howmuch == 1)) {
+                         holdRecord = true;
+                     }
                 } else {
                     howmuch = Math.min(len, r.availableDataBytes());
                 }
@@ -108,7 +119,7 @@
                     off += howmuch;
                     len -= howmuch;
                 }
-                c.writeRecord(r);
+                c.writeRecord(r, holdRecord);
                 c.checkWrite();
             } while (len > 0);
         } catch (Exception e) {
diff --git a/src/share/classes/sun/security/ssl/EngineOutputRecord.java b/src/share/classes/sun/security/ssl/EngineOutputRecord.java
index 707fd04..e5eb7f7 100644
--- a/src/share/classes/sun/security/ssl/EngineOutputRecord.java
+++ b/src/share/classes/sun/security/ssl/EngineOutputRecord.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -155,8 +155,9 @@
      * data to be generated/output before the exception is ever
      * generated.
      */
-    void writeBuffer(OutputStream s, byte [] buf, int off, int len)
-            throws IOException {
+    @Override
+    void writeBuffer(OutputStream s, byte [] buf, int off, int len,
+            int debugOffset) throws IOException {
         /*
          * Copy data out of buffer, it's ready to go.
          */
@@ -196,7 +197,8 @@
             // compress();              // eventually
             addMAC(writeMAC);
             encrypt(writeCipher);
-            write((OutputStream)null);  // send down for processing
+            write((OutputStream)null, false,  // send down for processing
+                (ByteArrayOutputStream)null);
         }
         return;
     }
diff --git a/src/share/classes/sun/security/ssl/OutputRecord.java b/src/share/classes/sun/security/ssl/OutputRecord.java
index e5c7a6d..ca3cf7b 100644
--- a/src/share/classes/sun/security/ssl/OutputRecord.java
+++ b/src/share/classes/sun/security/ssl/OutputRecord.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 
 import java.io.*;
 import java.nio.*;
+import java.util.Arrays;
 
 import javax.net.ssl.SSLException;
 import sun.misc.HexDumpEncoder;
@@ -227,6 +228,24 @@
     }
 
     /*
+     * Increases the capacity if necessary to ensure that it can hold
+     * at least the number of elements specified by the minimum
+     * capacity argument.
+     *
+     * Note that the increased capacity is only can be used for held
+     * record buffer. Please DO NOT update the availableDataBytes()
+     * according to the expended buffer capacity.
+     *
+     * @see availableDataBytes()
+     */
+    private void ensureCapacity(int minCapacity) {
+        // overflow-conscious code
+        if (minCapacity > buf.length) {
+            buf = Arrays.copyOf(buf, minCapacity);
+        }
+    }
+
+    /*
      * Return the type of SSL record that's buffered here.
      */
     final byte contentType() {
@@ -243,7 +262,9 @@
      * that synchronization be done elsewhere.  Also, this does its work
      * in a single low level write, for efficiency.
      */
-    void write(OutputStream s) throws IOException {
+    void write(OutputStream s, boolean holdRecord,
+            ByteArrayOutputStream heldRecordBuffer) throws IOException {
+
         /*
          * Don't emit content-free records.  (Even change cipher spec
          * messages have a byte of data!)
@@ -300,7 +321,49 @@
         }
         firstMessage = false;
 
-        writeBuffer(s, buf, 0, count);
+        /*
+         * The upper levels may want us to delay sending this packet so
+         * multiple TLS Records can be sent in one (or more) TCP packets.
+         * If so, add this packet to the heldRecordBuffer.
+         *
+         * NOTE:  all writes have been synchronized by upper levels.
+         */
+        int debugOffset = 0;
+        if (holdRecord) {
+            /*
+             * If holdRecord is true, we must have a heldRecordBuffer.
+             *
+             * Don't worry about the override of writeBuffer(), because
+             * when holdRecord is true, the implementation in this class
+             * will be used.
+             */
+            writeBuffer(heldRecordBuffer, buf, 0, count, debugOffset);
+        } else {
+            // It's time to send, do we have buffered data?
+            // May or may not have a heldRecordBuffer.
+            if (heldRecordBuffer != null && heldRecordBuffer.size() > 0) {
+                int heldLen = heldRecordBuffer.size();
+
+                // Ensure the capacity of this buffer.
+                ensureCapacity(count + heldLen);
+
+                // Slide everything in the buffer to the right.
+                System.arraycopy(buf, 0, buf, heldLen, count);
+
+                // Prepend the held record to the buffer.
+                System.arraycopy(
+                    heldRecordBuffer.toByteArray(), 0, buf, 0, heldLen);
+                count += heldLen;
+
+                // Clear the held buffer.
+                heldRecordBuffer.reset();
+
+                // The held buffer has been dumped, set the debug dump offset.
+                debugOffset = heldLen;
+            }
+            writeBuffer(s, buf, 0, count, debugOffset);
+        }
+
         reset();
     }
 
@@ -309,15 +372,17 @@
      * we'll override this method and let it take the appropriate
      * action.
      */
-    void writeBuffer(OutputStream s, byte [] buf, int off, int len)
-            throws IOException {
+    void writeBuffer(OutputStream s, byte [] buf, int off, int len,
+            int debugOffset) throws IOException {
         s.write(buf, off, len);
         s.flush();
 
+        // Output only the record from the specified debug offset.
         if (debug != null && Debug.isOn("packet")) {
             try {
                 HexDumpEncoder hd = new HexDumpEncoder();
-                ByteBuffer bb = ByteBuffer.wrap(buf, off, len);
+                ByteBuffer bb = ByteBuffer.wrap(
+                        buf, off + debugOffset, len - debugOffset);
 
                 System.out.println("[Raw write]: length = " +
                     bb.remaining());
diff --git a/src/share/classes/sun/security/ssl/SSLSocketImpl.java b/src/share/classes/sun/security/ssl/SSLSocketImpl.java
index db11db8..b9f2299 100644
--- a/src/share/classes/sun/security/ssl/SSLSocketImpl.java
+++ b/src/share/classes/sun/security/ssl/SSLSocketImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -374,6 +374,12 @@
      */
     private boolean isFirstAppOutputRecord = true;
 
+    /*
+     * If AppOutputStream needs to delay writes of small packets, we
+     * will use this to store the data until we actually do the write.
+     */
+    private ByteArrayOutputStream heldRecordBuffer = null;
+
     //
     // CONSTRUCTORS AND INITIALIZATION CODE
     //
@@ -654,13 +660,24 @@
     //
 
     /*
+     * AppOutputStream calls may need to buffer multiple outbound
+     * application packets.
+     *
+     * All other writeRecord() calls will not buffer, so do not hold
+     * these records.
+     */
+    void writeRecord(OutputRecord r) throws IOException {
+        writeRecord(r, false);
+    }
+
+    /*
      * Record Output. Application data can't be sent until the first
      * handshake establishes a session.
      *
      * NOTE:  we let empty records be written as a hook to force some
      * TCP-level activity, notably handshaking, to occur.
      */
-    void writeRecord(OutputRecord r) throws IOException {
+    void writeRecord(OutputRecord r, boolean holdRecord) throws IOException {
         /*
          * The loop is in case of HANDSHAKE --> ERROR transitions, etc
          */
@@ -731,7 +748,7 @@
                 try {
                     if (writeLock.tryLock(getSoLinger(), TimeUnit.SECONDS)) {
                         try {
-                            writeRecordInternal(r);
+                            writeRecordInternal(r, holdRecord);
                         } finally {
                             writeLock.unlock();
                         }
@@ -779,7 +796,7 @@
             } else {
                 writeLock.lock();
                 try {
-                    writeRecordInternal(r);
+                    writeRecordInternal(r, holdRecord);
                 } finally {
                     writeLock.unlock();
                 }
@@ -787,11 +804,29 @@
         }
     }
 
-    private void writeRecordInternal(OutputRecord r) throws IOException {
+    private void writeRecordInternal(OutputRecord r,
+            boolean holdRecord) throws IOException {
+
         // r.compress(c);
         r.addMAC(writeMAC);
         r.encrypt(writeCipher);
-        r.write(sockOutput);
+
+        if (holdRecord) {
+            // If we were requested to delay the record due to possibility
+            // of Nagle's being active when finally got to writing, and
+            // it's actually not, we don't really need to delay it.
+            if (getTcpNoDelay()) {
+                holdRecord = false;
+            } else {
+                // We need to hold the record, so let's provide
+                // a per-socket place to do it.
+                if (heldRecordBuffer == null) {
+                    // Likely only need 37 bytes.
+                    heldRecordBuffer = new ByteArrayOutputStream(40);
+                }
+            }
+        }
+        r.write(sockOutput, holdRecord, heldRecordBuffer);
 
         /*
          * Check the sequence number state
diff --git a/src/share/classes/sun/tools/java/ClassPath.java b/src/share/classes/sun/tools/java/ClassPath.java
index ccb1cff..5f8aa01 100644
--- a/src/share/classes/sun/tools/java/ClassPath.java
+++ b/src/share/classes/sun/tools/java/ClassPath.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -141,7 +141,7 @@
         } else {
             StringBuilder sb = new StringBuilder(patharray[0]);
             for (int i = 1; i < patharray.length; i++) {
-                sb.append(File.separator);
+                sb.append(File.pathSeparatorChar);
                 sb.append(patharray[i]);
             }
             this.pathstr = sb.toString();
diff --git a/src/share/classes/sun/tools/jcmd/JCmd.java b/src/share/classes/sun/tools/jcmd/JCmd.java
index b84f112..3ec7996 100644
--- a/src/share/classes/sun/tools/jcmd/JCmd.java
+++ b/src/share/classes/sun/tools/jcmd/JCmd.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *com.sun.tools.attach.AttachNotSupportedException
 
@@ -142,17 +142,20 @@
         // Cast to HotSpotVirtualMachine as this is an
         // implementation specific method.
         HotSpotVirtualMachine hvm = (HotSpotVirtualMachine) vm;
-        try (InputStream in = hvm.executeJCmd(command);) {
-            // read to EOF and just print output
-            byte b[] = new byte[256];
-            int n;
-            do {
-                n = in.read(b);
-                if (n > 0) {
-                    String s = new String(b, 0, n, "UTF-8");
-                    System.out.print(s);
-                }
-            } while (n > 0);
+        String lines[] = command .split("\\n");
+        for (String line : lines) {
+            try (InputStream in = hvm.executeJCmd(line);) {
+                // read to EOF and just print output
+                byte b[] = new byte[256];
+                int n;
+                do {
+                    n = in.read(b);
+                    if (n > 0) {
+                        String s = new String(b, 0, n, "UTF-8");
+                        System.out.print(s);
+                    }
+                } while (n > 0);
+            }
         }
         vm.detach();
     }
diff --git a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java
index 49bb826..5c844bc 100644
--- a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java
+++ b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java
@@ -78,7 +78,7 @@
         }
         try {
             // only support legacy JAR URL syntax  jar:{uri}!/{entry} for now
-            String spec = uri.getSchemeSpecificPart();
+            String spec = uri.getRawSchemeSpecificPart();
             int sep = spec.indexOf("!/");
             if (sep != -1)
                 spec = spec.substring(0, sep);
diff --git a/src/share/lib/security/java.security b/src/share/lib/security/java.security
index a89d40e..fc48b9e 100644
--- a/src/share/lib/security/java.security
+++ b/src/share/lib/security/java.security
@@ -123,7 +123,7 @@
 # passed to checkPackageAccess unless the
 # corresponding RuntimePermission ("accessClassInPackage."+package) has
 # been granted.
-package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
+package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.
 
 #
 # List of comma-separated packages that start with or equal this string
diff --git a/src/share/lib/security/java.security-macosx b/src/share/lib/security/java.security-macosx
index 42f9d3a..65be54c 100644
--- a/src/share/lib/security/java.security-macosx
+++ b/src/share/lib/security/java.security-macosx
@@ -124,7 +124,7 @@
 # passed to checkPackageAccess unless the
 # corresponding RuntimePermission ("accessClassInPackage."+package) has
 # been granted.
-package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,apple.
+package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,apple.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.
 
 #
 # List of comma-separated packages that start with or equal this string
diff --git a/src/share/lib/security/java.security-solaris b/src/share/lib/security/java.security-solaris
index d01cfda..1abd2f4 100644
--- a/src/share/lib/security/java.security-solaris
+++ b/src/share/lib/security/java.security-solaris
@@ -125,7 +125,7 @@
 # passed to checkPackageAccess unless the
 # corresponding RuntimePermission ("accessClassInPackage."+package) has
 # been granted.
-package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
+package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.
 
 #
 # List of comma-separated packages that start with or equal this string
diff --git a/src/share/lib/security/java.security-windows b/src/share/lib/security/java.security-windows
index 3db627a..8091e4a 100644
--- a/src/share/lib/security/java.security-windows
+++ b/src/share/lib/security/java.security-windows
@@ -124,7 +124,7 @@
 # passed to checkPackageAccess unless the
 # corresponding RuntimePermission ("accessClassInPackage."+package) has
 # been granted.
-package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
+package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.
 
 #
 # List of comma-separated packages that start with or equal this string
diff --git a/src/share/native/sun/font/sunFont.c b/src/share/native/sun/font/sunFont.c
index e6ce37f..cfcc5ed 100644
--- a/src/share/native/sun/font/sunFont.c
+++ b/src/share/native/sun/font/sunFont.c
@@ -29,7 +29,7 @@
 #include "jlong.h"
 #include "sunfontids.h"
 #include "fontscalerdefs.h"
-#include "sun_font_FontManager.h"
+#include "sun_font_SunFontManager.h"
 #include "sun_font_NullFontScaler.h"
 #include "sun_font_StrikeCache.h"
 
diff --git a/src/solaris/classes/sun/java2d/xr/XRRenderer.java b/src/solaris/classes/sun/java2d/xr/XRRenderer.java
index e68d078..f2fd155 100644
--- a/src/solaris/classes/sun/java2d/xr/XRRenderer.java
+++ b/src/solaris/classes/sun/java2d/xr/XRRenderer.java
@@ -69,20 +69,26 @@
     }
 
     public void drawLine(SunGraphics2D sg2d, int x1, int y1, int x2, int y2) {
-        try {
-            SunToolkit.awtLock();
+        Region compClip = sg2d.getCompClip();
+        int transX1 = x1 + sg2d.transX;
+        int transY1 = y1 + sg2d.transY;
+        int transX2 = x2 + sg2d.transX;
+        int transY2 = y2 + sg2d.transY;
 
-            validateSurface(sg2d);
-            int transx = sg2d.transX;
-            int transy = sg2d.transY;
+        // Non clipped fast path
+        if (compClip.contains(transX1, transY1)
+                && compClip.contains(transX2, transY2)) {
+            try {
+                SunToolkit.awtLock();
 
-            XRSurfaceData xrsd = (XRSurfaceData) sg2d.surfaceData;
-
-            tileManager.addLine(x1 + transx, y1 + transy,
-                                x2 + transx, y2 + transy);
-            tileManager.fillMask(xrsd);
-        } finally {
-            SunToolkit.awtUnlock();
+                validateSurface(sg2d);
+                tileManager.addLine(transX1, transY1, transX2, transY2);
+                tileManager.fillMask((XRSurfaceData) sg2d.surfaceData);
+            } finally {
+                SunToolkit.awtUnlock();
+            }
+        } else {
+            draw(sg2d, new Line2D.Float(x1, y1, x2, y2));
         }
     }
 
diff --git a/src/solaris/classes/sun/nio/ch/SinkChannelImpl.java b/src/solaris/classes/sun/nio/ch/SinkChannelImpl.java
index 6e89d06..e99c184 100644
--- a/src/solaris/classes/sun/nio/ch/SinkChannelImpl.java
+++ b/src/solaris/classes/sun/nio/ch/SinkChannelImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -84,7 +84,8 @@
 
     protected void implCloseSelectableChannel() throws IOException {
         synchronized (stateLock) {
-            nd.preClose(fd);
+            if (state != ST_KILLED)
+                nd.preClose(fd);
             long th = thread;
             if (th != 0)
                 NativeThread.signal(th);
diff --git a/src/solaris/classes/sun/nio/ch/SourceChannelImpl.java b/src/solaris/classes/sun/nio/ch/SourceChannelImpl.java
index 915573b..b6b005a 100644
--- a/src/solaris/classes/sun/nio/ch/SourceChannelImpl.java
+++ b/src/solaris/classes/sun/nio/ch/SourceChannelImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -84,7 +84,8 @@
 
     protected void implCloseSelectableChannel() throws IOException {
         synchronized (stateLock) {
-            nd.preClose(fd);
+            if (state != ST_KILLED)
+                nd.preClose(fd);
             long th = thread;
             if (th != 0)
                 NativeThread.signal(th);
diff --git a/src/solaris/native/com/sun/management/MacosxOperatingSystem.c b/src/solaris/native/com/sun/management/MacosxOperatingSystem.c
index e2c561b..3e7ac65 100644
--- a/src/solaris/native/com/sun/management/MacosxOperatingSystem.c
+++ b/src/solaris/native/com/sun/management/MacosxOperatingSystem.c
@@ -25,16 +25,136 @@
 
 #include "com_sun_management_UnixOperatingSystem.h"
 
+#include <sys/time.h>
+#include <mach/mach.h>
+#include <mach/task_info.h>
+
+
 JNIEXPORT jdouble JNICALL
 Java_com_sun_management_UnixOperatingSystem_getSystemCpuLoad
 (JNIEnv *env, jobject dummy)
 {
-  return -1.0; // not available
+    // This code is influenced by the darwin top source
+
+    kern_return_t kr;
+    mach_msg_type_number_t count;
+    host_cpu_load_info_data_t load;
+
+    static jlong last_used  = 0;
+    static jlong last_total = 0;
+
+    count = HOST_CPU_LOAD_INFO_COUNT;
+    kr = host_statistics(mach_host_self(), HOST_CPU_LOAD_INFO, (host_info_t)&load, &count);
+    if (kr != KERN_SUCCESS) {
+        return -1;
+    }
+
+    jlong used  = load.cpu_ticks[CPU_STATE_USER] + load.cpu_ticks[CPU_STATE_NICE] + load.cpu_ticks[CPU_STATE_SYSTEM];
+    jlong total = used + load.cpu_ticks[CPU_STATE_IDLE];
+
+    if (last_used == 0 || last_total == 0) {
+        // First call, just set the last values
+        last_used  = used;
+        last_total = total;
+        // return 0 since we have no data, not -1 which indicates error
+        return 0;
+    }
+
+    jlong used_delta  = used - last_used;
+    jlong total_delta = total - last_total;
+
+    jdouble cpu = (jdouble) used_delta / total_delta;
+
+    last_used  = used;
+    last_total = total;
+
+    return cpu;
 }
 
+
+#define TIME_VALUE_TO_TIMEVAL(a, r) do {  \
+     (r)->tv_sec = (a)->seconds;          \
+     (r)->tv_usec = (a)->microseconds;    \
+} while (0)
+
+
+#define TIME_VALUE_TO_MICROSECONDS(TV) \
+     ((TV).tv_sec * 1000 * 1000 + (TV).tv_usec)
+
+
 JNIEXPORT jdouble JNICALL
 Java_com_sun_management_UnixOperatingSystem_getProcessCpuLoad
 (JNIEnv *env, jobject dummy)
 {
-  return -1.0; // not available
-}
+    // This code is influenced by the darwin top source
+
+    struct task_basic_info_64 task_info_data;
+    struct task_thread_times_info thread_info_data;
+    struct timeval user_timeval, system_timeval, task_timeval;
+    struct timeval now;
+    mach_port_t task = mach_task_self();
+    kern_return_t kr;
+
+    static jlong last_task_time = 0;
+    static jlong last_time      = 0;
+
+    mach_msg_type_number_t thread_info_count = TASK_THREAD_TIMES_INFO_COUNT;
+    kr = task_info(task,
+            TASK_THREAD_TIMES_INFO,
+            (task_info_t)&thread_info_data,
+            &thread_info_count);
+    if (kr != KERN_SUCCESS) {
+        // Most likely cause: |task| is a zombie.
+        return -1;
+    }
+
+    mach_msg_type_number_t count = TASK_BASIC_INFO_64_COUNT;
+    kr = task_info(task,
+            TASK_BASIC_INFO_64,
+            (task_info_t)&task_info_data,
+            &count);
+    if (kr != KERN_SUCCESS) {
+        // Most likely cause: |task| is a zombie.
+        return -1;
+    }
+
+    /* Set total_time. */
+    // thread info contains live time...
+    TIME_VALUE_TO_TIMEVAL(&thread_info_data.user_time, &user_timeval);
+    TIME_VALUE_TO_TIMEVAL(&thread_info_data.system_time, &system_timeval);
+    timeradd(&user_timeval, &system_timeval, &task_timeval);
+
+    // ... task info contains terminated time.
+    TIME_VALUE_TO_TIMEVAL(&task_info_data.user_time, &user_timeval);
+    TIME_VALUE_TO_TIMEVAL(&task_info_data.system_time, &system_timeval);
+    timeradd(&user_timeval, &task_timeval, &task_timeval);
+    timeradd(&system_timeval, &task_timeval, &task_timeval);
+
+    if (gettimeofday(&now, NULL) < 0) {
+       return -1;
+    }
+    jint ncpus      = JVM_ActiveProcessorCount();
+    jlong time      = TIME_VALUE_TO_MICROSECONDS(now) * ncpus;
+    jlong task_time = TIME_VALUE_TO_MICROSECONDS(task_timeval);
+
+    if ((last_task_time == 0) || (last_time == 0)) {
+        // First call, just set the last values.
+        last_task_time = task_time;
+        last_time      = time;
+        // return 0 since we have no data, not -1 which indicates error
+        return 0;
+    }
+
+    jlong task_time_delta = task_time - last_task_time;
+    jlong time_delta      = time - last_time;
+    if (time_delta == 0) {
+        return -1;
+    }
+
+    jdouble cpu = (jdouble) task_time_delta / time_delta;
+
+    last_task_time = task_time;
+    last_time      = time;
+
+    return cpu;
+ }
diff --git a/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c b/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c
index 088b3cf..656306c 100644
--- a/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c
+++ b/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c
@@ -34,6 +34,13 @@
 #include <sys/stat.h>
 #if defined(_ALLBSD_SOURCE)
 #include <sys/sysctl.h>
+#ifdef __APPLE__
+#include <sys/param.h>
+#include <sys/mount.h>
+#include <mach/mach.h>
+#include <sys/proc_info.h>
+#include <libproc.h>
+#endif
 #else
 #include <sys/swap.h>
 #endif
@@ -150,6 +157,13 @@
     avail = (jlong)si.freeswap * si.mem_unit;
 
     return available ? avail : total;
+#elif defined(__APPLE__)
+    struct xsw_usage vmusage;
+    size_t size = sizeof(vmusage);
+    if (sysctlbyname("vm.swapusage", &vmusage, &size, NULL, 0) != 0) {
+        throw_internal_error(env, "sysctlbyname failed");
+    }
+    return available ? (jlong)vmusage.xsu_avail : (jlong)vmusage.xsu_total;
 #else /* _ALLBSD_SOURCE */
     /*
      * XXXBSD: there's no way available to get swap info in
@@ -216,6 +230,15 @@
 
     fclose(fp);
     return (jlong)vsize;
+#elif defined(__APPLE__)
+    struct task_basic_info t_info;
+    mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
+
+    kern_return_t res = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&t_info, &t_info_count);
+    if (res != KERN_SUCCESS) {
+        throw_internal_error(env, "task_info failed");
+    }
+    return t_info.virtual_size;
 #else /* _ALLBSD_SOURCE */
     /*
      * XXXBSD: there's no way available to do it in FreeBSD, AFAIK.
@@ -243,6 +266,17 @@
 Java_com_sun_management_UnixOperatingSystem_getProcessCpuTime
   (JNIEnv *env, jobject mbean)
 {
+#ifdef __APPLE__
+    struct rusage usage;
+    if (getrusage(RUSAGE_SELF, &usage) != 0) {
+        throw_internal_error(env, "getrusage failed");
+        return -1;
+    }
+    jlong microsecs =
+        usage.ru_utime.tv_sec * 1000 * 1000 + usage.ru_utime.tv_usec +
+        usage.ru_stime.tv_sec * 1000 * 1000 + usage.ru_stime.tv_usec;
+    return microsecs * 1000;
+#else
     jlong clk_tck, ns_per_clock_tick;
     jlong cpu_time_ns;
     struct tms time;
@@ -267,19 +301,32 @@
     cpu_time_ns = ((jlong)time.tms_utime + (jlong) time.tms_stime) *
                       ns_per_clock_tick;
     return cpu_time_ns;
+#endif
 }
 
 JNIEXPORT jlong JNICALL
 Java_com_sun_management_UnixOperatingSystem_getFreePhysicalMemorySize
   (JNIEnv *env, jobject mbean)
 {
-#ifdef _ALLBSD_SOURCE
+#ifdef __APPLE__
+    mach_msg_type_number_t count;
+    vm_statistics_data_t vm_stats;
+    kern_return_t res;
+
+    count = HOST_VM_INFO_COUNT;
+    res = host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&vm_stats, &count);
+    if (res != KERN_SUCCESS) {
+        throw_internal_error(env, "host_statistics failed");
+        return -1;
+    }
+    return (jlong)vm_stats.free_count * page_size;
+#elif defined(_ALLBSD_SOURCE)
     /*
      * XXBSDL no way to do it in FreeBSD
      */
     // throw_internal_error(env, "unimplemented in FreeBSD")
     return (128 * MB);
-#else
+#else // solaris / linux
     jlong num_avail_physical_pages = sysconf(_SC_AVPHYS_PAGES);
     return (num_avail_physical_pages * page_size);
 #endif
@@ -290,28 +337,75 @@
   (JNIEnv *env, jobject mbean)
 {
 #ifdef _ALLBSD_SOURCE
-    jlong result;
+    jlong result = 0;
     int mib[2];
     size_t rlen;
 
     mib[0] = CTL_HW;
-    mib[1] = HW_PHYSMEM;
+    mib[1] = HW_MEMSIZE;
     rlen = sizeof(result);
-    if (sysctl(mib, 2, &result, &rlen, NULL, 0) == -1)
-        result = 256 * MB;
-
-    return (result);
-#else
+    if (sysctl(mib, 2, &result, &rlen, NULL, 0) != 0) {
+        throw_internal_error(env, "sysctl failed");
+        return -1;
+    }
+    return result;
+#else // solaris / linux
     jlong num_physical_pages = sysconf(_SC_PHYS_PAGES);
     return (num_physical_pages * page_size);
 #endif
 }
 
+
+
 JNIEXPORT jlong JNICALL
 Java_com_sun_management_UnixOperatingSystem_getOpenFileDescriptorCount
   (JNIEnv *env, jobject mbean)
 {
-#ifdef _ALLBSD_SOURCE
+#ifdef __APPLE__
+    // This code is influenced by the darwin lsof source
+    pid_t my_pid;
+    struct proc_bsdinfo bsdinfo;
+    struct proc_fdinfo *fds;
+    int nfiles;
+    kern_return_t kres;
+    int res;
+    size_t fds_size;
+
+    kres = pid_for_task(mach_task_self(), &my_pid);
+    if (res != KERN_SUCCESS) {
+        throw_internal_error(env, "pid_for_task failed");
+        return -1;
+    }
+
+    // get the maximum number of file descriptors
+    res = proc_pidinfo(my_pid, PROC_PIDTBSDINFO, 0, &bsdinfo, PROC_PIDTBSDINFO_SIZE);
+    if (res <= 0) {
+        throw_internal_error(env, "proc_pidinfo with PROC_PIDTBSDINFO failed");
+        return -1;
+    }
+
+    // allocate memory to hold the fd information (we don't acutally use this information
+    // but need it to get the number of open files)
+    fds_size = bsdinfo.pbi_nfiles * sizeof(struct proc_fdinfo);
+    fds = malloc(fds_size);
+    if (fds == NULL) {
+        JNU_ThrowOutOfMemoryError(env, "could not allocate space for file descriptors");
+        return -1;
+    }
+
+    // get the list of open files - the return value is the number of bytes
+    // proc_pidinfo filled in
+    res = proc_pidinfo(my_pid, PROC_PIDLISTFDS, 0, fds, fds_size);
+    if (res <= 0) {
+        free(fds);
+        throw_internal_error(env, "proc_pidinfo failed for PROC_PIDLISTFDS");
+        return -1;
+    }
+    nfiles = res / sizeof(struct proc_fdinfo);
+    free(fds);
+
+    return nfiles;
+#elif defined(_ALLBSD_SOURCE)
     /*
      * XXXBSD: there's no way available to do it in FreeBSD, AFAIK.
      */
diff --git a/src/solaris/native/sun/awt/fontpath.c b/src/solaris/native/sun/awt/fontpath.c
index e549b4f..214ecd0 100644
--- a/src/solaris/native/sun/awt/fontpath.c
+++ b/src/solaris/native/sun/awt/fontpath.c
@@ -583,9 +583,6 @@
 }
 
 #include <dlfcn.h>
-#if !(defined(__linux__) || defined(MACOSX))
-#include <link.h>
-#endif
 
 #include "fontconfig.h"
 
diff --git a/src/solaris/native/sun/java2d/opengl/OGLFuncs_md.h b/src/solaris/native/sun/java2d/opengl/OGLFuncs_md.h
index 14fe6f1..252749b 100644
--- a/src/solaris/native/sun/java2d/opengl/OGLFuncs_md.h
+++ b/src/solaris/native/sun/java2d/opengl/OGLFuncs_md.h
@@ -28,7 +28,7 @@
 
 #include <stdlib.h>
 #ifndef MACOSX
-#include <link.h>
+#include <dlfcn.h>
 #endif
 #include "jvm_md.h"
 #include "J2D_GL/glx.h"
diff --git a/src/solaris/native/sun/java2d/x11/XRBackendNative.c b/src/solaris/native/sun/java2d/x11/XRBackendNative.c
index a2b4815..0f8d0a8 100644
--- a/src/solaris/native/sun/java2d/x11/XRBackendNative.c
+++ b/src/solaris/native/sun/java2d/x11/XRBackendNative.c
@@ -70,7 +70,6 @@
 
 #ifdef __solaris__
 /* Solaris 10 will not have these symbols at runtime */
-#include <link.h>
 
 typedef Picture (*XRenderCreateLinearGradientFuncType)
                                      (Display *dpy,
diff --git a/test/ProblemList.txt b/test/ProblemList.txt
index 70a44d7..1980d03 100644
--- a/test/ProblemList.txt
+++ b/test/ProblemList.txt
@@ -161,6 +161,26 @@
 # Need to be marked othervm, or changed to be samevm safe
 com/sun/jndi/rmi/registry/RegistryContext/UnbindIdempotent.java generic-all
 
+# 7162111
+demo/jvmti/mtrace/TraceJFrame.java                              macosx-all
+javax/script/CauseExceptionTest.java                            macosx-all
+javax/script/GetInterfaceTest.java                              macosx-all
+javax/script/JavaScriptScopeTest.java                           macosx-all
+javax/script/NullUndefinedVarTest.java                          macosx-all
+javax/script/PluggableContextTest.java                          macosx-all
+javax/script/ProviderTest.sh                                    macosx-all
+javax/script/RhinoExceptionTest.java                            macosx-all
+javax/script/StringWriterPrintTest.java                         macosx-all
+javax/script/Test1.java                                         macosx-all
+javax/script/Test2.java                                         macosx-all
+javax/script/Test3.java                                         macosx-all
+javax/script/Test4.java                                         macosx-all
+javax/script/Test5.java                                         macosx-all
+javax/script/Test6.java                                         macosx-all
+javax/script/Test7.java                                         macosx-all
+javax/script/Test8.java                                         macosx-all
+javax/script/UnescapedBracketRegExTest.java                     macosx-all
+javax/script/VersionTest.java                                   macosx-all
 ############################################################################
 
 # jdk_net
@@ -202,6 +222,8 @@
 sun/net/www/protocol/http/B6299712.java                         macosx-all
 java/net/CookieHandler/CookieManagerTest.java                   macosx-all
 
+# JPRT needs to set 127.0.0.1 in proxy bypass list
+java/net/URLClassLoader/closetest/CloseTest.java                macosx-all
 ############################################################################
 
 # jdk_io
@@ -252,6 +274,9 @@
 # 7132247
 java/rmi/registry/readTest/readTest.sh				windows-all
 
+# 7142596
+java/rmi/transport/pinClientSocketFactory/PinClientSocketFactory.java generic-all
+
 ############################################################################
 
 # jdk_security
diff --git a/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.sh b/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.sh
index 63bff97..009be00 100644
--- a/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.sh
+++ b/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.sh
@@ -83,6 +83,13 @@
        total_swap=`free -b | grep -i swap | awk '{print $2}'`
        runOne GetTotalSwapSpaceSize $total_swap 
        ;;
+     Darwin )
+       # $ sysctl -n vm.swapusage 
+       # total = 8192.00M  used = 7471.11M  free = 720.89M  (encrypted)
+       swap=`/usr/sbin/sysctl -n vm.swapusage | awk '{ print $3 }' | awk -F . '{ print $1 }'` || exit 2
+       total_swap=`expr $swap \* 1024 \* 1024` || exit 2
+       runOne GetTotalSwapSpaceSize $total_swap
+       ;;
     * )
        runOne GetTotalSwapSpaceSize "sanity-only"
        ;;
diff --git a/test/demo/zipfs/ZFSTests.java b/test/demo/zipfs/ZFSTests.java
new file mode 100644
index 0000000..c5d6e8c
--- /dev/null
+++ b/test/demo/zipfs/ZFSTests.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+   @bug 7156873
+   @summary ZipFileSystem regression tests
+ */
+
+
+import java.net.URI;
+import java.nio.file.*;
+import java.util.Map;
+import java.util.HashMap;
+
+public class ZFSTests {
+
+    public static void main(String[] args) throws Throwable {
+        test7156873();
+    }
+
+    static void test7156873() throws Throwable {
+        String DIRWITHSPACE = "testdir with spaces";
+        Path dir = Paths.get(DIRWITHSPACE);
+        Path path = Paths.get(DIRWITHSPACE, "file.zip");
+        try {
+            Files.createDirectory(dir);
+            URI uri = URI.create("jar:" + path.toUri());
+            Map<String, Object> env = new HashMap<String, Object>();
+            env.put("create", "true");
+            try (FileSystem fs = FileSystems.newFileSystem(uri, env)) {}
+        } finally {
+            Files.deleteIfExists(path);
+            Files.deleteIfExists(dir);
+        }
+    }
+}
diff --git a/test/java/lang/SecurityManager/CheckPackageAccess.java b/test/java/lang/SecurityManager/CheckPackageAccess.java
new file mode 100644
index 0000000..6db95eb
--- /dev/null
+++ b/test/java/lang/SecurityManager/CheckPackageAccess.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7146431
+ * @summary Test that internal JAXP packages cannot be accessed
+ */
+
+public class CheckPackageAccess {
+
+    public static void main(String[] args) throws Exception {
+
+        String[] pkgs = new String[] {
+            "com.sun.org.apache.xerces.internal.utils.",
+            "com.sun.org.apache.xalan.internal.utils." };
+        SecurityManager sm = new SecurityManager();
+        System.setSecurityManager(sm);
+        for (String pkg : pkgs) {
+            System.out.println("Checking package access for " + pkg);
+            try {
+                sm.checkPackageAccess(pkg);
+                throw new Exception("Expected SecurityException not thrown");
+            } catch (SecurityException se) { }
+        }
+    }
+}
diff --git a/test/java/nio/channels/Selector/OpRead.java b/test/java/nio/channels/Selector/OpRead.java
index 7834050..cec4779 100644
--- a/test/java/nio/channels/Selector/OpRead.java
+++ b/test/java/nio/channels/Selector/OpRead.java
@@ -58,7 +58,10 @@
             boolean done = false;
             int failCount = 0;
             while (!done) {
-                if (selector.select() > 0) {
+                int nSelected = selector.select();
+                if (nSelected > 0) {
+                    if (nSelected > 1)
+                        throw new RuntimeException("More than one channel selected");
                     Set<SelectionKey> keys = selector.selectedKeys();
                     Iterator<SelectionKey> iterator = keys.iterator();
                     while (iterator.hasNext()) {
diff --git a/test/java/nio/charset/coders/StreamTimeout.java b/test/java/nio/charset/coders/StreamTimeout.java
index 6511955..1d8f117 100644
--- a/test/java/nio/charset/coders/StreamTimeout.java
+++ b/test/java/nio/charset/coders/StreamTimeout.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,51 +27,56 @@
  *          when the underlying byte stream times out
  */
 
-import java.net.*;
-import java.io.*;
-
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.InterruptedIOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.net.ServerSocket;
+import java.net.Socket;
 
 public class StreamTimeout {
+    static final PrintStream log = System.err;
+    static String charset = "US-ASCII";
 
-    private static PrintStream log = System.err;
+    private static class Client extends Thread implements Closeable {
+        private final Socket so;
 
-    private static String charset = "US-ASCII";
-
-    private static Object lock = new Object();
-    private static synchronized void waitABit(int millisec) {
-        synchronized(lock) {
-            try {
-                lock.wait(millisec);
-            } catch (InterruptedException e) {
-                //ignore
-            }
+        Client(int port) throws IOException {
+            so = new Socket("127.0.0.1", port);
         }
-    }
 
-    private static class Client extends Thread {
+        @Override
         public void run() {
             try {
-                Socket so = new Socket("127.0.0.1", 22222);
                 Writer wr = new OutputStreamWriter(so.getOutputStream(),
-                                                   charset);
+                        charset);
                 wr.write("ab");
                 wr.flush();
             } catch (IOException x) {
                 log.print("Unexpected exception in writer: ");
                 x.printStackTrace();
-                System.exit(1);
             }
         }
+
+        @Override
+        public void close() throws IOException {
+            so.close();
+        }
     }
 
     private static void gobble(InputStream is, Reader rd,
-                               int ec, boolean force)
-        throws Exception
-    {
+            int ec, boolean force)
+                    throws Exception
+                    {
         int a = is.available();
         boolean r = rd.ready();
         log.print("" + a + " bytes available, "
-                  + "reader " + (r ? "" : "not ") + "ready");
+                + "reader " + (r ? "" : "not ") + "ready");
         if (!r && !force) {
             log.println();
             return;
@@ -84,10 +89,10 @@
             throw x;
         }
         log.println(", read() ==> "
-                    + (c >= 0 ? ("'" + (char)c + "'" ): "EOF"));
+                + (c >= 0 ? ("'" + (char)c + "'" ): "EOF"));
         if (c != ec)
             throw new Exception("Incorrect value read: Expected "
-                                + ec + ", read " + (char)c);
+                    + ec + ", read " + (char)c);
     }
 
     public static void main(String[] args) throws Exception {
@@ -95,43 +100,49 @@
         if (args.length > 0)
             charset = args[0];
 
-        ServerSocket ss = new ServerSocket(22222);
-        Thread cl = new Client();
-        cl.start();
-        Socket s = ss.accept();
-        s.setSoTimeout(150);
-        InputStream is = s.getInputStream();
-        Reader rd = new InputStreamReader(is, charset);
+        try(ServerSocket ss = new ServerSocket(0);
+            Client cl = new Client(ss.getLocalPort())) {
 
-        while (is.available() <= 0)
-            Thread.yield();
+            cl.start();
 
-        gobble(is, rd, 'a', false);
-        gobble(is, rd, 'b', false);
-        gobble(is, rd, -1, false);
+            try(Socket s = ss.accept()) {
+                s.setSoTimeout(150);
 
-        boolean caught = false;
-        try {
-            gobble(is, rd, -1, true);
-        } catch (InterruptedIOException e) {
-            log.println("Read timed out, as expected");
-            caught = true;
+                try(InputStream is = s.getInputStream();
+                    Reader rd = new InputStreamReader(is, charset)) {
+
+                    while (is.available() <= 0)
+                        Thread.yield();
+
+                    gobble(is, rd, 'a', false);
+                    gobble(is, rd, 'b', false);
+                    gobble(is, rd, -1, false);
+
+                    boolean caught = false;
+                    try {
+                        gobble(is, rd, -1, true);
+                    } catch (InterruptedIOException e) {
+                        log.println("Read timed out, as expected");
+                        caught = true;
+                    }
+                    if (!caught) {
+                        log.println("Read did not time out, test inapplicable");
+                        return;
+                    }
+
+                    caught = false;
+                    try {
+                        gobble(is, rd, -1, true);
+                    } catch (InterruptedIOException x) {
+                        log.println("Second read timed out, as expected");
+                        caught = true;
+                    }
+                    if (!caught)
+                        throw new Exception("Second read completed");
+                }
+            }
+
+            cl.join();
         }
-        if (!caught) {
-            log.println("Read did not time out, test inapplicable");
-            return;
-        }
-
-        caught = false;
-        try {
-            gobble(is, rd, -1, true);
-        } catch (InterruptedIOException x) {
-            log.println("Second read timed out, as expected");
-            caught = true;
-        }
-        if (!caught)
-            throw new Exception("Second read completed");
-
     }
-
 }
diff --git a/test/java/security/CodeSource/Implies.java b/test/java/security/CodeSource/Implies.java
index bc37dcb..9e4c26b 100644
--- a/test/java/security/CodeSource/Implies.java
+++ b/test/java/security/CodeSource/Implies.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,25 +23,42 @@
 
 /*
  * @test
- * @bug 4866847
- * @summary NullPointerException from CodeSource.matchLocation
+ * @bug 4866847 7152564 7155693
+ * @summary various CodeSource.implies tests
  */
 
 import java.security.CodeSource;
-import java.net.*;
+import java.net.URL;
 
 public class Implies {
     public static void main(String[] args) throws Exception {
         URL thisURL = new URL("http", "localhost", "file");
         URL thatURL = new URL("http", null, "file");
+        // should not throw NullPointerException
+        testImplies(thisURL, thatURL, false);
+
+        thisURL = new URL("http", "localhost", "dir/-");
+        thatURL = new URL("HTTP", "localhost", "dir/file");
+        // protocol check should ignore case
+        testImplies(thisURL, thatURL, true);
+
+        thisURL = new URL("http", "localhost", 80, "dir/-");
+        thatURL = new URL("HTTP", "localhost", "dir/file");
+        // port check should match default port of thatURL
+        testImplies(thisURL, thatURL, true);
+
+        System.out.println("test passed");
+    }
+
+    private static void testImplies(URL thisURL, URL thatURL, boolean result)
+        throws SecurityException
+    {
         CodeSource thisCs =
             new CodeSource(thisURL, (java.security.cert.Certificate[]) null);
         CodeSource thatCs =
             new CodeSource(thatURL, (java.security.cert.Certificate[]) null);
-
-        if (thisCs.implies(thatCs)) {
+        if (thisCs.implies(thatCs) != result) {
             throw new SecurityException("test failed");
         }
-        System.out.println("test passed");
     }
 }
diff --git a/test/java/util/AbstractCollection/ToArrayTest.java b/test/java/util/AbstractCollection/ToArrayTest.java
new file mode 100644
index 0000000..1cbf66f
--- /dev/null
+++ b/test/java/util/AbstractCollection/ToArrayTest.java
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7121314
+ * @summary AbstractCollection.toArray(T[]) doesn't return the given array
+ *           in concurrent modification.
+ * @author Ulf Zibis, David Holmes
+ */
+
+import java.util.AbstractCollection;
+import java.util.Arrays;
+import java.util.Iterator;
+
+public class ToArrayTest {
+
+    static class TestCollection<E> extends AbstractCollection<E> {
+        private final E[] elements;
+        private int[] sizes;
+        private int nextSize;
+
+        public TestCollection(E[] elements) {
+            this.elements = elements;
+            setSizeSequence(new int[] { elements.length });
+        }
+
+        /*
+         * Sets the values that size() will return on each use. The next
+         * call to size will return sizes[0], then sizes[1] etc. This allows us
+         * to emulate a concurrent change to the contents of the collection
+         * without having to perform concurrent changes. If sizes[n+1] contains
+         * a larger value, the collection will appear to have shrunk when
+         * iterated; if a smaller value then the collection will appear to have
+         * grown when iterated.
+         */
+        void setSizeSequence(int... sizes) {
+            this.sizes = sizes;
+            nextSize = 0;
+        }
+
+        /* can change collection's size after each invocation */
+        @Override
+        public int size() {
+            return sizes[nextSize == sizes.length - 1 ? nextSize : nextSize++];
+        }
+
+        @Override
+        public Iterator<E> iterator() {
+            return new Iterator<E>() {
+                int pos = 0;
+
+                public boolean hasNext() {
+                    return pos < sizes[nextSize];
+                }
+                public E next() {
+                    return elements[pos++];
+                }
+                public void remove() {
+                    throw new UnsupportedOperationException(
+                            "Not supported yet.");
+                }
+            };
+        }
+    }
+
+    static final Object[] OBJECTS = { new Object(), new Object(), new Object() };
+    static final TestCollection<?> CANDIDATE = new TestCollection<Object>(OBJECTS);
+    static final int CAP = OBJECTS.length; // capacity of the CANDIDATE
+    static final int LAST = CAP - 1; // last possible array index
+    Object[] a;
+    Object[] res;
+
+    int last() {
+        return a.length - 1;
+    }
+
+    protected void test() throws Throwable {
+        // Check array type conversion
+        res = new TestCollection<>(new Object[] { "1", "2" }).toArray(new String[0]);
+        check(res instanceof String[]);
+        check(res.length == 2);
+        check(res[1] == "2");
+
+        // Check incompatible type of target array
+        try {
+            res = CANDIDATE.toArray(new String[CAP]);
+            check(false);
+        } catch (Throwable t) {
+            check(t instanceof ArrayStoreException);
+        }
+
+        // Check more elements than a.length
+        a = new Object[CAP - 1]; // appears too small
+        res = CANDIDATE.toArray(a);
+        check(res != a);
+        check(res[LAST] != null);
+
+        // Check equal elements as a.length
+        a = new Object[CAP]; // appears to match
+        res = CANDIDATE.toArray(a);
+        check(res == a);
+        check(res[last()] != null);
+
+        // Check equal elements as a.length
+        a = new Object[CAP + 1]; // appears too big
+        res = CANDIDATE.toArray(a);
+        check(res == a);
+        check(res[last()] == null);
+
+        // Check less elements than expected, but more than a.length
+        a = new Object[CAP - 2]; // appears too small
+        CANDIDATE.setSizeSequence(CAP, CAP - 1);
+        res = CANDIDATE.toArray(a);
+        check(res != a);
+        check(res.length == CAP - 1);
+        check(res[LAST - 1] != null);
+
+        // Check less elements than expected, but equal as a.length
+        a = Arrays.copyOf(OBJECTS, CAP); // appears to match
+        CANDIDATE.setSizeSequence(CAP, CAP - 1);
+        res = CANDIDATE.toArray(a);
+        check(res == a);
+        check(res[last()] == null);
+
+        // Check more elements than expected and more than a.length
+        a = new Object[CAP - 1]; // appears to match
+        CANDIDATE.setSizeSequence(CAP - 1, CAP);
+        res = CANDIDATE.toArray(a);
+        check(res != a);
+        check(res[LAST] != null);
+
+        // Check more elements than expected, but equal as a.length
+        a = new Object[CAP - 1]; // appears to match
+        CANDIDATE.setSizeSequence(CAP - 2, CAP - 1);
+        res = CANDIDATE.toArray(a);
+        check(res == a);
+        check(res[last()] != null);
+
+        // Check more elements than expected, but less than a.length
+        a = Arrays.copyOf(OBJECTS, CAP); // appears to match
+        CANDIDATE.setSizeSequence(CAP - 2, CAP - 1);
+        res = CANDIDATE.toArray(a);
+        check(res == a);
+        check(res[last()] == null);
+
+        test_7121314();
+    }
+
+    /*
+     * Major target of this testcase, bug 7121314.
+     */
+    protected void test_7121314() throws Throwable {
+        // Check equal elements as a.length, but less than expected
+        a = new Object[CAP - 1]; // appears too small
+        CANDIDATE.setSizeSequence(CAP, CAP - 1);
+        res = CANDIDATE.toArray(a);
+        check(res == a);
+        check(res[last()] != null);
+
+        // Check less elements than a.length and less than expected
+        a = Arrays.copyOf(OBJECTS, CAP - 1); // appears too small
+        CANDIDATE.setSizeSequence(CAP, CAP - 2);
+        res = CANDIDATE.toArray(a);
+        check(res == a);
+        check(res[last()] == null);
+
+    }
+
+    public static void main(String[] args) throws Throwable {
+        ToArrayTest testcase = new ToArrayTest();
+        try {
+            testcase.test();
+        } catch (Throwable t) {
+            unexpected(t);
+        }
+
+        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
+        if (failed > 0) throw new Exception("Some tests failed");
+    }
+
+    //--------------------- Infrastructure ---------------------------
+    static volatile int passed = 0, failed = 0;
+    static void pass() { passed++; }
+    static void fail() { failed++; Thread.dumpStack(); }
+    static void fail(String msg) { System.out.println(msg); fail(); }
+    static void unexpected(Throwable t) { failed++; t.printStackTrace(); }
+    static void check(boolean cond) { if (cond) pass(); else fail(); }
+    static void equal(Object x, Object y) {
+        if (x == null ? y == null : x.equals(y)) pass();
+        else {System.out.println(x + " not equal to " + y); fail(); }
+    }
+}
+
+
diff --git a/test/java/util/regex/RegExTest.java b/test/java/util/regex/RegExTest.java
index 159e9af..f583769 100644
--- a/test/java/util/regex/RegExTest.java
+++ b/test/java/util/regex/RegExTest.java
@@ -33,6 +33,7 @@
  * 5013885 5003322 4988891 5098443 5110268 6173522 4829857 5027748 6376940
  * 6358731 6178785 6284152 6231989 6497148 6486934 6233084 6504326 6635133
  * 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066
+ * 7067045
  */
 
 import java.util.regex.*;
@@ -852,6 +853,17 @@
         if (!result.equals(toSupplementaries("zzz\\t$\\$zzz")))
             failCount++;
 
+        // IAE should be thrown if backslash or '$' is the last character
+        // in replacement string
+        try {
+            "\uac00".replaceAll("\uac00", "$");
+            "\uac00".replaceAll("\uac00", "\\");
+            failCount++;
+        } catch (IllegalArgumentException iie) {
+        } catch (Exception e) {
+            failCount++;
+        }
+
         report("Literal replacement");
     }
 
diff --git a/test/sun/awt/image/ImageWatched/AddNoLeak.java b/test/sun/awt/image/ImageWatched/AddNoLeak.java
new file mode 100644
index 0000000..110a415
--- /dev/null
+++ b/test/sun/awt/image/ImageWatched/AddNoLeak.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.image.ImageObserver;
+import java.awt.image.ImageProducer;
+import java.awt.image.ImageConsumer;
+import java.awt.Image;
+import java.awt.Container;
+
+/* @test 1.0 12/01/17
+   @bug 7104151
+   @summary Make sure that we don't leak image observers (or related objects)
+   @run main/othervm AddNoLeak
+   @author David Buck
+*/
+
+public class AddNoLeak {
+    public static void main(String[] args) {
+        System.setProperty("java.awt.headless", "true");
+        Container cont = new Container();
+        Image img = cont.createImage(new DummyImageSource());
+        for(int i=0;i < 15000;i++) {
+            img.getWidth(new ImageObserver() {
+                public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {return false;}
+            });
+            if (i % 100 == 0) {
+                System.gc();
+            }
+        }
+    }
+
+    private static class DummyImageSource implements ImageProducer {
+        public void addConsumer(ImageConsumer ic){}
+        public boolean isConsumer(ImageConsumer ic){return false;}
+        public void removeConsumer(ImageConsumer ic){}
+        public void startProduction(ImageConsumer ic){}
+        public void requestTopDownLeftRightResend(ImageConsumer ic){}
+    }
+}
diff --git a/test/sun/net/www/protocol/jar/B4957695.java b/test/sun/net/www/protocol/jar/B4957695.java
index da1ee0e..0d25825 100644
--- a/test/sun/net/www/protocol/jar/B4957695.java
+++ b/test/sun/net/www/protocol/jar/B4957695.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,8 +24,6 @@
 /**
  * @test
  * @bug 4957695
- * @library ../../httptest/
- * @build HttpCallback HttpServer ClosedChannelList HttpTransaction AbstractCallback
  * @summary URLJarFile.retrieve does not delete tmpFile on IOException
  */
 
@@ -34,8 +32,56 @@
 
 public class B4957695 {
 
-    static int count = 0;
-    static boolean error = false;
+    static Server server;
+
+    static class Server extends Thread {
+        final ServerSocket srv;
+        static final byte[] requestEnd = new byte[] {'\r', '\n', '\r', '\n'};
+
+        Server(ServerSocket s) {
+            srv = s;
+        }
+
+        void readOneRequest(InputStream is) throws IOException {
+            int requestEndCount = 0, r;
+            while ((r = is.read()) != -1) {
+                if (r == requestEnd[requestEndCount]) {
+                    requestEndCount++;
+                    if (requestEndCount == 4) {
+                        break;
+                    }
+                } else {
+                    requestEndCount = 0;
+                }
+            }
+        }
+
+        public void run() {
+            try (Socket s = srv.accept()) {
+                // read HTTP request from client
+                readOneRequest(s.getInputStream());
+                try (OutputStreamWriter ow =
+                     new OutputStreamWriter((s.getOutputStream()))) {
+                    FileInputStream fin = new FileInputStream("foo1.jar");
+                    int length = fin.available();
+                    byte[] b = new byte[length-10];
+                    fin.read(b, 0, length-10);
+                    ow.write("HTTP/1.0 200 OK\r\n");
+
+                    // Note: The client expects length bytes.
+                    ow.write("Content-Length: " + length + "\r\n");
+                    ow.write("Content-Type: text/html\r\n");
+                    ow.write("\r\n");
+
+                    // Note: The (buggy) server only sends length-10 bytes.
+                    ow.write(new String(b));
+                    ow.flush();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
 
     static void read (InputStream is) throws IOException {
         int c,len=0;
@@ -45,32 +91,13 @@
         System.out.println ("read " + len + " bytes");
     }
 
-    static class CallBack extends AbstractCallback {
-
-        public void request (HttpTransaction req, int count) {
-            try {
-                System.out.println ("Request received");
-                req.setResponseEntityBody (new FileInputStream ("foo1.jar"));
-                System.out.println ("content length " + req.getResponseHeader (
-                        "Content-length"
-                ));
-                req.sendPartialResponse (200, "Ok");
-                req.abortiveClose();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-
-    };
-
-    static HttpServer server;
-
     public static void main (String[] args) throws Exception {
         String tmpdir = System.getProperty("java.io.tmpdir");
         String[] list1 = listTmpFiles(tmpdir);
-        //server = new HttpServer (new CallBack(), 10, 1, 0);
-        server = new HttpServer (new CallBack(), 1, 5, 0);
-        int port = server.getLocalPort();
+        ServerSocket serverSocket = new ServerSocket(0);
+        server = new Server(serverSocket);
+        server.start();
+        int port = serverSocket.getLocalPort();
         System.out.println ("Server: listening on port: " + port);
         URL url = new URL ("jar:http://localhost:"+port+"!/COPYRIGHT");
         try {
@@ -81,14 +108,12 @@
         } catch (IOException e) {
             System.out.println ("Received IOException as expected");
         }
-        server.terminate();
         String[] list2 = listTmpFiles(tmpdir);
         if (!sameList (list1, list2)) {
             throw new RuntimeException ("some jar_cache files left behind");
         }
     }
 
-
     static String[] listTmpFiles (String d) {
         File dir = new File (d);
         return dir.list (new FilenameFilter () {
diff --git a/test/sun/nio/ch/SelProvider.java b/test/sun/nio/ch/SelProvider.java
index 53b18cb..cae745f 100644
--- a/test/sun/nio/ch/SelProvider.java
+++ b/test/sun/nio/ch/SelProvider.java
@@ -38,20 +38,9 @@
         if ("SunOS".equals(osname)) {
             expected = "sun.nio.ch.DevPollSelectorProvider";
         } else if ("Linux".equals(osname)) {
-            String[] vers = osver.split("\\.", 0);
-            if (vers.length >= 2) {
-                int major = Integer.parseInt(vers[0]);
-                int minor = Integer.parseInt(vers[1]);
-                if (major > 2 || (major == 2 && minor >= 6)) {
-                    expected = "sun.nio.ch.EPollSelectorProvider";
-                } else {
-                    expected = "sun.nio.ch.PollSelectorProvider";
-                }
-            } else {
-                throw new RuntimeException("Test does not recognize this operating system");
-            }
+            expected = "sun.nio.ch.EPollSelectorProvider";
         } else if (osname.startsWith("Mac OS")) {
-            expected = "sun.nio.ch.PollSelectorProvider";
+            expected = "sun.nio.ch.KQueueSelectorProvider";
         } else
             return;
         if (!spName.equals(expected))
diff --git a/test/sun/nio/cs/TestSJIS0213_SM.java b/test/sun/nio/cs/TestSJIS0213_SM.java
new file mode 100644
index 0000000..753cfb7
--- /dev/null
+++ b/test/sun/nio/cs/TestSJIS0213_SM.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+   @bug 7152690
+   @summary Initialize SJIS_0213 charset with SecurityManager enabled
+ */
+public class TestSJIS0213_SM {
+    public static void main(String[] args) throws Throwable {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm == null) {
+            System.setSecurityManager(new SecurityManager());
+        }
+        java.nio.charset.Charset.forName("SJIS_0213");
+    }
+}
diff --git a/test/sun/rmi/rmic/classpath/RMICClassPathTest.java b/test/sun/rmi/rmic/classpath/RMICClassPathTest.java
new file mode 100644
index 0000000..a79d21b
--- /dev/null
+++ b/test/sun/rmi/rmic/classpath/RMICClassPathTest.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Portions Copyright (c) 2012 IBM Corporation
+ */
+
+/* @test
+ * @bug 6610897
+ * @summary New constructor in sun.tools.java.ClassPath builds a path using
+ *          File.separator instead of File.pathSeparator
+ * @run main RMICClassPathTest
+ */
+
+import java.io.File;
+
+import sun.rmi.rmic.BatchEnvironment;
+
+public class RMICClassPathTest {
+    public static void main(String[] args) throws Exception {
+        String sysPath = "/home/~user/jdk/jre/lib/rt.jar";
+        String extDir = "";
+        String clPath = "/home/~user/user.jar" + File.pathSeparator +
+            "/home/~user/user2.jar" + File.pathSeparator +
+            "/home/~user/user3.jar";
+
+        String cpStr = BatchEnvironment.createClassPath(clPath, sysPath, extDir).toString();
+
+        String[] paths = cpStr.split(File.pathSeparator);
+
+        if (paths.length != 4) {
+            throw new Exception("ClassPath length is not correct: the expected length is 4 and the actual length is " + paths.length);
+        }
+    }
+}
diff --git a/test/sun/security/krb5/ccache/EmptyCC.java b/test/sun/security/krb5/ccache/EmptyCC.java
new file mode 100644
index 0000000..d5bfc00
--- /dev/null
+++ b/test/sun/security/krb5/ccache/EmptyCC.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7158329
+ * @summary NPE in sun.security.krb5.Credentials.acquireDefaultCreds()
+ * @compile -XDignore.symbol.file EmptyCC.java
+ * @run main EmptyCC
+ */
+import java.io.File;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import sun.security.krb5.Credentials;
+import sun.security.krb5.PrincipalName;
+import sun.security.krb5.internal.ccache.CredentialsCache;
+
+public class EmptyCC {
+    public static void main(String[] args) throws Exception {
+        final PrincipalName pn = new PrincipalName("dummy@FOO.COM");
+        final String ccache = "tmpcc";
+
+        if (args.length == 0) {
+            // Main process, write the ccache and launch sub process
+            CredentialsCache cache = CredentialsCache.create(pn, ccache);
+            cache.save();
+
+            // java -cp $test.classes EmptyCC readcc
+            ProcessBuilder pb = new ProcessBuilder(
+                    new File(new File(System.getProperty("java.home"), "bin"),
+                        "java").getPath(),
+                    "-cp",
+                    System.getProperty("test.classes"),
+                    "EmptyCC",
+                    "readcc"
+                    );
+
+            pb.environment().put("KRB5CCNAME", ccache);
+            pb.redirectErrorStream(true);
+
+            Process p = pb.start();
+            try (InputStream ins = p.getInputStream()) {
+                byte[] buf = new byte[8192];
+                int n;
+                while ((n = ins.read(buf)) > 0) {
+                    System.out.write(buf, 0, n);
+                }
+            }
+            if (p.waitFor() != 0) {
+                throw new Exception("Test failed");
+            }
+        } else {
+            // Sub process, read the ccache
+            String cc = System.getenv("KRB5CCNAME");
+            if (!cc.equals(ccache)) {
+                throw new Exception("env not set correctly");
+            }
+            Credentials.acquireTGTFromCache(pn, null);
+        }
+    }
+}
diff --git a/test/sun/tools/jcmd/dcmd-big-script.txt b/test/sun/tools/jcmd/dcmd-big-script.txt
new file mode 100644
index 0000000..401d3f2
--- /dev/null
+++ b/test/sun/tools/jcmd/dcmd-big-script.txt
@@ -0,0 +1,95 @@
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
diff --git a/test/sun/tools/jcmd/jcmd-big-script.sh b/test/sun/tools/jcmd/jcmd-big-script.sh
new file mode 100644
index 0000000..a101c8c
--- /dev/null
+++ b/test/sun/tools/jcmd/jcmd-big-script.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+
+# @test
+# @bug 7154822
+# @summary test if we can send a file over 1024 bytes large via jcmd -f
+# @author David Buck
+#
+# @library ../common
+# @build SimpleApplication ShutdownSimpleApplication
+# @run shell jcmd-big-script.sh
+
+. ${TESTSRC}/../common/CommonSetup.sh
+. ${TESTSRC}/../common/ApplicationSetup.sh
+
+# Start application and use PORTFILE for coordination
+PORTFILE="${TESTCLASSES}"/shutdown.port
+startApplication SimpleApplication "${PORTFILE}"
+
+failed=0;
+
+# -f <script>
+rm -f jcmd.out 2>/dev/null
+set +e # even if jcmd fails, we do not want abort the script yet.
+${JCMD} -J-XX:+UsePerfData $appJavaPid -f ${TESTSRC}/dcmd-big-script.txt > jcmd.out 2>&1
+status="$?"
+set -e
+if [ "$status" != 0 ]; then
+  echo "jcmd command returned non-zero exit code (status=$status). Failed."
+  failed=1;
+fi
+cat jcmd.out
+set +e # if the test passes, grep will "fail" with an exit code of 1
+grep Exception jcmd.out > /dev/null 2>&1
+status="$?"
+set -e
+if [ "$status" = 0 ]; then
+  echo "Output of \"jcmd [pid] -f dcmd-big-script.txt\" contains string \"Exception\". Failed."
+  failed=1;
+fi
+
+# clean up
+rm -f jcmd.out 2>/dev/null
+stopApplication "${PORTFILE}"
+waitForApplication
+
+exit $failed
